summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-06 13:19:31 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-06 13:19:31 +0000
commitfd8b2547054fffe8dd01631b50e917df47c5b637 (patch)
tree16ff4ad037a8596fa2cda34aa908f211b8aa4162
parent199f814f32e97b2fed528801c0ad2c84c1e5f8a6 (diff)
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
-rw-r--r--ChangeLog7
-rw-r--r--compile.c2
-rw-r--r--node.h2
-rw-r--r--parse.y16
4 files changed, 10 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 551dd1c..6168907 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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):
diff --git a/compile.c b/compile.c
index e4d2998..89dc4e4 100644
--- a/compile.c
+++ b/compile.c
@@ -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
diff --git a/node.h b/node.h
index 2c6cd91..9ee0704 100644
--- a/node.h
+++ b/node.h
@@ -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) \
diff --git a/parse.y b/parse.y
index a9f7d5d..bdfa2df 100644
--- a/parse.y
+++ b/parse.y
@@ -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;