diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-01-06 22:31:25 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-01-06 22:31:25 +0900 |
| commit | 7d8a3b618a2b082645fe978aca04c9f72c72e070 (patch) | |
| tree | eadf732085b1a8f888eca4e2ed2e3dea63f3bf09 /src/variable.c | |
| parent | fe19ac2bcd0baed7ee7bb62927d1356e50e439d8 (diff) | |
| download | mruby-7d8a3b618a2b082645fe978aca04c9f72c72e070.tar.gz mruby-7d8a3b618a2b082645fe978aca04c9f72c72e070.zip | |
small refactoring (dedup mrb_vm_cv_set)
Diffstat (limited to 'src/variable.c')
| -rw-r--r-- | src/variable.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/variable.c b/src/variable.c index c66e7fe89..921d465a2 100644 --- a/src/variable.c +++ b/src/variable.c @@ -756,7 +756,7 @@ mrb_cv_get(mrb_state *mrb, mrb_value mod, mrb_sym sym) } void -mrb_mod_cv_set(mrb_state *mrb, struct RClass * c, mrb_sym sym, mrb_value v) +mrb_mod_cv_set(mrb_state *mrb, struct RClass *c, mrb_sym sym, mrb_value v) { struct RClass * cls = c; @@ -823,24 +823,7 @@ mrb_vm_cv_set(mrb_state *mrb, mrb_sym sym, mrb_value v) struct RClass *c = mrb->c->ci->proc->target_class; if (!c) c = mrb->c->ci->target_class; - while (c) { - if (c->iv) { - iv_tbl *t = c->iv; - - if (iv_get(mrb, t, sym, NULL)) { - mrb_write_barrier(mrb, (struct RBasic*)c); - iv_put(mrb, t, sym, v); - return; - } - } - c = c->super; - } - c = mrb->c->ci->target_class; - if (!c->iv) { - c->iv = iv_new(mrb); - } - mrb_write_barrier(mrb, (struct RBasic*)c); - iv_put(mrb, c->iv, sym, v); + mrb_mod_cv_set(mrb, c, sym, v); } mrb_bool |
