зеркало из https://github.com/github/ruby.git
[PRISM] Don't increment argc for PM_ASSOC_SPLAT_NODE
Fixes ruby/prism#2087.
This commit is contained in:
Родитель
015b0e2e1d
Коммит
51061b6631
|
@ -982,7 +982,6 @@ pm_setup_args(pm_arguments_node_t *arguments_node, int *flags, struct rb_callinf
|
|||
|
||||
if (has_keyword_splat) {
|
||||
int cur_hash_size = 0;
|
||||
orig_argc++;
|
||||
|
||||
bool new_hash_emitted = false;
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
|
@ -992,6 +991,7 @@ pm_setup_args(pm_arguments_node_t *arguments_node, int *flags, struct rb_callinf
|
|||
|
||||
switch (PM_NODE_TYPE(cur_node)) {
|
||||
case PM_ASSOC_NODE: {
|
||||
orig_argc++;
|
||||
pm_assoc_node_t *assoc = (pm_assoc_node_t *)cur_node;
|
||||
|
||||
PM_COMPILE_NOT_POPPED(assoc->key);
|
||||
|
|
|
@ -1441,6 +1441,11 @@ module Prism
|
|||
|
||||
assert_prism_eval("prism_test_call_node_splat(*[], 1, 2)")
|
||||
|
||||
assert_prism_eval(<<~RUBY)
|
||||
def self.prism_test_call_node_splat_and_double_splat(a, b, **opts); end
|
||||
prism_test_call_node_splat_and_double_splat(*[1], 2, **{})
|
||||
RUBY
|
||||
|
||||
assert_prism_eval(<<-CODE)
|
||||
class Foo
|
||||
def []=(a, b)
|
||||
|
|
Загрузка…
Ссылка в новой задаче