diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/parse.y | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/parse.y b/src/parse.y index ec04ae8a6..35eff1b33 100644 --- a/src/parse.y +++ b/src/parse.y @@ -967,12 +967,11 @@ var_reference(parser_state *p, node *lhs) %% program : { p->lstate = EXPR_BEG; - local_nest(p); + if (!p->locals) p->locals = cons(0,0); } top_compstmt { p->tree = new_scope(p, $2); - local_unnest(p); } ; @@ -4631,6 +4630,9 @@ mrb_parser_parse(parser_state *p) } yyparse(p); tree = p->tree; + if ((int)tree->car == NODE_SCOPE) { + p->locals = cons(tree->cdr->car, 0); + } if (!tree) { if (p->begin_tree) { tree = p->begin_tree; |
