[前][次][番号順一覧][スレッド一覧]

ruby-changes:53013

From: yui-knk <ko1@a...>
Date: Sat, 20 Oct 2018 19:53:36 +0900 (JST)
Subject: [ruby-changes:53013] yui-knk:r65227 (trunk): Fix locations of NODE_SCOPE in lambda.

yui-knk	2018-10-20 19:53:31 +0900 (Sat, 20 Oct 2018)

  New Revision: 65227

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65227

  Log:
    Fix locations of NODE_SCOPE in lambda.
    
    * parse.y: Fix to start with the argument.
    
      e.g. The locations of the NODE_SCOPE is fixed:
    
      ```
      -> x { 1 + 2 }
      ```
    
      * Before
    
      ```
      NODE_SCOPE (line: 1, location: (1,2)-(1,14))
      ```
    
      * After
    
      ```
      NODE_SCOPE (line: 1, location: (1,3)-(1,14))
      ```

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 65226)
+++ parse.y	(revision 65227)
@@ -3132,7 +3132,8 @@ lambda		:   { https://github.com/ruby/ruby/blob/trunk/parse.y#L3132
 			p->lex.lpar_beg = $<num>2;
 			CMDARG_POP();
 		    /*%%%*/
-			$$ = NEW_LAMBDA($3, $5, &@$);
+                        YYLTYPE loc = code_loc_gen(&@3, &@5);
+			$$ = NEW_LAMBDA($3, $5, &loc);
 			nd_set_line($$->nd_body, @5.end_pos.lineno);
 			nd_set_line($$, @3.end_pos.lineno);
 		    /*% %*/

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]