summaryrefslogtreecommitdiffhomepage
path: root/src/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse.y')
-rw-r--r--src/parse.y14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/parse.y b/src/parse.y
index 41363b49e..811107902 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -4630,9 +4630,6 @@ 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;
@@ -4641,9 +4638,14 @@ mrb_parser_parse(parser_state *p)
tree = new_nil(p);
}
}
- else if (p->begin_tree) {
- tree = new_begin(p, p->begin_tree);
- append(tree, p->tree);
+ else {
+ if ((int)tree->car == NODE_SCOPE) {
+ p->locals = cons(tree->cdr->car, 0);
+ }
+ if (p->begin_tree) {
+ tree = new_begin(p, p->begin_tree);
+ append(tree, p->tree);
+ }
}
}