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:
parent
2a05d8c7fb
commit
962bcf1394
4 changed files with 14 additions and 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:40:04 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Sep 28 23:40:04 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* file.c (rb_stat_inspect): constified.
|
* file.c (rb_stat_inspect): constified.
|
||||||
|
|
2
eval.c
2
eval.c
|
@ -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);
|
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)) {
|
while (RCLASS(klass)->iv_tbl && st_lookup(RCLASS(klass)->iv_tbl, id, &result)) {
|
||||||
if (result == Qundef) {
|
if (result == Qundef) {
|
||||||
rb_autoload_load(klass, id);
|
if (!RTEST(rb_autoload_load(klass, id))) break;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
2
intern.h
2
intern.h
|
@ -531,7 +531,7 @@ VALUE rb_path2class(const char*);
|
||||||
void rb_name_class(VALUE, ID);
|
void rb_name_class(VALUE, ID);
|
||||||
VALUE rb_class_name(VALUE);
|
VALUE rb_class_name(VALUE);
|
||||||
void rb_autoload(VALUE, ID, const char*);
|
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);
|
VALUE rb_autoload_p(VALUE, ID);
|
||||||
void rb_gc_mark_global_tbl(void);
|
void rb_gc_mark_global_tbl(void);
|
||||||
VALUE rb_f_trace_var(int, VALUE*);
|
VALUE rb_f_trace_var(int, VALUE*);
|
||||||
|
|
|
@ -1215,16 +1215,16 @@ autoload_delete(VALUE mod, ID id)
|
||||||
return (NODE *)load;
|
return (NODE *)load;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
VALUE
|
||||||
rb_autoload_load(VALUE klass, ID id)
|
rb_autoload_load(VALUE klass, ID id)
|
||||||
{
|
{
|
||||||
VALUE file;
|
VALUE file;
|
||||||
NODE *load = autoload_delete(klass, id);
|
NODE *load = autoload_delete(klass, id);
|
||||||
|
|
||||||
if (!load || !(file = load->nd_lit) || rb_provided(RSTRING(file)->ptr)) {
|
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
|
static VALUE
|
||||||
|
@ -1283,7 +1283,7 @@ rb_const_get_0(VALUE klass, ID id, int exclude, int recurse)
|
||||||
while (tmp) {
|
while (tmp) {
|
||||||
while (RCLASS(tmp)->iv_tbl && st_lookup(RCLASS(tmp)->iv_tbl,id,&value)) {
|
while (RCLASS(tmp)->iv_tbl && st_lookup(RCLASS(tmp)->iv_tbl,id,&value)) {
|
||||||
if (value == Qundef) {
|
if (value == Qundef) {
|
||||||
rb_autoload_load(tmp, id);
|
if (!RTEST(rb_autoload_load(tmp, id))) break;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (exclude && tmp == rb_cObject && klass != rb_cObject) {
|
if (exclude && tmp == rb_cObject && klass != rb_cObject) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue