summaryrefslogtreecommitdiffhomepage
path: root/src/variable.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-12-12 01:00:24 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2016-12-12 01:00:24 +0900
commit761562b65f33f47a18eae2c5db26ec48818498fc (patch)
tree3a42bd73b4292712586e164cd25971e52e075499 /src/variable.c
parent92c843dd07211d698a6dac90fbd740e483ae34af (diff)
downloadmruby-761562b65f33f47a18eae2c5db26ec48818498fc.tar.gz
mruby-761562b65f33f47a18eae2c5db26ec48818498fc.zip
freeze instance variables; ref #3340
Diffstat (limited to 'src/variable.c')
-rw-r--r--src/variable.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/variable.c b/src/variable.c
index 45dc055af..390da5455 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -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);
}