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

Unified Diff: sdk/lib/_internal/compiler/implementation/lib/core_patch.dart

Issue 11975008: Revert "Revert "Don't use Error.toSafeString in List constructor."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/js_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 372c4d41ead2cafc216b6aebe20836bff8a2593e..4b74f75622a54fe62927977df1a7fcc30bbf9381 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/core_patch.dart
@@ -162,15 +162,17 @@ 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)) {
- String lengthString = Error.safeToString(length);
- throw new ArgumentError(
- "Length must be a positive integer: $lengthString.");
+ throw new ArgumentError("Length must be a positive integer: $length.");
}
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.");
}
@@ -188,6 +190,8 @@ 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.");
}
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698