From f390c51b15c470590a416d0def51ea1cca1bd74b Mon Sep 17 00:00:00 2001 From: Ufuk Kayserilioglu Date: Wed, 13 Dec 2023 01:37:50 +0200 Subject: [PATCH] [PRISM] Use `PM_KEYWORD_HASH_NODE_FLAGS_STATIC_KEYS` flag in compiler --- prism_compile.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/prism_compile.c b/prism_compile.c index 486da5df82ff9c..715cb8629100d4 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -993,18 +993,7 @@ pm_setup_args(pm_arguments_node_t *arguments_node, int *flags, struct rb_callinf else { // We need to first figure out if all elements of the KeywordHashNode are AssocNodes // with static literal keys. - // TODO: Figure this out from flags on the KeywordHashNode when Prism supports it - bool all_keys_static_literals = true; - - for (size_t i = 0; i < len; i++) { - pm_assoc_node_t *assoc = (pm_assoc_node_t *)keyword_arg->elements.nodes[i]; - pm_node_t *key = assoc->key; - - if (!key || !PM_NODE_TYPE_P(key, PM_ASSOC_NODE) || !pm_static_literal_p(key)) { - all_keys_static_literals = false; - break; - } - } + bool all_keys_static_literals = PM_NODE_FLAG_P(keyword_arg, PM_KEYWORD_HASH_NODE_FLAGS_STATIC_KEYS); if (all_keys_static_literals) { // If they are all static literal keys then we can pass them as keyword arguments.