ruby-changes:61448
From: Nobuyoshi <ko1@a...>
Date: Tue, 2 Jun 2020 09:26:08 +0900 (JST)
Subject: [ruby-changes:61448] 27bef64862 (master): Include the entire lambda expression in lambda rule
https://git.ruby-lang.org/ruby.git/commit/?id=27bef64862 From 27bef648629760ffeda569057ddef6fb3be64b9a Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 2 Jun 2020 09:04:30 +0900 Subject: Include the entire lambda expression in lambda rule diff --git a/parse.y b/parse.y index 74cdd4a..d2099e2 100644 --- a/parse.y +++ b/parse.y @@ -2912,17 +2912,7 @@ primary : literal https://github.com/ruby/ruby/blob/trunk/parse.y#L2912 /*% %*/ /*% ripper: method_add_block!($1, $2) %*/ } - | tLAMBDA - { - token_info_push(p, "->", &@1); - } - lambda - { - $$ = $3; - /*%%%*/ - nd_set_first_loc($$, @1.beg_pos); - /*% %*/ - } + | lambda | k_if expr_value then compstmt if_tail @@ -3605,10 +3595,10 @@ bvar : tIDENTIFIER https://github.com/ruby/ruby/blob/trunk/parse.y#L3595 } ; -lambda : { - $<vars>$ = dyna_push(p); - } +lambda : tLAMBDA { + token_info_push(p, "->", &@1); + $<vars>1 = dyna_push(p); $<num>$ = p->lex.lpar_beg; p->lex.lpar_beg = p->lex.paren_nest; } @@ -3636,6 +3626,7 @@ lambda : { https://github.com/ruby/ruby/blob/trunk/parse.y#L3626 $$ = NEW_LAMBDA($5, $7, &loc); nd_set_line($$->nd_body, @7.end_pos.lineno); nd_set_line($$, @5.end_pos.lineno); + nd_set_first_loc($$, @1.beg_pos); } /*% %*/ /*% ripper: lambda!($5, $7) %*/ @@ -4347,17 +4338,7 @@ p_primitive : literal https://github.com/ruby/ruby/blob/trunk/parse.y#L4338 /*% %*/ /*% ripper: var_ref!($1) %*/ } - | tLAMBDA - { - token_info_push(p, "->", &@1); - } - lambda - { - $$ = $3; - /*%%%*/ - nd_set_first_loc($$, @1.beg_pos); - /*% %*/ - } + | lambda ; p_variable : tIDENTIFIER -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/