Chromium Code Reviews| Index: dart/pkg/compiler/lib/src/resolution/members.dart |
| diff --git a/dart/pkg/compiler/lib/src/resolution/members.dart b/dart/pkg/compiler/lib/src/resolution/members.dart |
| index 40d197f2d6408f4ebc9a55c5d5d37ba467696ef8..18309afce5bab2af2f045ba96af5fb3d8d733c41 100644 |
| --- a/dart/pkg/compiler/lib/src/resolution/members.dart |
| +++ b/dart/pkg/compiler/lib/src/resolution/members.dart |
| @@ -2245,8 +2245,6 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> { |
| } else if (node.isSuper()) { |
| if (!inInstanceContext) { |
| error(node, MessageKind.NO_SUPER_IN_STATIC); |
| - // TODO(ahe): Don't throw, recover from error. |
| - throw new CompilerCancelledException(null); |
| } |
| if ((ElementCategory.SUPER & allowedCategory) == 0) { |
| error(node, MessageKind.INVALID_USE_OF_SUPER); |
| @@ -2274,11 +2272,11 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> { |
| // Use the erroneous element. |
| } else { |
| if ((element.kind.category & allowedCategory) == 0) { |
| - // TODO(ahe): Improve error message. Need UX input. |
| - error(node, MessageKind.GENERIC, |
| - {'text': "is not an expression $element"}); |
| - // TODO(ahe): Don't throw, recover from error. |
| - throw new CompilerCancelledException(null); |
| + element = warnAndCreateErroneousElement( |
|
Johnni Winther
2015/01/09 08:44:17
Add a TODO to create a more precise erroneous elem
ahe
2015/01/09 10:43:46
Are you suggesting that we decode allowedCategory
Johnni Winther
2015/01/09 11:12:47
Yes.
ahe
2015/01/09 11:43:24
Done in CL 837563004.
|
| + node, name, |
| + MessageKind.GENERIC, |
| + // TODO(ahe): Improve error message. Need UX input. |
| + {'text': "is not an expression $element"}); |
| } |
| } |
| if (!Elements.isUnresolved(element) && element.isClass) { |
| @@ -4924,15 +4922,20 @@ class ConstructorResolver extends CommonResolverVisitor<Element> { |
| } else if (element.isTypedef) { |
| error(node, MessageKind.CANNOT_INSTANTIATE_TYPEDEF, |
| {'typedefName': name}); |
| + element = new ErroneousElementX( |
|
Johnni Winther
2015/01/09 08:44:18
Ditto.
ahe
2015/01/09 10:43:46
Are you thinking of an element like this:
class E
Johnni Winther
2015/01/09 11:12:47
Yes.
ahe
2015/01/09 11:43:24
Done in CL 837563004.
|
| + MessageKind.CANNOT_INSTANTIATE_TYPEDEF, |
| + {'typedefName': name}, name, resolver.enclosingElement); |
| } else if (element.isTypeVariable) { |
| error(node, MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE, |
| {'typeVariableName': name}); |
| - // TODO(ahe): Don't throw, recover from error. |
| - throw new CompilerCancelledException(null); |
| + element = new ErroneousElementX( |
|
Johnni Winther
2015/01/09 08:44:18
Ditto.
ahe
2015/01/09 11:43:24
Done in CL 837563004.
|
| + MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE, |
| + {'typeVariableName': name}, name, resolver.enclosingElement); |
| } else if (!element.isClass && !element.isPrefix) { |
| error(node, MessageKind.NOT_A_TYPE, {'node': name}); |
| - // TODO(ahe): Don't throw, recover from error. |
| - throw new CompilerCancelledException(null); |
| + element = new ErroneousElementX( |
|
Johnni Winther
2015/01/09 08:44:18
Ditto.
ahe
2015/01/09 11:43:24
Done in CL 837563004.
|
| + MessageKind.NOT_A_TYPE, {'node': name}, name, |
| + resolver.enclosingElement); |
| } |
| return element; |
| } |