| Index: pkg/compiler/lib/src/resolution/send_structure.dart
|
| diff --git a/pkg/compiler/lib/src/resolution/send_structure.dart b/pkg/compiler/lib/src/resolution/send_structure.dart
|
| index e0f6d3090687c8a704b5b4f516516c6f99d0837c..d507dda98383057fd48f8468e2033630502daad8 100644
|
| --- a/pkg/compiler/lib/src/resolution/send_structure.dart
|
| +++ b/pkg/compiler/lib/src/resolution/send_structure.dart
|
| @@ -7,8 +7,10 @@ library dart2js.send_structure;
|
| import 'access_semantics.dart';
|
| import 'operators.dart';
|
| import 'semantic_visitor.dart';
|
| -import '../tree/tree.dart';
|
| import '../dart_types.dart';
|
| +import '../constants/expressions.dart';
|
| +import '../elements/elements.dart';
|
| +import '../tree/tree.dart';
|
| import '../universe/universe.dart';
|
| import '../util/util.dart';
|
|
|
| @@ -1808,3 +1810,67 @@ class PostfixStructure<R, A> implements SendStructure<R, A> {
|
| String toString() => 'postfix($operator,$semantics)';
|
| }
|
|
|
| +/// The structure for a [NewExpression] of a new invocation.
|
| +abstract class NewStructure<R, A> {
|
| + /// Calls the matching visit method on [visitor] with [node] and [arg].
|
| + R dispatch(SemanticSendVisitor<R, A> visitor, NewExpression node, A arg);
|
| +}
|
| +
|
| +/// The structure for a [NewExpression] of a new invocation. For instance
|
| +/// `new C()`.
|
| +class NewInvokeStructure<R, A> extends NewStructure<R, A> {
|
| + final ConstructorAccessSemantics semantics;
|
| + final Selector selector;
|
| +
|
| + NewInvokeStructure(this.semantics, this.selector);
|
| +
|
| + R dispatch(SemanticSendVisitor<R, A> visitor, NewExpression node, A arg) {
|
| + switch (semantics.kind) {
|
| + case ConstructorAccessKind.GENERATIVE:
|
| + return visitor.visitGenerativeConstructorInvoke(
|
| + node, semantics.element, semantics.type,
|
| + node.send.argumentsNode, selector, arg);
|
| + case ConstructorAccessKind.REDIRECTING_GENERATIVE:
|
| + return visitor.visitRedirectingGenerativeConstructorInvoke(
|
| + node, semantics.element, semantics.type,
|
| + node.send.argumentsNode, selector, arg);
|
| + case ConstructorAccessKind.FACTORY:
|
| + return visitor.visitFactoryConstructorInvoke(
|
| + node, semantics.element, semantics.type,
|
| + node.send.argumentsNode, selector, arg);
|
| + case ConstructorAccessKind.REDIRECTING_FACTORY:
|
| + return visitor.visitRedirectingFactoryConstructorInvoke(
|
| + node, semantics.element, semantics.type,
|
| + semantics.effectiveTargetSemantics.element,
|
| + semantics.effectiveTargetSemantics.type,
|
| + node.send.argumentsNode, selector, arg);
|
| + case ConstructorAccessKind.ABSTRACT:
|
| + return visitor.errorAbstractClassConstructorInvoke(
|
| + node, semantics.element, semantics.type,
|
| + node.send.argumentsNode, selector, arg);
|
| + case ConstructorAccessKind.ERRONEOUS:
|
| + return visitor.errorUnresolvedConstructorInvoke(
|
| + node, semantics.element, semantics.type,
|
| + node.send.argumentsNode, selector, arg);
|
| + case ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY:
|
| + return visitor.errorUnresolvedRedirectingFactoryConstructorInvoke(
|
| + node, semantics.element, semantics.type,
|
| + node.send.argumentsNode, selector, arg);
|
| + }
|
| + throw new SpannableAssertionFailure(node,
|
| + "Unhandled constructor invocation kind: ${semantics.kind}");
|
| + }
|
| +}
|
| +
|
| +/// The structure for a [NewExpression] of a constant invocation. For instance
|
| +/// `const C()`.
|
| +class ConstInvokeStructure<R, A> extends NewStructure<R, A> {
|
| + final ConstructedConstantExpression constant;
|
| +
|
| + ConstInvokeStructure(this.constant);
|
| +
|
| + R dispatch(SemanticSendVisitor<R, A> visitor, NewExpression node, A arg) {
|
| + return visitor.visitConstConstructorInvoke(node, constant, arg);
|
| + }
|
| +}
|
| +
|
|
|