[PRISM] Updated LocalVariableTargetNodes too
This commit is contained in:
parent
b913626bea
commit
103bbd21f8
@ -2883,8 +2883,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
|
|||||||
pm_local_variable_target_node_t *local_write_node = (pm_local_variable_target_node_t *) node;
|
pm_local_variable_target_node_t *local_write_node = (pm_local_variable_target_node_t *) node;
|
||||||
|
|
||||||
pm_constant_id_t constant_id = local_write_node->name;
|
pm_constant_id_t constant_id = local_write_node->name;
|
||||||
for (size_t index = 0; index < local_write_node->depth; index++) scope_node = scope_node->previous;
|
int index = pm_lookup_local_index_any_scope(iseq, scope_node, constant_id);
|
||||||
int index = pm_lookup_local_index(iseq, scope_node, constant_id);
|
|
||||||
|
|
||||||
ADD_SETLOCAL(ret, &dummy_line_node, index, local_write_node->depth);
|
ADD_SETLOCAL(ret, &dummy_line_node, index, local_write_node->depth);
|
||||||
return;
|
return;
|
||||||
|
@ -350,6 +350,14 @@ module Prism
|
|||||||
|
|
||||||
def test_LocalVariableTargetNode
|
def test_LocalVariableTargetNode
|
||||||
assert_prism_eval("pit, pit1 = 1")
|
assert_prism_eval("pit, pit1 = 1")
|
||||||
|
assert_prism_eval(<<-CODE)
|
||||||
|
a = 1
|
||||||
|
[1].each do
|
||||||
|
c = 2
|
||||||
|
a, b = 2
|
||||||
|
end
|
||||||
|
a
|
||||||
|
CODE
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_MultiTargetNode
|
def test_MultiTargetNode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user