aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-15 05:19:54 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-15 05:19:54 +0000
commitc36a6f97f243778d3eb8e973eba89ce2b424b707 (patch)
tree47e0e1c2829393dad21e5511f4c0e79e8b5f8c95 /compile.c
parent560bb32fb2a04713bdbe5fa51ee2aaa271da91b6 (diff)
downloadruby-c36a6f97f243778d3eb8e973eba89ce2b424b707.tar.gz
node.h: introduce nd_brace to determine if a hash literal is a keyword
NODE_HASH#nd_brace is a flag that is 1 for `foo({ k: 1 })` and 0 for `foo(k: 1)`. nd_alen had been abused for the flag (and the implementation is completely the same), but an explicit name is better to read. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index 7201447d97..aa5551d5cc 100644
--- a/compile.c
+++ b/compile.c
@@ -3801,7 +3801,7 @@ compile_keyword_arg(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
assert(nd_type(node) == NODE_ARRAY);
if (!key_node) {
- if (flag && !root_node->nd_alen) *flag |= VM_CALL_KW_SPLAT;
+ if (flag && !root_node->nd_brace) *flag |= VM_CALL_KW_SPLAT;
return FALSE;
}
else if (nd_type(key_node) == NODE_LIT && RB_TYPE_P(key_node->nd_lit, T_SYMBOL)) {
@@ -4785,7 +4785,7 @@ check_keyword(const NODE *node)
node = node->nd_head;
}
- if (nd_type(node) == NODE_HASH && !node->nd_alen) return TRUE;
+ if (nd_type(node) == NODE_HASH && !node->nd_brace) return TRUE;
return FALSE;
}