summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-22 02:52:27 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-22 02:52:27 +0000
commit873e6c2f92933920d07367b7853eab59dea66c6e (patch)
treeaeb3b7bc9dfd7b0a8269de3c01a26be3c688f4d9
parent114d113d0c023cc8fea77d6356de316c03d17b62 (diff)
downloadruby-873e6c2f92933920d07367b7853eab59dea66c6e.tar.gz
ruby-873e6c2f92933920d07367b7853eab59dea66c6e.tar.xz
ruby-873e6c2f92933920d07367b7853eab59dea66c6e.zip
* eval.c (rb_obj_instance_eval): use class of immediate objects.
* test/ruby/test_eval.rb: fix a test. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--eval.c2
-rw-r--r--test/ruby/test_eval.rb2
3 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f94c868e8..50be216f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sat Dec 22 11:47:42 2007 Koichi Sasada <ko1@atdot.net>
+
+ * eval.c (rb_obj_instance_eval): use class of immediate objects.
+
+ * test/ruby/test_eval.rb: fix a test.
+
Sat Dec 22 11:37:06 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* encoding.c (rb_locale_charmap): win32 support.
diff --git a/eval.c b/eval.c
index 8a1ff85a0..3b59db95c 100644
--- a/eval.c
+++ b/eval.c
@@ -1998,7 +1998,7 @@ rb_obj_instance_eval(int argc, VALUE *argv, VALUE self)
VALUE klass;
if (SPECIAL_CONST_P(self)) {
- klass = Qnil;
+ klass = CLASS_OF(self); //klass = Qnil;
}
else {
klass = rb_singleton_class(self);
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb
index af59cced4..6e39374a9 100644
--- a/test/ruby/test_eval.rb
+++ b/test/ruby/test_eval.rb
@@ -341,7 +341,7 @@ class TestEval < Test::Unit::TestCase
def test_cvar_scope_with_instance_eval
Fixnum.class_eval "@@test_cvar_scope_with_instance_eval = 1" # depends on [ruby-dev:24229]
@@test_cvar_scope_with_instance_eval = 4
- assert_equal(4, 1.instance_eval("@@test_cvar_scope_with_instance_eval"), "[ruby-dev:24223]")
+ assert_equal(1, 1.instance_eval("@@test_cvar_scope_with_instance_eval"), "[ruby-dev:24223]")
Fixnum.__send__(:remove_class_variable, :@@test_cvar_scope_with_instance_eval)
end