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

Unified Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 12328104: Change new List(n) to return fixed length list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head. Created 7 years, 10 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: tools/dom/templates/html/impl/impl_Element.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index 3e0080a1f7be6021899ee96906afeb79e430188e..3abcc2510836f35c44177012240a2816d39b93c9 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -15,8 +15,14 @@ class _ChildrenElementList implements List {
: _childElements = element.$dom_children,
_element = element;
- List<Element> toList() {
- final output = new List<Element>.fixedLength(_childElements.length);
+ List<Element> toList({ bool growable: false }) {
+ final output;
+ if (growable) {
+ output = <Element>[];
+ output.length = _childElements.length;
+ } else {
+ output = new List<Element>(_childElements.length);
+ }
for (int i = 0, len = _childElements.length; i < len; i++) {
output[i] = _childElements[i];
}
@@ -312,7 +318,8 @@ class _FrozenElementList implements List {
return false;
}
- List<Element> toList() => new List<Element>.from(this);
+ List<Element> toList({ bool growable: false }) =>
+ new List<Element>.from(this, growable: growable);
Set<Element> toSet() => new Set<Element>.from(this);
Iterable<Element> take(int n) {

Powered by Google App Engine
This is Rietveld 408576698