| 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 f6c7e21608b46c268c89575c9d7531f6141c63e8..f7447c328023299b86438afb9289d2e99e43d0a1 100644
|
| --- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
|
| @@ -206,9 +206,10 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
|
| @override
|
| js.Expression visitInvokeConstructor(tree_ir.InvokeConstructor node) {
|
| checkStaticTargetIsValid(node, node.target);
|
| -
|
| if (node.constant != null) return giveup(node);
|
| - registry.registerInstantiatedClass(node.target.enclosingClass);
|
| +
|
| + ClassElement instantiatedClass = node.target.enclosingClass;
|
| + registry.registerInstantiatedClass(instantiatedClass);
|
| Selector selector = node.selector;
|
| FunctionElement target = node.target;
|
| List<js.Expression> arguments = visitArguments(node.arguments);
|
| @@ -500,9 +501,24 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
|
|
|
| @override
|
| js.Expression visitCreateInstance(tree_ir.CreateInstance node) {
|
| - registry.registerInstantiatedClass(node.classElement);
|
| - return new js.New(glue.constructorAccess(node.classElement),
|
| - node.arguments.map(visitExpression).toList());
|
| + ClassElement cls = node.classElement;
|
| + registry.registerInstantiatedClass(cls);
|
| + js.Expression instance = new js.New(
|
| + glue.constructorAccess(cls),
|
| + node.arguments.map(visitExpression).toList());
|
| +
|
| + List<tree_ir.Expression> typeInformation = node.typeInformation;
|
| + assert(typeInformation.isEmpty ||
|
| + typeInformation.length == cls.typeVariables.length);
|
| + if (typeInformation.isNotEmpty) {
|
| + FunctionElement helper = glue.getAddRuntimeTypeInformation();
|
| + js.Expression typeArguments = new js.ArrayInitializer(
|
| + typeInformation.map(visitExpression).toList());
|
| + return buildStaticHelperInvocation(helper,
|
| + <js.Expression>[instance, typeArguments]);
|
| + } else {
|
| + return instance;
|
| + }
|
| }
|
|
|
| @override
|
| @@ -555,6 +571,12 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
|
| }
|
| }
|
|
|
| + @override
|
| + js.Expression visitTypeExpression(tree_ir.TypeExpression node) {
|
| + List<js.Expression> arguments =
|
| + node.arguments.map(visitExpression).toList(growable: false);
|
| + return glue.generateTypeRepresentation(node.dartType, arguments);
|
| + }
|
|
|
| // Dart-specific IR nodes
|
|
|
|
|