1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

node.h: remove NODE_PRIVATE_RECV

* compile.c (private_recv_p): check by node type, instead of a
  magic number.
* node.h (NODE_PRIVATE_RECV), parse.y (attrset_gen): remove

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-06-06 13:19:31 +00:00
parent 199f814f32
commit fd8b254705
4 changed files with 10 additions and 17 deletions

View file

@ -1,3 +1,10 @@
Fri Jun 6 22:19:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* compile.c (private_recv_p): check by node type, instead of a
magic number.
* node.h (NODE_PRIVATE_RECV), parse.y (attrset_gen): remove
Fri Jun 6 17:07:08 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* compile.c (iseq_compile_each), parse.y (new_attr_op_assign_gen):

View file

@ -2791,7 +2791,7 @@ compile_cpath(LINK_ANCHOR *ret, rb_iseq_t *iseq, NODE *cpath)
}
}
#define private_recv_p(node) ((node)->nd_recv == NODE_PRIVATE_RECV)
#define private_recv_p(node) (nd_type((node)->nd_recv) == NODE_SELF)
#define defined_expr defined_expr0
static int

2
node.h
View file

@ -465,8 +465,6 @@ typedef struct RNode {
#define NEW_PRELUDE(p,b) NEW_NODE(NODE_PRELUDE,p,b,0)
#define NEW_MEMO(a,b,c) NEW_NODE(NODE_MEMO,a,b,c)
#define NODE_PRIVATE_RECV ((NODE *)1)
#define roomof(x, y) ((sizeof(x) + sizeof(y) - 1) / sizeof(y))
#define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
#define NEW_MEMO_FOR(type, value) \

16
parse.y
View file

@ -444,7 +444,6 @@ static NODE *aryset_gen(struct parser_params*,NODE*,NODE*);
#define aryset(node1,node2) aryset_gen(parser, (node1), (node2))
static NODE *attrset_gen(struct parser_params*,NODE*,ID);
#define attrset(node,id) attrset_gen(parser, (node), (id))
static inline NODE *attr_receiver(NODE *recv);
static void rb_backref_error_gen(struct parser_params*,NODE*);
#define rb_backref_error(n) rb_backref_error_gen(parser,(n))
@ -1206,7 +1205,7 @@ stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
else if ($5 == tANDOP) {
$5 = 1;
}
$$ = NEW_OP_ASGN1(attr_receiver($1), $5, args);
$$ = NEW_OP_ASGN1($1, $5, args);
fixpos($$, $1);
/*%
$$ = dispatch2(aref_field, $1, escape_Qundef($3));
@ -1998,7 +1997,7 @@ arg : lhs '=' arg
else if ($5 == tANDOP) {
$5 = 1;
}
$$ = NEW_OP_ASGN1(attr_receiver($1), $5, args);
$$ = NEW_OP_ASGN1($1, $5, args);
fixpos($$, $1);
/*%
$1 = dispatch2(aref_field, $1, escape_Qundef($3));
@ -8825,7 +8824,6 @@ new_bv_gen(struct parser_params *parser, ID name)
static NODE *
aryset_gen(struct parser_params *parser, NODE *recv, NODE *idx)
{
recv = attr_receiver(recv);
return NEW_ATTRASGN(recv, tASET, idx);
}
@ -8895,18 +8893,9 @@ rb_id_attrget(ID id)
return attrsetname_to_attr(rb_id2str(id));
}
static inline NODE *
attr_receiver(NODE *recv)
{
if (recv && nd_type(recv) == NODE_SELF)
recv = NODE_PRIVATE_RECV;
return recv;
}
static NODE *
attrset_gen(struct parser_params *parser, NODE *recv, ID id)
{
recv = attr_receiver(recv);
return NEW_ATTRASGN(recv, rb_id_attrset(id), 0);
}
@ -9650,7 +9639,6 @@ new_attr_op_assign_gen(struct parser_params *parser, NODE *lhs, ID attr, ID op,
else if (op == tANDOP) {
op = 1;
}
lhs = attr_receiver(lhs);
asgn = NEW_OP_ASGN2(lhs, attr, op, rhs);
fixpos(asgn, lhs);
return asgn;