diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-01-13 05:48:59 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-01-13 05:48:59 +0000 |
commit | c043fe6db4b8b9745466b99976371f568af70dbf (patch) | |
tree | 81d1776b9bdec24ddfcf69c0d4fca1b7127bf045 /ruby.h | |
parent | 30b14ec98d23ca4d7797d7c86a1d67078e13b5f2 (diff) | |
download | ruby-c043fe6db4b8b9745466b99976371f568af70dbf.tar.gz ruby-c043fe6db4b8b9745466b99976371f568af70dbf.tar.xz ruby-c043fe6db4b8b9745466b99976371f568af70dbf.zip |
* parse.y (primary): allow no "when" case. [ruby-dev:22578]
* ruby.h (rb_class_of): reduce branch. [ruby-dev:22577]
* ruby.h (rb_type): ditto.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.h')
-rw-r--r-- | ruby.h | 39 |
1 files changed, 25 insertions, 14 deletions
@@ -629,13 +629,18 @@ rb_class_of(obj) VALUE obj; #endif { - if (FIXNUM_P(obj)) return rb_cFixnum; - if (obj == Qnil) return rb_cNilClass; - if (obj == Qfalse) return rb_cFalseClass; - if (obj == Qtrue) return rb_cTrueClass; - if (SYMBOL_P(obj)) return rb_cSymbol; - - return RBASIC(obj)->klass; + if(IMMEDIATE_P(obj)){ + if (FIXNUM_P(obj)) return rb_cFixnum; + if (obj == Qtrue) return rb_cTrueClass; + if (SYMBOL_P(obj)) return rb_cSymbol; + } + else if(!RTEST(obj)){ + if (obj == Qnil) return rb_cNilClass; + if (obj == Qfalse) return rb_cFalseClass; + } + else{ + return RBASIC(obj)->klass; + } } static inline int @@ -646,13 +651,19 @@ rb_type(obj) VALUE obj; #endif { - if (FIXNUM_P(obj)) return T_FIXNUM; - if (obj == Qnil) return T_NIL; - if (obj == Qfalse) return T_FALSE; - if (obj == Qtrue) return T_TRUE; - if (obj == Qundef) return T_UNDEF; - if (SYMBOL_P(obj)) return T_SYMBOL; - return BUILTIN_TYPE(obj); + if(IMMEDIATE_P(obj)){ + if (FIXNUM_P(obj)) return T_FIXNUM; + if (obj == Qtrue) return T_TRUE; + if (SYMBOL_P(obj)) return T_SYMBOL; + if (obj == Qundef) return T_UNDEF; + } + else if(!RTEST(obj)){ + if (obj == Qnil) return T_NIL; + if (obj == Qfalse) return T_FALSE; + } + else{ + return BUILTIN_TYPE(obj); + } } static inline int |