summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-08-28 11:35:14 -0400
committergit <svn-admin@ruby-lang.org>2024-08-28 15:35:23 +0000
commitccef391140f924af907080e62f24ef259550f324 (patch)
treed4d8ee70c0ed96f4beb745b7e5832f114a82e6dc
parent4c5a1dad0a7e9fb70a830d9312352b855abfc7cb (diff)
[ruby/prism] Swap around order of predicates for assoc static literal
https://github.com/ruby/prism/commit/ec181a3b68
-rw-r--r--prism/prism.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/prism/prism.c b/prism/prism.c
index ff5d5c2ccc..b506f710dd 100644
--- a/prism/prism.c
+++ b/prism/prism.c
@@ -2287,10 +2287,10 @@ pm_assoc_node_create(pm_parser_t *parser, pm_node_t *key, const pm_token_t *oper
// If the key and value of this assoc node are both static literals, then
// we can mark this node as a static literal.
pm_node_flags_t flags = 0;
- if (value &&
- !PM_NODE_TYPE_P(key, PM_ARRAY_NODE) && !PM_NODE_TYPE_P(key, PM_HASH_NODE) && !PM_NODE_TYPE_P(key, PM_RANGE_NODE) &&
- !PM_NODE_TYPE_P(value, PM_ARRAY_NODE) && !PM_NODE_TYPE_P(value, PM_HASH_NODE) && !PM_NODE_TYPE_P(value, PM_RANGE_NODE)
- ) {
+ if (
+ !PM_NODE_TYPE_P(key, PM_ARRAY_NODE) && !PM_NODE_TYPE_P(key, PM_HASH_NODE) && !PM_NODE_TYPE_P(key, PM_RANGE_NODE) &&
+ value && !PM_NODE_TYPE_P(value, PM_ARRAY_NODE) && !PM_NODE_TYPE_P(value, PM_HASH_NODE) && !PM_NODE_TYPE_P(value, PM_RANGE_NODE)
+ ) {
flags = key->flags & value->flags & PM_NODE_FLAG_STATIC_LITERAL;
}