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

ruby-changes:49005

From: yui-knk <ko1@a...>
Date: Tue, 12 Dec 2017 08:13:52 +0900 (JST)
Subject: [ruby-changes:49005] yui-knk:r61124 (trunk): parse.y: Change locations of NODE_DVAR in NODE_MASGN

yui-knk	2017-12-12 08:13:47 +0900 (Tue, 12 Dec 2017)

  New Revision: 61124

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

  Log:
    parse.y: Change locations of NODE_DVAR in NODE_MASGN
    
    * parse.y: Change the last location of NODE_DVAR to
      be equal to the first location of NODE_DVAR.
      NODE_DVAR of NODE_MASGN (nd_value) is an internal variable,
      so it has no length.
    
      e.g. The locations of the NODE_DVAR is changed:
    
      ```
      a.b {|(c,d)| e}
      ```
    
      * Before
    
      ```
      NODE_DVAR (line: 1, code_range: (1,7)-(1,10))
      ```
    
      * After
    
      ```
      NODE_DVAR (line: 1, code_range: (1,7)-(1,7))
      ```

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 61123)
+++ parse.y	(revision 61124)
@@ -4643,13 +4643,16 @@ f_arg_item	: f_arg_asgn https://github.com/ruby/ruby/blob/trunk/parse.y#L4643
 		| tLPAREN f_margs rparen
 		    {
 			ID tid = internal_id();
+			YYLTYPE location;
+			location.first_loc = @2.first_loc;
+			location.last_loc = @2.first_loc;
 			arg_var(tid);
 		    /*%%%*/
 			if (dyna_in_block()) {
-			    $2->nd_value = new_dvar(tid, &@2);
+			    $2->nd_value = new_dvar(tid, &location);
 			}
 			else {
-			    $2->nd_value = new_lvar(tid, &@2);
+			    $2->nd_value = new_lvar(tid, &location);
 			}
 			$$ = NEW_ARGS_AUX(tid, 1);
 			$$->nd_next = $2;

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

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