diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-05-19 15:37:41 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-05-19 15:37:41 +0900 |
| commit | cb8b4691f09cf935f119595f1b3e755f7fc0f8f3 (patch) | |
| tree | b8915352e5be30acba03dfbfe9a41339cc52c219 /src | |
| parent | 6421887917a69fa79b76d238803f55e905e9619c (diff) | |
| download | mruby-cb8b4691f09cf935f119595f1b3e755f7fc0f8f3.tar.gz mruby-cb8b4691f09cf935f119595f1b3e755f7fc0f8f3.zip | |
p->tree may be NULL; close #161
Diffstat (limited to 'src')
| -rw-r--r-- | src/parse.y | 14 |
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); + } } } |
