diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-05-29 21:21:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-05-29 21:21:23 +0000 |
commit | f130d47f6a60228933c451f82b6a1da7fc1d69e2 (patch) | |
tree | 1f5318fdf86630e4f52a53cc01e57d54753125d9 /variable.c | |
parent | e617fd0bf84f80de8fc40a1ea86e96bd2848493a (diff) | |
download | ruby-f130d47f6a60228933c451f82b6a1da7fc1d69e2.tar.gz |
* variable.c (rb_autoload_load): should delete autoloaded
symbol itself before load. [ruby-core:01097]
* variable.c (rb_mod_remove_const): must not return Qundef.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/variable.c b/variable.c index 3a38a7ca11..4835ab502e 100644 --- a/variable.c +++ b/variable.c @@ -1112,7 +1112,7 @@ uninitialized_constant(klass, id) RSTRING(rb_class_path(klass))->ptr, rb_id2name(id)); else { - rb_name_error(id, "uninitialized constant %s",rb_id2name(id)); + rb_name_error(id, "uninitialized constant %s", rb_id2name(id)); } } @@ -1194,7 +1194,17 @@ rb_autoload_load(klass, id) ID id; { VALUE file, value; + ID tmp = id; + if (!st_delete(RCLASS(klass)->iv_tbl, &tmp, &value) || value != Qundef) { + if (klass != rb_cObject) + rb_name_error(id, "not autoload constant %s::%s", + RSTRING(rb_class_path(klass))->ptr, + rb_id2name(id)); + else { + rb_name_error(id, "not autoload constant %s", rb_id2name(id)); + } + } file = autoload_delete(klass, id); if (NIL_P(file)) { uninitialized_constant(klass, id); @@ -1330,7 +1340,10 @@ rb_mod_remove_const(mod, name) if (OBJ_FROZEN(mod)) rb_error_frozen("class/module"); if (RCLASS(mod)->iv_tbl && st_delete(ROBJECT(mod)->iv_tbl, &id, &val)) { - if (val == Qundef) autoload_delete(mod, id); + if (val == Qundef) { + autoload_delete(mod, id); + val = Qnil; + } return val; } if (rb_const_defined_at(mod, id)) { |