diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-05 01:24:18 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-05 01:24:18 +0000 |
commit | 20d94b47b9591069ad8d12319bffa594b9b8d5b7 (patch) | |
tree | d6e9d8a2a3c45bd39107e2535d0c8ec895c7b130 | |
parent | b1f7a158a937e7628558fe942c8287ffce93699d (diff) | |
download | ruby-20d94b47b9591069ad8d12319bffa594b9b8d5b7.tar.gz |
parse.y: CALL_Q_P
* parse.y (CALL_Q_P): extract common condition for safe-call
token.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | parse.y | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -371,7 +371,8 @@ static int parser_yyerror(struct parser_params*, const char*); #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 *parser, NODE *node1, NODE *node2) 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_params *parser, NODE *lhs, 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; } |