Index: lib/compiler/implementation/elements/elements.dart |
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart |
index 390d775f5e8968ba4bcdcb888eff0d33fd086f3a..a337c1f5a2a6621b91c328404b8fe36a440231f1 100644 |
--- a/lib/compiler/implementation/elements/elements.dart |
+++ b/lib/compiler/implementation/elements/elements.dart |
@@ -341,6 +341,11 @@ class Element implements Spannable { |
FunctionElement asFunctionElement() => null; |
static bool isInvalid(Element e) => e == null || e.isErroneous(); |
+ |
+ bool inStaticContext() { |
+ return modifiers !== null && modifiers.isStatic(); |
ahe
2012/10/04 07:51:02
Didn't Johnni land a change that ensures modifiers
aam-me
2012/10/10 02:48:40
Done.
|
+ } |
+ |
Element cloneTo(Element enclosing, DiagnosticListener listener) { |
listener.cancel("Unimplemented cloneTo", element: this); |
} |
@@ -926,15 +931,8 @@ class VariableListElement extends Element { |
return isMember() && !modifiers.isStatic(); |
} |
- // TODO(johnniwinther): Rewrite to avoid the optional argument. |
- Scope buildScope({bool patchScope: false}) { |
- Scope result = new VariableScope( |
- enclosingElement.buildScope(patchScope: patchScope), this); |
- if (enclosingElement.isClass()) { |
- Scope clsScope = result.parent; |
- clsScope.inStaticContext = !isInstanceMember(); |
- } |
- return result; |
+ bool inStaticContext() { |
+ return super.inStaticContext() || enclosingElement.inStaticContext(); |
} |
} |
@@ -1198,10 +1196,6 @@ class FunctionElement extends Element { |
Scope buildScope({bool patchScope: false}) { |
Scope result = new MethodScope( |
enclosingElement.buildScope(patchScope: patchScope), this); |
- if (enclosingElement.isClass()) { |
- Scope clsScope = result.parent; |
- clsScope.inStaticContext = !isInstanceMember() && !isConstructor(); |
- } |
return result; |
} |
} |