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

ruby-changes:40376

From: nobu <ko1@a...>
Date: Thu, 5 Nov 2015 10:24:22 +0900 (JST)
Subject: [ruby-changes:40376] nobu:r52457 (trunk): parse.y: CALL_Q_P

nobu	2015-11-05 10:24:18 +0900 (Thu, 05 Nov 2015)

  New Revision: 52457

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

  Log:
    parse.y: CALL_Q_P
    
    * parse.y (CALL_Q_P): extract common condition for safe-call
      token.

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 52456)
+++ parse.y	(revision 52457)
@@ -371,7 +371,8 @@ static int parser_yyerror(struct parser_ https://github.com/ruby/ruby/blob/trunk/parse.y#L371
 #define ruby_coverage		(parser->coverage)
 #endif
 
-#define NODE_CALL_Q(q) (((q) == tDOTQ) ? NODE_QCALL : NODE_CALL)
+#define CALL_Q_P(q) ((q) == tDOTQ)
+#define NODE_CALL_Q(q) (CALL_Q_P(q) ? NODE_QCALL : NODE_CALL)
 #define NEW_QCALL(q,r,m,a) NEW_NODE(NODE_CALL_Q(q),r,m,a)
 
 static int yylex(YYSTYPE*, struct parser_params*);
@@ -9211,7 +9212,7 @@ block_dup_check_gen(struct parser_params https://github.com/ruby/ruby/blob/trunk/parse.y#L9212
 static NODE *
 attrset_gen(struct parser_params *parser, NODE *recv, ID atype, ID id)
 {
-    if (atype != tDOTQ) id = rb_id_attrset(id);
+    if (!CALL_Q_P(atype)) id = rb_id_attrset(id);
     return NEW_ATTRASGN(recv, id, 0);
 }
 
@@ -10082,7 +10083,7 @@ new_attr_op_assign_gen(struct parser_par https://github.com/ruby/ruby/blob/trunk/parse.y#L10083
     else if (op == tANDOP) {
 	op = 1;
     }
-    asgn = NEW_OP_ASGN2(lhs, (atype == tDOTQ), attr, op, rhs);
+    asgn = NEW_OP_ASGN2(lhs, CALL_Q_P(atype), attr, op, rhs);
     fixpos(asgn, lhs);
     return asgn;
 }

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

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