зеркало из https://github.com/github/ruby.git
[PRISM] Fix popped for AssocSplatNode
This commit is contained in:
Родитель
8b4b3b1d38
Коммит
62baf723b6
|
@ -2400,7 +2400,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
|
|||
int elements_of_cur_type = 0;
|
||||
int allocated_hashes = 0;
|
||||
|
||||
if (!PM_NODE_TYPE_P(cur_node, PM_ASSOC_NODE)) {
|
||||
if (!PM_NODE_TYPE_P(cur_node, PM_ASSOC_NODE) && !popped) {
|
||||
ADD_INSN1(ret, &dummy_line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
|
||||
ADD_INSN1(ret, &dummy_line_node, newhash, INT2FIX(0));
|
||||
allocated_hashes++;
|
||||
|
@ -2435,6 +2435,9 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
|
|||
PM_COMPILE(elements->nodes[index]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
PM_COMPILE(elements->nodes[index]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!popped) {
|
||||
|
|
|
@ -441,11 +441,9 @@ module Prism
|
|||
end
|
||||
|
||||
def test_AssocSplatNode
|
||||
=begin
|
||||
assert_prism_eval("foo = { a: 1 }; { **foo }")
|
||||
assert_prism_eval("foo = { a: 1 }; bar = foo; { **foo, b: 2, **bar, c: 3 }")
|
||||
assert_prism_eval("foo = { a: 1 }; { b: 2, **foo, c: 3}")
|
||||
=end
|
||||
end
|
||||
|
||||
def test_HashNode
|
||||
|
|
Загрузка…
Ссылка в новой задаче