 Chromium Code Reviews
 Chromium Code Reviews 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
    
  
    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| 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); | 
| } | 
| } |