ruby-changes:50464
From: nobu <ko1@a...>
Date: Tue, 27 Feb 2018 17:15:33 +0900 (JST)
Subject: [ruby-changes:50464] nobu:r62593 (trunk): defs/id.def: predefine to_f ID
nobu 2018-02-27 17:15:27 +0900 (Tue, 27 Feb 2018) New Revision: 62593 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62593 Log: defs/id.def: predefine to_f ID Modified files: trunk/complex.c trunk/defs/id.def trunk/object.c trunk/rational.c Index: rational.c =================================================================== --- rational.c (revision 62592) +++ rational.c (revision 62593) @@ -962,7 +962,7 @@ nurat_fdiv(VALUE self, VALUE other) https://github.com/ruby/ruby/blob/trunk/rational.c#L962 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 Index: object.c =================================================================== --- object.c (revision 62592) +++ object.c (revision 62593) @@ -50,7 +50,7 @@ VALUE rb_cFalseClass; /*!< FalseClass cl https://github.com/ruby/ruby/blob/trunk/object.c#L50 #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) https://github.com/ruby/ruby/blob/trunk/object.c#L4117 void Init_Object(void) { - id_to_f = rb_intern_const("to_f"); id_dig = rb_intern_const("dig"); InitVM(Object); } Index: defs/id.def =================================================================== --- defs/id.def (revision 62592) +++ defs/id.def (revision 62593) @@ -38,6 +38,7 @@ firstline, predefined = __LINE__+1, %[\ https://github.com/ruby/ruby/blob/trunk/defs/id.def#L38 to_a to_s to_i + to_f to_r bt bt_locations Index: complex.c =================================================================== --- complex.c (revision 62592) +++ complex.c (revision 62593) @@ -33,14 +33,14 @@ static VALUE nucomp_arg(VALUE self); https://github.com/ruby/ruby/blob/trunk/complex.c#L33 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) https://github.com/ruby/ruby/blob/trunk/complex.c#L2125 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?"); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/