[macruby-changes] [1764] MacRuby/branches/experimental
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jun 5 18:35:30 PDT 2009
Revision: 1764
http://trac.macosforge.org/projects/ruby/changeset/1764
Author: lsansonetti at apple.com
Date: 2009-06-05 18:35:30 -0700 (Fri, 05 Jun 2009)
Log Message:
-----------
Array#concat: fixed some failing specs
Modified Paths:
--------------
MacRuby/branches/experimental/array.c
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/concat_tags.txt
Modified: MacRuby/branches/experimental/array.c
===================================================================
--- MacRuby/branches/experimental/array.c 2009-06-06 01:29:53 UTC (rev 1763)
+++ MacRuby/branches/experimental/array.c 2009-06-06 01:35:30 UTC (rev 1764)
@@ -980,7 +980,9 @@
long n, rlen;
n = RARRAY_LEN(ary);
- if (len < 0) rb_raise(rb_eIndexError, "negative length (%ld)", len);
+ if (len < 0) {
+ rb_raise(rb_eIndexError, "negative length (%ld)", len);
+ }
if (beg < 0) {
beg += n;
if (beg < 0) {
@@ -1242,8 +1244,9 @@
if (*(Class *)ary != (Class)rb_cCFArray) {
*(Class *)dup = *(Class *)ary;
}
- if (OBJ_TAINTED(ary))
+ if (OBJ_TAINTED(ary)) {
OBJ_TAINT(dup);
+ }
CFMakeCollectable((CFTypeRef)dup);
return dup;
@@ -1259,8 +1262,9 @@
rb_ary_clone(VALUE ary, SEL sel)
{
VALUE clone = rb_ary_dup(ary);
- if (OBJ_FROZEN(ary))
+ if (OBJ_FROZEN(ary)) {
OBJ_FREEZE(clone);
+ }
return clone;
}
@@ -1625,7 +1629,7 @@
VALUE collect;
RETURN_ENUMERATOR(ary, 0, 0);
- collect = rb_ary_new2(RARRAY_LEN(ary));
+ collect = rb_ary_new();
for (i = 0; i < RARRAY_LEN(ary); i++) {
VALUE v = rb_yield(RARRAY_AT(ary, i));
RETURN_IF_BROKEN();
@@ -2274,6 +2278,11 @@
if (RARRAY_LEN(y) > 0) {
rb_ary_splice(x, RARRAY_LEN(x), 0, y);
}
+ else {
+ // Even if we do nothing since the given array is empty, we still need
+ // to check if the receiver is modifiable, for RubySpec compliance.
+ rb_ary_modify(x);
+ }
return x;
}
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/concat_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/concat_tags.txt 2009-06-06 01:29:53 UTC (rev 1763)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/concat_tags.txt 2009-06-06 01:35:30 UTC (rev 1764)
@@ -1,5 +1,3 @@
-fails:Array#concat is not infected by the other
fails:Array#concat keeps untrusted status
fails:Array#concat is not infected untrustedness by the other
fails:Array#concat keeps the untrusted status of elements
-fails:Array#concat raises a RuntimeError when Array is frozen and modification occurs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090605/5a545323/attachment.html>
More information about the macruby-changes
mailing list