Chromium Code Reviews| Index: pkg/compiler/lib/src/resolution/scope.dart |
| diff --git a/pkg/compiler/lib/src/resolution/scope.dart b/pkg/compiler/lib/src/resolution/scope.dart |
| index 41df8033f6ef8b6710d5d7f0ab20b202471393f4..05473790843defd69f4bd9930bc48dac9dbc7b34 100644 |
| --- a/pkg/compiler/lib/src/resolution/scope.dart |
| +++ b/pkg/compiler/lib/src/resolution/scope.dart |
| @@ -58,17 +58,14 @@ class VariableDefinitionScope extends NestedScope { |
| } |
| } |
| -/** |
| - * [TypeDeclarationScope] defines the outer scope of a type declaration in |
| - * which the declared type variables and the entities in the enclosing scope are |
| - * available but where declared and inherited members are not available. This |
| - * scope is only used for class declarations during resolution of the |
| - * class hierarchy. In all other cases [ClassScope] is used. |
| - */ |
| -class TypeDeclarationScope extends NestedScope { |
| - final TypeDeclarationElement element; |
| - |
| - TypeDeclarationScope(parent, this.element) : super(parent) { |
| +/// [TypeVariablesScope] defines the outer scope in a context where some type |
| +/// variables are declared and the entities in the enclosing scope are |
| +/// available, but where locally declared and inherited members are not |
| +/// available. |
| +abstract class TypeVariablesScope extends NestedScope { |
| + List<DartType> get typeVariables; |
| + |
| + TypeVariablesScope(Scope parent) : super(parent) { |
| assert(parent != null); |
| } |
| @@ -77,7 +74,6 @@ class TypeDeclarationScope extends NestedScope { |
| } |
| Element lookupTypeVariable(String name) { |
| - List<DartType> typeVariables = element.typeVariables; |
| for (TypeVariableType type in typeVariables) { |
| if (type.name == name) { |
| return type.element; |
| @@ -87,6 +83,22 @@ class TypeDeclarationScope extends NestedScope { |
| } |
| Element localLookup(String name) => lookupTypeVariable(name); |
| +} |
| + |
| +/** |
| + * [TypeDeclarationScope] defines the outer scope of a type declaration in |
| + * which the declared type variables and the entities in the enclosing scope are |
| + * available but where declared and inherited members are not available. This |
| + * scope is only used for class declarations during resolution of the |
| + * class hierarchy. In all other cases [ClassScope] is used. |
|
Johnni Winther
2016/04/29 07:21:06
It is also used for resolving typedef signatures.
eernst
2016/04/29 13:24:50
Done.
|
| + */ |
| +class TypeDeclarationScope extends TypeVariablesScope { |
| + final GenericElement element; |
| + |
| + @override |
| + List<DartType> get typeVariables => element.typeVariables; |
| + |
| + TypeDeclarationScope(Scope parent, this.element) : super(parent); |
| String toString() => 'TypeDeclarationScope($element)'; |
| } |