Skip to content

Commit

Permalink
add line annotations to assignment operator
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Jun 26, 2012
1 parent 11b9d5e commit 1ffd6cf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Perl6/Actions.pm
Expand Up @@ -1411,7 +1411,7 @@ class Perl6::Actions is HLL::Actions {
} }
} }
elsif $<initializer>[0]<sym> eq '=' { elsif $<initializer>[0]<sym> eq '=' {
$past := assign_op($past, $<initializer>[0].ast); $past := assign_op($/, $past, $<initializer>[0].ast);
} }
elsif $<initializer>[0]<sym> eq '.=' { elsif $<initializer>[0]<sym> eq '.=' {
$past := make_dot_equals($past, $<initializer>[0].ast); $past := make_dot_equals($past, $<initializer>[0].ast);
Expand Down Expand Up @@ -1456,7 +1456,7 @@ class Perl6::Actions is HLL::Actions {
if $<initializer>[0]<sym> eq '=' { if $<initializer>[0]<sym> eq '=' {
$/.CURSOR.panic("Cannot assign to a list of 'has' scoped declarations") $/.CURSOR.panic("Cannot assign to a list of 'has' scoped declarations")
if $*SCOPE eq 'has'; if $*SCOPE eq 'has';
$list := assign_op($list, $<initializer>[0].ast); $list := assign_op($/, $list, $<initializer>[0].ast);
} }
elsif $<initializer>[0]<sym> eq '.=' { elsif $<initializer>[0]<sym> eq '.=' {
$/.CURSOR.panic("Cannot use .= initializer with a list of declarations"); $/.CURSOR.panic("Cannot use .= initializer with a list of declarations");
Expand Down Expand Up @@ -3589,7 +3589,7 @@ class Perl6::Actions is HLL::Actions {
'<<==', -> $/, $sym { make_feed($/) }, '<<==', -> $/, $sym { make_feed($/) },
'~~', -> $/, $sym { make_smartmatch($/, 0) }, '~~', -> $/, $sym { make_smartmatch($/, 0) },
'!~~', -> $/, $sym { make_smartmatch($/, 1) }, '!~~', -> $/, $sym { make_smartmatch($/, 1) },
'=', -> $/, $sym { assign_op($/[0].ast, $/[1].ast) }, '=', -> $/, $sym { assign_op($/, $/[0].ast, $/[1].ast) },
':=', -> $/, $sym { bind_op($/, $/[0].ast, $/[1].ast, 0) }, ':=', -> $/, $sym { bind_op($/, $/[0].ast, $/[1].ast, 0) },
'::=', -> $/, $sym { bind_op($/, $/[0].ast, $/[1].ast, 1) }, '::=', -> $/, $sym { bind_op($/, $/[0].ast, $/[1].ast, 1) },
'ff', -> $/, $sym { flipflop($/[0].ast, $/[1].ast, 0, 0, 0) }, 'ff', -> $/, $sym { flipflop($/[0].ast, $/[1].ast, 0, 0, 0) },
Expand Down Expand Up @@ -3867,7 +3867,7 @@ class Perl6::Actions is HLL::Actions {
} }
} }


sub assign_op($lhs_ast, $rhs_ast) { sub assign_op($/, $lhs_ast, $rhs_ast) {
my $past; my $past;
my $var_sigil; my $var_sigil;
if $lhs_ast.isa(PAST::Var) { if $lhs_ast.isa(PAST::Var) {
Expand All @@ -3889,7 +3889,8 @@ class Perl6::Actions is HLL::Actions {
$lhs_ast, $rhs_ast); $lhs_ast, $rhs_ast);
} }
else { else {
$past := PAST::Op.new(:pirop('perl6_container_store__0PP'), $past := PAST::Op.new(:node($/), :pirop('perl6_container_store__0PP'),

$lhs_ast, $rhs_ast); $lhs_ast, $rhs_ast);
} }
return $past; return $past;
Expand Down

0 comments on commit 1ffd6cf

Please sign in to comment.