OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // TODO(sigmund): rename and move to common/elements.dart | 5 // TODO(sigmund): rename and move to common/elements.dart |
6 library dart2js.type_system; | 6 library dart2js.type_system; |
7 | 7 |
8 import 'common/names.dart' show Uris; | 8 import 'common/names.dart' show Uris; |
9 import 'elements/types.dart'; | 9 import 'elements/types.dart'; |
10 import 'elements/entities.dart'; | 10 import 'elements/entities.dart'; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 bool isStringOnlySupertype(ClassEntity element); | 204 bool isStringOnlySupertype(ClassEntity element); |
205 | 205 |
206 /// Returns `true` if [element] is a superclass of `List`. | 206 /// Returns `true` if [element] is a superclass of `List`. |
207 bool isListSupertype(ClassEntity element); | 207 bool isListSupertype(ClassEntity element); |
208 } | 208 } |
209 | 209 |
210 /// Interface for accessing libraries, classes and members. | 210 /// Interface for accessing libraries, classes and members. |
211 /// | 211 /// |
212 /// The _env makes private and injected members directly available and | 212 /// The _env makes private and injected members directly available and |
213 /// should therefore not be used to determine scopes. | 213 /// should therefore not be used to determine scopes. |
| 214 // TODO(johnniwinther): Split this into an element environment and a type query |
| 215 // interface, the first should only be used during resolution and the latter in |
| 216 // both resolution and codegen. |
214 abstract class ElementEnvironment { | 217 abstract class ElementEnvironment { |
215 /// Returns the main library for the compilation. | 218 /// Returns the main library for the compilation. |
216 LibraryEntity get mainLibrary; | 219 LibraryEntity get mainLibrary; |
217 | 220 |
218 /// Returns the main method for the compilation. | 221 /// Returns the main method for the compilation. |
219 FunctionEntity get mainFunction; | 222 FunctionEntity get mainFunction; |
220 | 223 |
221 /// Lookup the library with the canonical [uri], fail if the library is | 224 /// Lookup the library with the canonical [uri], fail if the library is |
222 /// missing and [required]; | 225 /// missing and [required]; |
223 LibraryEntity lookupLibrary(Uri uri, {bool required: false}); | 226 LibraryEntity lookupLibrary(Uri uri, {bool required: false}); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 /// The upper bound on the [typeVariable]. If not explicitly declared, this is | 291 /// The upper bound on the [typeVariable]. If not explicitly declared, this is |
289 /// `Object`. | 292 /// `Object`. |
290 DartType getTypeVariableBound(TypeVariableEntity typeVariable); | 293 DartType getTypeVariableBound(TypeVariableEntity typeVariable); |
291 | 294 |
292 /// Returns `true` if [a] is a subtype of [b]. | 295 /// Returns `true` if [a] is a subtype of [b]. |
293 bool isSubtype(DartType a, DartType b); | 296 bool isSubtype(DartType a, DartType b); |
294 | 297 |
295 /// Returns the type if [function]. | 298 /// Returns the type if [function]. |
296 FunctionType getFunctionType(FunctionEntity function); | 299 FunctionType getFunctionType(FunctionEntity function); |
297 | 300 |
| 301 /// Returns the type of the [local] function. |
| 302 FunctionType getLocalFunctionType(Local local); |
| 303 |
| 304 /// Returns the unaliased type of [type]. |
| 305 /// |
| 306 /// Use this during resolution to ensure that the alias has been computed. |
| 307 // TODO(johnniwinther): Remove this when the resolver is removed. |
| 308 DartType getUnaliasedType(DartType type); |
| 309 |
298 /// Returns the [CallStructure] corresponding to calling [entity] with all | 310 /// Returns the [CallStructure] corresponding to calling [entity] with all |
299 /// arguments, both required and optional. | 311 /// arguments, both required and optional. |
300 CallStructure getCallStructure(FunctionEntity entity); | 312 CallStructure getCallStructure(FunctionEntity entity); |
301 | 313 |
302 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected | 314 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected |
303 /// on deferred libraries. | 315 /// on deferred libraries. |
304 bool isDeferredLoadLibraryGetter(MemberEntity member); | 316 bool isDeferredLoadLibraryGetter(MemberEntity member); |
305 } | 317 } |
306 | 318 |
307 class CommonElementsImpl implements CommonElements { | 319 class CommonElementsImpl implements CommonElements { |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 } | 584 } |
573 | 585 |
574 @override | 586 @override |
575 InterfaceType streamType([DartType elementType]) { | 587 InterfaceType streamType([DartType elementType]) { |
576 if (elementType == null) { | 588 if (elementType == null) { |
577 return getRawType(streamClass); | 589 return getRawType(streamClass); |
578 } | 590 } |
579 return createInterfaceType(streamClass, [elementType]); | 591 return createInterfaceType(streamClass, [elementType]); |
580 } | 592 } |
581 } | 593 } |
OLD | NEW |