summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorSeiei Miyagi <hanachin@gmail.com>2020-02-03 17:43:03 +0900
committerYusuke Endoh <mame@ruby-lang.org>2020-02-03 17:54:44 +0900
commit11963da9e8e98821860fbb0c0f2adc118860c814 (patch)
tree488c9fc3adf104cb8333e83e904f657cb42ce711 /compile.c
parenta635c93fdebeda6347b8654af1a191e214ad7ccf (diff)
Check type of empty keyword [Bug #16603]
Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2874
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index eb36f57e0f..9de9114c90 100644
--- a/compile.c
+++ b/compile.c
@@ -4253,7 +4253,7 @@ compile_hash(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int popp
FLUSH_CHUNK();
const NODE *kw = node->nd_next->nd_head;
- int empty_kw = nd_type(kw) == NODE_LIT; /* foo( ..., **{}, ...) */
+ int empty_kw = nd_type(kw) == NODE_LIT && RB_TYPE_P(kw->nd_lit, T_HASH); /* foo( ..., **{}, ...) */
int first_kw = first_chunk && stack_len == 0; /* foo(1,2,3, **kw, ...) */
int last_kw = !node->nd_next->nd_next; /* foo( ..., **kw) */
int only_kw = last_kw && first_kw; /* foo(1,2,3, **kw) */