do not dump_node if parser failed

This commit is contained in:
Yukihiro "Matz" Matsumoto
2016-11-11 22:51:48 +09:00
parent 185dad3a6e
commit 752ca514f6
+4 -1
View File
@@ -5479,7 +5479,10 @@ mrb_parser_parse(parser_state *p, mrbc_context *c)
p->lex_strterm = NULL;
parser_init_cxt(p, c);
yyparse(p);
if (yyparse(p) != 0 || p->nerr > 0) {
p->tree = 0;
return;
}
if (!p->tree) {
p->tree = new_nil(p);
}