| Index: sdk/lib/_internal/compiler/implementation/resolution/members.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
|
| index a72e7b2a9e2b417e4edac2d610dbf959719bc384..e5b2b8b6137ac7632ad876c4acd2ed8585a40059 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
|
| @@ -1666,52 +1666,34 @@ class TypeResolver {
|
|
|
| TypeResolver(this.compiler);
|
|
|
| - /// Tries to resolve the type name as an element.
|
| - Element resolveTypeName(Identifier prefixName,
|
| - Identifier typeName,
|
| - Scope scope,
|
| - {bool deferredIsMalformed: true}) {
|
| - Element element;
|
| - bool deferredTypeAnnotation = false;
|
| + Element resolveTypeName(Scope scope,
|
| + Identifier prefixName,
|
| + Identifier typeName) {
|
| if (prefixName != null) {
|
| - Element prefixElement =
|
| + Element element =
|
| lookupInScope(compiler, prefixName, scope, prefixName.source);
|
| - if (prefixElement != null && prefixElement.isPrefix()) {
|
| + if (element != null && element.isPrefix()) {
|
| // The receiver is a prefix. Lookup in the imported members.
|
| - PrefixElement prefix = prefixElement;
|
| - element = prefix.lookupLocalMember(typeName.source);
|
| - // TODO(17260, sigurdm): The test for DartBackend is there because
|
| - // dart2dart outputs malformed types with prefix.
|
| - if (element != null &&
|
| - prefix.isDeferred &&
|
| - deferredIsMalformed &&
|
| - compiler.backend is! DartBackend) {
|
| - element = new ErroneousElementX(MessageKind.DEFERRED_TYPE_ANNOTATION,
|
| - {'node': typeName},
|
| - element.name,
|
| - element);
|
| - }
|
| - } else {
|
| - // The caller of this method will create the ErroneousElement for
|
| - // the MalformedType.
|
| - element = null;
|
| + PrefixElement prefix = element;
|
| + return prefix.lookupLocalMember(typeName.source);
|
| }
|
| + // The caller of this method will create the ErroneousElement for
|
| + // the MalformedType.
|
| + return null;
|
| } else {
|
| String stringValue = typeName.source;
|
| if (identical(stringValue, 'void')) {
|
| - element = compiler.types.voidType.element;
|
| + return compiler.types.voidType.element;
|
| } else if (identical(stringValue, 'dynamic')) {
|
| - element = compiler.dynamicClass;
|
| + return compiler.dynamicClass;
|
| } else {
|
| - element = lookupInScope(compiler, typeName, scope, typeName.source);
|
| + return lookupInScope(compiler, typeName, scope, typeName.source);
|
| }
|
| }
|
| - return element;
|
| }
|
|
|
| DartType resolveTypeAnnotation(MappingVisitor visitor, TypeAnnotation node,
|
| - {bool malformedIsError: false,
|
| - bool deferredIsMalformed: true}) {
|
| + {bool malformedIsError: false}) {
|
| Identifier typeName;
|
| Identifier prefixName;
|
| Send send = node.typeName.asSend();
|
| @@ -1723,24 +1705,20 @@ class TypeResolver {
|
| typeName = node.typeName.asIdentifier();
|
| }
|
|
|
| - Element element = resolveTypeName(prefixName, typeName, visitor.scope,
|
| - deferredIsMalformed: deferredIsMalformed);
|
| + Element element = resolveTypeName(visitor.scope, prefixName, typeName);
|
|
|
| DartType reportFailureAndCreateType(MessageKind messageKind,
|
| Map messageArguments,
|
| - {DartType userProvidedBadType,
|
| - Element erroneousElement}) {
|
| + {DartType userProvidedBadType}) {
|
| if (malformedIsError) {
|
| visitor.error(node, messageKind, messageArguments);
|
| } else {
|
| compiler.backend.registerThrowRuntimeError(visitor.mapping);
|
| visitor.warning(node, messageKind, messageArguments);
|
| }
|
| - if (erroneousElement == null) {
|
| - erroneousElement = new ErroneousElementX(
|
| - messageKind, messageArguments, typeName.source,
|
| - visitor.enclosingElement);
|
| - }
|
| + Element erroneousElement = new ErroneousElementX(
|
| + messageKind, messageArguments, typeName.source,
|
| + visitor.enclosingElement);
|
| LinkBuilder<DartType> arguments = new LinkBuilder<DartType>();
|
| resolveTypeArguments(visitor, node, null, arguments);
|
| return new MalformedType(erroneousElement,
|
| @@ -1760,7 +1738,6 @@ class TypeResolver {
|
| return type;
|
| }
|
|
|
| - // Try to construct the type from the element.
|
| DartType type;
|
| if (element == null) {
|
| type = reportFailureAndCreateType(
|
| @@ -1773,11 +1750,6 @@ class TypeResolver {
|
| } else if (!element.impliesType()) {
|
| type = reportFailureAndCreateType(
|
| MessageKind.NOT_A_TYPE, {'node': node.typeName});
|
| - } else if (element.isErroneous()) {
|
| - ErroneousElement erroneousElement = element;
|
| - type = reportFailureAndCreateType(
|
| - erroneousElement.messageKind, erroneousElement.messageArguments,
|
| - erroneousElement: erroneousElement);
|
| } else {
|
| bool addTypeVariableBoundsCheck = false;
|
| if (identical(element, compiler.types.voidType.element) ||
|
| @@ -3209,11 +3181,9 @@ class ResolverVisitor extends MappingVisitor<Element> {
|
| }
|
|
|
| DartType resolveTypeAnnotation(TypeAnnotation node,
|
| - {bool malformedIsError: false,
|
| - bool deferredIsMalformed: true}) {
|
| + {bool malformedIsError: false}) {
|
| DartType type = typeResolver.resolveTypeAnnotation(
|
| - this, node, malformedIsError: malformedIsError,
|
| - deferredIsMalformed: deferredIsMalformed);
|
| + this, node, malformedIsError: malformedIsError);
|
| if (type == null) return null;
|
| if (inCheckContext) {
|
| compiler.enqueuer.resolution.registerIsCheck(type, mapping);
|
| @@ -4597,11 +4567,8 @@ class ConstructorResolver extends CommonResolverVisitor<Element> {
|
|
|
| Element visitTypeAnnotation(TypeAnnotation node) {
|
| assert(invariant(node, type == null));
|
| - // This is not really resolving a type-annotation, but the name of the
|
| - // constructor. Therefore we allow deferred types.
|
| type = resolver.resolveTypeAnnotation(node,
|
| - malformedIsError: inConstContext,
|
| - deferredIsMalformed: false);
|
| + malformedIsError: inConstContext);
|
| compiler.backend.registerRequiredType(type, resolver.enclosingElement);
|
| return type.element;
|
| }
|
|
|