mirror of
https://github.com/ruby/ruby.git
synced 2025-09-18 10:03:59 +02:00
merge revision(s) 57198: [Backport #13073]
parse.y: preserve cmdarg stack * parse.y (do_body): preserve cmdarg stack around do/end block. [ruby-core:78837] [Bug #13073] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
927c116d0c
commit
c093d46f4f
3 changed files with 11 additions and 2 deletions
2
parse.y
2
parse.y
|
@ -3762,7 +3762,7 @@ brace_body : {$<vars>$ = dyna_push();}
|
||||||
;
|
;
|
||||||
|
|
||||||
do_body : {$<vars>$ = dyna_push();}
|
do_body : {$<vars>$ = dyna_push();}
|
||||||
{$<val>$ = cmdarg_stack >> 1; CMDARG_SET(0);}
|
{$<val>$ = cmdarg_stack; CMDARG_SET(0);}
|
||||||
opt_block_param compstmt
|
opt_block_param compstmt
|
||||||
{
|
{
|
||||||
$$ = new_do_body($3, $4);
|
$$ = new_do_body($3, $4);
|
||||||
|
|
|
@ -917,6 +917,15 @@ eom
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_do_block_in_hash_brace
|
||||||
|
bug13073 = '[ruby-core:78837] [Bug #13073]'
|
||||||
|
assert_valid_syntax 'p :foo, {a: proc do end, b: proc do end}', bug13073
|
||||||
|
assert_valid_syntax 'p :foo, {:a => proc do end, b: proc do end}', bug13073
|
||||||
|
assert_valid_syntax 'p :foo, {"a": proc do end, b: proc do end}', bug13073
|
||||||
|
assert_valid_syntax 'p :foo, {** proc do end, b: proc do end}', bug13073
|
||||||
|
assert_valid_syntax 'p :foo, {proc do end => proc do end, b: proc do end}', bug13073
|
||||||
|
end
|
||||||
|
|
||||||
def test_do_after_local_variable
|
def test_do_after_local_variable
|
||||||
obj = Object.new
|
obj = Object.new
|
||||||
def obj.m; yield; end
|
def obj.m; yield; end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#define RUBY_VERSION "2.4.0"
|
#define RUBY_VERSION "2.4.0"
|
||||||
#define RUBY_RELEASE_DATE "2017-03-11"
|
#define RUBY_RELEASE_DATE "2017-03-11"
|
||||||
#define RUBY_PATCHLEVEL 5
|
#define RUBY_PATCHLEVEL 6
|
||||||
|
|
||||||
#define RUBY_RELEASE_YEAR 2017
|
#define RUBY_RELEASE_YEAR 2017
|
||||||
#define RUBY_RELEASE_MONTH 3
|
#define RUBY_RELEASE_MONTH 3
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue