mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 05:55:46 +02:00
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
This commit is contained in:
parent
7defa3836a
commit
65accad30a
1 changed files with 7 additions and 7 deletions
12
parse.y
12
parse.y
|
@ -63,11 +63,6 @@ static inline int id_type(ID);
|
||||||
#define is_class_id(id) (id_type(id)==ID_CLASS)
|
#define is_class_id(id) (id_type(id)==ID_CLASS)
|
||||||
#define is_junk_id(id) (id_type(id)==ID_JUNK)
|
#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 {
|
enum lex_state_bits {
|
||||||
EXPR_BEG_bit, /* ignore newline, +/- is a sign. */
|
EXPR_BEG_bit, /* ignore newline, +/- is a sign. */
|
||||||
EXPR_END_bit, /* newline significant, +/- is an operator. */
|
EXPR_END_bit, /* newline significant, +/- is an operator. */
|
||||||
|
@ -9610,10 +9605,15 @@ new_op_assign_gen(struct parser_params *parser, NODE *lhs, ID op, NODE *rhs)
|
||||||
if (op == tOROP) {
|
if (op == tOROP) {
|
||||||
lhs->nd_value = rhs;
|
lhs->nd_value = rhs;
|
||||||
asgn = NEW_OP_ASGN_OR(gettable(vid), lhs);
|
asgn = NEW_OP_ASGN_OR(gettable(vid), lhs);
|
||||||
if (is_asgn_or_id(vid)) {
|
if (is_notop_id(vid)) {
|
||||||
|
switch (id_type(vid)) {
|
||||||
|
case ID_GLOBAL:
|
||||||
|
case ID_INSTANCE:
|
||||||
|
case ID_CLASS:
|
||||||
asgn->nd_aid = vid;
|
asgn->nd_aid = vid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (op == tANDOP) {
|
else if (op == tANDOP) {
|
||||||
lhs->nd_value = rhs;
|
lhs->nd_value = rhs;
|
||||||
asgn = NEW_OP_ASGN_AND(gettable(vid), lhs);
|
asgn = NEW_OP_ASGN_AND(gettable(vid), lhs);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue