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

ruby-changes:48871

From: yui-knk <ko1@a...>
Date: Sun, 3 Dec 2017 15:53:23 +0900 (JST)
Subject: [ruby-changes:48871] yui-knk:r60989 (trunk): parse.y: Set a location of NODE_NIL in `not()`

yui-knk	2017-12-03 15:53:18 +0900 (Sun, 03 Dec 2017)

  New Revision: 60989

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

  Log:
    parse.y: Set a location of NODE_NIL in `not()`

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 60988)
+++ parse.y	(revision 60989)
@@ -389,7 +389,8 @@ set_line_body(NODE *body, int line) https://github.com/ruby/ruby/blob/trunk/parse.y#L389
 static NODE *cond_gen(struct parser_params*,NODE*,int,const YYLTYPE*);
 #define cond(node,location) cond_gen(parser, (node), FALSE, location)
 #define method_cond(node,location) cond_gen(parser, (node), TRUE, location)
-#define new_nil() NEW_NIL()
+static NODE *new_nil_gen(struct parser_params*,const YYLTYPE*);
+#define new_nil(location) new_nil_gen(parser,location)
 static NODE *new_if_gen(struct parser_params*,NODE*,NODE*,NODE*,const YYLTYPE*);
 #define new_if(cc,left,right,location) new_if_gen(parser, (cc), (left), (right), (location))
 static NODE *new_unless_gen(struct parser_params*,NODE*,NODE*,NODE*,const YYLTYPE*);
@@ -641,7 +642,7 @@ static VALUE new_qcall_gen(struct parser https://github.com/ruby/ruby/blob/trunk/parse.y#L642
 #define new_command_call(q,r,m,a) dispatch4(command_call, (r), (q), (m), (a))
 #define new_command(m,a) dispatch2(command, (m), (a));
 
-#define new_nil() Qnil
+#define new_nil(location) Qnil
 static VALUE new_op_assign_gen(struct parser_params *parser, VALUE lhs, VALUE op, VALUE rhs);
 #define new_op_assign(lhs, op, rhs, location) new_op_assign_gen(parser, (lhs), (op), (rhs))
 static VALUE new_attr_op_assign_gen(struct parser_params *parser, VALUE lhs, VALUE type, VALUE attr, VALUE op, VALUE rhs);
@@ -2786,7 +2787,7 @@ primary		: literal https://github.com/ruby/ruby/blob/trunk/parse.y#L2787
 		    }
 		| keyword_not '(' rparen
 		    {
-			$$ = call_uni_op(method_cond(new_nil(), &@2), METHOD_NOT, &@$);
+			$$ = call_uni_op(method_cond(new_nil(&@2), &@2), METHOD_NOT, &@$);
 		    }
 		| fcall brace_block
 		    {
@@ -10552,6 +10553,14 @@ cond_gen(struct parser_params *parser, N https://github.com/ruby/ruby/blob/trunk/parse.y#L10553
 }
 
 static NODE*
+new_nil_gen(struct parser_params *parser, const YYLTYPE *location)
+{
+    NODE *node_nil = NEW_NIL();
+    node_nil->nd_loc = *location;
+    return node_nil;
+}
+
+static NODE*
 new_if_gen(struct parser_params *parser, NODE *cc, NODE *left, NODE *right, const YYLTYPE *location)
 {
     NODE *node_if;

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

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