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

Unified Diff: pkg/compiler/lib/src/resolution/scope.dart

Issue 1942763002: Rebased and retested version of CL 1915123008. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 | « pkg/compiler/lib/src/resolution/resolution.dart ('k') | pkg/compiler/lib/src/resolution/signatures.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..75c3de9b7dc0c5eda317ccbe01d97bbcb6b6f5b6 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 used for class declarations during resolution of the class hierarchy
+ * and when resolving typedef signatures. In other cases [ClassScope] is used.
+ */
+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)';
}
« no previous file with comments | « pkg/compiler/lib/src/resolution/resolution.dart ('k') | pkg/compiler/lib/src/resolution/signatures.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698