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

Unified Diff: pkg/compiler/lib/src/js_backend/runtime_types.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
Index: pkg/compiler/lib/src/js_backend/runtime_types.dart
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index f32d77fe9d7c8db25064145476b8b5859d5e7954..50f728266938655b9b7584605a5f523d6ef5261a 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -506,13 +506,10 @@ class RuntimeTypes {
jsAst.Expression getSubstitutionRepresentation(
List<DartType> types,
OnVariableCallback onVariable) {
- List<jsAst.ArrayElement> elements = <jsAst.ArrayElement>[];
- int index = 0;
- for (DartType type in types) {
- jsAst.Expression representation = getTypeRepresentation(type, onVariable);
- elements.add(new jsAst.ArrayElement(index++, representation));
- }
- return new jsAst.ArrayInitializer(index, elements);
+ List<jsAst.Expression> elements = types
+ .map((DartType type) => getTypeRepresentation(type, onVariable))
+ .toList(growable: false);
+ return new jsAst.ArrayInitializer(elements);
}
jsAst.Expression getTypeEncoding(DartType type,
@@ -657,15 +654,15 @@ class TypeRepresentationGenerator extends DartTypeVisitor {
jsAst.Expression visitList(List<DartType> types, {jsAst.Expression head}) {
int index = 0;
- List<jsAst.ArrayElement> elements = <jsAst.ArrayElement>[];
+ List<jsAst.Expression> elements = <jsAst.Expression>[];
if (head != null) {
- elements.add(new jsAst.ArrayElement(0, head));
+ elements.add(head);
index++;
}
for (DartType type in types) {
- elements.add(new jsAst.ArrayElement(index++, visit(type)));
+ elements.add(visit(type));
}
- return new jsAst.ArrayInitializer(elements.length, elements);
+ return new jsAst.ArrayInitializer(elements);
}
visitFunctionType(FunctionType type, _) {
« no previous file with comments | « pkg/compiler/lib/src/js_backend/constant_emitter.dart ('k') | pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698