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

ruby-changes:48713

From: yui-knk <ko1@a...>
Date: Sat, 18 Nov 2017 10:40:19 +0900 (JST)
Subject: [ruby-changes:48713] yui-knk:r60829 (trunk): Update the last location of NODE_ARRAY

yui-knk	2017-11-18 10:40:13 +0900 (Sat, 18 Nov 2017)

  New Revision: 60829

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

  Log:
    Update the last location of NODE_ARRAY
    
    * parse.y (list_append_gen, list_concat): Update
      the last location of NODE_ARRAY when an item is
      appended or concatenated with another NODE_ARRAY.
    
      e.g. The locations of NODE_ARRAY is fixed:
    
      ```
      a(1,2,3)
      ```
    
      * Before
    
      ```
      NODE_ARRAY (line: 1, first_lineno: 1, first_column: 2, last_lineno: 1, last_column: 3)
      ```
    
      * After
    
      ```
      NODE_ARRAY (line: 1, first_lineno: 1, first_column: 2, last_lineno: 1, last_column: 7)
      ```

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 60828)
+++ parse.y	(revision 60829)
@@ -9032,6 +9032,10 @@ list_append_gen(struct parser_params *pa https://github.com/ruby/ruby/blob/trunk/parse.y#L9032
     list->nd_alen += 1;
     last->nd_next = new_list(item, location);
     list->nd_next->nd_end = last->nd_next;
+
+    nd_set_last_lineno(list, nd_last_lineno(item));
+    nd_set_last_column(list, nd_last_column(item));
+
     return list;
 }
 
@@ -9057,6 +9061,9 @@ list_concat(NODE *head, NODE *tail) https://github.com/ruby/ruby/blob/trunk/parse.y#L9061
 	head->nd_next->nd_end = tail;
     }
 
+    nd_set_last_lineno(head, nd_last_lineno(tail));
+    nd_set_last_column(head, nd_last_column(tail));
+
     return head;
 }
 

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

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