| Index: dart/lib/compiler/implementation/elements/elements.dart
|
| diff --git a/dart/lib/compiler/implementation/elements/elements.dart b/dart/lib/compiler/implementation/elements/elements.dart
|
| index 1878a37c3221e27c4bf750c76444dd147556fd00..0a47eb1e2ec0077dfb98be59d555fcc51cc8570f 100644
|
| --- a/dart/lib/compiler/implementation/elements/elements.dart
|
| +++ b/dart/lib/compiler/implementation/elements/elements.dart
|
| @@ -216,6 +216,8 @@ class Element implements Hashable {
|
| bool _isNative = false;
|
| void setNative() { _isNative = true; }
|
| bool isNative() => _isNative;
|
| +
|
| + FunctionElement asFunctionElement() => null;
|
| }
|
|
|
| class ContainerElement extends Element {
|
| @@ -252,12 +254,12 @@ class ContainerElement extends Element {
|
| }
|
| } else {
|
| AbstractFieldElement field = new AbstractFieldElement(element.name, this);
|
| - addMember(field, listener);
|
| if (element.kind == ElementKind.GETTER) {
|
| field.getter = element;
|
| } else {
|
| field.setter = element;
|
| }
|
| + addMember(field, listener);
|
| }
|
| }
|
| }
|
| @@ -502,11 +504,9 @@ class ForeignElement extends Element {
|
| class AbstractFieldElement extends Element {
|
| FunctionElement getter;
|
| FunctionElement setter;
|
| - Modifiers modifiers;
|
|
|
| AbstractFieldElement(SourceString name, Element enclosing)
|
| - : super(name, ElementKind.ABSTRACT_FIELD, enclosing),
|
| - modifiers = new Modifiers.empty();
|
| + : super(name, ElementKind.ABSTRACT_FIELD, enclosing);
|
|
|
| Type computeType(Compiler compiler) {
|
| throw "internal error: AbstractFieldElement has no type";
|
| @@ -526,11 +526,23 @@ class AbstractFieldElement extends Element {
|
| // the compilation unit of the abstract element.
|
| if (getter !== null && getter.enclosingElement === enclosingElement) {
|
| return getter.position();
|
| - } else if (setter != null) {
|
| - // TODO(ahe): checking for null should not be necessary.
|
| + } else {
|
| return setter.position();
|
| }
|
| }
|
| +
|
| + Modifiers get modifiers() {
|
| + // The resolver ensures that the flags match (ignoring abstract).
|
| + if (getter !== null) {
|
| + return new Modifiers.withFlags(
|
| + getter.modifiers.nodes,
|
| + getter.modifiers.flags | Modifiers.FLAG_ABSTRACT);
|
| + } else {
|
| + return new Modifiers.withFlags(
|
| + setter.modifiers.nodes,
|
| + setter.modifiers.flags | Modifiers.FLAG_ABSTRACT);
|
| + }
|
| + }
|
| }
|
|
|
| class FunctionSignature {
|
| @@ -642,6 +654,8 @@ class FunctionElement extends Element {
|
| Node parseNode(DiagnosticListener listener) => cachedNode;
|
|
|
| Token position() => cachedNode.getBeginToken();
|
| +
|
| + FunctionElement asFunctionElement() => this;
|
| }
|
|
|
| class ConstructorBodyElement extends FunctionElement {
|
| @@ -735,12 +749,7 @@ class ClassElement extends ContainerElement {
|
| }
|
|
|
| ClassElement ensureResolved(Compiler compiler) {
|
| - if (!isResolved && !isBeingResolved) {
|
| - isBeingResolved = true;
|
| - compiler.resolveClass(this);
|
| - isBeingResolved = false;
|
| - isResolved = true;
|
| - }
|
| + compiler.resolveClass(this);
|
| return this;
|
| }
|
|
|
| @@ -756,11 +765,12 @@ class ClassElement extends ContainerElement {
|
| Element lookupSuperMember(SourceString memberName) {
|
| for (ClassElement s = superclass; s != null; s = s.superclass) {
|
| Element e = s.lookupLocalMember(memberName);
|
| - if (e !== null) {
|
| - if (!memberName.isPrivate() || getLibrary() === e.getLibrary()) {
|
| - return e;
|
| - }
|
| - }
|
| + if (e === null) continue;
|
| + // Private members from a different library are not visible.
|
| + if (memberName.isPrivate() && getLibrary() !== e.getLibrary()) continue;
|
| + // Static members are not inherited.
|
| + if (e.modifiers.isStatic()) continue;
|
| + return e;
|
| }
|
| return null;
|
| }
|
|
|