[macruby-changes] [5097] MacRuby/trunk/array.h

source_changes at macosforge.org source_changes at macosforge.org
Sat Jan 1 21:26:58 PST 2011


Revision: 5097
          http://trac.macosforge.org/projects/ruby/changeset/5097
Author:   watson1978 at gmail.com
Date:     2011-01-01 21:26:54 -0800 (Sat, 01 Jan 2011)
Log Message:
-----------
Array#[]= will throw an exception when Array has been frozen.

Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

a = []
a.freeze
assert_raise(RuntimeError){ a[0] = "a" }

puts :ok
}}}

Modified Paths:
--------------
    MacRuby/trunk/array.h

Modified: MacRuby/trunk/array.h
===================================================================
--- MacRuby/trunk/array.h	2011-01-02 05:26:48 UTC (rev 5096)
+++ MacRuby/trunk/array.h	2011-01-02 05:26:54 UTC (rev 5097)
@@ -106,6 +106,7 @@
 	rb_raise(rb_eIndexError, "index %ld too big", idx);
     }
 
+    rary_modify(ary);
     size_t uidx = (size_t)idx;
     if (uidx >= RARY(ary)->len) {
         rary_reserve(ary, uidx + 1);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110101/37124030/attachment-0001.html>


More information about the macruby-changes mailing list