summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authorYukihiro Matsumoto <matz@ruby-lang.org>1995-02-24 13:15:43 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2019-08-17 22:09:31 +0900
commit881c5a9c320c637ee0f6526b40cf70c1379ab656 (patch)
tree3c0327fc9bdef8f056563ceee400226ac572535b /variable.c
parent2f106ab85c4f4e171374aee261f5a12bdd923c41 (diff)
version 0.68v0_68
https://cache.ruby-lang.org/pub/ruby/1.0/ruby-0.67-0.68.diff.gz Fri Feb 24 13:15:43 1995 Yukihiro Matsumoto (matz@ix-02) * version 0.68 Thu Feb 23 11:19:19 1995 Yukihiro Matsumoto (matz@ix-02) * eval.c: resque節のselfの値が間違っていた. * eval.c(rb_clear_cache): キャッシュのクリアし忘れがあった. * eval.c: 定数のスコープをクラス内の静的スコープに変更した.これに よって,特異メソッドからは参照される定数は,レシーバのクラスでは なく,定義されたスコープのクラスの定数となる. Wed Feb 22 00:51:38 1995 Yukihiro Matsumoto (matz@dyna) * regex.c: ignorecaseを正規表現のコンパイル前に指定しないと正しく 動作しない.修正. * string.c(toupper,tolower): bug fix. * ENV,VERSION: readonly変数から定数へ.
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/variable.c b/variable.c
index 9ac538c37e..b65a1fc05e 100644
--- a/variable.c
+++ b/variable.c
@@ -335,22 +335,29 @@ rb_ivar_set(id, val)
}
VALUE
-rb_const_get(id)
+rb_const_get(class, id)
+ struct RClass *class;
ID id;
{
- struct RClass *class = (struct RClass*)CLASS_OF(Qself);
VALUE value;
while (class) {
if (class->iv_tbl && st_lookup(class->iv_tbl, id, &value)) {
return value;
}
- class = class->super;
+ if (BUILTIN_TYPE(class) == T_MODULE) {
+ class = RCLASS(C_Object);
+ }
+ else {
+ class = class->super;
+ }
}
/* pre-defined class */
if (st_lookup(class_tbl, id, &value)) return value;
+ /* here comes autoload code in the future. */
+
Fail("Uninitialized constant %s", rb_id2name(id));
/* not reached */
}
@@ -366,6 +373,8 @@ rb_const_bound(class, id)
}
class = class->super;
}
+ if (st_lookup(class_tbl, id, Qnil))
+ return TRUE;
return FALSE;
}