Chromium Code Reviews| Index: lib/compiler/implementation/elements/elements.dart |
| diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart |
| index 1556604510ef10e1cbcc23df93d4c0ac91e69f10..58d44411abd83516d40d5f554f55dc2b1edeaf92 100644 |
| --- a/lib/compiler/implementation/elements/elements.dart |
| +++ b/lib/compiler/implementation/elements/elements.dart |
| @@ -118,9 +118,15 @@ class Element implements Hashable { |
| } |
| bool isFunction() => kind === ElementKind.FUNCTION; |
| + bool isConstructor() => isFactoryConstructor() || isGenerativeConstructor(); |
| bool isClosure() => false; |
| - bool isMember() => |
| - enclosingElement !== null && enclosingElement.kind === ElementKind.CLASS; |
| + bool isMember() { |
| + // Check that this element is defined in the scope of a Class. |
| + Element enclosing = enclosingElement; |
| + // TODO(lrn): Skip any synthetic elements inserted, e.g., |
|
Anders Johnsen
2012/08/09 08:08:37
Maybe just travel up the tree and see if you hit a
Lasse Reichstein Nielsen
2012/08/09 11:22:09
Alas no. That would make the parameter of a method
|
| + // a compilation unit override. |
| + return enclosing !== null && enclosing.isClass(); |
| + } |
| bool isInstanceMember() => false; |
| bool isFactoryConstructor() => modifiers !== null && modifiers.isFactory(); |
| bool isGenerativeConstructor() => kind === ElementKind.GENERATIVE_CONSTRUCTOR; |
| @@ -142,6 +148,7 @@ class Element implements Hashable { |
| bool isSetter() => kind === ElementKind.SETTER; |
| bool isAccessor() => isGetter() || isSetter(); |
| bool isForeign() => kind === ElementKind.FOREIGN; |
| + bool isLibrary() => kind === ElementKind.LIBRARY; |
| bool impliesType() => (kind.category & ElementCategory.IMPLIES_TYPE) != 0; |
| bool isExtendable() => (kind.category & ElementCategory.IS_EXTENDABLE) != 0; |
| @@ -193,7 +200,7 @@ class Element implements Hashable { |
| ClassElement getEnclosingClass() { |
| for (Element e = this; e !== null; e = e.enclosingElement) { |
| - if (e.kind === ElementKind.CLASS) return e; |
| + if (e.isClass()) return e; |
| } |
| return null; |
| } |
| @@ -206,6 +213,7 @@ class Element implements Hashable { |
| } |
| Element getOutermostEnclosingMemberOrTopLevel() { |
| + // TODO(lrn): Why is this called "Outermost"? |
| for (Element e = this; e !== null; e = e.enclosingElement) { |
| if (e.isMember() || e.isTopLevel()) { |
| return e; |