aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authorTSUYUSATO Kitsune <make.just.on@gmail.com>2023-11-14 17:15:37 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-11-21 14:07:47 +0900
commitfe746747b49efb310989792681e171559581920c (patch)
treeaadb369c0ca11d577009b847267cba6b4ac98ee8 /parse.y
parent04eb40b633397d03e4cbce41418626f4fabdcb02 (diff)
downloadruby-fe746747b49efb310989792681e171559581920c.tar.gz
Reject 'class << (return); end` by "void value expression"
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y10
1 files changed, 5 insertions, 5 deletions
diff --git a/parse.y b/parse.y
index caddbcc178..94eb6f3e5a 100644
--- a/parse.y
+++ b/parse.y
@@ -4124,7 +4124,7 @@ primary : literal
p->ctxt.in_class = $k_class.in_class;
p->ctxt.shareable_constant_value = $k_class.shareable_constant_value;
}
- | k_class tLSHFT expr
+ | k_class tLSHFT expr_value
{
begin_definition("", &@k_class, &@tLSHFT);
}
@@ -4133,12 +4133,12 @@ primary : literal
k_end
{
/*%%%*/
- $$ = NEW_SCLASS($expr, $bodystmt, &@$);
+ $$ = NEW_SCLASS($expr_value, $bodystmt, &@$);
nd_set_line(RNODE_SCLASS($$)->nd_body, @k_end.end_pos.lineno);
- set_line_body($bodystmt, nd_line($expr));
- fixpos($$, $expr);
+ set_line_body($bodystmt, nd_line($expr_value));
+ fixpos($$, $expr_value);
/*% %*/
- /*% ripper: sclass!($expr, $bodystmt) %*/
+ /*% ripper: sclass!($expr_value, $bodystmt) %*/
local_pop(p);
p->ctxt.in_def = $k_class.in_def;
p->ctxt.in_class = $k_class.in_class;