Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Unified Diff: runtime/lib/growable_array.dart

Issue 351673002: Add class id constants fields to dart:_internal class 'ClassID'. Use the fields in the library (mor… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698