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

ruby-changes:49112

From: mame <ko1@a...>
Date: Thu, 14 Dec 2017 17:22:28 +0900 (JST)
Subject: [ruby-changes:49112] mame:r61227 (trunk): node.h: add nd_last_loc and nd_set_last_loc

mame	2017-12-14 17:22:22 +0900 (Thu, 14 Dec 2017)

  New Revision: 61227

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

  Log:
    node.h: add nd_last_loc and nd_set_last_loc
    
    Just refactoring.

  Modified files:
    trunk/node.h
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 61226)
+++ parse.y	(revision 61227)
@@ -1673,8 +1673,7 @@ command		: fcall command_args       %pre https://github.com/ruby/ruby/blob/trunk/parse.y#L1673
 		    /*%%%*/
 			$$ = $1;
 			$$->nd_args = $2;
-			nd_set_last_lineno($1, nd_last_lineno($2));
-			nd_set_last_column($1, nd_last_column($2));
+			nd_set_last_loc($1, nd_last_loc($2));
 		    /*%
 			$$ = dispatch2(command, $1, $2);
 		    %*/
@@ -1687,8 +1686,7 @@ command		: fcall command_args       %pre https://github.com/ruby/ruby/blob/trunk/parse.y#L1686
 			fixpos($$, $1);
 		    /*%%%*/
 			$$->nd_loc = @$;
-			nd_set_last_lineno($1, nd_last_lineno($2));
-			nd_set_last_column($1, nd_last_column($2));
+			nd_set_last_loc($1, nd_last_loc($2));
 		    /*%
 		    %*/
 		    }
@@ -3720,8 +3718,7 @@ method_call	: fcall paren_args https://github.com/ruby/ruby/blob/trunk/parse.y#L3718
 		    /*%%%*/
 			$$ = $1;
 			$$->nd_args = $2;
-			nd_set_last_lineno($1, @2.last_loc.lineno);
-			nd_set_last_column($1, @2.last_loc.column);
+			nd_set_last_loc($1, @2.last_loc);
 		    /*%
 			$$ = method_arg(dispatch1(fcall, $1), $2);
 		    %*/
@@ -9066,8 +9063,7 @@ block_append_gen(struct parser_params *p https://github.com/ruby/ruby/blob/trunk/parse.y#L9063
     }
     end->nd_next = tail;
     h->nd_end = tail->nd_end;
-    nd_set_last_lineno(head, nd_last_lineno(tail));
-    nd_set_last_column(head, nd_last_column(tail));
+    nd_set_last_loc(head, nd_last_loc(tail));
     return head;
 }
 
@@ -9089,8 +9085,7 @@ list_append_gen(struct parser_params *pa https://github.com/ruby/ruby/blob/trunk/parse.y#L9085
     last->nd_next = new_list(item, &item->nd_loc);
     list->nd_next->nd_end = last->nd_next;
 
-    nd_set_last_lineno(list, nd_last_lineno(item));
-    nd_set_last_column(list, nd_last_column(item));
+    nd_set_last_loc(list, nd_last_loc(item));
 
     return list;
 }
@@ -9117,8 +9112,7 @@ list_concat(NODE *head, NODE *tail) https://github.com/ruby/ruby/blob/trunk/parse.y#L9112
 	head->nd_next->nd_end = tail;
     }
 
-    nd_set_last_lineno(head, nd_last_lineno(tail));
-    nd_set_last_column(head, nd_last_column(tail));
+    nd_set_last_loc(head, nd_last_loc(tail));
 
     return head;
 }
Index: node.h
===================================================================
--- node.h	(revision 61226)
+++ node.h	(revision 61227)
@@ -290,6 +290,8 @@ typedef struct RNode { https://github.com/ruby/ruby/blob/trunk/node.h#L290
 #define nd_set_last_column(n, v) ((n)->nd_loc.last_loc.column = (v))
 #define nd_last_lineno(n) ((int)((n)->nd_loc.last_loc.lineno))
 #define nd_set_last_lineno(n, v) ((n)->nd_loc.last_loc.lineno = (v))
+#define nd_last_loc(n) ((n)->nd_loc.last_loc)
+#define nd_set_last_loc(n, v) (nd_last_loc(n) = (v))
 
 #define nd_head  u1.node
 #define nd_alen  u2.argc

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

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