diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-08-05 17:12:03 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-08-05 17:12:03 +0900 |
| commit | 52ba6f5a8c79d4463167e2a3b802aa5238a52b51 (patch) | |
| tree | a4df445b95d5db546956725f4335b120c3610611 /src/variable.c | |
| parent | 722c53c5607f1986b5dd7d9d19e4be7a2ba63954 (diff) | |
| download | mruby-52ba6f5a8c79d4463167e2a3b802aa5238a52b51.tar.gz mruby-52ba6f5a8c79d4463167e2a3b802aa5238a52b51.zip | |
class variable resolution should be same as const resolution
Diffstat (limited to 'src/variable.c')
| -rw-r--r-- | src/variable.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/variable.c b/src/variable.c index 0b4288734..8b94f5bbb 100644 --- a/src/variable.c +++ b/src/variable.c @@ -233,8 +233,9 @@ mrb_obj_instance_variables(mrb_state *mrb, mrb_value self) mrb_value mrb_vm_cv_get(mrb_state *mrb, mrb_sym sym) { - struct RClass *c = mrb->ci->target_class; + struct RClass *c = mrb->ci->proc->target_class; + if (!c) c = mrb->ci->target_class; while (c) { if (c->iv) { khash_t(iv) *h = c->iv; @@ -251,10 +252,11 @@ mrb_vm_cv_get(mrb_state *mrb, mrb_sym sym) void mrb_vm_cv_set(mrb_state *mrb, mrb_sym sym, mrb_value v) { - struct RClass *c = mrb->ci->target_class; + struct RClass *c = mrb->ci->proc->target_class; khash_t(iv) *h; khiter_t k; + if (!c) c = mrb->ci->target_class; while (c) { if (c->iv) { h = c->iv; |
