Created
June 21, 2013 20:49
-
-
Save timo/5834220 to your computer and use it in GitHub Desktop.
semilists now generate actual lists.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp | |
index daf1093..fceea94 100644 | |
--- a/src/Perl6/Actions.nqp | |
+++ b/src/Perl6/Actions.nqp | |
@@ -623,12 +623,20 @@ class Perl6::Actions is HLL::Actions does STDActions { | |
} | |
method semilist($/) { | |
- my $past := QAST::Stmts.new( :node($/) ); | |
- if $<statement> { | |
- for $<statement> { $past.push($_.ast) if $_.ast; } | |
+ my $past; | |
+ if +($<statement>) > 1 { | |
+ $past := QAST::Op.new( :op('call'), :name('&infix:<,>'), :node($/) ); | |
+ } else { | |
+ $past := QAST::Stmts.new( :node($/) ); | |
} | |
- unless +@($past) { | |
- $past.push( QAST::Op.new( :op('call'), :name('&infix:<,>') ) ); | |
+ if $<statement> { | |
+ for $<statement> { | |
+ if $_.ast { | |
+ $past.push($_.ast) | |
+ } else { | |
+ $past.push(QAST::Var.new(:name('Nil'), :scope('lexical'))); | |
+ } | |
+ } | |
} | |
make $past; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment