diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-06-12 23:39:27 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-06-12 23:39:27 +0900 |
| commit | 8bc506e25825620c356a61e0db8825b669409159 (patch) | |
| tree | e3c469da9ead093ce282990a877f8ae475f159d5 /src/variable.c | |
| parent | db1244cef5b21074945f26eb4351d7feecb31af4 (diff) | |
| download | mruby-8bc506e25825620c356a61e0db8825b669409159.tar.gz mruby-8bc506e25825620c356a61e0db8825b669409159.zip | |
a bug in contant reference from modules
Diffstat (limited to 'src/variable.c')
| -rw-r--r-- | src/variable.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/variable.c b/src/variable.c index 33cd6ba14..b8957fb6a 100644 --- a/src/variable.c +++ b/src/variable.c @@ -235,6 +235,7 @@ const_get(mrb_state *mrb, struct RClass *base, mrb_sym sym) khiter_t k; mrb_sym cm = mrb_intern(mrb, "const_missing"); + L_RETRY: while (c) { if (c->iv) { h = c->iv; @@ -250,6 +251,10 @@ const_get(mrb_state *mrb, struct RClass *base, mrb_sym sym) c = c->super; } + if (base->tt == MRB_TT_MODULE) { + c = base = mrb->object_class; + goto L_RETRY; + } mrb_raise(mrb, E_NAME_ERROR, "uninitialized constant %s", mrb_sym2name(mrb, sym)); /* not reached */ |
