зеркало из https://github.com/github/ruby.git
[PRISM] Implement opt_str_uminus
This commit is contained in:
Родитель
bc10b958d2
Коммит
8e1fe15b4a
|
@ -3972,13 +3972,18 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
|
|||
PM_PUTSELF;
|
||||
pm_compile_call(iseq, call_node, ret, src, popped, scope_node, method_id, start);
|
||||
}
|
||||
else if (method_id == idFreeze &&
|
||||
else if ((method_id == idUMinus || method_id == idFreeze) &&
|
||||
PM_NODE_TYPE_P(call_node->receiver, PM_STRING_NODE) &&
|
||||
call_node->arguments == NULL &&
|
||||
call_node->block == NULL &&
|
||||
ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) {
|
||||
VALUE str = rb_fstring(parse_string_encoded(call_node->receiver, &((pm_string_node_t *)call_node->receiver)->unescaped, parser));
|
||||
ADD_INSN2(ret, &dummy_line_node, opt_str_freeze, str, new_callinfo(iseq, idFreeze, 0, 0, NULL, FALSE));
|
||||
if (method_id == idUMinus) {
|
||||
ADD_INSN2(ret, &dummy_line_node, opt_str_uminus, str, new_callinfo(iseq, idUMinus, 0, 0, NULL, FALSE));
|
||||
}
|
||||
else {
|
||||
ADD_INSN2(ret, &dummy_line_node, opt_str_freeze, str, new_callinfo(iseq, idFreeze, 0, 0, NULL, FALSE));
|
||||
}
|
||||
}
|
||||
else {
|
||||
PM_COMPILE_NOT_POPPED(call_node->receiver);
|
||||
|
|
Загрузка…
Ссылка в новой задаче