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

ruby-changes:48751

From: yui-knk <ko1@a...>
Date: Tue, 21 Nov 2017 08:37:07 +0900 (JST)
Subject: [ruby-changes:48751] yui-knk:r60867 (trunk): parse.y: Set the last location of NODE_ARRAY in %w

yui-knk	2017-11-21 08:37:01 +0900 (Tue, 21 Nov 2017)

  New Revision: 60867

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

  Log:
    parse.y: Set the last location of NODE_ARRAY in %w
    
      * parse.y: list_append uses the locations
        of the second argument. So we should set the
        locations of $2 before pass it to list_append.
    
      e.g. The locations of NODE_ARRAY is fixed:
    
      ```
      %w[a b]
      ```
    
      * Before
    
      ```
      NODE_ARRAY (line: 1, first_lineno: 1, first_column: 0, last_lineno: 0, last_column: -1)
      ```
    
      * After
    
      ```
      NODE_ARRAY (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 7)
      ```

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 60866)
+++ parse.y	(revision 60867)
@@ -4101,8 +4101,8 @@ qword_list	: /* none */ https://github.com/ruby/ruby/blob/trunk/parse.y#L4101
 		| qword_list tSTRING_CONTENT ' '
 		    {
 		    /*%%%*/
-			$$ = list_append($1, $2, &@$);
 			$2->nd_loc = @$;
+			$$ = list_append($1, $2, &@$);
 		    /*%
 			$$ = dispatch2(qwords_add, $1, $2);
 		    %*/

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

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