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

Unified Diff: pkg/compiler/lib/src/js/template.dart

Issue 750323003: Remove js.ArrayElement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add parsing and testing of array holes, make lists non-growable Created 6 years, 1 month 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: pkg/compiler/lib/src/js/template.dart
diff --git a/pkg/compiler/lib/src/js/template.dart b/pkg/compiler/lib/src/js/template.dart
index 03b956e108c219add667d3418bcdfb14324a05d3..789d5d1bf24a1a211834af46d16d8c6289e83468 100644
--- a/pkg/compiler/lib/src/js/template.dart
+++ b/pkg/compiler/lib/src/js/template.dart
@@ -612,26 +612,20 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
(arguments) => new LiteralNull();
Instantiator visitArrayInitializer(ArrayInitializer node) {
- // Assume array has no missing elements.
// TODO(sra): Implement splicing?
List<Instantiator> elementMakers = node.elements
- .map((ArrayElement element) => visit(element.value))
- .toList();
+ .map((Expression element) => visit(element))
floitsch 2014/12/01 13:03:29 .map(visit)
sigurdm 2014/12/02 09:27:31 Done.
+ .toList(growable: false);
return (arguments) {
- List<ArrayElement> elements = <ArrayElement>[];
- void add(Expression value) {
- elements.add(new ArrayElement(elements.length, value));
- }
- for (Instantiator instantiator in elementMakers) {
- var result = instantiator(arguments);
- add(result);
- }
- return new ArrayInitializer(elements.length, elements);
+ List<Expression> elements = elementMakers.map(
floitsch 2014/12/01 13:03:29 move the ".map(" into the next line (hoping that i
sigurdm 2014/12/02 09:27:31 Done.
+ (Instantiator instantiator) => instantiator(arguments))
+ .toList(growable: false);
+ return new ArrayInitializer(elements);
};
}
- Instantiator visitArrayElement(ArrayElement node) {
- throw 'Should not get here'; // Handled in visitArrayInitializer.
+ Instantiator visitArrayHole(ArrayHole node) {
+ return (arguments) => new ArrayHole();
}
Instantiator visitObjectInitializer(ObjectInitializer node) {

Powered by Google App Engine
This is Rietveld 408576698