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

Unified Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 1642493002: Add type info to JSArray. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: array changes Created 4 years, 11 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: pkg/compiler/lib/src/js_backend/codegen/codegen.dart
diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
index e7cc68a4c981c0a13b9645a0b23af79b8b9cae2c..85afd266b5010c190d67ef3f6fd4aa900540259c 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -827,17 +827,14 @@ class CodeGenerator extends tree_ir.StatementVisitor
registry.registerInstantiatedClosure(classElement.methodElement);
}
js.Expression instance = new js.New(
- glue.constructorAccess(classElement),
- visitExpressionList(node.arguments))
+ glue.constructorAccess(classElement),
+ visitExpressionList(node.arguments))
.withSourceInformation(node.sourceInformation);
- List<tree_ir.Expression> typeInformation = node.typeInformation;
- assert(typeInformation.isEmpty ||
- typeInformation.length == classElement.typeVariables.length);
- if (typeInformation.isNotEmpty) {
+ tree_ir.Expression typeInformation = node.typeInformation;
+ if (typeInformation != null) {
FunctionElement helper = glue.getAddRuntimeTypeInformation();
- js.Expression typeArguments = new js.ArrayInitializer(
- visitExpressionList(typeInformation));
+ js.Expression typeArguments = visitExpression(typeInformation);
return buildStaticHelperInvocation(helper,
<js.Expression>[instance, typeArguments],
sourceInformation: node.sourceInformation);
@@ -989,7 +986,14 @@ class CodeGenerator extends tree_ir.StatementVisitor
@override
js.Expression visitTypeExpression(tree_ir.TypeExpression node) {
List<js.Expression> arguments = visitExpressionList(node.arguments);
- return glue.generateTypeRepresentation(node.dartType, arguments, registry);
+ switch (node.kind) {
+ case tree_ir.TypeExpressionKind.COMPLETE:
+ return glue.generateTypeRepresentation(
+ node.dartType, arguments, registry);
+ case tree_ir.TypeExpressionKind.INSTANCE:
+ registry.registerInstantiatedClass(glue.listClass);
+ return new js.ArrayInitializer(arguments);
+ }
}
js.Node handleForeignCode(tree_ir.ForeignCode node) {

Powered by Google App Engine
This is Rietveld 408576698