1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@9333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-09-28 15:58:32 +00:00
parent 2a05d8c7fb
commit 962bcf1394
4 changed files with 14 additions and 6 deletions

View file

@ -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:40:04 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* file.c (rb_stat_inspect): constified.

2
eval.c
View file

@ -1795,7 +1795,7 @@ ev_const_get(NODE *cref, ID id, VALUE 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;

View file

@ -531,7 +531,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*);

View file

@ -1215,16 +1215,16 @@ autoload_delete(VALUE mod, ID id)
return (NODE *)load;
}
void
VALUE
rb_autoload_load(VALUE klass, ID id)
{
VALUE file;
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
@ -1283,7 +1283,7 @@ rb_const_get_0(VALUE klass, ID id, int exclude, int 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) {