diff --git a/ChangeLog b/ChangeLog index d0fcab6987..276e253cad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Dec 10 01:12:55 2009 Nobuyoshi Nakada + + * parse.y (dyna_pop_gen): pop dvars. [ruby-dev:39861] + Thu Dec 10 00:46:43 2009 Nobuyoshi Nakada * node.c (dump_node): fixed for long members. diff --git a/bootstraptest/test_syntax.rb b/bootstraptest/test_syntax.rb index 2e8639b3f4..619a4cbdb1 100644 --- a/bootstraptest/test_syntax.rb +++ b/bootstraptest/test_syntax.rb @@ -877,3 +877,10 @@ assert_normal_exit %q{ end end }, bug2415 + +assert_normal_exit %q{ + a { + b {|c.d| } + e + } +}, '[ruby-dev:39861]' diff --git a/parse.y b/parse.y index 8451eb17d5..78e66ee240 100644 --- a/parse.y +++ b/parse.y @@ -8892,13 +8892,10 @@ dyna_push_gen(struct parser_params *parser) } static void -dyna_pop_gen(struct parser_params *parser, const struct vtable *lvargs) +dyna_pop_1(struct parser_params *parser) { struct vtable *tmp; - while (lvtbl->args != lvargs) { - local_pop(); - } tmp = lvtbl->args; lvtbl->args = lvtbl->args->prev; vtable_free(tmp); @@ -8907,6 +8904,20 @@ dyna_pop_gen(struct parser_params *parser, const struct vtable *lvargs) vtable_free(tmp); } +static void +dyna_pop_gen(struct parser_params *parser, const struct vtable *lvargs) +{ + while (lvtbl->args != lvargs) { + dyna_pop_1(parser); + if (!lvtbl->args) { + struct local_vars *local = lvtbl->prev; + xfree(lvtbl); + lvtbl = local; + } + } + dyna_pop_1(parser); +} + static int dyna_in_block_gen(struct parser_params *parser) {