Index: sdk/lib/_internal/compiler/implementation/lib/core_patch.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart b/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart |
index 4b74f75622a54fe62927977df1a7fcc30bbf9381..372c4d41ead2cafc216b6aebe20836bff8a2593e 100644 |
--- a/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart |
+++ b/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart |
@@ -162,17 +162,15 @@ patch class _StopwatchImpl { |
// Patch for List implementation. |
patch class List<E> { |
patch factory List([int length = 0]) { |
- // Explicit type test is necessary to protect Primitives.newGrowableList in |
- // unchecked mode. |
if ((length is !int) || (length < 0)) { |
- throw new ArgumentError("Length must be a positive integer: $length."); |
+ String lengthString = Error.safeToString(length); |
+ throw new ArgumentError( |
+ "Length must be a positive integer: $lengthString."); |
} |
return Primitives.newGrowableList(length); |
} |
patch factory List.fixedLength(int length, {E fill: null}) { |
- // Explicit type test is necessary to protect Primitives.newFixedList in |
- // unchecked mode. |
if ((length is !int) || (length < 0)) { |
throw new ArgumentError("Length must be a positive integer: $length."); |
} |
@@ -190,8 +188,6 @@ patch class List<E> { |
* filled with [fill]. |
*/ |
patch factory List.filled(int length, E fill) { |
- // Explicit type test is necessary to protect Primitives.newGrowableList in |
- // unchecked mode. |
if ((length is !int) || (length < 0)) { |
throw new ArgumentError("Length must be a positive integer: $length."); |
} |