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

ruby-changes:48762

From: yui-knk <ko1@a...>
Date: Wed, 22 Nov 2017 21:32:49 +0900 (JST)
Subject: [ruby-changes:48762] yui-knk:r60877 (trunk): parse.y: Fix the locations of NODE_BLOCK_PASS

yui-knk	2017-11-22 21:32:41 +0900 (Wed, 22 Nov 2017)

  New Revision: 60877

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

  Log:
    parse.y: Fix the locations of NODE_BLOCK_PASS
    
      * parse.y (arg_blk_pass): Update the first location of
        NODE_BLOCK_PASS if nd_head is assigned.
    
      e.g. The locations of NODE_BLOCK_PASS is fixed:
    
      ```
      a(1, &:to_s)
      ```
    
      * Before
    
      ```
      NODE_BLOCK_PASS (line: 1, first_lineno: 1, first_column: 5, last_lineno: 1, last_column: 11)
      ```
    
      * After
    
      ```
      NODE_BLOCK_PASS (line: 1, first_lineno: 1, first_column: 2, last_lineno: 1, last_column: 11)
      ```

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 60876)
+++ parse.y	(revision 60877)
@@ -10698,6 +10698,8 @@ arg_blk_pass(NODE *node1, NODE *node2) https://github.com/ruby/ruby/blob/trunk/parse.y#L10698
 {
     if (node2) {
 	node2->nd_head = node1;
+	nd_set_lineno(node2, nd_lineno(node1));
+	nd_set_column(node2, nd_column(node1));
 	return node2;
     }
     return node1;

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

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