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

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: 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..0fa84f447eefe926207bc2841f5a331378d572c8 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -15,8 +15,10 @@ 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 = growable
+ ? (<Element>[]..length = _childElements.length)
floitsch 2013/02/26 13:54:19 I would prefer an if with 2 lines for the length.
Lasse Reichstein Nielsen 2013/02/26 15:26:00 Done.
+ : new List<Element>(_childElements.length);
for (int i = 0, len = _childElements.length; i < len; i++) {
output[i] = _childElements[i];
}
@@ -312,7 +314,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);
floitsch 2013/02/26 13:54:19 IterableMixinWorkaround.toListList(this, growable)
Set<Element> toSet() => new Set<Element>.from(this);
Iterable<Element> take(int n) {

Powered by Google App Engine
This is Rietveld 408576698