Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Hack in @A[1;2] / %h{"a";"b"} support
Attempts to change semilist directly or use a different rule were
breaking the build -- special-casing the behaviour in .[] and .{} is
much simpler than tracking down all the faulty uses of <semilist> and
making them all work with the change.
  • Loading branch information
Mouq committed Jul 26, 2014
1 parent 7e6dd3f commit 1d2bb62
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/Perl6/Actions.nqp
Expand Up @@ -840,6 +840,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
make $past;
}

# Should produce a LoL, with most uses converted to actually statementlist
method semilist($/) {
my $past := QAST::Stmts.new( :node($/) );
if $<statement> {
Expand Down Expand Up @@ -5508,20 +5509,34 @@ class Perl6::Actions is HLL::Actions does STDActions {

method postcircumfix:sym<[ ]>($/) {
my $past := QAST::Op.new( :name('&postcircumfix:<[ ]>'), :op('call'), :node($/) );
# Should eventually be $past.push($<semilist>.ast) if $<semilist><statement>
if $<semilist><statement> {
my $slast := $<semilist>.ast;
$past.push($slast);
if $<semilist><statement> > 1 {
my $l := QAST::Op.new( :name('&infix:<,>'), :op('call'));
for $<semilist><statement> {
$l.push($_.ast);
}
$past.push(QAST::Op.new( :name('lol'), :op('callmethod'), $l));
} else {
$past.push($<semilist>.ast);
}
}
make $past;
}

method postcircumfix:sym<{ }>($/) {
my $past := QAST::Op.new( :name('&postcircumfix:<{ }>'), :op('call'), :node($/) );
# Should eventually be $past.push($<semilist>.ast) if $<semilist><statement>
if $<semilist><statement> {
if +$<semilist><statement> > 1 {
$*W.throw($/, 'X::Comp::NYI', feature => 'multi-dimensional indexes');
if $<semilist><statement> > 1 {
my $l := QAST::Op.new( :name('&infix:<,>'), :op('call'));
for $<semilist><statement> {
$l.push($_.ast);
}
$past.push(QAST::Op.new( :name('lol'), :op('callmethod'), $l));
} else {
$past.push($<semilist>.ast);
}
$past.push($<semilist>.ast);
}
make $past;
}
Expand Down

0 comments on commit 1d2bb62

Please sign in to comment.