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

ruby-changes:48980

From: yui-knk <ko1@a...>
Date: Mon, 11 Dec 2017 08:28:03 +0900 (JST)
Subject: [ruby-changes:48980] yui-knk:r61099 (trunk): parse.y: Change the first location of NODE_ARRAY in NODE_DSTR (nd_next->nd_next)

yui-knk	2017-12-11 08:27:58 +0900 (Mon, 11 Dec 2017)

  New Revision: 61099

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

  Log:
    parse.y: Change the first location of NODE_ARRAY in NODE_DSTR (nd_next->nd_next)
    
    * parse.y (list_append_gen): Change the first location to
      start with the location of item if new list is generated.
    
      e.g. The locations of the NODE_ARRAY is changed:
    
      ```
      "#{a}.#{b}"
      ```
    
      * Before
    
      ```
      NODE_ARRAY (line: 1, code_range: (1,0)-(1,6))
      ```
    
      * After
    
      ```
      NODE_ARRAY (line: 1, code_range: (1,5)-(1,6))
      ```

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 61098)
+++ parse.y	(revision 61099)
@@ -9039,7 +9039,7 @@ list_append_gen(struct parser_params *pa https://github.com/ruby/ruby/blob/trunk/parse.y#L9039
 {
     NODE *last;
 
-    if (list == 0) return new_list(item, location);
+    if (list == 0) return new_list(item, &item->nd_loc);
     if (list->nd_next) {
 	last = list->nd_next->nd_end;
     }
@@ -9048,7 +9048,7 @@ list_append_gen(struct parser_params *pa https://github.com/ruby/ruby/blob/trunk/parse.y#L9048
     }
 
     list->nd_alen += 1;
-    last->nd_next = new_list(item, location);
+    last->nd_next = new_list(item, &item->nd_loc);
     list->nd_next->nd_end = last->nd_next;
 
     nd_set_last_lineno(list, nd_last_lineno(item));

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

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