vm_eval.c: cref-scope hack
* vm_eval.c (eval_under): singletons other than special constants don't need cref-scope hack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6b4ecb32fb
commit
393ed5c950
@ -1,3 +1,8 @@
|
||||
Wed Aug 8 22:51:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_eval.c (eval_under): singletons other than special constants
|
||||
don't need cref-scope hack.
|
||||
|
||||
Wed Aug 8 22:45:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* common.mk (.y.h): split from .y.c rule to manage dependency on
|
||||
|
@ -215,6 +215,18 @@ class TestEval < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
class Foo
|
||||
Bar = 2
|
||||
end
|
||||
|
||||
def test_instance_eval_const
|
||||
bar = nil
|
||||
assert_nothing_raised(NameError) do
|
||||
bar = Foo.new.instance_eval("Bar")
|
||||
end
|
||||
assert_equal(2, bar)
|
||||
end
|
||||
|
||||
#
|
||||
# From ruby/test/ruby/test_eval.rb
|
||||
#
|
||||
|
@ -1320,7 +1320,7 @@ eval_under(VALUE under, VALUE self, VALUE src, const char *file, int line)
|
||||
{
|
||||
NODE *cref = vm_cref_push(GET_THREAD(), under, NOEX_PUBLIC, NULL);
|
||||
|
||||
if (FL_TEST(under, FL_SINGLETON) || (SPECIAL_CONST_P(self) && !NIL_P(under))) {
|
||||
if (SPECIAL_CONST_P(self) && !NIL_P(under)) {
|
||||
cref->flags |= NODE_FL_CREF_PUSHED_BY_EVAL;
|
||||
}
|
||||
if (rb_safe_level() >= 4) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user