Commit cb8b4691 authored by Yukihiro Matsumoto's avatar Yukihiro Matsumoto

p->tree may be NULL; close #161

parent 64218879
...@@ -4630,9 +4630,6 @@ mrb_parser_parse(parser_state *p) ...@@ -4630,9 +4630,6 @@ mrb_parser_parse(parser_state *p)
} }
yyparse(p); yyparse(p);
tree = p->tree; tree = p->tree;
if ((int)tree->car == NODE_SCOPE) {
p->locals = cons(tree->cdr->car, 0);
}
if (!tree) { if (!tree) {
if (p->begin_tree) { if (p->begin_tree) {
tree = p->begin_tree; tree = p->begin_tree;
...@@ -4641,9 +4638,14 @@ mrb_parser_parse(parser_state *p) ...@@ -4641,9 +4638,14 @@ mrb_parser_parse(parser_state *p)
tree = new_nil(p); tree = new_nil(p);
} }
} }
else if (p->begin_tree) { else {
tree = new_begin(p, p->begin_tree); if ((int)tree->car == NODE_SCOPE) {
append(tree, p->tree); p->locals = cons(tree->cdr->car, 0);
}
if (p->begin_tree) {
tree = new_begin(p, p->begin_tree);
append(tree, p->tree);
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment