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

ruby-changes:48796

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

yui-knk	2017-11-27 08:33:23 +0900 (Mon, 27 Nov 2017)

  New Revision: 60912

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

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

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 60911)
+++ parse.y	(revision 60912)
@@ -9343,9 +9343,11 @@ static NODE * https://github.com/ruby/ruby/blob/trunk/parse.y#L9343
 opt_arg_append(NODE *opt_list, NODE *opt)
 {
     NODE *opts = opt_list;
+    opts->nd_loc.last_loc = opt->nd_loc.last_loc;
 
     while (opts->nd_next) {
 	opts = opts->nd_next;
+	opts->nd_loc.last_loc = opt->nd_loc.last_loc;
     }
     opts->nd_next = opt;
 

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

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