mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
id.def: predefine to_i
* defs/id.def: predefine `to_i` as well as `to_int`. * numeric.c (id_to_i): use predefined `idTo_i`. * object.c (conv_method_names): add `to_i` ID. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7f3b12f05b
commit
c0dba956d1
3 changed files with 4 additions and 2 deletions
|
@ -35,6 +35,7 @@ firstline, predefined = __LINE__+1, %[\
|
||||||
to_io
|
to_io
|
||||||
to_a
|
to_a
|
||||||
to_s
|
to_s
|
||||||
|
to_i
|
||||||
|
|
||||||
_ UScore
|
_ UScore
|
||||||
"/*NULL*/" NULL
|
"/*NULL*/" NULL
|
||||||
|
|
|
@ -109,7 +109,8 @@ static VALUE fix_uminus(VALUE num);
|
||||||
static VALUE fix_mul(VALUE x, VALUE y);
|
static VALUE fix_mul(VALUE x, VALUE y);
|
||||||
static VALUE int_pow(long x, unsigned long y);
|
static VALUE int_pow(long x, unsigned long y);
|
||||||
|
|
||||||
static ID id_coerce, id_to_i, id_div;
|
static ID id_coerce, id_div;
|
||||||
|
#define id_to_i idTo_i
|
||||||
#define id_eq idEq
|
#define id_eq idEq
|
||||||
#define id_cmp idCmp
|
#define id_cmp idCmp
|
||||||
|
|
||||||
|
@ -3981,7 +3982,6 @@ Init_Numeric(void)
|
||||||
_control87(_control87(0,0),0x1FFF);
|
_control87(_control87(0,0),0x1FFF);
|
||||||
#endif
|
#endif
|
||||||
id_coerce = rb_intern("coerce");
|
id_coerce = rb_intern("coerce");
|
||||||
id_to_i = rb_intern("to_i");
|
|
||||||
id_div = rb_intern("div");
|
id_div = rb_intern("div");
|
||||||
|
|
||||||
rb_eZeroDivError = rb_define_class("ZeroDivisionError", rb_eStandardError);
|
rb_eZeroDivError = rb_define_class("ZeroDivisionError", rb_eStandardError);
|
||||||
|
|
1
object.c
1
object.c
|
@ -2559,6 +2559,7 @@ static const struct conv_method_tbl {
|
||||||
M(io),
|
M(io),
|
||||||
M(a),
|
M(a),
|
||||||
M(s),
|
M(s),
|
||||||
|
M(i),
|
||||||
#undef M
|
#undef M
|
||||||
};
|
};
|
||||||
#define IMPLICIT_CONVERSIONS 7
|
#define IMPLICIT_CONVERSIONS 7
|
||||||
|
|
Loading…
Add table
Reference in a new issue