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

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: address comments Created 6 years 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
« no previous file with comments | « pkg/compiler/lib/src/js/printer.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/codegen.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6237adceaad24682cbe4c9b305c42d206c575961 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(visit)
+ .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((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) {
« no previous file with comments | « pkg/compiler/lib/src/js/printer.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698