mruby-compiler: generate OP_SSEND from Complex and Rational literals

This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-02-18 11:07:35 +09:00
parent 4a0e80601f
commit 111fe4b3be
+3 -3
View File
@@ -1015,14 +1015,14 @@ new_op_asgn(parser_state *p, node *a, mrb_sym op, node *b)
static node*
new_imaginary(parser_state *p, node *imaginary)
{
return new_call(p, new_const(p, MRB_SYM_2(p->mrb, Kernel)), MRB_SYM_2(p->mrb, Complex),
new_callargs(p, list2(list3((node*)NODE_INT, (node*)strdup("0"), nint(10)), imaginary), 0, 0), '.');
return new_fcall(p, MRB_SYM_2(p->mrb, Complex),
new_callargs(p, list2(list3((node*)NODE_INT, (node*)strdup("0"), nint(10)), imaginary), 0, 0));
}
static node*
new_rational(parser_state *p, node *rational)
{
return new_call(p, new_const(p, MRB_SYM_2(p->mrb, Kernel)), MRB_SYM_2(p->mrb, Rational), new_callargs(p, list1(rational), 0, 0), '.');
return new_fcall(p, MRB_SYM_2(p->mrb, Rational), new_callargs(p, list1(rational), 0, 0));
}
/* (:int . i) */