| Index: pkg/compiler/lib/src/resolution/send_resolver.dart
|
| diff --git a/pkg/compiler/lib/src/resolution/send_resolver.dart b/pkg/compiler/lib/src/resolution/send_resolver.dart
|
| index 85ad9a8f7b08aa3f3ada7a7bff90703ceca67c1e..d592cf4f51f8c6324ef100db97f8dd7799af4cae 100644
|
| --- a/pkg/compiler/lib/src/resolution/send_resolver.dart
|
| +++ b/pkg/compiler/lib/src/resolution/send_resolver.dart
|
| @@ -9,138 +9,11 @@ import '../constants/expressions.dart';
|
| import '../dart_types.dart';
|
| import '../elements/elements.dart';
|
| import '../tree/tree.dart';
|
| -import '../universe/call_structure.dart' show
|
| - CallStructure;
|
| -import '../universe/selector.dart' show
|
| - Selector;
|
|
|
| -import 'access_semantics.dart';
|
| import 'semantic_visitor.dart';
|
| import 'send_structure.dart';
|
| import 'tree_elements.dart';
|
|
|
| -abstract class SendResolverMixin {
|
| - TreeElements get elements;
|
| -
|
| - internalError(Spannable spannable, String message);
|
| -
|
| - ConstructorAccessSemantics computeConstructorAccessSemantics(
|
| - ConstructorElement constructor,
|
| - CallStructure callStructure,
|
| - DartType type,
|
| - {bool mustBeConstant: false}) {
|
| - if (mustBeConstant && !constructor.isConst) {
|
| - return new ConstructorAccessSemantics(
|
| - ConstructorAccessKind.NON_CONSTANT_CONSTRUCTOR, constructor, type);
|
| - }
|
| - if (constructor.isMalformed) {
|
| - if (constructor is ErroneousElement) {
|
| - ErroneousElement error = constructor;
|
| - if (error.messageKind == MessageKind.CANNOT_FIND_CONSTRUCTOR ||
|
| - error.messageKind == MessageKind.CANNOT_FIND_UNNAMED_CONSTRUCTOR) {
|
| - return new ConstructorAccessSemantics(
|
| - ConstructorAccessKind.UNRESOLVED_CONSTRUCTOR, constructor, type);
|
| - }
|
| - }
|
| - return new ConstructorAccessSemantics(
|
| - ConstructorAccessKind.UNRESOLVED_TYPE, constructor, type);
|
| - } else if (constructor.isRedirectingFactory) {
|
| - ConstructorElement effectiveTarget = constructor.effectiveTarget;
|
| - if (effectiveTarget == constructor ||
|
| - effectiveTarget.isMalformed ||
|
| - (mustBeConstant && !effectiveTarget.isConst)) {
|
| - return new ConstructorAccessSemantics(
|
| - ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY,
|
| - constructor,
|
| - type);
|
| - }
|
| - ConstructorAccessSemantics effectiveTargetSemantics =
|
| - computeConstructorAccessSemantics(
|
| - effectiveTarget,
|
| - callStructure,
|
| - constructor.computeEffectiveTargetType(type));
|
| - if (effectiveTargetSemantics.isErroneous) {
|
| - return new RedirectingFactoryConstructorAccessSemantics(
|
| - ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY,
|
| - constructor,
|
| - type,
|
| - effectiveTargetSemantics);
|
| - }
|
| - return new RedirectingFactoryConstructorAccessSemantics(
|
| - ConstructorAccessKind.REDIRECTING_FACTORY,
|
| - constructor,
|
| - type,
|
| - effectiveTargetSemantics);
|
| - } else {
|
| - if (!callStructure.signatureApplies(constructor.functionSignature)) {
|
| - return new ConstructorAccessSemantics(
|
| - ConstructorAccessKind.INCOMPATIBLE,
|
| - constructor,
|
| - type);
|
| - } else if (constructor.isFactoryConstructor) {
|
| - return new ConstructorAccessSemantics(
|
| - ConstructorAccessKind.FACTORY, constructor, type);
|
| - } else if (constructor.isRedirectingGenerative) {
|
| - if (constructor.enclosingClass.isAbstract) {
|
| - return new ConstructorAccessSemantics(
|
| - ConstructorAccessKind.ABSTRACT, constructor, type);
|
| - }
|
| - return new ConstructorAccessSemantics(
|
| - ConstructorAccessKind.REDIRECTING_GENERATIVE, constructor, type);
|
| - } else if (constructor.enclosingClass.isAbstract) {
|
| - return new ConstructorAccessSemantics(
|
| - ConstructorAccessKind.ABSTRACT, constructor, type);
|
| - } else {
|
| - return new ConstructorAccessSemantics(
|
| - ConstructorAccessKind.GENERATIVE, constructor, type);
|
| - }
|
| - }
|
| - }
|
| -
|
| - NewStructure computeNewStructure(NewExpression node) {
|
| - Element element = elements[node.send];
|
| - Selector selector = elements.getSelector(node.send);
|
| - DartType type = elements.getType(node);
|
| -
|
| - ConstructorAccessSemantics constructorAccessSemantics =
|
| - computeConstructorAccessSemantics(
|
| - element, selector.callStructure, type,
|
| - mustBeConstant: node.isConst);
|
| - if (node.isConst) {
|
| - ConstantExpression constant = elements.getConstant(node);
|
| - if (constructorAccessSemantics.isErroneous ||
|
| - constant == null ||
|
| - constant.kind == ConstantExpressionKind.ERRONEOUS) {
|
| - // This is a non-constant constant constructor invocation, like
|
| - // `const Const(method())`.
|
| - constructorAccessSemantics = new ConstructorAccessSemantics(
|
| - ConstructorAccessKind.NON_CONSTANT_CONSTRUCTOR, element, type);
|
| - } else {
|
| - ConstantInvokeKind kind;
|
| - switch (constant.kind) {
|
| - case ConstantExpressionKind.CONSTRUCTED:
|
| - kind = ConstantInvokeKind.CONSTRUCTED;
|
| - break;
|
| - case ConstantExpressionKind.BOOL_FROM_ENVIRONMENT:
|
| - kind = ConstantInvokeKind.BOOL_FROM_ENVIRONMENT;
|
| - break;
|
| - case ConstantExpressionKind.INT_FROM_ENVIRONMENT:
|
| - kind = ConstantInvokeKind.INT_FROM_ENVIRONMENT;
|
| - break;
|
| - case ConstantExpressionKind.STRING_FROM_ENVIRONMENT:
|
| - kind = ConstantInvokeKind.STRING_FROM_ENVIRONMENT;
|
| - break;
|
| - default:
|
| - return internalError(
|
| - node, "Unexpected constant kind $kind: ${constant.getText()}");
|
| - }
|
| - return new ConstInvokeStructure(kind, constant);
|
| - }
|
| - }
|
| - return new NewInvokeStructure(constructorAccessSemantics, selector);
|
| - }
|
| -}
|
| -
|
| abstract class DeclStructure<R, A> {
|
| final FunctionElement element;
|
|
|
|
|