summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-27 08:15:27 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-27 08:15:27 (GMT)
commit86d9071e0b81de7032cd52de0ec5f2af14a804c9 (patch)
tree127395984175c4c5af931da19fff51dd0869f4e3
parent34560d950bf4d2455cdaa15261f7523a06851cab (diff)
defs/id.def: predefine to_f ID
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--complex.c5
-rw-r--r--defs/id.def1
-rw-r--r--object.c3
-rw-r--r--rational.c2
4 files changed, 5 insertions, 6 deletions
diff --git a/complex.c b/complex.c
index 2221c9e..40fec0c 100644
--- a/complex.c
+++ b/complex.c
@@ -33,14 +33,14 @@ static VALUE nucomp_arg(VALUE self);
static ID id_abs, id_arg,
id_denominator, id_fdiv, id_numerator, id_quo,
- id_real_p, id_to_f,
- id_i_real, id_i_imag,
+ id_real_p, id_i_real, id_i_imag,
id_finite_p, id_infinite_p, id_rationalize,
id_PI;
#define id_to_i idTo_i
#define id_to_r idTo_r
#define id_negate idUMinus
#define id_expt idPow
+#define id_to_f idTo_f
#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
@@ -2125,7 +2125,6 @@ Init_Complex(void)
id_numerator = rb_intern("numerator");
id_quo = rb_intern("quo");
id_real_p = rb_intern("real?");
- id_to_f = rb_intern("to_f");
id_i_real = rb_intern("@real");
id_i_imag = rb_intern("@image"); /* @image, not @imag */
id_finite_p = rb_intern("finite?");
diff --git a/defs/id.def b/defs/id.def
index f30b993..e1a66f5 100644
--- a/defs/id.def
+++ b/defs/id.def
@@ -38,6 +38,7 @@ firstline, predefined = __LINE__+1, %[\
to_a
to_s
to_i
+ to_f
to_r
bt
bt_locations
diff --git a/object.c b/object.c
index 5ecc035..5fd282c 100644
--- a/object.c
+++ b/object.c
@@ -50,7 +50,7 @@ VALUE rb_cFalseClass; /*!< FalseClass class */
#define id_init_clone idInitialize_clone
#define id_init_dup idInitialize_dup
#define id_const_missing idConst_missing
-static ID id_to_f;
+#define id_to_f idTo_f
#define CLASS_OR_MODULE_P(obj) \
(!SPECIAL_CONST_P(obj) && \
@@ -4117,7 +4117,6 @@ InitVM_Object(void)
void
Init_Object(void)
{
- id_to_f = rb_intern_const("to_f");
id_dig = rb_intern_const("dig");
InitVM(Object);
}
diff --git a/rational.c b/rational.c
index 0add47d..c350ad3 100644
--- a/rational.c
+++ b/rational.c
@@ -962,7 +962,7 @@ nurat_fdiv(VALUE self, VALUE other)
return nurat_to_f(div);
if (RB_FLOAT_TYPE_P(div))
return div;
- return rb_funcall(div, rb_intern("to_f"), 0);
+ return rb_funcall(div, idTo_f, 0);
}
inline static VALUE