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

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: Change to fixedLength. Created 8 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
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 5b4f36a612dd73f37a56a7c035d18e5b31ec40dd..efcc42008406c0588e2bfd3cb7aad2fb37c26127 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
@@ -522,11 +522,11 @@ class Primitives {
return "Instance of '$name'";
}
- static List newList(length) {
- if (length == null) return JS('Object', r'new Array()');
- if ((length is !int) || (length < 0)) {
- throw new ArgumentError(length);
- }
+ static List newGrowableList(length) {
+ return JS('Object', r'new Array(#)', length);
+ }
+
+ static List newFixedList(length) {
var result = JS('Object', r'new Array(#)', length);
JS('void', r'#.fixed$length = #', result, true);
return result;

Powered by Google App Engine
This is Rietveld 408576698