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

ruby-changes:48798

From: yui-knk <ko1@a...>
Date: Mon, 27 Nov 2017 08:52:52 +0900 (JST)
Subject: [ruby-changes:48798] yui-knk:r60914 (trunk): parse.y: Fix the last location of NODE_KW_ARG

yui-knk	2017-11-27 08:52:47 +0900 (Mon, 27 Nov 2017)

  New Revision: 60914

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

  Log:
    parse.y: Fix the last location of NODE_KW_ARG
    
    * parse.y (kwd_append): Update the last location of
      NODE_KW_ARG when NODE is appended to the last.
    
      e.g. The locations of the first NODE_KW_ARG is fixed:
    
      ```
      def a(b: 1, c: 2); end
      ```
    
      * Before
    
      ```
      NODE_KW_ARG (line: 1, first_lineno: 1, first_column: 6, last_lineno: 1, last_column: 10)
      ```
    
      * After
    
      ```
      NODE_KW_ARG (line: 1, first_lineno: 1, first_column: 6, last_lineno: 1, last_column: 16)
      ```

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 60913)
+++ parse.y	(revision 60914)
@@ -9359,8 +9359,10 @@ kwd_append(NODE *kwlist, NODE *kw) https://github.com/ruby/ruby/blob/trunk/parse.y#L9359
 {
     if (kwlist) {
 	NODE *kws = kwlist;
+	kws->nd_loc.last_loc = kw->nd_loc.last_loc;
 	while (kws->nd_next) {
 	    kws = kws->nd_next;
+	    kws->nd_loc.last_loc = kw->nd_loc.last_loc;
 	}
 	kws->nd_next = kw;
     }

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

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