diff options
author | Jenny Shen <[email protected]> | 2024-02-02 16:53:55 -0500 |
---|---|---|
committer | Kevin Newton <[email protected]> | 2024-02-05 10:27:58 -0500 |
commit | 8ed26a3f5923a0f1213060200bf542f172c99b7c (patch) | |
tree | 42c9c144a837abea88d37b33a6da9cf5c91c0009 /prism_compile.c | |
parent | 3af47f14d4e535956edc44039382db24a963be61 (diff) |
[PRISM] Refactor PM_CALL_NODE conditional
Co-authored-by: Peter Zhu <[email protected]>
Diffstat (limited to 'prism_compile.c')
-rw-r--r-- | prism_compile.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/prism_compile.c b/prism_compile.c index b9838398a1..37fdd88699 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -4142,17 +4142,8 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, } ID method_id = pm_constant_id_lookup(scope_node, call_node->name); - if (node->flags & PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE) { - if (!popped) { - PM_PUTNIL; - } - } - if (call_node->receiver == NULL) { - PM_PUTSELF; - pm_compile_call(iseq, call_node, ret, popped, scope_node, method_id, start); - } - else if ((method_id == idUMinus || method_id == idFreeze) && + if ((method_id == idUMinus || method_id == idFreeze) && !PM_NODE_FLAG_P(call_node, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION) && PM_NODE_TYPE_P(call_node->receiver, PM_STRING_NODE) && call_node->arguments == NULL && @@ -4185,7 +4176,16 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, } } else { - PM_COMPILE_NOT_POPPED(call_node->receiver); + if ((node->flags & PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE) && !popped) { + PM_PUTNIL; + } + + if (call_node->receiver == NULL) { + PM_PUTSELF; + } + else { + PM_COMPILE_NOT_POPPED(call_node->receiver); + } pm_compile_call(iseq, call_node, ret, popped, scope_node, method_id, start); } |