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

Side by Side Diff: pkg/compiler/lib/src/resolution/scope.dart

Issue 2603263002: Prefix resolution_types with Resolution. (Closed)
Patch Set: Rebased Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.resolution.scope; 5 library dart2js.resolution.scope;
6 6
7 import '../elements/resolution_types.dart'; 7 import '../elements/resolution_types.dart';
8 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
9 9
10 abstract class Scope { 10 abstract class Scope {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 Element add(Element newElement) { 59 Element add(Element newElement) {
60 throw "Cannot add element to VariableDefinitionScope"; 60 throw "Cannot add element to VariableDefinitionScope";
61 } 61 }
62 } 62 }
63 63
64 /// [TypeVariablesScope] defines the outer scope in a context where some type 64 /// [TypeVariablesScope] defines the outer scope in a context where some type
65 /// variables are declared and the entities in the enclosing scope are 65 /// variables are declared and the entities in the enclosing scope are
66 /// available, but where locally declared and inherited members are not 66 /// available, but where locally declared and inherited members are not
67 /// available. 67 /// available.
68 abstract class TypeVariablesScope extends NestedScope { 68 abstract class TypeVariablesScope extends NestedScope {
69 List<DartType> get typeVariables; 69 List<ResolutionDartType> get typeVariables;
70 70
71 TypeVariablesScope(Scope parent) : super(parent) { 71 TypeVariablesScope(Scope parent) : super(parent) {
72 assert(parent != null); 72 assert(parent != null);
73 } 73 }
74 74
75 Element add(Element newElement) { 75 Element add(Element newElement) {
76 throw "Cannot add element to TypeDeclarationScope"; 76 throw "Cannot add element to TypeDeclarationScope";
77 } 77 }
78 78
79 Element lookupTypeVariable(String name) { 79 Element lookupTypeVariable(String name) {
80 for (TypeVariableType type in typeVariables) { 80 for (ResolutionTypeVariableType type in typeVariables) {
81 if (type.name == name) { 81 if (type.name == name) {
82 return type.element; 82 return type.element;
83 } 83 }
84 } 84 }
85 return null; 85 return null;
86 } 86 }
87 87
88 Element localLookup(String name) => lookupTypeVariable(name); 88 Element localLookup(String name) => lookupTypeVariable(name);
89 } 89 }
90 90
91 /** 91 /**
92 * [TypeDeclarationScope] defines the outer scope of a type declaration in 92 * [TypeDeclarationScope] defines the outer scope of a type declaration in
93 * which the declared type variables and the entities in the enclosing scope are 93 * which the declared type variables and the entities in the enclosing scope are
94 * available but where declared and inherited members are not available. This 94 * available but where declared and inherited members are not available. This
95 * scope is used for class declarations during resolution of the class hierarchy 95 * scope is used for class declarations during resolution of the class hierarchy
96 * and when resolving typedef signatures. In other cases [ClassScope] is used. 96 * and when resolving typedef signatures. In other cases [ClassScope] is used.
97 */ 97 */
98 class TypeDeclarationScope extends TypeVariablesScope { 98 class TypeDeclarationScope extends TypeVariablesScope {
99 final GenericElement element; 99 final GenericElement element;
100 100
101 @override 101 @override
102 List<DartType> get typeVariables => element.typeVariables; 102 List<ResolutionDartType> get typeVariables => element.typeVariables;
103 103
104 TypeDeclarationScope(Scope parent, this.element) : super(parent); 104 TypeDeclarationScope(Scope parent, this.element) : super(parent);
105 105
106 String toString() => 'TypeDeclarationScope($element)'; 106 String toString() => 'TypeDeclarationScope($element)';
107 } 107 }
108 108
109 abstract class MutableScope extends NestedScope { 109 abstract class MutableScope extends NestedScope {
110 final Map<String, Element> elements; 110 final Map<String, Element> elements;
111 111
112 MutableScope(Scope parent) 112 MutableScope(Scope parent)
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 Element localLookup(String name) => library.find(name); 222 Element localLookup(String name) => library.find(name);
223 Element lookup(String name) => localLookup(name); 223 Element lookup(String name) => localLookup(name);
224 224
225 Element add(Element newElement) { 225 Element add(Element newElement) {
226 throw "Cannot add an element to a library scope"; 226 throw "Cannot add an element to a library scope";
227 } 227 }
228 228
229 String toString() => 'LibraryScope($library)'; 229 String toString() => 'LibraryScope($library)';
230 } 230 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/resolution_result.dart ('k') | pkg/compiler/lib/src/resolution/semantic_visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698