Implement List.empty() in the DDC patch file.

Change-Id: Ib588f52daebea9a51f3aeed858e418406d57a8bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123960
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
This commit is contained in:
Robert Nystrom 2019-11-01 23:52:59 +00:00 committed by commit-bot@chromium.org
parent e83e66111d
commit 28cc459458

View file

@ -410,6 +410,13 @@ class List<E> {
return JSArray<E>.of(list);
}
@patch
factory List.empty({bool growable = false}) {
var list = JSArray<E>.of(JS('', 'new Array()'));
if (!growable) JSArray.markFixedList(list);
return list;
}
@patch
factory List.filled(@nullCheck int length, E fill, {bool growable = false}) {
var list = JSArray<E>.of(JS('', 'new Array(#)', length));