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

ruby-changes:51184

From: yui-knk <ko1@a...>
Date: Thu, 10 May 2018 15:34:26 +0900 (JST)
Subject: [ruby-changes:51184] yui-knk:r63391 (trunk): parse.y: Fix locations of NODE_NIL in endless ranges.

yui-knk	2018-05-10 15:34:20 +0900 (Thu, 10 May 2018)

  New Revision: 63391

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

  Log:
    parse.y: Fix locations of NODE_NIL in endless ranges.
    
    * parse.y: Fix to start with the end of dots.
    
      e.g. The locations of the NODE_NIL is fixed:
    
      ```
      1..
      ```
    
      * Before
    
      ```
      NODE_NIL (line: 1, location: (1,0)-(1,3))
      ```
    
      * After
    
      ```
      NODE_NIL (line: 1, location: (1,3)-(1,3))
      ```

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 63390)
+++ parse.y	(revision 63391)
@@ -1906,16 +1906,24 @@ arg		: lhs '=' arg_rhs https://github.com/ruby/ruby/blob/trunk/parse.y#L1906
 		| arg tDOT2
 		    {
 		    /*%%%*/
+                        YYLTYPE loc;
+                        loc.beg_pos = @2.end_pos;
+                        loc.end_pos = @2.end_pos;
+
 			value_expr($1);
-			$$ = NEW_DOT2($1, new_nil(&@$), &@$);
+			$$ = NEW_DOT2($1, new_nil(&loc), &@$);
 		    /*% %*/
 		    /*% ripper: dot2!($1, Qnil) %*/
 		    }
 		| arg tDOT3
 		    {
 		    /*%%%*/
+                        YYLTYPE loc;
+                        loc.beg_pos = @2.end_pos;
+                        loc.end_pos = @2.end_pos;
+
 			value_expr($1);
-			$$ = NEW_DOT3($1, new_nil(&@$), &@$);
+			$$ = NEW_DOT3($1, new_nil(&loc), &@$);
 		    /*% %*/
 		    /*% ripper: dot3!($1, Qnil) %*/
 		    }

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

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