1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

parse.y: save cmdarg_stack in local scope

* parse.y (local_push_gen, local_pop_gen): save cmdarg_stack to
  isolate command argument state from outer scope.
  [ruby-core:59342] [Bug #9308]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-12-27 15:42:49 +00:00
parent bb4a1ac9b0
commit 04bb9d6b75
3 changed files with 15 additions and 0 deletions

View file

@ -1,3 +1,9 @@
Sat Dec 28 00:42:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (local_push_gen, local_pop_gen): save cmdarg_stack to
isolate command argument state from outer scope.
[ruby-core:59342] [Bug #9308]
Fri Dec 27 13:25:03 2013 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/{setup.mak,Makefile.sub}: update fake.rb like

View file

@ -130,6 +130,7 @@ struct local_vars {
struct vtable *vars;
struct vtable *used;
struct local_vars *prev;
stack_type cmdargs;
};
#define DVARS_INHERIT ((void*)1)
@ -9647,6 +9648,8 @@ local_push_gen(struct parser_params *parser, int inherit_dvars)
local->used = !(inherit_dvars &&
(ifndef_ripper(compile_for_eval || e_option_supplied(parser))+0)) &&
RTEST(ruby_verbose) ? vtable_alloc(0) : 0;
local->cmdargs = cmdarg_stack;
cmdarg_stack = 0;
lvtbl = local;
}
@ -9660,6 +9663,7 @@ local_pop_gen(struct parser_params *parser)
}
vtable_free(lvtbl->args);
vtable_free(lvtbl->vars);
cmdarg_stack = lvtbl->cmdargs;
xfree(lvtbl);
lvtbl = local;
}

View file

@ -256,6 +256,11 @@ WARN
assert_valid_syntax("p begin 1.times do 1 end end", __FILE__, bug6419)
end
def test_do_block_in_call_args
bug9308 = '[ruby-core:59342] [Bug #9308]'
assert_valid_syntax("bar def foo; self.each do end end", bug9308)
end
def test_reserved_method_no_args
bug6403 = '[ruby-dev:45626]'
assert_valid_syntax("def self; :foo; end", __FILE__, bug6403)