From cf51572bea16c7ec319c1dfb5a1f010530a2af9d Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 28 Sep 2005 15:58:32 +0000 Subject: * 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] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@9333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ eval.c | 2 +- intern.h | 2 +- variable.c | 8 ++++---- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf7afe26d..a9bd4ba23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Sep 29 00:57:35 2005 Nobuyoshi Nakada + + * 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 * file.c (apply2files): add prototype. diff --git a/eval.c b/eval.c index e9b953044..0601f2d70 100644 --- a/eval.c +++ b/eval.c @@ -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; diff --git a/intern.h b/intern.h index 9021d8f94..8042ba492 100644 --- a/intern.h +++ b/intern.h @@ -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 34a978f25..610dae226 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) { -- cgit