Skip to content

Commit

Permalink
Fix fake-infix adverb args with new .= opt
Browse files Browse the repository at this point in the history
Phixes: #1485

Annotate the `.=` construct so when we get to fake-infix adverbs
we shove them in the right place.
  • Loading branch information
zoffixznet committed Feb 7, 2018
1 parent 1e2e46f commit 7fa5765
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Perl6/Actions.nqp
Expand Up @@ -6725,7 +6725,10 @@ class Perl6::Actions is HLL::Actions does STDActions {
if nqp::istype($target, QAST::Op) && $target.op eq 'hllize' {
$target := $target[0];
}
unless nqp::istype($target, QAST::Op) && ($target.op eq 'call' || $target.op eq 'callmethod') {

unless nqp::istype($target, QAST::Op)
&& ($target.op eq 'call' || $target.op eq 'callmethod')
|| $target.has_ann('dot_equals_call') {
if nqp::can($target, 'name') {
$/.typed_panic('X::Syntax::Adverb', what => $target.name);
}
Expand All @@ -6735,7 +6738,12 @@ class Perl6::Actions is HLL::Actions does STDActions {
}
my $cpast := $<colonpair>.ast;
$cpast[2].named(compile_time_value_str($cpast[1], 'LHS of pair', $/));
$target.push(WANTED($cpast[2],'EXPR/POSTFIX'));
(
$target.has_ann('dot_equals_call')
?? nqp::istype($target, QAST::Op)
?? $target[1] !! $target[1][1]
!! $target
).push(WANTED($cpast[2],'EXPR/POSTFIX'));

if nqp::istype($past, QAST::Op) && $past.op eq 'hllize' {
$past[0] := WANTED($target,'EXPR/POSTFIX');
Expand Down Expand Up @@ -9362,6 +9370,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
sub make_dot_equals($t, $call) {
my $target := WANTED($t,'make_dot_equals');
my $qast;

# clear the annotation so we don't double-dot-equals the QAST
$call.annotate: 'dot_equals', 0 if $call.ann: 'dot_equals';
if nqp::istype($target, QAST::Var) {
Expand All @@ -9384,7 +9393,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
}
$qast.nosink: 1;
wantall($qast, 'make_dot_equals');
$qast
$qast.annotate_self: 'dot_equals_call', 1; # ann. for fakeinfix adverbs
}

sub make_dot($target, $call) {
Expand Down

0 comments on commit 7fa5765

Please sign in to comment.