summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--eval.c27
-rw-r--r--hash.c1
-rw-r--r--io.c2
-rw-r--r--parse.y2
5 files changed, 36 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 76f100e907..d4fde5e1cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Wed Feb 20 12:41:59 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * 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 21:43:32 2002 Minero Aoki <aamine@loveruby.net>
* lib/net/protocol.rb: rename Protocol.port to default_port.
@@ -58,6 +68,10 @@ Tue Feb 19 21:43:32 2002 Minero Aoki <aamine@loveruby.net>
* lib/net/http.rb: proxy related class-instance-variables are not
initialized correctly.
+Tue Feb 19 20:20:12 2002 Ed Sinjiashvili <edsin@swes.saren.ru>
+
+ * parse.y (str_extend): backslash escape was done wrong.
+
Tue Feb 19 17:10:25 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* file.c (path_check_1): do not fail on world writable *parent*
diff --git a/eval.c b/eval.c
index b4a30e35aa..68db0ed335 100644
--- a/eval.c
+++ b/eval.c
@@ -311,7 +311,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_name_error(mid, "method `%s' not defined in %s",
rb_id2name(mid), rb_class2name(klass));
}
@@ -3301,14 +3301,25 @@ 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;
+ }
+ 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");
+ klass = rb_singleton_class(result);
}
- if (rb_safe_level() >= 4 && !OBJ_TAINTED(klass))
- rb_raise(rb_eSecurityError, "Insecure: can't extend object");
- klass = rb_singleton_class(klass);
if (ruby_wrapper) {
rb_extend_object(klass, ruby_wrapper);
diff --git a/hash.c b/hash.c
index 8234db2b25..dda50abe12 100644
--- a/hash.c
+++ b/hash.c
@@ -70,6 +70,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/io.c b/io.c
index 2404b1faf5..78c2ef9750 100644
--- a/io.c
+++ b/io.c
@@ -1165,7 +1165,7 @@ rb_io_close(io)
int fd;
fptr = RFILE(io)->fptr;
- if (!fptr) return;
+ if (!fptr) return Qnil;
if (!fptr->f && !fptr->f2) return;
fd = fileno(fptr->f);
diff --git a/parse.y b/parse.y
index beb7a13b93..7845433ce0 100644
--- a/parse.y
+++ b/parse.y
@@ -4101,7 +4101,7 @@ str_extend(list, term, paren)
tokadd('\\');
tokadd(c);
}
- break;
+ goto loop_again;
case '{':
if (brace != -1) brace_nest++;
default: