shithub: mc

Download patch

ref: a53b68479664f176614fa259484145eb4583fd71
parent: aaaf97aff4d5475e8cf636746c78bd25699d6049
author: Ori Bernstein <[email protected]>
date: Tue May 8 08:01:44 EDT 2012

Fix up grammar for inserting into the end of blocks

--- a/parse/gram.y
+++ b/parse/gram.y
@@ -534,9 +534,10 @@
                 putdcl($$->block.scope, $1->decl.sym);}
         | blockbody stmt
             {if ($2)
-                lappend(&$$->block.stmts, &$$->block.nstmts, $2);
-             if ($1->type == Ndecl)
-                putdcl($$->block.scope, $1->decl.sym);}
+                lappend(&$1->block.stmts, &$1->block.nstmts, $2);
+             if ($2 && $2->type == Ndecl)
+                putdcl($1->block.scope, $2->decl.sym);
+             $$ = $1;}
         ;
 
 label   : TColon TIdent