Skip to content

Commit

Permalink
Fix reflection for . twigilled parameters
Browse files Browse the repository at this point in the history
A "$.foo" parameter would get stringified as "f.foo". There were two
problems causing this:
- . twigilled parameters' names were being reset unnecessarily by the
  compiler
- Parameter.usage-name wasn't accounting for . twigils
  • Loading branch information
Kaiepi committed Mar 27, 2020
1 parent aaa3fdc commit 296fbcf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/Perl6/Actions.nqp
Expand Up @@ -5529,10 +5529,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
}
}
%*PARAM_INFO<bind_accessor> := 1;
if $<name> {
%*PARAM_INFO<variable_name> := ~$<name>;
}
else {
unless $<name> {
$/.panic("Cannot declare $. parameter in signature without an accessor name");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core.c/Parameter.pm6
Expand Up @@ -245,7 +245,7 @@ my class Parameter { # declared in BOOTSTRAP
?? Nil
!! nqp::iseq_i(nqp::index('@$%&',nqp::substr($!variable_name,0,1)),-1)
?? $!variable_name
!! nqp::iseq_i(nqp::index('*!',nqp::substr($!variable_name,1,1)),-1)
!! nqp::iseq_i(nqp::index('*!.',nqp::substr($!variable_name,1,1)),-1)
?? nqp::substr($!variable_name,1)
!! nqp::substr($!variable_name,2)
}
Expand Down

0 comments on commit 296fbcf

Please sign in to comment.