diff --git a/ChangeLog b/ChangeLog index 936bed691e..76b1ba036a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Wed Feb 20 12:41:59 2002 Yukihiro Matsumoto + + * hash.c (rb_any_cmp): should handle Qundef in keys. + + * eval.c (remove_method): should not remove a empty method to + implement "undef". + + * eval.c (rb_eval): should allow singleton class def for + true/false/nil. + Tue Feb 19 22:49:29 2002 Minero Aoki * lib/net/http.rb: remove unused class Accumulator. @@ -10,6 +20,15 @@ Tue Feb 19 22:49:29 2002 Minero Aoki * doc/net/http.rb: modify typo in the description of basic auth. +Tue Feb 19 20:20:12 2002 Ed Sinjiashvili + + * parse.y (str_extend): backslash escape was done wrong. + +Tue Feb 19 15:51:41 2002 Yukihiro Matsumoto + + * class.c (rb_include_module): should preserve ancestor order in + the included class/module. + Tue Feb 19 14:45:32 2002 Yukihiro Matsumoto * marshal.c (r_object): complete restoration before calling diff --git a/class.c b/class.c index b4d8c935ae..ea3e124293 100644 --- a/class.c +++ b/class.c @@ -330,8 +330,10 @@ rb_include_module(klass, module) /* ignore if the module included already in superclasses */ for (p = RCLASS(klass)->super; p; p = RCLASS(p)->super) { if (BUILTIN_TYPE(p) == T_ICLASS) { - if (RCLASS(p)->m_tbl == RCLASS(module)->m_tbl) + if (RCLASS(p)->m_tbl == RCLASS(module)->m_tbl) { + c = p; goto skip; + } } } RCLASS(c)->super = include_class_new(module, RCLASS(c)->super); diff --git a/eval.c b/eval.c index f2dba3a293..db75fb549b 100644 --- a/eval.c +++ b/eval.c @@ -314,7 +314,7 @@ remove_method(klass, mid) rb_raise(rb_eSecurityError, "Insecure: can't remove method"); } if (OBJ_FROZEN(klass)) rb_error_frozen("class/module"); - if (!st_delete(RCLASS(klass)->m_tbl, &mid, &body)) { + if (!st_delete(RCLASS(klass)->m_tbl, &mid, &body) || !body->nd_body) { rb_raise(rb_eNameError, "method `%s' not defined in %s", rb_id2name(mid), rb_class2name(klass)); } @@ -3159,17 +3159,28 @@ rb_eval(self, n) { VALUE klass; - klass = rb_eval(self, node->nd_recv); - if (rb_special_const_p(klass)) { - rb_raise(rb_eTypeError, "no virtual class for %s", - rb_class2name(CLASS_OF(klass))); + result = rb_eval(self, node->nd_recv); + if (result == Qtrue) { + klass = rb_cTrueClass; } - if (rb_safe_level() >= 4 && !OBJ_TAINTED(klass)) - rb_raise(rb_eSecurityError, "Insecure: can't extend object"); - if (FL_TEST(CLASS_OF(klass), FL_SINGLETON)) { - rb_clear_cache(); + else if (result == Qfalse) { + klass = rb_cTrueClass; + } + else if (result == Qnil) { + klass = rb_cNilClass; + } + else { + if (rb_special_const_p(result)) { + rb_raise(rb_eTypeError, "no virtual class for %s", + rb_class2name(CLASS_OF(klass))); + } + if (rb_safe_level() >= 4 && !OBJ_TAINTED(result)) + rb_raise(rb_eSecurityError, "Insecure: can't extend object"); + if (FL_TEST(CLASS_OF(result), FL_SINGLETON)) { + rb_clear_cache(); + } + klass = rb_singleton_class(result); } - klass = rb_singleton_class(klass); if (ruby_wrapper) { rb_extend_object(klass, ruby_wrapper); diff --git a/hash.c b/hash.c index a9abb0fbab..57fe0d1013 100644 --- a/hash.c +++ b/hash.c @@ -69,6 +69,7 @@ rb_any_cmp(a, b) if (SYMBOL_P(a) && SYMBOL_P(b)) { return a != b; } + if (a == Qundef || b == Qundef) return -1; args[0] = a; args[1] = b; diff --git a/parse.y b/parse.y index 9307b7e144..2594f9be0d 100644 --- a/parse.y +++ b/parse.y @@ -3933,7 +3933,7 @@ str_extend(list, term, paren) tokadd('\\'); tokadd(c); } - break; + goto loop_again; case '{': if (brace != -1) brace_nest++; default: diff --git a/version.h b/version.h index f58e7534f8..b8c3fe019d 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.6.6" -#define RUBY_RELEASE_DATE "2002-02-19" +#define RUBY_RELEASE_DATE "2002-02-20" #define RUBY_VERSION_CODE 166 -#define RUBY_RELEASE_CODE 20020219 +#define RUBY_RELEASE_CODE 20020220