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

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

Issue 101823004: We inline List allocations in dart2js to get the right behavior when the passed length is null. Thi… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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/lib/core_patch.dart
===================================================================
--- sdk/lib/_internal/lib/core_patch.dart (revision 30984)
+++ sdk/lib/_internal/lib/core_patch.dart (working copy)
@@ -186,11 +186,16 @@
patch static int _now() => Primitives.numMicroseconds();
}
+class _ListConstructorSentinel extends JSInt {
+ const _ListConstructorSentinel();
+}
// Patch for List implementation.
patch class List<E> {
- patch factory List([int length]) {
- if (length == null) return new JSArray<E>.emptyGrowable();
+ patch factory List([int length = const _ListConstructorSentinel()]) {
+ if (length == const _ListConstructorSentinel()) {
+ return new JSArray<E>.emptyGrowable();
+ }
return new JSArray<E>.fixed(length);
}

Powered by Google App Engine
This is Rietveld 408576698