summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler
diff options
context:
space:
mode:
authorUkrainskiy Sergey <[email protected]>2018-09-09 11:55:21 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2019-05-15 16:57:21 +0900
commit79c3335e8d22ec76340b3028a7bbc658d631b17c (patch)
tree7bda5425c9c4c4986b4f9b5fcfbf6c6aa6e98bf5 /mrbgems/mruby-compiler
parent8808219e6d51673e6fa582819703e6e5912439b0 (diff)
downloadmruby-79c3335e8d22ec76340b3028a7bbc658d631b17c.tar.gz
mruby-79c3335e8d22ec76340b3028a7bbc658d631b17c.zip
Small refactoring
Diffstat (limited to 'mrbgems/mruby-compiler')
-rw-r--r--mrbgems/mruby-compiler/core/parse.y15
1 files changed, 5 insertions, 10 deletions
diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y
index b18906ed3..2c5e0c991 100644
--- a/mrbgems/mruby-compiler/core/parse.y
+++ b/mrbgems/mruby-compiler/core/parse.y
@@ -862,14 +862,17 @@ new_op_asgn(parser_state *p, node *a, mrb_sym op, node *b)
#ifdef MRB_COMPLEX_NUMBERS
static node*
-new_imaginary(parser_state *p, node *imaginary);
+new_imaginary(parser_state *p, node *imaginary)
+{
+ return new_call(p, new_const(p, intern_cstr("Kernel")), intern_cstr("Complex"), list1(list2(list3((node*)NODE_INT, (node*)strdup("0"), nint(10)), imaginary)), 1);
+}
#endif
#ifdef MRB_RATIONAL_NUMBERS
static node*
new_rational(parser_state *p, node *rational)
{
- return new_call(p, new_const(p, intern_cstr("Rational")), intern_cstr("new"), list1(list1(rational)), 1);
+ return new_call(p, new_const(p, intern_cstr("Kernel")), intern_cstr("Rational"), list1(list1(rational)), 1);
}
#endif
@@ -911,14 +914,6 @@ new_float(parser_state *p, const char *s, int suffix)
}
#endif
-#ifdef MRB_COMPLEX_NUMBERS
-static node*
-new_imaginary(parser_state *p, node *imaginary)
-{
- return new_call(p, new_const(p, intern_cstr("Complex")), intern_cstr("new"), list1(list2(new_int(p, "0", 10, 0), imaginary)), 1);
-}
-#endif
-
/* (:str . (s . len)) */
static node*
new_str(parser_state *p, const char *s, size_t len)