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

ruby-changes:50460

From: nobu <ko1@a...>
Date: Mon, 26 Feb 2018 23:30:46 +0900 (JST)
Subject: [ruby-changes:50460] nobu:r62588 (trunk): use convert_type_with_id

nobu	2018-02-26 23:30:39 +0900 (Mon, 26 Feb 2018)

  New Revision: 62588

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62588

  Log:
    use convert_type_with_id

  Modified files:
    trunk/object.c
Index: object.c
===================================================================
--- object.c	(revision 62587)
+++ object.c	(revision 62588)
@@ -50,6 +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 CLASS_OR_MODULE_P(obj) \
     (!SPECIAL_CONST_P(obj) && \
@@ -3131,7 +3132,7 @@ rb_convert_to_integer(VALUE val, int bas https://github.com/ruby/ruby/blob/trunk/object.c#L3132
       arg_error:
 	rb_raise(rb_eArgError, "base specified for non string value");
     }
-    tmp = convert_type(val, "Integer", "to_int", FALSE);
+    tmp = convert_type_with_id(val, "Integer", idTo_int, FALSE, -1);
     if (!RB_INTEGER_TYPE_P(tmp)) {
 	return rb_to_integer(val, "to_i");
     }
@@ -3404,7 +3405,7 @@ rb_Float(VALUE val) https://github.com/ruby/ruby/blob/trunk/object.c#L3405
       case T_STRING:
 	return DBL2NUM(rb_str_to_dbl(val, TRUE));
     }
-    return rb_convert_type(val, T_FLOAT, "Float", "to_f");
+    return rb_convert_type_with_id(val, T_FLOAT, "Float", id_to_f);
 }
 
 static VALUE FUNC_MINIMIZED(rb_f_float(VALUE obj, VALUE arg)); /*!< \private */
@@ -3437,7 +3438,7 @@ numeric_to_float(VALUE val) https://github.com/ruby/ruby/blob/trunk/object.c#L3438
 	rb_raise(rb_eTypeError, "can't convert %"PRIsVALUE" into Float",
 		 rb_obj_class(val));
     }
-    return rb_convert_type(val, T_FLOAT, "Float", "to_f");
+    return rb_convert_type_with_id(val, T_FLOAT, "Float", id_to_f);
 }
 
 /*!
@@ -3472,8 +3473,6 @@ rb_check_to_float(VALUE val) https://github.com/ruby/ruby/blob/trunk/object.c#L3473
     return rb_check_convert_type(val, T_FLOAT, "Float", "to_f");
 }
 
-static ID id_to_f;
-
 static inline int
 basic_to_f_p(VALUE klass)
 {
@@ -3547,7 +3546,7 @@ rb_num2dbl(VALUE val) https://github.com/ruby/ruby/blob/trunk/object.c#L3546
 	    rb_raise(rb_eTypeError, "no implicit conversion to float from string");
 	}
     }
-    val = rb_convert_type(val, T_FLOAT, "Float", "to_f");
+    val = rb_convert_type_with_id(val, T_FLOAT, "Float", id_to_f);
     return RFLOAT_VALUE(val);
 }
 

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

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