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

ruby-changes:48665

From: yui-knk <ko1@a...>
Date: Thu, 16 Nov 2017 10:57:00 +0900 (JST)
Subject: [ruby-changes:48665] yui-knk:r60781 (trunk): parse.y: Fix location of asgn node

yui-knk	2017-11-16 10:56:54 +0900 (Thu, 16 Nov 2017)

  New Revision: 60781

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

  Log:
    parse.y: Fix location of asgn node
    
    * parse.y (new_op_assign_gen): Fix location of asgn node.
      Assignable node (e.g. NODE_LASGN) is generated before rhs
      is generated, so we reset the location when nd_value of
      asgn is fixed.
    
      e.g. :
    
      ```
      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: 7)
      ```

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 60780)
+++ parse.y	(revision 60781)
@@ -10865,6 +10865,7 @@ new_op_assign_gen(struct parser_params * https://github.com/ruby/ruby/blob/trunk/parse.y#L10865
 	else {
 	    asgn = lhs;
 	    asgn->nd_value = new_call(gettable(vid, location), op, new_list(rhs, location), location);
+	    asgn->nd_loc = *location;
 	}
     }
     else {

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

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