diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | lib/pathname.rb | 8 | ||||
-rw-r--r-- | parse.y | 4 | ||||
-rw-r--r-- | ruby.h | 39 |
4 files changed, 45 insertions, 14 deletions
@@ -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> * lib/test/unit/ui/testrunnerutilities.rb (TestRunnerUtilities): diff --git a/lib/pathname.rb b/lib/pathname.rb index e664d64768..724a8ff2eb 100644 --- a/lib/pathname.rb +++ b/lib/pathname.rb @@ -103,6 +103,7 @@ # - #owned? # - #pipe? # - #readable? +# - #world_readable? # - #readable_real? # - #setgid? # - #setuid? @@ -112,6 +113,7 @@ # - #sticky? # - #symlink? # - #writable? +# - #world_writable? # - #writable_real? # - #zero? # @@ -717,6 +719,9 @@ class Pathname # * FileTest * # See <tt>FileTest.readable?</tt>. 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>. def readable_real?() FileTest.readable_real?(@path) end @@ -741,6 +746,9 @@ class Pathname # * FileTest * # See <tt>FileTest.writable?</tt>. 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>. def writable_real?() FileTest.writable_real?(@path) end @@ -1565,6 +1565,10 @@ primary : literal $$ = NEW_CASE($2, $4); fixpos($$, $2); } + | kCASE expr_value opt_terms kELSE compstmt kEND + { + $$ = block_append($2, $5); + } | kCASE opt_terms case_body kEND { $$ = $3; @@ -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 |