diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | intern.h | 2 | ||||
-rw-r--r-- | variable.c | 8 |
4 files changed, 14 insertions, 6 deletions
@@ -1,3 +1,11 @@ +Thu Sep 29 00:57:35 2005 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * eval.c (ev_const_get), variable.c (rb_const_get_0): retry only when + autoload succeeded. + + * variable.c (rb_autoload_load): now return true if autoload + succeeded. fixed: [ruby-dev:27331] + Wed Sep 28 23:42:15 2005 Nobuyoshi Nakada <nobu@ruby-lang.org> * file.c (apply2files): add prototype. @@ -1837,7 +1837,7 @@ ev_const_get(cref, id, self) if (NIL_P(klass)) return rb_const_get(CLASS_OF(self), id); while (RCLASS(klass)->iv_tbl && st_lookup(RCLASS(klass)->iv_tbl, id, &result)) { if (result == Qundef) { - rb_autoload_load(klass, id); + if (!RTEST(rb_autoload_load(klass, id))) break; continue; } return result; @@ -449,7 +449,7 @@ VALUE rb_path2class _((const char*)); void rb_name_class _((VALUE, ID)); VALUE rb_class_name _((VALUE)); void rb_autoload _((VALUE, ID, const char*)); -void rb_autoload_load _((VALUE, ID)); +VALUE rb_autoload_load _((VALUE, ID)); VALUE rb_autoload_p _((VALUE, ID)); void rb_gc_mark_global_tbl _((void)); VALUE rb_f_trace_var _((int, VALUE*)); diff --git a/variable.c b/variable.c index 34a978f253..610dae2261 100644 --- a/variable.c +++ b/variable.c @@ -1329,7 +1329,7 @@ autoload_delete(mod, id) return (NODE *)load; } -void +VALUE rb_autoload_load(klass, id) VALUE klass; ID id; @@ -1338,9 +1338,9 @@ rb_autoload_load(klass, id) NODE *load = autoload_delete(klass, id); if (!load || !(file = load->nd_lit) || rb_provided(RSTRING(file)->ptr)) { - const_missing(klass, id); + return Qfalse; } - rb_require_safe(file, load->nd_nth); + return rb_require_safe(file, load->nd_nth); } static VALUE @@ -1406,7 +1406,7 @@ rb_const_get_0(klass, id, exclude, recurse) while (tmp) { while (RCLASS(tmp)->iv_tbl && st_lookup(RCLASS(tmp)->iv_tbl,id,&value)) { if (value == Qundef) { - rb_autoload_load(tmp, id); + if (!RTEST(rb_autoload_load(tmp, id))) break; continue; } if (exclude && tmp == rb_cObject && klass != rb_cObject) { |