Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 11361124: Introduce AmbiguousElement (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of resolution; 5 part of resolution;
6 6
7 abstract class TreeElements { 7 abstract class TreeElements {
8 Element operator[](Node node); 8 Element operator[](Node node);
9 Selector getSelector(Send send); 9 Selector getSelector(Send send);
10 DartType getType(Node node); 10 DartType getType(Node node);
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 return resolveTypeAnnotationInContext(scope, node, onFailure, 1076 return resolveTypeAnnotationInContext(scope, node, onFailure,
1077 whenResolved); 1077 whenResolved);
1078 } 1078 }
1079 1079
1080 DartType resolveTypeAnnotationInContext(Scope scope, TypeAnnotation node, 1080 DartType resolveTypeAnnotationInContext(Scope scope, TypeAnnotation node,
1081 onFailure, whenResolved) { 1081 onFailure, whenResolved) {
1082 Element element = resolveTypeName(scope, node); 1082 Element element = resolveTypeName(scope, node);
1083 DartType type; 1083 DartType type;
1084 if (element == null) { 1084 if (element == null) {
1085 onFailure(node, MessageKind.CANNOT_RESOLVE_TYPE, [node.typeName]); 1085 onFailure(node, MessageKind.CANNOT_RESOLVE_TYPE, [node.typeName]);
1086 } else if (element.isErroneous()) { 1086 } else if (element.isAmbiguous()) {
1087 ErroneousElement error = element; 1087 AmbiguousElement ambiguous = element;
1088 onFailure(node, error.messageKind, error.messageArguments); 1088 onFailure(node, ambiguous.messageKind, ambiguous.messageArguments);
1089 } else if (!element.impliesType()) { 1089 } else if (!element.impliesType()) {
1090 onFailure(node, MessageKind.NOT_A_TYPE, [node.typeName]); 1090 onFailure(node, MessageKind.NOT_A_TYPE, [node.typeName]);
1091 } else { 1091 } else {
1092 if (identical(element, compiler.types.voidType.element) || 1092 if (identical(element, compiler.types.voidType.element) ||
1093 identical(element, compiler.types.dynamicType.element)) { 1093 identical(element, compiler.types.dynamicType.element)) {
1094 type = element.computeType(compiler); 1094 type = element.computeType(compiler);
1095 } else if (element.isClass()) { 1095 } else if (element.isClass()) {
1096 ClassElement cls = element; 1096 ClassElement cls = element;
1097 cls.ensureResolved(compiler); 1097 cls.ensureResolved(compiler);
1098 Link<DartType> arguments = 1098 Link<DartType> arguments =
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 } 1267 }
1268 return null; 1268 return null;
1269 } else { 1269 } else {
1270 Element element = lookup(node, node.source); 1270 Element element = lookup(node, node.source);
1271 if (element == null) { 1271 if (element == null) {
1272 if (!inInstanceContext) { 1272 if (!inInstanceContext) {
1273 element = warnAndCreateErroneousElement(node, node.source, 1273 element = warnAndCreateErroneousElement(node, node.source,
1274 MessageKind.CANNOT_RESOLVE, 1274 MessageKind.CANNOT_RESOLVE,
1275 [node]); 1275 [node]);
1276 } 1276 }
1277 } else if (element.isErroneous()) { 1277 } else if (element.isAmbiguous()) {
1278 element = warnOnErroneousElement(node, element); 1278 AmbiguousElement ambiguous = element;
1279 element = warnAndCreateErroneousElement(
1280 node, node.source, ambiguous.messageKind, ambiguous.messageArguments );
ahe 2012/11/06 16:28:10 Long line.
Johnni Winther 2012/11/07 08:24:43 Done.
1279 } else { 1281 } else {
1280 if ((element.kind.category & allowedCategory) == 0) { 1282 if ((element.kind.category & allowedCategory) == 0) {
1281 // TODO(ahe): Improve error message. Need UX input. 1283 // TODO(ahe): Improve error message. Need UX input.
1282 error(node, MessageKind.GENERIC, ["is not an expression $element"]); 1284 error(node, MessageKind.GENERIC, ["is not an expression $element"]);
1283 } 1285 }
1284 } 1286 }
1285 if (!Elements.isUnresolved(element) 1287 if (!Elements.isUnresolved(element)
1286 && element.kind == ElementKind.CLASS) { 1288 && element.kind == ElementKind.CLASS) {
1287 ClassElement classElement = element; 1289 ClassElement classElement = element;
1288 classElement.ensureResolved(compiler); 1290 classElement.ensureResolved(compiler);
(...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after
3038 return e; 3040 return e;
3039 } 3041 }
3040 3042
3041 /// Assumed to be called by [resolveRedirectingFactory]. 3043 /// Assumed to be called by [resolveRedirectingFactory].
3042 Element visitReturn(Return node) { 3044 Element visitReturn(Return node) {
3043 Expression expression = node.expression; 3045 Expression expression = node.expression;
3044 return finishConstructorReference(visit(expression), 3046 return finishConstructorReference(visit(expression),
3045 expression, expression); 3047 expression, expression);
3046 } 3048 }
3047 } 3049 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698