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

ruby-changes:49961

From: nobu <ko1@a...>
Date: Sun, 28 Jan 2018 23:05:43 +0900 (JST)
Subject: [ruby-changes:49961] nobu:r62079 (trunk): parse.y (parser_append_options): shorter alias LOC

nobu	2018-01-28 23:05:39 +0900 (Sun, 28 Jan 2018)

  New Revision: 62079

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

  Log:
    parse.y (parser_append_options): shorter alias LOC

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 62078)
+++ parse.y	(revision 62079)
@@ -10575,27 +10575,30 @@ static NODE * https://github.com/ruby/ruby/blob/trunk/parse.y#L10575
 parser_append_options(struct parser_params *p, NODE *node)
 {
     static const YYLTYPE default_location = {{1, 0}, {1, 0}};
+    const YYLTYPE *const LOC = &default_location;
 
     if (p->do_print) {
-	node = block_append(p, node,
-			    NEW_FCALL(rb_intern("print"),
-				      NEW_ARRAY(NEW_GVAR(idLASTLINE, &default_location), &NULL_LOC), &default_location));
+	NODE *print = NEW_FCALL(rb_intern("print"),
+				NEW_ARRAY(NEW_GVAR(idLASTLINE, LOC), LOC),
+				LOC);
+	node = block_append(p, node, print);
     }
 
     if (p->do_loop) {
 	if (p->do_split) {
-	    node = block_append(p, NEW_GASGN(rb_intern("$F"),
-					  NEW_CALL(NEW_GVAR(idLASTLINE, &default_location),
-						   rb_intern("split"), 0, &default_location),
-					  &NULL_LOC),
-				node);
+	    NODE *split = NEW_GASGN(rb_intern("$F"),
+				    NEW_CALL(NEW_GVAR(idLASTLINE, LOC),
+					     rb_intern("split"), 0, LOC),
+				    LOC);
+	    node = block_append(p, split, node);
 	}
 	if (p->do_chomp) {
-	    node = block_append(p, NEW_CALL(NEW_GVAR(idLASTLINE, &default_location),
-					 rb_intern("chomp!"), 0, &default_location), node);
+	    NODE *chomp = NEW_CALL(NEW_GVAR(idLASTLINE, LOC),
+				   rb_intern("chomp!"), 0, LOC);
+	    node = block_append(p, chomp, node);
 	}
 
-	node = NEW_WHILE(NEW_VCALL(idGets, &NULL_LOC), node, 1, &NULL_LOC);
+	node = NEW_WHILE(NEW_VCALL(idGets, LOC), node, 1, LOC);
     }
 
     return node;

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

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