summaryrefslogtreecommitdiffstats
path: root/ruby.h
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-01-13 05:48:59 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-01-13 05:48:59 +0000
commitc043fe6db4b8b9745466b99976371f568af70dbf (patch)
tree81d1776b9bdec24ddfcf69c0d4fca1b7127bf045 /ruby.h
parent30b14ec98d23ca4d7797d7c86a1d67078e13b5f2 (diff)
downloadruby-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.h39
1 files changed, 25 insertions, 14 deletions
diff --git a/ruby.h b/ruby.h
index dda9acc97..8790a2863 100644
--- a/ruby.h
+++ b/ruby.h
@@ -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