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

ruby-changes:48976

From: yui-knk <ko1@a...>
Date: Sat, 9 Dec 2017 22:14:02 +0900 (JST)
Subject: [ruby-changes:48976] yui-knk:r61095 (trunk): parse.y: Fix locations of NODE_ARRAY in NODE_ATTRASGN (nd_args)

yui-knk	2017-12-09 22:13:58 +0900 (Sat, 09 Dec 2017)

  New Revision: 61095

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

  Log:
    parse.y: Fix locations of NODE_ARRAY in NODE_ATTRASGN (nd_args)
    
    * parse.y (arg_append_gen): Fix to only include a range of
      node2 if new list is generated.
    
      e.g. The locations of the NODE_ARRAY is fixed:
    
      ```
      x.default = 5
      ```
    
      * Before
    
      ```
      NODE_ARRAY (line: 1, code_range: (1,0)-(1,13))
      ```
    
      * After
    
      ```
      NODE_ARRAY (line: 1, code_range: (1,12)-(1,13))
      ```

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 61094)
+++ parse.y	(revision 61095)
@@ -10118,7 +10118,7 @@ arg_append_gen(struct parser_params *par https://github.com/ruby/ruby/blob/trunk/parse.y#L10118
 {
     NODE *argspush;
 
-    if (!node1) return new_list(node2, location);
+    if (!node1) return new_list(node2, &node2->nd_loc);
     switch (nd_type(node1))  {
       case NODE_ARRAY:
 	return list_append(node1, node2, location);

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

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