summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-08 07:01:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-08 07:01:10 +0000
commit65accad30a056321856765fcac35655afbd9f44e (patch)
treefb4542d5874f92d54d4fcd9ba416fccc280e87a4 /parse.y
parent7defa3836a6dfd45e92b9a9e32f17c8246f80e21 (diff)
parse.y: expand is_asgn_or_id
* parse.y (new_op_assign_gen): expand is_asgn_or_id(), which call id_type() function multiple times now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y14
1 files changed, 7 insertions, 7 deletions
diff --git a/parse.y b/parse.y
index f0e91f4318..79c9e342d9 100644
--- a/parse.y
+++ b/parse.y
@@ -63,11 +63,6 @@ static inline int id_type(ID);
#define is_class_id(id) (id_type(id)==ID_CLASS)
#define is_junk_id(id) (id_type(id)==ID_JUNK)
-#define is_asgn_or_id(id) ((is_notop_id(id)) && \
- ((id_type(id)) == ID_GLOBAL || \
- (id_type(id)) == ID_INSTANCE || \
- (id_type(id)) == ID_CLASS))
-
enum lex_state_bits {
EXPR_BEG_bit, /* ignore newline, +/- is a sign. */
EXPR_END_bit, /* newline significant, +/- is an operator. */
@@ -9610,8 +9605,13 @@ new_op_assign_gen(struct parser_params *parser, NODE *lhs, ID op, NODE *rhs)
if (op == tOROP) {
lhs->nd_value = rhs;
asgn = NEW_OP_ASGN_OR(gettable(vid), lhs);
- if (is_asgn_or_id(vid)) {
- asgn->nd_aid = vid;
+ if (is_notop_id(vid)) {
+ switch (id_type(vid)) {
+ case ID_GLOBAL:
+ case ID_INSTANCE:
+ case ID_CLASS:
+ asgn->nd_aid = vid;
+ }
}
}
else if (op == tANDOP) {