Handle the case where someone is doing double quoted variable interpolation
in the label part of an i18n fetch.
This commit is contained in:
parent
0302e7b96e
commit
7f2bc2458c
1 changed files with 5 additions and 3 deletions
|
|
@ -98,8 +98,6 @@ sub violates {
|
||||||
if ($arguments[1]) {
|
if ($arguments[1]) {
|
||||||
my $secondArgument = $arguments[1]->[0];
|
my $secondArgument = $arguments[1]->[0];
|
||||||
return unless $secondArgument->isa('PPI::Token::Quote');
|
return unless $secondArgument->isa('PPI::Token::Quote');
|
||||||
use Data::Dumper;
|
|
||||||
print Dumper($arguments[1]);
|
|
||||||
$namespace = $arguments[1]->[0]->string;
|
$namespace = $arguments[1]->[0]->string;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -118,7 +116,11 @@ sub violates {
|
||||||
##constructing arguments for the get call.
|
##constructing arguments for the get call.
|
||||||
return if exists $arguments[0]->[1] and $arguments[0]->[1]->isa('PPI::Token::Operator');
|
return if exists $arguments[0]->[1] and $arguments[0]->[1]->isa('PPI::Token::Operator');
|
||||||
return unless $arguments[0]->[0]->isa('PPI::Token::Quote');
|
return unless $arguments[0]->[0]->isa('PPI::Token::Quote');
|
||||||
my $label = $arguments[0]->[0]->string;
|
my $firstArgument = $arguments[0]->[0];
|
||||||
|
my $label = $firstArgument->string;
|
||||||
|
##Can't do variable interpolation
|
||||||
|
return if $firstArgument->isa('PPI::Token::Quote::Double')
|
||||||
|
&& $label =~ /\$/;
|
||||||
my $namespace = $self->{_i18n_objects}->{$symbol_name};
|
my $namespace = $self->{_i18n_objects}->{$symbol_name};
|
||||||
if ($arguments[1]) {
|
if ($arguments[1]) {
|
||||||
$namespace = $arguments[1]->[0]->string;
|
$namespace = $arguments[1]->[0]->string;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue