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

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

Issue 1637843002: typeInformation in CreateInstance is a kind of TypeExpression (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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..ae281954f89c44bb36cd09ed629e14d04d6c0877 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -831,13 +831,12 @@ class CodeGenerator extends tree_ir.StatementVisitor
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;
+ //assert(typeInformation.isEmpty ||
+ // typeInformation.length == classElement.typeVariables.length);
asgerf 2016/01/26 10:30:00 Clean up outcommented code.
sra1 2016/01/26 22:21:08 Done. It had to be removed since it can be a varia
+ 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 +988,13 @@ 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);
+ if (node.isForInstance) {
+ registry.registerInstantiatedClass(glue.listClass);
+ return new js.ArrayInitializer(arguments);
+ } else {
+ return glue.generateTypeRepresentation(
+ node.dartType, arguments, registry);
+ }
}
js.Node handleForeignCode(tree_ir.ForeignCode node) {

Powered by Google App Engine
This is Rietveld 408576698