Index: dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart |
diff --git a/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart |
index b39441181dbaa2a1b0f3a4305f161f9603c53e03..3f9e10f8072786ecee5d58cf052b5935389fd2e7 100644 |
--- a/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart |
+++ b/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart |
@@ -77,6 +77,12 @@ class ResolverTask extends CompilerTask { |
TreeElements resolve(Element element) { |
return measure(() { |
ElementKind kind = element.kind; |
karlklose
2012/11/13 08:33:47
Move variable 'kind' down to its use.
ahe
2012/11/13 13:13:43
Done.
|
+ if (Elements.isErroneousElement(element)) return null; |
+ |
+ for (MetadataAnnotation metadata in element.metadata) { |
+ metadata.ensureResolved(compiler); |
+ } |
+ |
if (identical(kind, ElementKind.GENERATIVE_CONSTRUCTOR) || |
identical(kind, ElementKind.FUNCTION) || |
identical(kind, ElementKind.GETTER) || |
@@ -90,6 +96,14 @@ class ResolverTask extends CompilerTask { |
identical(kind, ElementKind.FIELD_PARAMETER)) { |
return resolveParameter(element); |
} |
+ if (element.isClass()) { |
+ ClassElement cls = element; |
+ cls.ensureResolved(compiler); |
+ return null; |
+ } else if (element.isTypedef()) { |
+ element.computeType(compiler); |
+ return null; |
+ } |
compiler.unimplemented("resolve($element)", |
node: element.parseNode(compiler)); |
@@ -628,7 +642,7 @@ class ResolverTask extends CompilerTask { |
visitorFor(annotation.annotatedElement.enclosingElement); |
node.accept(visitor); |
annotation.value = compiler.constantHandler.compileNodeWithDefinitions( |
- node, visitor.mapping); |
+ node, visitor.mapping, isConst: true); |
annotation.resolutionState = STATE_DONE; |
})); |
@@ -1201,8 +1215,12 @@ class ResolverVisitor extends CommonResolverVisitor<Element> { |
Element result = scope.lookup(name); |
if (!Elements.isUnresolved(result)) { |
if (!inInstanceContext && result.isInstanceMember()) { |
- error(node, MessageKind.NO_INSTANCE_AVAILABLE, [node]); |
- // TODO(johnniwinther): Create an ErroneousElement. |
+ compiler.reportMessage(compiler.spanFromNode(node), |
+ MessageKind.NO_INSTANCE_AVAILABLE.error([name]), |
+ Diagnostic.ERROR); |
+ return new ErroneousElement(MessageKind.NO_INSTANCE_AVAILABLE, |
+ [name], |
+ name, enclosingElement); |
} else if (result.isAmbiguous()) { |
AmbiguousElement ambiguous = result; |
compiler.reportMessage(compiler.spanFromNode(node), |