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

Unified Diff: runtime/lib/array_patch.dart

Issue 2612043002: Fixes to patch files necessary to use the analyzer (Closed)
Patch Set: Created 3 years, 11 months 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: runtime/lib/array_patch.dart
diff --git a/runtime/lib/array_patch.dart b/runtime/lib/array_patch.dart
index f8343941905d1ddb2c5d28e186722763f1c4d648..db4626a9ed3a3794311e1062020250dd0be78df6 100644
--- a/runtime/lib/array_patch.dart
+++ b/runtime/lib/array_patch.dart
@@ -11,14 +11,7 @@ class _GrowableArrayMarker implements int {
const _GROWABLE_ARRAY_MARKER = const _GrowableArrayMarker();
@patch class List<E> {
- @patch factory List([int length = _GROWABLE_ARRAY_MARKER]) {
- if (identical(length, _GROWABLE_ARRAY_MARKER)) {
- return new _GrowableList<E>(0);
- }
- // All error handling on the length parameter is done at the implementation
- // of new _List.
- return new _List<E>(length);
- }
+ @patch factory List([int length]) = List<E>._internal;
Kevin Millikin (Google) 2017/01/04 15:31:04 Patch files can't change the default value (it's n
@patch factory List.filled(int length, E fill, {bool growable: false}) {
// All error handling on the length parameter is done at the implementation
@@ -59,6 +52,17 @@ const _GROWABLE_ARRAY_MARKER = const _GrowableArrayMarker();
return makeFixedListUnmodifiable(result);
}
+ // The List factory constructor redirects to this one so that we can change
+ // length's default value from the one in the SDK's implementation.
+ factory List._internal([int length = _GROWABLE_ARRAY_MARKER]) {
+ if (identical(length, _GROWABLE_ARRAY_MARKER)) {
+ return new _GrowableList<E>(0);
+ }
+ // All error handling on the length parameter is done at the implementation
+ // of new _List.
+ return new _List<E>(length);
+ }
+
// Factory constructing a mutable List from a parser generated List literal.
// [elements] contains elements that are already type checked.
factory List._fromLiteral(List elements) {

Powered by Google App Engine
This is Rietveld 408576698