Implement Object#freeze

This commit is contained in:
Takashi Kokubun
2016-12-11 01:45:38 +09:00
parent 3cc913490b
commit 10bb7ad693
10 changed files with 45 additions and 20 deletions
+4
View File
@@ -108,6 +108,10 @@ ary_fill_with_nil(mrb_value *ptr, mrb_int size)
static void
ary_modify(mrb_state *mrb, struct RArray *a)
{
if (RBASIC_FROZEN_P(a)) {
mrb_raise(mrb, E_RUNTIME_ERROR, "can't modify frozen array");
}
if (ARY_SHARED_P(a)) {
mrb_shared_array *shared = a->aux.shared;