Skip to content

Instantly share code, notes, and snippets.

@timo
Created June 21, 2013 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timo/5834220 to your computer and use it in GitHub Desktop.
Save timo/5834220 to your computer and use it in GitHub Desktop.
semilists now generate actual lists.
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