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

ruby-changes:48739

From: yui-knk <ko1@a...>
Date: Mon, 20 Nov 2017 08:59:38 +0900 (JST)
Subject: [ruby-changes:48739] yui-knk:r60855 (trunk): Update the last location of NODE_BLOCK

yui-knk	2017-11-20 08:59:32 +0900 (Mon, 20 Nov 2017)

  New Revision: 60855

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

  Log:
    Update the last location of NODE_BLOCK
    
    * parse.y (block_append_gen): Update the last
      location of NODE_BLOCK when a tail is appended.
    
      e.g. The locations of NODE_BLOCK is fixed:
    
      ```
      a; b; c
      ```
    
      * Before
    
      ```
      NODE_BLOCK (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 4)
      ```
    
      * After
    
      ```
      NODE_BLOCK (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 60854)
+++ parse.y	(revision 60855)
@@ -9015,6 +9015,8 @@ block_append_gen(struct parser_params *p https://github.com/ruby/ruby/blob/trunk/parse.y#L9015
     }
     end->nd_next = tail;
     h->nd_end = tail->nd_end;
+    nd_set_last_lineno(head, nd_last_lineno(tail));
+    nd_set_last_column(head, nd_last_column(tail));
     return head;
 }
 

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

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