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

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

Issue 70703002: Add constructors for JSArray (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | sdk/lib/_internal/lib/js_array.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/lib/core_patch.dart
diff --git a/sdk/lib/_internal/lib/core_patch.dart b/sdk/lib/_internal/lib/core_patch.dart
index 84d7c1f152488fe60c91bc37f1911b19b9f85713..de1c0c0f6afc5c08501971bf9e6e2c53ea6ef808 100644
--- a/sdk/lib/_internal/lib/core_patch.dart
+++ b/sdk/lib/_internal/lib/core_patch.dart
@@ -11,9 +11,6 @@ import 'dart:_js_helper' show checkNull,
Primitives,
stringJoinUnchecked,
objectHashCode;
-import 'dart:_js_primitives' show
- newFixedList,
- newGrowableList;
String _symbolToString(Symbol symbol) => _symbol_dev.Symbol.getName(symbol);
@@ -193,22 +190,12 @@ patch class Stopwatch {
// Patch for List implementation.
patch class List<E> {
patch factory List([int length]) {
- if (length == null) return newGrowableList(0);
- // Explicit type test is necessary to protect [newFixedList] in
- // unchecked mode.
- if ((length is !int) || (length < 0)) {
- throw new ArgumentError("Length must be a positive integer: $length.");
- }
- return newFixedList(length);
+ if (length == null) return new JSArray<E>.emptyGrowable();
+ return new JSArray<E>.fixed(length);
}
patch factory List.filled(int length, E fill) {
- // Explicit type test is necessary to protect [newFixedList] in
- // unchecked mode.
- if ((length is !int) || (length < 0)) {
- throw new ArgumentError("Length must be a positive integer: $length.");
- }
- List result = newFixedList(length);
+ List result = new JSArray<E>.fixed(length);
if (length != 0 && fill != null) {
for (int i = 0; i < result.length; i++) {
result[i] = fill;
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | sdk/lib/_internal/lib/js_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698