| Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| index 87203a2b1e5b13c412e29782d33cdc19f7a66513..1e9429d18482791e75be9aa4abaa10198f468a48 100644
|
| --- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| +++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
|
| @@ -13,7 +13,8 @@ import '../io/source_information.dart';
|
| import '../tree/tree.dart' as ast;
|
| import '../closure.dart' hide ClosureScope;
|
| import 'cps_ir_nodes.dart' as ir;
|
| -import 'cps_ir_builder_task.dart' show DartCapturedVariables;
|
| +import 'cps_ir_builder_task.dart' show DartCapturedVariables,
|
| + GlobalProgramInformation;
|
|
|
| /// A mapping from variable elements to their compile-time values.
|
| ///
|
| @@ -787,12 +788,8 @@ abstract class IrBuilder {
|
| /// argument values are defined by [arguments].
|
| ir.Primitive buildConstructorInvocation(FunctionElement element,
|
| Selector selector,
|
| - DartType type,
|
| - List<ir.Primitive> arguments) {
|
| - assert(isOpen);
|
| - return _continueWithExpression(
|
| - (k) => new ir.InvokeConstructor(type, element, selector, k, arguments));
|
| - }
|
| + InterfaceType type,
|
| + List<ir.Primitive> arguments);
|
|
|
| /// Create a string concatenation of the [arguments].
|
| ir.Primitive buildStringConcatenation(List<ir.Primitive> arguments) {
|
| @@ -2113,6 +2110,16 @@ class DartIrBuilder extends IrBuilder {
|
| return _buildInvokeSuper(target, selector, arguments);
|
| }
|
|
|
| + @override
|
| + ir.Primitive buildConstructorInvocation(FunctionElement element,
|
| + Selector selector,
|
| + InterfaceType type,
|
| + List<ir.Primitive> arguments) {
|
| + assert(isOpen);
|
| + return _continueWithExpression(
|
| + (k) => new ir.InvokeConstructor.byType(type, element, selector, k,
|
| + arguments));
|
| + }
|
| }
|
|
|
| /// State shared between JsIrBuilders within the same function.
|
| @@ -2133,11 +2140,13 @@ class JsIrBuilderSharedState {
|
| /// variables are boxed as necessary using [CreateBox], [GetField], [SetField].
|
| class JsIrBuilder extends IrBuilder {
|
| final JsIrBuilderSharedState jsState;
|
| + final GlobalProgramInformation program;
|
|
|
| - IrBuilder _makeInstance() => new JsIrBuilder._blank(jsState);
|
| - JsIrBuilder._blank(this.jsState);
|
| + IrBuilder _makeInstance() => new JsIrBuilder._blank(program, jsState);
|
| + JsIrBuilder._blank(this.program, this.jsState);
|
|
|
| - JsIrBuilder(ConstantSystem constantSystem, ExecutableElement currentElement)
|
| + JsIrBuilder(this.program, ConstantSystem constantSystem,
|
| + ExecutableElement currentElement)
|
| : jsState = new JsIrBuilderSharedState() {
|
| _init(constantSystem, currentElement);
|
| }
|
| @@ -2378,6 +2387,40 @@ class JsIrBuilder extends IrBuilder {
|
| jsState.boxedVariables.addAll(closureScope.capturedVariables);
|
| }
|
| }
|
| +
|
| + @override
|
| + ir.Primitive buildConstructorInvocation(FunctionElement element,
|
| + Selector selector,
|
| + InterfaceType type,
|
| + List<ir.Primitive> arguments) {
|
| + assert(isOpen);
|
| + // TODO(karlklose): resolve effective target and type here or inline later?
|
| + ClassElement cls = element.enclosingClass;
|
| + List<ir.TypeExpression> typeArguments = const <ir.TypeExpression>[];
|
| + if (program.requiresRuntimeTypesFor(cls) && !type.treatAsRaw) {
|
| + typeArguments = type.typeArguments.map(buildTypeExpression).toList();
|
| + }
|
| + return _continueWithExpression(
|
| + (k) => new ir.InvokeConstructor.withTypeArguments(element, selector, k,
|
| + arguments, typeArguments));
|
| + }
|
| +
|
| + ir.Primitive buildTypeExpression(DartType type) {
|
| + ir.Primitive expression;
|
| + if (type is TypeVariableType) {
|
| + expression = new ir.ReadTypeVariable(type, buildThis());
|
| + } else {
|
| + assert(type is InterfaceType);
|
| + List<ir.Primitive> arguments = <ir.Primitive>[];
|
| + type.forEachTypeVariable((TypeVariableType variable) {
|
| + ir.Primitive value = buildTypeExpression(variable);
|
| + arguments.add(value);
|
| + });
|
| + expression = new ir.TypeExpression(type, arguments);
|
| + }
|
| + add(new ir.LetPrim(expression));
|
| + return expression;
|
| + }
|
| }
|
|
|
|
|
|
|