mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm_insnhelper.c (vm_get_ev_const): should not autoload in
defined? mode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0e3822c1e2
commit
d3326ddf11
3 changed files with 16 additions and 1 deletions
|
@ -1,4 +1,7 @@
|
||||||
Thu Mar 24 23:05:42 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Mar 24 23:06:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* vm_insnhelper.c (vm_get_ev_const): should not autoload in
|
||||||
|
defined? mode.
|
||||||
|
|
||||||
* variable.c (rb_const_defined_0): fix autoloading base.
|
* variable.c (rb_const_defined_0): fix autoloading base.
|
||||||
[ruby-core:35509]
|
[ruby-core:35509]
|
||||||
|
|
|
@ -103,4 +103,15 @@ class TestDefined < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
assert_equal("constant", klass.new.a?, bug)
|
assert_equal("constant", klass.new.a?, bug)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_autoloaded_noload
|
||||||
|
klass = Class.new do
|
||||||
|
autoload(:A, "a")
|
||||||
|
def a?
|
||||||
|
defined?(A)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
x = klass.new
|
||||||
|
assert_equal("constant", x.a?)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1177,6 +1177,7 @@ vm_get_ev_const(rb_thread_t *th, const rb_iseq_t *iseq,
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
if (am == klass) break;
|
if (am == klass) break;
|
||||||
am = klass;
|
am = klass;
|
||||||
|
if (is_defined) return 1;
|
||||||
rb_autoload_load(klass, id);
|
rb_autoload_load(klass, id);
|
||||||
goto search_continue;
|
goto search_continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue