* time.c (num_exact): rb_check_to_integer() can deal with both of

Fixnum and Bignum together.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-07-01 23:04:46 +00:00
parent fc5f0cafa1
commit 432768449d
2 changed files with 7 additions and 5 deletions

View File

@ -1,3 +1,8 @@
Thu Jul 2 08:04:39 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* time.c (num_exact): rb_check_to_integer() can deal with both of
Fixnum and Bignum together.
Thu Jul 2 07:53:44 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (parser_yylex): fixed wrong variable.

7
time.c
View File

@ -160,14 +160,11 @@ num_exact(VALUE v)
case T_NIL:
goto typeerror;
default:
{
default: {
VALUE tmp;
if (!NIL_P(tmp = rb_check_convert_type(v, T_RATIONAL, "Rational", "to_r")))
v = tmp;
else if (!NIL_P(tmp = rb_check_convert_type(v, T_FIXNUM, "Integer", "to_int")))
v = tmp;
else if (!NIL_P(tmp = rb_check_convert_type(v, T_BIGNUM, "Integer", "to_int")))
else if (!NIL_P(tmp = rb_check_to_integer(v, "to_int")))
v = tmp;
else {
typeerror: