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; |