mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 13:34:17 +02:00
[PRISM] Refactor PM_CALL_NODE conditional
Co-authored-by: Peter Zhu <peter@peterzhu.ca>
This commit is contained in:
parent
3af47f14d4
commit
8ed26a3f59
1 changed files with 11 additions and 11 deletions
|
@ -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);
|
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) {
|
if ((method_id == idUMinus || method_id == idFreeze) &&
|
||||||
PM_PUTSELF;
|
|
||||||
pm_compile_call(iseq, call_node, ret, popped, scope_node, method_id, start);
|
|
||||||
}
|
|
||||||
else if ((method_id == idUMinus || method_id == idFreeze) &&
|
|
||||||
!PM_NODE_FLAG_P(call_node, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION) &&
|
!PM_NODE_FLAG_P(call_node, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION) &&
|
||||||
PM_NODE_TYPE_P(call_node->receiver, PM_STRING_NODE) &&
|
PM_NODE_TYPE_P(call_node->receiver, PM_STRING_NODE) &&
|
||||||
call_node->arguments == NULL &&
|
call_node->arguments == NULL &&
|
||||||
|
@ -4184,8 +4175,17 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
|
||||||
ADD_INSN(ret, &dummy_line_node, pop);
|
ADD_INSN(ret, &dummy_line_node, pop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if ((node->flags & PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE) && !popped) {
|
||||||
|
PM_PUTNIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (call_node->receiver == NULL) {
|
||||||
|
PM_PUTSELF;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
PM_COMPILE_NOT_POPPED(call_node->receiver);
|
PM_COMPILE_NOT_POPPED(call_node->receiver);
|
||||||
|
}
|
||||||
pm_compile_call(iseq, call_node, ret, popped, scope_node, method_id, start);
|
pm_compile_call(iseq, call_node, ret, popped, scope_node, method_id, start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue