summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--env.h1
-rw-r--r--eval.c8
-rw-r--r--gc.c6
-rw-r--r--io.c4
-rw-r--r--lib/weakref.rb29
-rw-r--r--object.c1
-rw-r--r--range.c6
8 files changed, 38 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 047c3354ab..8543292541 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Mar 13 13:49:24 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * object.c (mod_clone): need to dups constants and instance
+ variables.
+
+ * eval.c (rb_eval): forgot to initialize body for NODE_DEFS.
+
Thu Mar 12 15:33:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* experimental release 1.1b9_01.
diff --git a/env.h b/env.h
index ebcfcc5d31..b254ddef1c 100644
--- a/env.h
+++ b/env.h
@@ -12,6 +12,7 @@
#define ENV_H
extern struct FRAME {
+ VALUE self;
int argc;
VALUE *argv;
ID last_func;
diff --git a/eval.c b/eval.c
index 4c070729e7..a0efea26dc 100644
--- a/eval.c
+++ b/eval.c
@@ -1879,8 +1879,9 @@ rb_eval(self, node)
}
PUSH_ITER(the_iter->iter?ITER_PRE:ITER_NOT);
- result = rb_call(RCLASS(the_frame->last_class)->super, self,
- the_frame->last_func, argc, argv, 3);
+ result = rb_call(RCLASS(the_frame->last_class)->super,
+ the_frame->self, the_frame->last_func,
+ argc, argv, 3);
POP_ITER();
}
break;
@@ -2234,7 +2235,7 @@ rb_eval(self, node)
if (node->nd_defn) {
VALUE recv = rb_eval(self, node->nd_recv);
VALUE klass;
- NODE *body;
+ NODE *body = 0;
if (FIXNUM_P(recv)) {
TypeError("Can't define method \"%s\" for Fixnum",
@@ -3169,6 +3170,7 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
PUSH_FRAME();
the_frame->last_func = id;
the_frame->last_class = nosuper?0:klass;
+ the_frame->self = recv;
the_frame->argc = argc;
the_frame->argv = argv;
diff --git a/gc.c b/gc.c
index fe1e4942f8..edf06d313a 100644
--- a/gc.c
+++ b/gc.c
@@ -1016,6 +1016,10 @@ id2ref(obj, id)
INT ptr = NUM2INT(id);
if (FIXNUM_P(ptr)) return (VALUE)ptr;
+ if (ptr == TRUE) return TRUE;
+ if (ptr == FALSE) return FALSE;
+ if (ptr == Qnil) return Qnil;
+
if (!looks_pointerp(ptr)) {
IndexError("0x%x is not the id value", ptr);
}
@@ -1045,7 +1049,7 @@ Init_GC()
rb_define_module_function(mObSpace, "remove_finalizer", rm_final, 1);
rb_define_module_function(mObSpace, "finalizers", finals, 0);
rb_define_module_function(mObSpace, "call_finalizer", call_final, 1);
- rb_define_module_function(mObSpace, "id2ref", id2ref, 1);
+ rb_define_module_function(mObSpace, "_id2ref", id2ref, 1);
rb_global_variable(&finalizers);
finalizers = ary_new();
diff --git a/io.c b/io.c
index 751a5ef393..4e3f60c982 100644
--- a/io.c
+++ b/io.c
@@ -369,7 +369,7 @@ io_gets_method(argc, argv, io)
VALUE rs;
if (argc == 0) {
- return io_gets(io);
+ rs = RS;
}
else {
rb_scan_args(argc, argv, "1", &rs);
@@ -394,7 +394,6 @@ io_gets_method(argc, argv, io)
rsptr = 0;
rslen = 0;
}
- newline = rslen ? rsptr[rslen - 1] : 0777;
GetOpenFile(io, fptr);
io_readable(fptr);
@@ -413,6 +412,7 @@ io_gets_method(argc, argv, io)
} while (c != EOF);
}
+ newline = rslen ? rsptr[rslen - 1] : 0777;
{
char buf[8192];
char *bp, *bpe = buf + sizeof buf - 3;
diff --git a/lib/weakref.rb b/lib/weakref.rb
index 18d3bbc9a3..6a6dcec5a1 100644
--- a/lib/weakref.rb
+++ b/lib/weakref.rb
@@ -31,26 +31,27 @@ class WeakRef<Delegator
def initialize(orig)
super
- @id = orig.id
+ @__id = orig.id
ObjectSpace.call_finalizer orig
- ID_MAP[@id] = self.id
- ID_REV_MAP[self.id] = @id
+ ObjectSpace.call_finalizer self
+ ID_MAP[@__id] = self.id
+ ID_REV_MAP[self.id] = @__id
end
def __getobj__
- unless ID_MAP[@id]
+ unless ID_MAP[@__id]
$@ = caller(1)
$! = RefError.new("Illegal Reference - probably recycled")
raise
end
- ObjectSpace.id2ref(@id)
+ ObjectSpace._id2ref(@__id)
# ObjectSpace.each_object do |obj|
-# return obj if obj.id == @id
+# return obj if obj.id == @__id
# end
end
def weakref_alive?
- if ID_MAP[@id]
+ if ID_MAP[@__id]
true
else
false
@@ -62,9 +63,11 @@ class WeakRef<Delegator
end
end
-foo = Object.new
-p foo.hash
-foo = WeakRef.new(foo)
-p foo.hash
-ObjectSpace.garbage_collect
-p foo.hash
+if __FILE__ == $0
+ foo = Object.new
+ p foo.hash
+ foo = WeakRef.new(foo)
+ p foo.hash
+ ObjectSpace.garbage_collect
+ p foo.hash
+end
diff --git a/object.c b/object.c
index 84d7a3b10b..286fc589e6 100644
--- a/object.c
+++ b/object.c
@@ -386,6 +386,7 @@ mod_clone(module)
clone->super = RCLASS(module)->super;
clone->iv_tbl = 0;
clone->m_tbl = 0; /* avoid GC crashing */
+ clone->iv_tbl = st_copy(RCLASS(module)->iv_tbl);
clone->m_tbl = st_copy(RCLASS(module)->m_tbl);
return (VALUE)clone;
diff --git a/range.c b/range.c
index a3f8865dc4..74ac972668 100644
--- a/range.c
+++ b/range.c
@@ -21,11 +21,7 @@ static VALUE
range_check(args)
VALUE *args;
{
- VALUE v = rb_funcall(args[0], rb_intern("<="), 1, args[1]);
-
- if (!RTEST(v)) {
- Fail(""); /* no ascending values */
- }
+ rb_funcall(args[0], rb_intern("<=>"), 1, args[1]);
return Qnil;
}