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

ruby-changes:48946

From: yui-knk <ko1@a...>
Date: Thu, 7 Dec 2017 11:48:43 +0900 (JST)
Subject: [ruby-changes:48946] yui-knk:r61065 (trunk): parse.y: Fix locations of dsym

yui-knk	2017-12-07 11:48:38 +0900 (Thu, 07 Dec 2017)

  New Revision: 61065

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

  Log:
    parse.y: Fix locations of dsym
    
    * parse.y (dsym_node_gen): Always set locations
      to include locations of tSYMBEG and tSTRING_END.
    
      e.g. The locations of the NODE_LIT is fixed:
    
      ```
      :"a"
      ```
    
      * Before
    
      ```
      NODE_LIT (line: 1, code_range: (1,2)-(1,3))
      ```
    
      * After
    
      ```
      NODE_LIT (line: 1, code_range: (1,0)-(1,4))
      ```

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 61064)
+++ parse.y	(revision 61065)
@@ -10842,11 +10842,13 @@ dsym_node_gen(struct parser_params *pars https://github.com/ruby/ruby/blob/trunk/parse.y#L10842
     switch (nd_type(node)) {
       case NODE_DSTR:
 	nd_set_type(node, NODE_DSYM);
+	nd_set_loc(node, location);
 	break;
       case NODE_STR:
 	lit = node->nd_lit;
 	add_mark_object(node->nd_lit = ID2SYM(rb_intern_str(lit)));
 	nd_set_type(node, NODE_LIT);
+	nd_set_loc(node, location);
 	break;
       default:
 	node = NEW_NODE(NODE_DSYM, Qnil, 1, new_list(node, location));

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

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