[前][次][番号順一覧][スレッド一覧]

ruby-changes:33949

From: nobu <ko1@a...>
Date: Tue, 20 May 2014 17:28:43 +0900 (JST)
Subject: [ruby-changes:33949] nobu:r46030 (trunk): id.def: predefine to_i

nobu	2014-05-20 17:28:33 +0900 (Tue, 20 May 2014)

  New Revision: 46030

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=46030

  Log:
    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.

  Modified files:
    trunk/defs/id.def
    trunk/numeric.c
    trunk/object.c
Index: defs/id.def
===================================================================
--- defs/id.def	(revision 46029)
+++ defs/id.def	(revision 46030)
@@ -35,6 +35,7 @@ firstline, predefined = __LINE__+1, %[\ https://github.com/ruby/ruby/blob/trunk/defs/id.def#L35
   to_io
   to_a
   to_s
+  to_i
 
   _                                                     UScore
   "/*NULL*/"                                            NULL
Index: object.c
===================================================================
--- object.c	(revision 46029)
+++ object.c	(revision 46030)
@@ -2559,6 +2559,7 @@ static const struct conv_method_tbl { https://github.com/ruby/ruby/blob/trunk/object.c#L2559
     M(io),
     M(a),
     M(s),
+    M(i),
 #undef M
 };
 #define IMPLICIT_CONVERSIONS 7
Index: numeric.c
===================================================================
--- numeric.c	(revision 46029)
+++ numeric.c	(revision 46030)
@@ -109,7 +109,8 @@ static VALUE fix_uminus(VALUE num); https://github.com/ruby/ruby/blob/trunk/numeric.c#L109
 static VALUE fix_mul(VALUE x, VALUE 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_cmp idCmp
 
@@ -3981,7 +3982,6 @@ Init_Numeric(void) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3982
     _control87(_control87(0,0),0x1FFF);
 #endif
     id_coerce = rb_intern("coerce");
-    id_to_i = rb_intern("to_i");
     id_div = rb_intern("div");
 
     rb_eZeroDivError = rb_define_class("ZeroDivisionError", rb_eStandardError);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]