Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Unified Diff: lib/compiler/implementation/elements/elements.dart

Issue 10996039: Bring type variables into static scope, but produce compile-time error when they are used. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Just rebased Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/compiler/implementation/resolver.dart » ('j') | lib/compiler/implementation/warnings.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
}
« no previous file with comments | « no previous file | lib/compiler/implementation/resolver.dart » ('j') | lib/compiler/implementation/warnings.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698