1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

defs/id.def: predefine to_f ID

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-02-27 08:15:27 +00:00
parent 34560d950b
commit 86d9071e0b
4 changed files with 5 additions and 6 deletions

View file

@ -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?");

View file

@ -38,6 +38,7 @@ firstline, predefined = __LINE__+1, %[\
to_a
to_s
to_i
to_f
to_r
bt
bt_locations

View file

@ -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);
}

View file

@ -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