Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/elements/modelx.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart |
| index acc035bc29f2005c78bb796ec453e6c9f14f138b..3a42bb9f9467ad91c28cdee54328213a2a3cdcae 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart |
| @@ -61,7 +61,7 @@ abstract class ElementX extends Element { |
| return null; |
| } |
| - void addMetadata(MetadataAnnotation annotation) { |
| + void addMetadata(MetadataAnnotationX annotation) { |
| assert(annotation.annotatedElement == null); |
| annotation.annotatedElement = this; |
| addMetadataInternal(annotation); |
| @@ -201,7 +201,7 @@ abstract class ElementX extends Element { |
| } |
| Element get outermostEnclosingMemberOrTopLevel { |
|
karlklose
2014/05/22 06:27:29
Add a TODO to remove this helper or give it a bett
Johnni Winther
2014/05/22 10:09:09
Done.
|
| - // TODO(lrn): Why is this called "Outermost"? |
| + // TODO(johnniwinther): Fix this for members of a closure class. |
| for (Element e = this; e != null; e = e.enclosingElement) { |
| if (e.isMember || e.isTopLevel) { |
| return e; |
| @@ -264,7 +264,9 @@ abstract class ElementX extends Element { |
| void diagnose(Element context, DiagnosticListener listener) {} |
| - TreeElements get treeElements => enclosingElement.treeElements; |
| + TreeElements get treeElements => analyzableElement.treeElements; |
| + |
| + Element get analyzableElement => outermostEnclosingMemberOrTopLevel; |
| } |
| /** |
| @@ -541,7 +543,7 @@ class ScopeX { |
| } |
| } |
| -class CompilationUnitElementX extends ElementX with AnalyzableElement |
| +class CompilationUnitElementX extends ElementX |
| implements CompilationUnitElement { |
| final Script script; |
| PartOf partTag; |
| @@ -610,6 +612,8 @@ class CompilationUnitElementX extends ElementX with AnalyzableElement |
| return '${script.readableUri}'.compareTo('${other.script.readableUri}'); |
| } |
| + Element get analyzableElement => library; |
| + |
| accept(ElementVisitor visitor) => visitor.visitCompilationUnitElement(this); |
| } |
| @@ -772,6 +776,8 @@ class LibraryElementX |
| CompilationUnitElement get compilationUnit => entryCompilationUnit; |
| + Element get analyzableElement => this; |
| + |
| void addCompilationUnit(CompilationUnitElement element) { |
| compilationUnits = compilationUnits.prepend(element); |
| } |