Skip to content

Commit de3abc8

Browse files
committed
merge revision(s) 44449: [Backport ruby#9416]
* parse.y (local_push_gen, local_pop_gen): save cmdarg_stack to isolate command argument state from outer scope. [ruby-core:59342] [Bug ruby#9308] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent c22f44b commit de3abc8

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Sat Feb 22 00:21:50 2014 Nobuyoshi Nakada <[email protected]>
2+
3+
* parse.y (local_push_gen, local_pop_gen): save cmdarg_stack to
4+
isolate command argument state from outer scope.
5+
[ruby-core:59342] [Bug #9308]
6+
17
Fri Feb 21 23:51:38 2014 Nobuyoshi Nakada <[email protected]>
28

39
* encoding.c (must_encindex, rb_enc_from_index, rb_obj_encoding): mask

parse.y

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ struct local_vars {
130130
struct vtable *vars;
131131
struct vtable *used;
132132
struct local_vars *prev;
133+
stack_type cmdargs;
133134
};
134135

135136
#define DVARS_INHERIT ((void*)1)
@@ -9642,6 +9643,8 @@ local_push_gen(struct parser_params *parser, int inherit_dvars)
96429643
local->used = !(inherit_dvars &&
96439644
(ifndef_ripper(compile_for_eval || e_option_supplied(parser))+0)) &&
96449645
RTEST(ruby_verbose) ? vtable_alloc(0) : 0;
9646+
local->cmdargs = cmdarg_stack;
9647+
cmdarg_stack = 0;
96459648
lvtbl = local;
96469649
}
96479650

@@ -9655,6 +9658,7 @@ local_pop_gen(struct parser_params *parser)
96559658
}
96569659
vtable_free(lvtbl->args);
96579660
vtable_free(lvtbl->vars);
9661+
cmdarg_stack = lvtbl->cmdargs;
96589662
xfree(lvtbl);
96599663
lvtbl = local;
96609664
}

test/ruby/test_syntax.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,11 @@ def test_do_block_in_cmdarg_begin
256256
assert_valid_syntax("p begin 1.times do 1 end end", __FILE__, bug6419)
257257
end
258258

259+
def test_do_block_in_call_args
260+
bug9308 = '[ruby-core:59342] [Bug #9308]'
261+
assert_valid_syntax("bar def foo; self.each do end end", bug9308)
262+
end
263+
259264
def test_reserved_method_no_args
260265
bug6403 = '[ruby-dev:45626]'
261266
assert_valid_syntax("def self; :foo; end", __FILE__, bug6403)

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.1.1"
22
#define RUBY_RELEASE_DATE "2014-02-22"
3-
#define RUBY_PATCHLEVEL 48
3+
#define RUBY_PATCHLEVEL 49
44

55
#define RUBY_RELEASE_YEAR 2014
66
#define RUBY_RELEASE_MONTH 2

0 commit comments

Comments
 (0)