* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@5457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2004-01-13 05:48:59 +00:00
Родитель 47c7c5bac6
Коммит 6760a5ed9f
4 изменённых файлов: 45 добавлений и 14 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Tue Jan 13 14:48:01 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* 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.
Tue Jan 13 14:26:59 2004 Kazuhiro NISHIYAMA <zn@mbf.nifty.com> Tue Jan 13 14:26:59 2004 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
* lib/test/unit/ui/testrunnerutilities.rb (TestRunnerUtilities): * lib/test/unit/ui/testrunnerutilities.rb (TestRunnerUtilities):

Просмотреть файл

@ -103,6 +103,7 @@
# - #owned? # - #owned?
# - #pipe? # - #pipe?
# - #readable? # - #readable?
# - #world_readable?
# - #readable_real? # - #readable_real?
# - #setgid? # - #setgid?
# - #setuid? # - #setuid?
@ -112,6 +113,7 @@
# - #sticky? # - #sticky?
# - #symlink? # - #symlink?
# - #writable? # - #writable?
# - #world_writable?
# - #writable_real? # - #writable_real?
# - #zero? # - #zero?
# #
@ -717,6 +719,9 @@ class Pathname # * FileTest *
# See <tt>FileTest.readable?</tt>. # See <tt>FileTest.readable?</tt>.
def readable?() FileTest.readable?(@path) end def readable?() FileTest.readable?(@path) end
# See <tt>FileTest.readable_world?</tt>.
def readable_world?() FileTest.readable_world?(@path) end
# See <tt>FileTest.readable_real?</tt>. # See <tt>FileTest.readable_real?</tt>.
def readable_real?() FileTest.readable_real?(@path) end def readable_real?() FileTest.readable_real?(@path) end
@ -741,6 +746,9 @@ class Pathname # * FileTest *
# See <tt>FileTest.writable?</tt>. # See <tt>FileTest.writable?</tt>.
def writable?() FileTest.writable?(@path) end def writable?() FileTest.writable?(@path) end
# See <tt>FileTest.writable_world?</tt>.
def writable_world?() FileTest.writable_world?(@path) end
# See <tt>FileTest.writable_real?</tt>. # See <tt>FileTest.writable_real?</tt>.
def writable_real?() FileTest.writable_real?(@path) end def writable_real?() FileTest.writable_real?(@path) end

Просмотреть файл

@ -1565,6 +1565,10 @@ primary : literal
$$ = NEW_CASE($2, $4); $$ = NEW_CASE($2, $4);
fixpos($$, $2); fixpos($$, $2);
} }
| kCASE expr_value opt_terms kELSE compstmt kEND
{
$$ = block_append($2, $5);
}
| kCASE opt_terms case_body kEND | kCASE opt_terms case_body kEND
{ {
$$ = $3; $$ = $3;

39
ruby.h
Просмотреть файл

@ -629,13 +629,18 @@ rb_class_of(obj)
VALUE obj; VALUE obj;
#endif #endif
{ {
if (FIXNUM_P(obj)) return rb_cFixnum; if(IMMEDIATE_P(obj)){
if (obj == Qnil) return rb_cNilClass; if (FIXNUM_P(obj)) return rb_cFixnum;
if (obj == Qfalse) return rb_cFalseClass; if (obj == Qtrue) return rb_cTrueClass;
if (obj == Qtrue) return rb_cTrueClass; if (SYMBOL_P(obj)) return rb_cSymbol;
if (SYMBOL_P(obj)) return rb_cSymbol; }
else if(!RTEST(obj)){
return RBASIC(obj)->klass; if (obj == Qnil) return rb_cNilClass;
if (obj == Qfalse) return rb_cFalseClass;
}
else{
return RBASIC(obj)->klass;
}
} }
static inline int static inline int
@ -646,13 +651,19 @@ rb_type(obj)
VALUE obj; VALUE obj;
#endif #endif
{ {
if (FIXNUM_P(obj)) return T_FIXNUM; if(IMMEDIATE_P(obj)){
if (obj == Qnil) return T_NIL; if (FIXNUM_P(obj)) return T_FIXNUM;
if (obj == Qfalse) return T_FALSE; if (obj == Qtrue) return T_TRUE;
if (obj == Qtrue) return T_TRUE; if (SYMBOL_P(obj)) return T_SYMBOL;
if (obj == Qundef) return T_UNDEF; if (obj == Qundef) return T_UNDEF;
if (SYMBOL_P(obj)) return T_SYMBOL; }
return BUILTIN_TYPE(obj); else if(!RTEST(obj)){
if (obj == Qnil) return T_NIL;
if (obj == Qfalse) return T_FALSE;
}
else{
return BUILTIN_TYPE(obj);
}
} }
static inline int static inline int