aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y11
1 files changed, 9 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index 2e73d64401..61251b9309 100644
--- a/parse.y
+++ b/parse.y
@@ -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);
}