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

ruby-changes:48700

From: yui-knk <ko1@a...>
Date: Fri, 17 Nov 2017 13:25:54 +0900 (JST)
Subject: [ruby-changes:48700] yui-knk:r60816 (trunk): Fix location of assignable nodes

yui-knk	2017-11-17 13:25:48 +0900 (Fri, 17 Nov 2017)

  New Revision: 60816

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

  Log:
    Fix location of assignable nodes
    
    * parse.y (node_assign_gen): In some case assignable nodes
      are created before rhs is created. In this case it is
      needed to set location after rhs is shifted to
      rhs range be included to assignable nodes.
    
      e.g. The locations of NODE_DASGN_CURR is fixed:
    
      ```
      a = 10
      ```
    
      * Before
    
      ```
      NODE_DASGN_CURR (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 1)
      ```
    
      * After
    
      ```
      NODE_DASGN_CURR (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 6)
      ```

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 60815)
+++ parse.y	(revision 60816)
@@ -10119,6 +10119,7 @@ node_assign_gen(struct parser_params *pa https://github.com/ruby/ruby/blob/trunk/parse.y#L10119
       case NODE_CDECL:
       case NODE_CVASGN:
 	lhs->nd_value = rhs;
+	lhs->nd_loc = *location;
 	break;
 
       case NODE_ATTRASGN:

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

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