summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-10 00:50:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-10 00:50:45 +0000
commit059cf260e72bace987bf4e1fc09733b576547c67 (patch)
tree09583b6964ad4d7fd5d8162c8858cc812e59ff7e /compile.c
parentc20fe4313bd4ebdeaa9ed5c8fbe4d166c50d2357 (diff)
compile.c: fix KW_SPLAT flag condition
* compile.c (compile_array_keyword_arg): fix the condition of KW_SPLAT flag. splat is value node only without key node, simple assoc argument is not. [ruby-core:82291] [Bug #13793] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index b21f002c9d..99e00b4e6a 100644
--- a/compile.c
+++ b/compile.c
@@ -3052,11 +3052,14 @@ compile_array_keyword_arg(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
NODE *key_node = node->nd_head;
assert(nd_type(node) == NODE_ARRAY);
- if (key_node && nd_type(key_node) == NODE_LIT && RB_TYPE_P(key_node->nd_lit, T_SYMBOL)) {
+ if (!key_node) {
+ if (flag) *flag |= VM_CALL_KW_SPLAT;
+ return FALSE;
+ }
+ else if (nd_type(key_node) == NODE_LIT && RB_TYPE_P(key_node->nd_lit, T_SYMBOL)) {
/* can be keywords */
}
else {
- if (flag) *flag |= VM_CALL_KW_SPLAT;
return FALSE;
}
node = node->nd_next; /* skip value node */