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

Side by Side Diff: pkg/compiler/lib/src/universe/use.dart

Issue 2644533002: Mostly use entities in use.dart (Closed)
Patch Set: Fixes 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 /// This library defines individual world impacts. 5 /// This library defines individual world impacts.
6 /// 6 ///
7 /// We call these building blocks `uses`. Each `use` is a single impact of the 7 /// We call these building blocks `uses`. Each `use` is a single impact of the
8 /// world. Some example uses are: 8 /// world. Some example uses are:
9 /// 9 ///
10 /// * an invocation of a top level function 10 /// * an invocation of a top level function
11 /// * a call to the `foo()` method on an unknown class. 11 /// * a call to the `foo()` method on an unknown class.
12 /// * an instantiation of class T 12 /// * an instantiation of class T
13 /// 13 ///
14 /// The different compiler stages combine these uses into `WorldImpact` objects, 14 /// The different compiler stages combine these uses into `WorldImpact` objects,
15 /// which are later used to construct a closed-world understanding of the 15 /// which are later used to construct a closed-world understanding of the
16 /// program. 16 /// program.
17 library dart2js.universe.use; 17 library dart2js.universe.use;
18 18
19 import '../closure.dart' show BoxFieldElement; 19 import '../closure.dart' show BoxFieldElement;
20 import '../common.dart'; 20 import '../common.dart';
21 import '../elements/types.dart'; 21 import '../elements/types.dart';
22 import '../elements/elements.dart'; 22 import '../elements/elements.dart'
23 show
24 ConstructorElement,
25 ConstructorBodyElement,
26 Element,
27 Entity,
Siggi Cherem (dart-lang) 2017/01/18 19:27:53 should we move Entity to entities.dart?
Johnni Winther 2017/01/19 12:20:57 Soon-ish.
28 LocalFunctionElement;
29 import '../elements/entities.dart';
23 import '../util/util.dart' show Hashing; 30 import '../util/util.dart' show Hashing;
24 import '../world.dart' show World; 31 import '../world.dart' show World;
25 import 'call_structure.dart' show CallStructure; 32 import 'call_structure.dart' show CallStructure;
26 import 'selector.dart' show Selector; 33 import 'selector.dart' show Selector;
27 import 'world_builder.dart' show ReceiverConstraint; 34 import 'world_builder.dart' show ReceiverConstraint;
28 35
29 enum DynamicUseKind { 36 enum DynamicUseKind {
30 INVOKE, 37 INVOKE,
31 GET, 38 GET,
32 SET, 39 SET,
33 } 40 }
34 41
35 /// The use of a dynamic property. [selector] defined the name and kind of the 42 /// The use of a dynamic property. [selector] defined the name and kind of the
36 /// property and [mask] defines the known constraint for the object on which 43 /// property and [mask] defines the known constraint for the object on which
37 /// the property is accessed. 44 /// the property is accessed.
38 class DynamicUse { 45 class DynamicUse {
39 final Selector selector; 46 final Selector selector;
40 final ReceiverConstraint mask; 47 final ReceiverConstraint mask;
41 48
42 DynamicUse(this.selector, this.mask); 49 DynamicUse(this.selector, this.mask);
43 50
44 bool appliesUnnamed(Element element, World world) { 51 bool appliesUnnamed(MemberEntity element, World world) {
45 return selector.appliesUnnamed(element) && 52 return selector.appliesUnnamed(element) &&
46 (mask == null || mask.canHit(element, selector, world)); 53 (mask == null || mask.canHit(element, selector, world));
47 } 54 }
48 55
49 DynamicUseKind get kind { 56 DynamicUseKind get kind {
50 if (selector.isGetter) { 57 if (selector.isGetter) {
51 return DynamicUseKind.GET; 58 return DynamicUseKind.GET;
52 } else if (selector.isSetter) { 59 } else if (selector.isSetter) {
53 return DynamicUseKind.SET; 60 return DynamicUseKind.SET;
54 } else { 61 } else {
(...skipping 24 matching lines...) Expand all
79 CONST_CONSTRUCTOR_INVOKE, 86 CONST_CONSTRUCTOR_INVOKE,
80 REDIRECTION, 87 REDIRECTION,
81 DIRECT_INVOKE, 88 DIRECT_INVOKE,
82 DIRECT_USE, 89 DIRECT_USE,
83 } 90 }
84 91
85 /// Statically known use of an [Element]. 92 /// Statically known use of an [Element].
86 // TODO(johnniwinther): Create backend-specific implementations with better 93 // TODO(johnniwinther): Create backend-specific implementations with better
87 // invariants. 94 // invariants.
88 class StaticUse { 95 class StaticUse {
89 final Element element; 96 final Entity element;
90 final StaticUseKind kind; 97 final StaticUseKind kind;
91 final int hashCode; 98 final int hashCode;
92 final DartType type; 99 final DartType type;
93 100
94 StaticUse.internal(Element element, StaticUseKind kind, 101 StaticUse.internal(Entity element, StaticUseKind kind, [DartType type = null])
95 [DartType type = null])
96 : this.element = element, 102 : this.element = element,
97 this.kind = kind, 103 this.kind = kind,
98 this.type = type, 104 this.type = type,
99 this.hashCode = Hashing.objectsHash(element, kind, type) { 105 this.hashCode = Hashing.objectsHash(element, kind, type) {
100 assert(invariant(element, element.isDeclaration, 106 assert(invariant(element, !(element is Element && !element.isDeclaration),
101 message: "Static use element $element must be " 107 message: "Static use element $element must be "
102 "the declaration element.")); 108 "the declaration element."));
103 } 109 }
104 110
105 /// Invocation of a static or top-level [element] with the given 111 /// Invocation of a static or top-level [element] with the given
106 /// [callStructure]. 112 /// [callStructure].
107 factory StaticUse.staticInvoke( 113 factory StaticUse.staticInvoke(
108 MethodElement element, CallStructure callStructure) { 114 FunctionEntity element, CallStructure callStructure) {
109 // TODO(johnniwinther): Use the [callStructure]. 115 // TODO(johnniwinther): Use the [callStructure].
110 assert(invariant(element, element.isStatic || element.isTopLevel, 116 assert(invariant(element, element.isStatic || element.isTopLevel,
111 message: "Static invoke element $element must be a top-level " 117 message: "Static invoke element $element must be a top-level "
112 "or static method.")); 118 "or static method."));
113 return new StaticUse.internal(element, StaticUseKind.GENERAL); 119 return new StaticUse.internal(element, StaticUseKind.GENERAL);
114 } 120 }
115 121
116 /// Closurization of a static or top-level function [element]. 122 /// Closurization of a static or top-level function [element].
117 factory StaticUse.staticTearOff(MethodElement element) { 123 factory StaticUse.staticTearOff(FunctionEntity element) {
118 assert(invariant(element, element.isStatic || element.isTopLevel, 124 assert(invariant(element, element.isStatic || element.isTopLevel,
119 message: "Static tear-off element $element must be a top-level " 125 message: "Static tear-off element $element must be a top-level "
120 "or static method.")); 126 "or static method."));
121 return new StaticUse.internal(element, StaticUseKind.STATIC_TEAR_OFF); 127 return new StaticUse.internal(element, StaticUseKind.STATIC_TEAR_OFF);
122 } 128 }
123 129
124 /// Read access of a static or top-level field or getter [element]. 130 /// Read access of a static or top-level field or getter [element].
125 factory StaticUse.staticGet(MemberElement element) { 131 factory StaticUse.staticGet(MemberEntity element) {
126 assert(invariant(element, element.isStatic || element.isTopLevel, 132 assert(invariant(element, element.isStatic || element.isTopLevel,
127 message: "Static get element $element must be a top-level " 133 message: "Static get element $element must be a top-level "
128 "or static method.")); 134 "or static method."));
129 assert(invariant(element, element.isField || element.isGetter, 135 assert(invariant(element, element.isField || element.isGetter,
130 message: "Static get element $element must be a field or a getter.")); 136 message: "Static get element $element must be a field or a getter."));
131 return new StaticUse.internal(element, StaticUseKind.GENERAL); 137 return new StaticUse.internal(element, StaticUseKind.GENERAL);
132 } 138 }
133 139
134 /// Write access of a static or top-level field or setter [element]. 140 /// Write access of a static or top-level field or setter [element].
135 factory StaticUse.staticSet(MemberElement element) { 141 factory StaticUse.staticSet(MemberEntity element) {
136 assert(invariant(element, element.isStatic || element.isTopLevel, 142 assert(invariant(element, element.isStatic || element.isTopLevel,
137 message: "Static set element $element must be a top-level " 143 message: "Static set element $element must be a top-level "
138 "or static method.")); 144 "or static method."));
139 assert(invariant(element, element.isField || element.isSetter, 145 assert(invariant(element, element.isField || element.isSetter,
140 message: "Static set element $element must be a field or a setter.")); 146 message: "Static set element $element must be a field or a setter."));
141 return new StaticUse.internal(element, StaticUseKind.GENERAL); 147 return new StaticUse.internal(element, StaticUseKind.GENERAL);
142 } 148 }
143 149
144 /// Invocation of the lazy initializer for a static or top-level field 150 /// Invocation of the lazy initializer for a static or top-level field
145 /// [element]. 151 /// [element].
146 factory StaticUse.staticInit(FieldElement element) { 152 factory StaticUse.staticInit(FieldEntity element) {
147 assert(invariant(element, element.isStatic || element.isTopLevel, 153 assert(invariant(element, element.isStatic || element.isTopLevel,
148 message: "Static init element $element must be a top-level " 154 message: "Static init element $element must be a top-level "
149 "or static method.")); 155 "or static method."));
150 assert(invariant(element, element.isField, 156 assert(invariant(element, element.isField,
151 message: "Static init element $element must be a field.")); 157 message: "Static init element $element must be a field."));
152 return new StaticUse.internal(element, StaticUseKind.GENERAL); 158 return new StaticUse.internal(element, StaticUseKind.GENERAL);
153 } 159 }
154 160
155 /// Invocation of a super method [element] with the given [callStructure]. 161 /// Invocation of a super method [element] with the given [callStructure].
156 factory StaticUse.superInvoke( 162 factory StaticUse.superInvoke(
157 MethodElement element, CallStructure callStructure) { 163 FunctionEntity element, CallStructure callStructure) {
158 // TODO(johnniwinther): Use the [callStructure]. 164 // TODO(johnniwinther): Use the [callStructure].
159 assert(invariant(element, element.isInstanceMember, 165 assert(invariant(element, element.isInstanceMember,
160 message: "Super invoke element $element must be an instance method.")); 166 message: "Super invoke element $element must be an instance method."));
161 return new StaticUse.internal(element, StaticUseKind.GENERAL); 167 return new StaticUse.internal(element, StaticUseKind.GENERAL);
162 } 168 }
163 169
164 /// Read access of a super field or getter [element]. 170 /// Read access of a super field or getter [element].
165 factory StaticUse.superGet(MemberElement element) { 171 factory StaticUse.superGet(MemberEntity element) {
166 assert(invariant(element, element.isInstanceMember, 172 assert(invariant(element, element.isInstanceMember,
167 message: "Super get element $element must be an instance method.")); 173 message: "Super get element $element must be an instance method."));
168 assert(invariant(element, element.isField || element.isGetter, 174 assert(invariant(element, element.isField || element.isGetter,
169 message: "Super get element $element must be a field or a getter.")); 175 message: "Super get element $element must be a field or a getter."));
170 return new StaticUse.internal(element, StaticUseKind.GENERAL); 176 return new StaticUse.internal(element, StaticUseKind.GENERAL);
171 } 177 }
172 178
173 /// Write access of a super field [element]. 179 /// Write access of a super field [element].
174 factory StaticUse.superFieldSet(FieldElement element) { 180 factory StaticUse.superFieldSet(FieldEntity element) {
175 assert(invariant(element, element.isInstanceMember, 181 assert(invariant(element, element.isInstanceMember,
176 message: "Super set element $element must be an instance method.")); 182 message: "Super set element $element must be an instance method."));
177 assert(invariant(element, element.isField, 183 assert(invariant(element, element.isField,
178 message: "Super set element $element must be a field.")); 184 message: "Super set element $element must be a field."));
179 return new StaticUse.internal(element, StaticUseKind.SUPER_FIELD_SET); 185 return new StaticUse.internal(element, StaticUseKind.SUPER_FIELD_SET);
180 } 186 }
181 187
182 /// Write access of a super setter [element]. 188 /// Write access of a super setter [element].
183 factory StaticUse.superSetterSet(SetterElement element) { 189 factory StaticUse.superSetterSet(FunctionEntity element) {
184 assert(invariant(element, element.isInstanceMember, 190 assert(invariant(element, element.isInstanceMember,
185 message: "Super set element $element must be an instance method.")); 191 message: "Super set element $element must be an instance method."));
186 assert(invariant(element, element.isSetter, 192 assert(invariant(element, element.isSetter,
187 message: "Super set element $element must be a setter.")); 193 message: "Super set element $element must be a setter."));
188 return new StaticUse.internal(element, StaticUseKind.GENERAL); 194 return new StaticUse.internal(element, StaticUseKind.GENERAL);
189 } 195 }
190 196
191 /// Closurization of a super method [element]. 197 /// Closurization of a super method [element].
192 factory StaticUse.superTearOff(MethodElement element) { 198 factory StaticUse.superTearOff(FunctionEntity element) {
193 assert(invariant(element, element.isInstanceMember && element.isFunction, 199 assert(invariant(element, element.isInstanceMember && element.isFunction,
194 message: "Super invoke element $element must be an instance method.")); 200 message: "Super invoke element $element must be an instance method."));
195 return new StaticUse.internal(element, StaticUseKind.SUPER_TEAR_OFF); 201 return new StaticUse.internal(element, StaticUseKind.SUPER_TEAR_OFF);
196 } 202 }
197 203
198 /// Invocation of a constructor [element] through a this or super 204 /// Invocation of a constructor [element] through a this or super
199 /// constructor call with the given [callStructure]. 205 /// constructor call with the given [callStructure].
200 factory StaticUse.superConstructorInvoke( 206 factory StaticUse.superConstructorInvoke(
201 Element element, CallStructure callStructure) { 207 ConstructorElement element, CallStructure callStructure) {
202 // TODO(johnniwinther): Use the [callStructure]. 208 // TODO(johnniwinther): Use the [callStructure].
203 assert(invariant(element, element.isGenerativeConstructor, 209 assert(invariant(element, element.isGenerativeConstructor,
204 message: "Constructor invoke element $element must be a " 210 message: "Constructor invoke element $element must be a "
205 "generative constructor.")); 211 "generative constructor."));
206 return new StaticUse.internal(element, StaticUseKind.GENERAL); 212 return new StaticUse.internal(element, StaticUseKind.GENERAL);
207 } 213 }
208 214
209 /// Invocation of a constructor (body) [element] through a this or super 215 /// Invocation of a constructor (body) [element] through a this or super
210 /// constructor call with the given [callStructure]. 216 /// constructor call with the given [callStructure].
211 factory StaticUse.constructorBodyInvoke( 217 factory StaticUse.constructorBodyInvoke(
212 ConstructorBodyElement element, CallStructure callStructure) { 218 ConstructorBodyElement element, CallStructure callStructure) {
213 // TODO(johnniwinther): Use the [callStructure]. 219 // TODO(johnniwinther): Use the [callStructure].
214 return new StaticUse.internal(element, StaticUseKind.GENERAL); 220 return new StaticUse.internal(element, StaticUseKind.GENERAL);
215 } 221 }
216 222
217 /// Direct invocation of a method [element] with the given [callStructure]. 223 /// Direct invocation of a method [element] with the given [callStructure].
218 factory StaticUse.directInvoke( 224 factory StaticUse.directInvoke(
219 MethodElement element, CallStructure callStructure) { 225 FunctionEntity element, CallStructure callStructure) {
220 // TODO(johnniwinther): Use the [callStructure]. 226 // TODO(johnniwinther): Use the [callStructure].
221 assert(invariant(element, element.isInstanceMember, 227 assert(invariant(element, element.isInstanceMember,
222 message: "Direct invoke element $element must be an instance member.")); 228 message: "Direct invoke element $element must be an instance member."));
223 assert(invariant(element, element.isFunction, 229 assert(invariant(element, element.isFunction,
224 message: "Direct invoke element $element must be a method.")); 230 message: "Direct invoke element $element must be a method."));
225 return new StaticUse.internal(element, StaticUseKind.DIRECT_INVOKE); 231 return new StaticUse.internal(element, StaticUseKind.DIRECT_INVOKE);
226 } 232 }
227 233
228 /// Direct read access of a field or getter [element]. 234 /// Direct read access of a field or getter [element].
229 factory StaticUse.directGet(MemberElement element) { 235 factory StaticUse.directGet(MemberEntity element) {
230 assert(invariant(element, element.isInstanceMember, 236 assert(invariant(element, element.isInstanceMember,
231 message: "Direct get element $element must be an instance member.")); 237 message: "Direct get element $element must be an instance member."));
232 assert(invariant(element, element.isField || element.isGetter, 238 assert(invariant(element, element.isField || element.isGetter,
233 message: "Direct get element $element must be a field or a getter.")); 239 message: "Direct get element $element must be a field or a getter."));
234 return new StaticUse.internal(element, StaticUseKind.GENERAL); 240 return new StaticUse.internal(element, StaticUseKind.GENERAL);
235 } 241 }
236 242
237 /// Direct write access of a field [element]. 243 /// Direct write access of a field [element].
238 factory StaticUse.directSet(FieldElement element) { 244 factory StaticUse.directSet(FieldEntity element) {
239 assert(invariant(element, element.isInstanceMember, 245 assert(invariant(element, element.isInstanceMember,
240 message: "Direct set element $element must be an instance member.")); 246 message: "Direct set element $element must be an instance member."));
241 assert(invariant(element, element.isField, 247 assert(invariant(element, element.isField,
242 message: "Direct set element $element must be a field.")); 248 message: "Direct set element $element must be a field."));
243 return new StaticUse.internal(element, StaticUseKind.GENERAL); 249 return new StaticUse.internal(element, StaticUseKind.GENERAL);
244 } 250 }
245 251
246 /// Constructor invocation of [element] with the given [callStructure]. 252 /// Constructor invocation of [element] with the given [callStructure].
247 factory StaticUse.constructorInvoke( 253 factory StaticUse.constructorInvoke(
248 ConstructorElement element, CallStructure callStructure) { 254 FunctionEntity element, CallStructure callStructure) {
255 assert(invariant(element, element.isConstructor,
256 message: "Constructor invocation element $element "
257 "must be a constructor."));
249 // TODO(johnniwinther): Use the [callStructure]. 258 // TODO(johnniwinther): Use the [callStructure].
250 return new StaticUse.internal(element, StaticUseKind.GENERAL); 259 return new StaticUse.internal(element, StaticUseKind.GENERAL);
251 } 260 }
252 261
253 /// Constructor invocation of [element] with the given [callStructure] on 262 /// Constructor invocation of [element] with the given [callStructure] on
254 /// [type]. 263 /// [type].
255 factory StaticUse.typedConstructorInvoke( 264 factory StaticUse.typedConstructorInvoke(
256 ConstructorElement element, CallStructure callStructure, DartType type) { 265 FunctionEntity element, CallStructure callStructure, DartType type) {
257 assert(invariant(element, type != null, 266 assert(invariant(element, type != null,
258 message: "No type provided for constructor invocation.")); 267 message: "No type provided for constructor invocation."));
268 assert(invariant(element, element.isConstructor,
269 message: "Typed constructor invocation element $element "
270 "must be a constructor."));
259 // TODO(johnniwinther): Use the [callStructure]. 271 // TODO(johnniwinther): Use the [callStructure].
260 return new StaticUse.internal( 272 return new StaticUse.internal(
261 element, StaticUseKind.CONSTRUCTOR_INVOKE, type); 273 element, StaticUseKind.CONSTRUCTOR_INVOKE, type);
262 } 274 }
263 275
264 /// Constant constructor invocation of [element] with the given 276 /// Constant constructor invocation of [element] with the given
265 /// [callStructure] on [type]. 277 /// [callStructure] on [type].
266 factory StaticUse.constConstructorInvoke( 278 factory StaticUse.constConstructorInvoke(
267 ConstructorElement element, CallStructure callStructure, DartType type) { 279 FunctionEntity element, CallStructure callStructure, DartType type) {
268 assert(invariant(element, type != null, 280 assert(invariant(element, type != null,
269 message: "No type provided for constructor invocation.")); 281 message: "No type provided for constructor invocation."));
282 assert(invariant(element, element.isConstructor,
283 message: "Const constructor invocation element $element "
284 "must be a constructor."));
270 // TODO(johnniwinther): Use the [callStructure]. 285 // TODO(johnniwinther): Use the [callStructure].
271 return new StaticUse.internal( 286 return new StaticUse.internal(
272 element, StaticUseKind.CONST_CONSTRUCTOR_INVOKE, type); 287 element, StaticUseKind.CONST_CONSTRUCTOR_INVOKE, type);
273 } 288 }
274 289
275 /// Constructor redirection to [element] on [type]. 290 /// Constructor redirection to [element] on [type].
276 factory StaticUse.constructorRedirect( 291 factory StaticUse.constructorRedirect(
277 ConstructorElement element, InterfaceType type) { 292 FunctionEntity element, InterfaceType type) {
278 assert(invariant(element, type != null, 293 assert(invariant(element, type != null,
279 message: "No type provided for constructor invocation.")); 294 message: "No type provided for constructor redirection."));
295 assert(invariant(element, element.isConstructor,
296 message: "Constructor redirection element $element "
297 "must be a constructor."));
280 return new StaticUse.internal(element, StaticUseKind.REDIRECTION, type); 298 return new StaticUse.internal(element, StaticUseKind.REDIRECTION, type);
281 } 299 }
282 300
283 /// Initialization of an instance field [element]. 301 /// Initialization of an instance field [element].
284 factory StaticUse.fieldInit(FieldElement element) { 302 factory StaticUse.fieldInit(FieldEntity element) {
285 assert(invariant(element, element.isInstanceMember, 303 assert(invariant(element, element.isInstanceMember,
286 message: "Field init element $element must be an instance field.")); 304 message: "Field init element $element must be an instance field."));
287 return new StaticUse.internal(element, StaticUseKind.GENERAL); 305 return new StaticUse.internal(element, StaticUseKind.GENERAL);
288 } 306 }
289 307
290 /// Read access of an instance field or boxed field [element]. 308 /// Read access of an instance field or boxed field [element].
291 factory StaticUse.fieldGet(FieldElement element) { 309 factory StaticUse.fieldGet(FieldEntity element) {
292 assert(invariant( 310 assert(invariant(
293 element, element.isInstanceMember || element is BoxFieldElement, 311 element, element.isInstanceMember || element is BoxFieldElement,
294 message: "Field init element $element must be an instance " 312 message: "Field init element $element must be an instance "
295 "or boxed field.")); 313 "or boxed field."));
296 return new StaticUse.internal(element, StaticUseKind.FIELD_GET); 314 return new StaticUse.internal(element, StaticUseKind.FIELD_GET);
297 } 315 }
298 316
299 /// Write access of an instance field or boxed field [element]. 317 /// Write access of an instance field or boxed field [element].
300 factory StaticUse.fieldSet(FieldElement element) { 318 factory StaticUse.fieldSet(FieldEntity element) {
301 assert(invariant( 319 assert(invariant(
302 element, element.isInstanceMember || element is BoxFieldElement, 320 element, element.isInstanceMember || element is BoxFieldElement,
303 message: "Field init element $element must be an instance " 321 message: "Field init element $element must be an instance "
304 "or boxed field.")); 322 "or boxed field."));
305 return new StaticUse.internal(element, StaticUseKind.FIELD_SET); 323 return new StaticUse.internal(element, StaticUseKind.FIELD_SET);
306 } 324 }
307 325
308 /// Read of a local function [element]. 326 /// Read of a local function [element].
309 factory StaticUse.closure(LocalFunctionElement element) { 327 factory StaticUse.closure(LocalFunctionElement element) {
310 return new StaticUse.internal(element, StaticUseKind.CLOSURE); 328 return new StaticUse.internal(element, StaticUseKind.CLOSURE);
311 } 329 }
312 330
313 /// Unknown use of [element]. 331 /// Unknown use of [element].
314 @deprecated 332 @deprecated
315 factory StaticUse.foreignUse(Element element) { 333 factory StaticUse.foreignUse(Entity element) {
316 return new StaticUse.internal(element, StaticUseKind.GENERAL); 334 return new StaticUse.internal(element, StaticUseKind.GENERAL);
317 } 335 }
318 336
319 /// Direct use of [element] as done with `--analyze-all` and `--analyze-main`. 337 /// Direct use of [element] as done with `--analyze-all` and `--analyze-main`.
320 factory StaticUse.directUse(Element element) { 338 factory StaticUse.directUse(Entity element) {
321 return new StaticUse.internal(element, StaticUseKind.DIRECT_USE); 339 return new StaticUse.internal(element, StaticUseKind.DIRECT_USE);
322 } 340 }
323 341
324 bool operator ==(other) { 342 bool operator ==(other) {
325 if (identical(this, other)) return true; 343 if (identical(this, other)) return true;
326 if (other is! StaticUse) return false; 344 if (other is! StaticUse) return false;
327 return element == other.element && kind == other.kind && type == other.type; 345 return element == other.element && kind == other.kind && type == other.type;
328 } 346 }
329 347
330 String toString() => 'StaticUse($element,$kind,$type)'; 348 String toString() => 'StaticUse($element,$kind,$type)';
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } 411 }
394 412
395 bool operator ==(other) { 413 bool operator ==(other) {
396 if (identical(this, other)) return true; 414 if (identical(this, other)) return true;
397 if (other is! TypeUse) return false; 415 if (other is! TypeUse) return false;
398 return type == other.type && kind == other.kind; 416 return type == other.type && kind == other.kind;
399 } 417 }
400 418
401 String toString() => 'TypeUse($type,$kind)'; 419 String toString() => 'TypeUse($type,$kind)';
402 } 420 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698