summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-04-25 07:17:10 +0900
committerGitHub <[email protected]>2019-04-25 07:17:10 +0900
commite5799b5d40a5c25beab5db881f8d6315720b987c (patch)
tree535584bbc083956801dd6c8c702c8dfe8c4c44d9 /src
parent163a6d01e035f16b15d3b08c0dfddd2caec09f9b (diff)
parent4720648137f2698cceb635c251475dec645cd598 (diff)
downloadmruby-e5799b5d40a5c25beab5db881f8d6315720b987c.tar.gz
mruby-e5799b5d40a5c25beab5db881f8d6315720b987c.zip
Merge pull request #4402 from shuujii/fix-modiying-class-variable-to-frozen-class
Fix modiying class variable to frozen class/module
Diffstat (limited to 'src')
-rw-r--r--src/variable.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/variable.c b/src/variable.c
index 983fe52f7..c4c9d369f 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -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);
}