Skip to content
Permalink
Browse files
freeze instance variables; ref #3340
  • Loading branch information
matz committed Dec 11, 2016
1 parent 92c843d commit 761562b65f33f47a18eae2c5db26ec48818498fc
Showing 1 changed file with 3 additions and 0 deletions.
@@ -489,6 +489,9 @@ mrb_obj_iv_set(mrb_state *mrb, struct RObject *obj, mrb_sym sym, mrb_value v)
{
iv_tbl *t = obj->iv;

if (MRB_FROZEN_P(obj)) {
mrb_raisef(mrb, E_RUNTIME_ERROR, "can't modify frozen %S", mrb_obj_value(obj));
}
if (!t) {
t = obj->iv = iv_new(mrb);
}

0 comments on commit 761562b

Please sign in to comment.