mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Should only check frozen for Array#pop
This commit is contained in:
+1
-1
@@ -451,7 +451,7 @@ mrb_ary_pop(mrb_state *mrb, mrb_value ary)
|
||||
{
|
||||
struct RArray *a = mrb_ary_ptr(ary);
|
||||
|
||||
ary_modify(mrb, a);
|
||||
ary_modify_check(mrb, a);
|
||||
if (a->len == 0) return mrb_nil_value();
|
||||
return a->ptr[--a->len];
|
||||
}
|
||||
|
||||
@@ -237,6 +237,8 @@ assert('Array#pop', '15.2.12.5.21') do
|
||||
assert_nil([].pop)
|
||||
assert_equal([1,2], a)
|
||||
assert_equal(3, b)
|
||||
|
||||
assert_raise(RuntimeError) { [].freeze.pop }
|
||||
end
|
||||
|
||||
assert('Array#push', '15.2.12.5.22') do
|
||||
|
||||
Reference in New Issue
Block a user