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

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: Removed passing test from the exception list. Created 8 years, 3 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/resolver.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 3775bc740d446d42d288da93064db6a366e48a8f..70560c1a69d6a93bb95bb31b0c8dacae8f3aa99d 100644
--- a/lib/compiler/implementation/elements/elements.dart
+++ b/lib/compiler/implementation/elements/elements.dart
@@ -342,6 +342,10 @@ class Element implements Hashable, Spannable {
FunctionElement asFunctionElement() => null;
+ bool inStaticContext() {
+ return modifiers !== null && modifiers.isStatic();
+ }
+
Element cloneTo(Element enclosing, DiagnosticListener listener) {
listener.cancel("Unimplemented cloneTo", element: this);
}
@@ -856,13 +860,12 @@ class VariableListElement extends Element {
return isMember() && !modifiers.isStatic();
}
+ bool inStaticContext() {
+ return super.inStaticContext() || enclosingElement.inStaticContext();
+ }
+
Scope buildScope() {
- Scope result = new VariableScope(enclosingElement.buildScope(), this);
- if (enclosingElement.isClass()) {
- ClassScope clsScope = result.parent;
- clsScope.inStaticContext = !isInstanceMember();
- }
- return result;
+ return new VariableScope(enclosingElement.buildScope(), this);
}
}
@@ -1125,13 +1128,7 @@ class FunctionElement extends Element {
}
Scope buildScope() {
Johnni Winther 2012/10/02 09:07:30 Remove this method. MethodScope is mutable and sho
aam-me 2012/10/02 12:50:39 Johnni, removing this method causes "Internal e
Johnni Winther 2012/10/03 10:40:33 OK. Just leave it there. I'll try to remove it in
- Scope result =
- new MethodScope(enclosingElement.buildScope(), this);
- if (enclosingElement.isClass()) {
- Scope clsScope = result.parent;
- clsScope.inStaticContext = !isInstanceMember() && !isConstructor();
- }
- return result;
+ return new MethodScope(enclosingElement.buildScope(), this);
}
}
« no previous file with comments | « no previous file | lib/compiler/implementation/resolver.dart » ('j') | lib/compiler/implementation/resolver.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698