[Bug #21011] nd_value is NULL in massign

This commit is contained in:
Nobuyoshi Nakada 2025-01-08 12:03:12 +09:00
parent 1a06bee027
commit b81db531b2
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2025-01-08 04:55:38 +00:00
2 changed files with 10 additions and 1 deletions

View File

@ -10417,7 +10417,7 @@ compile_shareable_literal_constant(rb_iseq_t *iseq, LINK_ANCHOR *ret, enum rb_pa
VALUE lit = Qnil;
DECL_ANCHOR(anchor);
enum node_type type = nd_type(node);
enum node_type type = node ? nd_type(node) : NODE_NIL;
switch (type) {
case NODE_TRUE:
*value_p = Qtrue;

View File

@ -1721,6 +1721,15 @@ x = __ENCODING__
end;
end
def test_shareable_constant_value_massign
a = eval_separately("#{<<~"begin;"}\n#{<<~'end;'}")
begin;
# shareable_constant_value: experimental_everything
A, = 1
end;
assert_equal(1, a)
end
def test_if_after_class
assert_valid_syntax('module if true; Object end::Kernel; end')
assert_valid_syntax('module while true; break Object end::Kernel; end')