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

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

Issue 11312122: Change List constructors. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Reupload. Adapt code for List.fixedLength. Created 8 years 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: sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
diff --git a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
index 467f28e3edd24d79c3843c78b4aa4a68544d4dab..8508a4ced9500fdf5b2b4da59337e0f09a75db7d 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
@@ -512,14 +512,17 @@ class Primitives {
return "Instance of '$name'";
}
- static List newList(length) {
+ static List newGrowableList(length) {
+ // TODO(sra): For good concrete type analysis we need the JS-type to
+ // specifically name the JavaScript Array implementation. 'List' matches
+ // all the dart:html types that implement List<T>.
+ return JS('Object', r'new Array(#)', length);
+ }
+
+ static List newFixedList(length) {
// TODO(sra): For good concrete type analysis we need the JS-type to
// specifically name the JavaScript Array implementation. 'List' matches
// all the dart:html types that implement List<T>.
- if (length == null) return JS('=List', r'new Array()');
- if ((length is !int) || (length < 0)) {
- throw new ArgumentError(length);
- }
var result = JS('=List', r'new Array(#)', length);
JS('void', r'#.fixed$length = #', result, true);
return result;

Powered by Google App Engine
This is Rietveld 408576698