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

ruby-changes:48748

From: yui-knk <ko1@a...>
Date: Tue, 21 Nov 2017 07:48:10 +0900 (JST)
Subject: [ruby-changes:48748] yui-knk:r60864 (trunk): parse.y: Set the last location of NODE_ARRAY in %i

yui-knk	2017-11-21 07:48:05 +0900 (Tue, 21 Nov 2017)

  New Revision: 60864

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

  Log:
    parse.y: Set the last location of NODE_ARRAY in %i
    
      * 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:
    
      ```
      %i[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 60863)
+++ parse.y	(revision 60864)
@@ -4124,8 +4124,8 @@ qsym_list	: /* none */ https://github.com/ruby/ruby/blob/trunk/parse.y#L4124
 			lit = $2->nd_lit;
 			nd_set_type($2, NODE_LIT);
 			add_mark_object($2->nd_lit = ID2SYM(rb_intern_str(lit)));
-			$$ = list_append($1, $2, &@$);
 			$2->nd_loc = @$;
+			$$ = list_append($1, $2, &@$);
 		    /*%
 			$$ = dispatch2(qsymbols_add, $1, $2);
 		    %*/

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

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