diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-06 06:05:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-06 06:05:19 +0000 |
commit | bb3f03633677b19814954da77975ec3f485eb490 (patch) | |
tree | e0f25e0a11e312d1af9e71a55a98057f746dbe1f /parse.y | |
parent | 71a3cb13eb588abca4833b2a34d48681de90b9fe (diff) | |
download | ruby-bb3f03633677b19814954da77975ec3f485eb490.tar.gz |
node.h: NODE_PRIVATE_RECV
* node.h (NODE_PRIVATE_RECV): name a magic number, `self` as the
receiver of a setter method call.
* compile.c (private_recv_p), parse.y (attr_receiver): use the
named macro.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -8895,11 +8895,18 @@ 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) { - if (recv && nd_type(recv) == NODE_SELF) - recv = (NODE *)1; + recv = attr_receiver(recv); return NEW_ATTRASGN(recv, rb_id_attrset(id), 0); } |