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

ruby-changes:49570

From: yui-knk <ko1@a...>
Date: Mon, 8 Jan 2018 21:23:59 +0900 (JST)
Subject: [ruby-changes:49570] yui-knk:r61686 (trunk): parse.y: Use nd_loc of head and tail

yui-knk	2018-01-08 21:23:53 +0900 (Mon, 08 Jan 2018)

  New Revision: 61686

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

  Log:
    parse.y: Use nd_loc of head and tail
    
    * parse.y (block_append_gen): Use nd_loc of
      head(tail) when create NEW_BLOCK of head(tail).
    
      e.g. The locations of the NODE_BLOCK is fixed:
    
      ```
      BEGIN {
        :a
      }
    
      BEGIN {
        :b
      }
      ```
    
      * Before
    
      ```
      NODE_BLOCK (line: 5, code_range: (5,0)-(7,1))
      ```
    
      * After
    
      ```
      NODE_BLOCK (line: 1, code_range: (1,0)-(7,1))
      ```

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 61685)
+++ parse.y	(revision 61686)
@@ -8852,7 +8852,7 @@ block_append_gen(struct parser_params *p https://github.com/ruby/ruby/blob/trunk/parse.y#L8852
 	parser_warning(h, "unused literal ignored");
 	return tail;
       default:
-	h = end = NEW_BLOCK(head, location);
+	h = end = NEW_BLOCK(head, &head->nd_loc);
 	end->nd_end = end;
 	head = end;
 	break;
@@ -8878,7 +8878,7 @@ block_append_gen(struct parser_params *p https://github.com/ruby/ruby/blob/trunk/parse.y#L8878
     }
 
     if (nd_type(tail) != NODE_BLOCK) {
-	tail = NEW_BLOCK(tail, location);
+	tail = NEW_BLOCK(tail, &tail->nd_loc);
 	tail->nd_end = tail;
     }
     end->nd_next = tail;

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

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