Index: runtime/lib/growable_array.dart |
=================================================================== |
--- runtime/lib/growable_array.dart (revision 37613) |
+++ runtime/lib/growable_array.dart (working copy) |
@@ -3,10 +3,9 @@ |
// BSD-style license that can be found in the LICENSE file. |
class _GrowableList<T> implements List<T> { |
- static final int _classId = ClassID.getID(new _GrowableList(0)); |
void insert(int index, T element) { |
- if (index < 0 || index > length) { |
+ if ((index < 0) || (index > length)) { |
throw new RangeError.range(index, 0, length); |
} |
if (index == this.length) { |
@@ -17,7 +16,7 @@ |
// We are modifying the length just below the is-check. Without the check |
// Array.copy could throw an exception, leaving the list in a bad state |
// (with a length that has been increased, but without a new element). |
- if (index is! int) throw new ArgumentError(index); |
+ if (ClassID.getID(index) != ClassID.cidSmi) throw new ArgumentError(index); |
siva
2014/06/23 21:23:31
The previous code was checking for int but now we
srdjan
2014/06/23 22:27:35
Any index that is not Smi throws an exception, eit
|
this.length++; |
Lists.copy(this, index, this, index + 1, oldLength - index); |
this[index] = element; |
@@ -110,7 +109,7 @@ |
return list; |
} |
- static final int _kDefaultCapacity = 2; |
+ static const int _kDefaultCapacity = 2; |
factory _GrowableList(int length) { |
var data = new _List((length == 0) ? _kDefaultCapacity : length); |