Chromium Code Reviews| Index: frog/leg/elements/elements.dart |
| diff --git a/frog/leg/elements/elements.dart b/frog/leg/elements/elements.dart |
| index f39d2457d8771d8bb38585ba63fd171751bd1637..28a6cfedecc4272d5ca4e0f799a48e251b223506 100644 |
| --- a/frog/leg/elements/elements.dart |
| +++ b/frog/leg/elements/elements.dart |
| @@ -627,6 +627,9 @@ class Elements { |
| static bool isStaticOrTopLevelField(Element element) { |
| return (element != null) |
| && !element.isInstanceMember() |
| + && (element.enclosingElement.kind == ElementKind.CLASS || |
| + element.enclosingElement.kind == ElementKind.COMPILATION_UNIT || |
| + element.enclosingElement.kind == ElementKind.LIBRARY) |
|
ngeoffray
2012/02/13 10:13:38
I believe element.enclosing is null for library el
floitsch
2012/02/13 12:03:42
done (null check).
refactored into a isStaticOrTop
|
| && (element.kind === ElementKind.FIELD |
| || element.kind === ElementKind.GETTER |
| || element.kind === ElementKind.SETTER); |
|
ngeoffray
2012/02/13 10:13:38
Which of these kinds do not have an enclosing as c
floitsch
2012/02/13 12:03:42
refactored.
|
| @@ -635,6 +638,9 @@ class Elements { |
| static bool isStaticOrTopLevelFunction(Element element) { |
| return (element != null) |
| && !element.isInstanceMember() |
| + && (element.enclosingElement.kind == ElementKind.CLASS || |
| + element.enclosingElement.kind == ElementKind.COMPILATION_UNIT || |
| + element.enclosingElement.kind == ElementKind.LIBRARY) |
|
ngeoffray
2012/02/13 10:13:38
Same comments as above.
floitsch
2012/02/13 12:03:42
the enclosing element of JS is LIBRARY.
|
| && (element.kind === ElementKind.FUNCTION); |
| } |
| @@ -658,7 +664,9 @@ class Elements { |
| if (element === null && send.selector.asIdentifier() === null) return true; |
| if (element === null) return false; |
| // foo() with foo a local or a parameter. |
| - return element.isVariable() || element.isParameter(); |
| + if (element.isVariable() || element.isParameter()) return true; |
|
ngeoffray
2012/02/13 10:13:38
Could that just be return element.isLocal()?
floitsch
2012/02/13 12:03:42
Done.
|
| + if (element.kind == ElementKind.FUNCTION && isLocal(element)) return true; |
| + return false; |
| } |
| static SourceString constructConstructorName(SourceString receiver, |