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

ruby-changes:48974

From: yui-knk <ko1@a...>
Date: Sat, 9 Dec 2017 18:44:09 +0900 (JST)
Subject: [ruby-changes:48974] yui-knk:r61093 (trunk): parse.y: Change locations of NODE_BLOCK in NODE_RESBODY (nd_body)

yui-knk	2017-12-09 18:44:03 +0900 (Sat, 09 Dec 2017)

  New Revision: 61093

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

  Log:
    parse.y: Change locations of NODE_BLOCK in NODE_RESBODY (nd_body)
    
    * parse.y: Change to only include a range from exc_var to compstmt.
    
      e.g. The locations of the NODE_BLOCK is changed:
    
      ```
      begin
        :a
      rescue E => e
        :b
      end
      ```
    
      * Before
    
      ```
      NODE_BLOCK (line: 3, code_range: (3,0)-(5,3))
      ```
    
      * After
    
      ```
      NODE_BLOCK (line: 3, code_range: (3,9)-(4,4))
      ```

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 61092)
+++ parse.y	(revision 61093)
@@ -3849,8 +3849,11 @@ opt_rescue	: keyword_rescue exc_list exc https://github.com/ruby/ruby/blob/trunk/parse.y#L3849
 		    {
 		    /*%%%*/
 			if ($3) {
+			    YYLTYPE location;
+			    location.first_loc = @3.first_loc;
+			    location.last_loc = @5.last_loc;
 			    $3 = node_assign($3, new_errinfo(&@3), &@3);
-			    $5 = block_append($3, $5, &@$);
+			    $5 = block_append($3, $5, &location);
 			}
 			$$ = new_resbody($2, $5, $6, &@$);
 			fixpos($$, $2?$2:$5);

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

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