зеркало из https://github.com/github/ruby.git
Родитель
d86c4e553e
Коммит
529700d314
|
@ -3177,7 +3177,9 @@ pm_compile_target_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *cons
|
|||
//
|
||||
// for i, j in []; end
|
||||
//
|
||||
if (state != NULL) state->position--;
|
||||
pm_compile_multi_target_node(iseq, node, parents, writes, cleanup, src, scope_node, state);
|
||||
if (state != NULL) state->position++;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -3270,6 +3272,9 @@ pm_compile_multi_target_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR
|
|||
// Now, we need to go back and modify the topn instructions in order to
|
||||
// ensure they can correctly retrieve the parent expressions.
|
||||
pm_multi_target_state_update(&target_state);
|
||||
|
||||
if (state != NULL) state->stack_size += target_state.stack_size;
|
||||
|
||||
return target_state.stack_size;
|
||||
}
|
||||
|
||||
|
|
|
@ -653,6 +653,21 @@ module Prism
|
|||
foo = Foo.new
|
||||
_, foo.bar, _, foo.baz = 1
|
||||
CODE
|
||||
|
||||
# Test nested writes with method calls
|
||||
assert_prism_eval(<<~RUBY)
|
||||
class Foo
|
||||
attr_accessor :bar
|
||||
end
|
||||
|
||||
a = Foo.new
|
||||
|
||||
(a.bar, a.bar), b = [1], 2
|
||||
RUBY
|
||||
assert_prism_eval(<<~RUBY)
|
||||
h = {}
|
||||
(h[:foo], h[:bar]), a = [1], 2
|
||||
RUBY
|
||||
end
|
||||
|
||||
############################################################################
|
||||
|
|
Загрузка…
Ссылка в новой задаче