mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix modiying class variable to frozen class/module
This commit is contained in:
@@ -671,6 +671,7 @@ mrb_mod_cv_set(mrb_state *mrb, struct RClass *c, mrb_sym sym, mrb_value v)
|
||||
iv_tbl *t = c->iv;
|
||||
|
||||
if (iv_get(mrb, t, sym, NULL)) {
|
||||
mrb_check_frozen(mrb, c);
|
||||
iv_put(mrb, t, sym, v);
|
||||
mrb_write_barrier(mrb, (struct RBasic*)c);
|
||||
return;
|
||||
@@ -698,6 +699,7 @@ mrb_mod_cv_set(mrb_state *mrb, struct RClass *c, mrb_sym sym, mrb_value v)
|
||||
c = cls;
|
||||
}
|
||||
|
||||
mrb_check_frozen(mrb, c);
|
||||
if (!c->iv) {
|
||||
c->iv = iv_new(mrb);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user