summaryrefslogtreecommitdiff
path: root/prism
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2023-12-12 10:39:41 -0500
committergit <svn-admin@ruby-lang.org>2023-12-12 15:55:54 +0000
commit278ce27ee4063dec5b8967563d58e32ea087a380 (patch)
tree4474af00494762bdb51f06536a92ec55410d22f0 /prism
parent2f1d6da8c45590bf3461ed4bf051a4e1009eaf85 (diff)
[ruby/prism] Flag for attribute write on calls
https://github.com/ruby/prism/commit/465731969c
Diffstat (limited to 'prism')
-rw-r--r--prism/config.yml2
-rw-r--r--prism/prism.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/prism/config.yml b/prism/config.yml
index 7e71e4e50b..d3b6b08709 100644
--- a/prism/config.yml
+++ b/prism/config.yml
@@ -345,6 +345,8 @@ flags:
comment: "&. operator"
- name: VARIABLE_CALL
comment: "a call that could have been a local variable"
+ - name: ATTRIBUTE_WRITE
+ comment: "a call that is an attribute write, so the value being written should be returned"
comment: Flags for call nodes.
- name: EncodingFlags
values:
diff --git a/prism/prism.c b/prism/prism.c
index 1474a1854f..2b74152cce 100644
--- a/prism/prism.c
+++ b/prism/prism.c
@@ -10856,6 +10856,7 @@ parse_write(pm_parser_t *parser, pm_node_t *target, pm_token_t *operator, pm_nod
call->base.location.end = arguments->base.location.end;
parse_write_name(parser, &call->name);
+ call->base.flags |= PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE;
return (pm_node_t *) call;
}
}
@@ -10873,6 +10874,7 @@ parse_write(pm_parser_t *parser, pm_node_t *target, pm_token_t *operator, pm_nod
// Replace the name with "[]=".
call->name = pm_parser_constant_id_constant(parser, "[]=", 3);
+ call->base.flags |= PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE;
return target;
}