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

ruby-changes:48705

From: yui-knk <ko1@a...>
Date: Fri, 17 Nov 2017 16:39:20 +0900 (JST)
Subject: [ruby-changes:48705] yui-knk:r60821 (trunk): Fix location of assignable nodes

yui-knk	2017-11-17 16:39:15 +0900 (Fri, 17 Nov 2017)

  New Revision: 60821

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

  Log:
    Fix location of assignable nodes
    
    * parse.y (node_assign_gen): NODE_ATTRASGN is created
      before rhs is created. It is needed to set location
      after rhs is created to rhs range be included to the
      location of NODE_ATTRASGN.
    
      e.g. The locations of NODE_ATTRASGN is fixed:
    
      ```
      a[1] = 2
      ```
    
      * Before
    
      ```
      NODE_ATTRASGN (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 4)
      ```
    
      * After
    
      ```
      NODE_ATTRASGN (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 8)
      ```

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 60820)
+++ parse.y	(revision 60821)
@@ -10125,6 +10125,7 @@ node_assign_gen(struct parser_params *pa https://github.com/ruby/ruby/blob/trunk/parse.y#L10125
       case NODE_ATTRASGN:
       case NODE_CALL:
 	lhs->nd_args = arg_append(lhs->nd_args, rhs, location);
+	lhs->nd_loc = *location;
 	break;
 
       default:

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

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