mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y: push cmdarg_stack
* parse.y (lambda): push and reset cmdarg_stack in lambda body. [ruby-core:69017] [Bug #11107] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5d071fe381
commit
fd0e9d2580
3 changed files with 17 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Apr 30 16:22:16 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (lambda): push and reset cmdarg_stack in lambda body.
|
||||
[ruby-core:69017] [Bug #11107]
|
||||
|
||||
Sun Apr 26 07:36:48 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* enc/utf_8.c (code_to_mbclen, code_to_mbc): reject values larger
|
||||
|
|
9
parse.y
9
parse.y
|
@ -3518,14 +3518,19 @@ lambda : {
|
|||
{
|
||||
$<num>$ = ruby_sourceline;
|
||||
}
|
||||
{
|
||||
$<val>$ = cmdarg_stack;
|
||||
cmdarg_stack = 0;
|
||||
}
|
||||
lambda_body
|
||||
{
|
||||
lpar_beg = $<num>2;
|
||||
cmdarg_stack = $<val>5;
|
||||
/*%%%*/
|
||||
$$ = NEW_LAMBDA($3, $5);
|
||||
$$ = NEW_LAMBDA($3, $6);
|
||||
nd_set_line($$, $<num>4);
|
||||
/*%
|
||||
$$ = dispatch2(lambda, $3, $5);
|
||||
$$ = dispatch2(lambda, $3, $6);
|
||||
%*/
|
||||
dyna_pop($<vars>1);
|
||||
}
|
||||
|
|
|
@ -400,6 +400,11 @@ WARN
|
|||
assert_valid_syntax("bar def foo; self.each do end end", bug9308)
|
||||
end
|
||||
|
||||
def test_do_block_in_lambda
|
||||
bug11107 = '[ruby-core:69017] [Bug #11107]'
|
||||
assert_valid_syntax('p ->() do a() do end end', bug11107)
|
||||
end
|
||||
|
||||
def test_reserved_method_no_args
|
||||
bug6403 = '[ruby-dev:45626]'
|
||||
assert_valid_syntax("def self; :foo; end", __FILE__, bug6403)
|
||||
|
|
Loading…
Reference in a new issue