| 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 Identifiers, Uris; | 8 import 'common/names.dart' show Identifiers, Uris; |
| 9 import 'constants/values.dart'; | 9 import 'constants/values.dart'; |
| 10 import 'elements/entities.dart'; | 10 import 'elements/entities.dart'; |
| (...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 } | 1146 } |
| 1147 | 1147 |
| 1148 ClassEntity get expectAssumeDynamicClass { | 1148 ClassEntity get expectAssumeDynamicClass { |
| 1149 _ensureExpectAnnotations(); | 1149 _ensureExpectAnnotations(); |
| 1150 return _expectAssumeDynamicClass; | 1150 return _expectAssumeDynamicClass; |
| 1151 } | 1151 } |
| 1152 } | 1152 } |
| 1153 | 1153 |
| 1154 /// Interface for accessing libraries, classes and members. | 1154 /// Interface for accessing libraries, classes and members. |
| 1155 /// | 1155 /// |
| 1156 /// The _env makes private and injected members directly available and | 1156 /// The element environment makes private and injected members directly |
| 1157 /// should therefore not be used to determine scopes. | 1157 /// available and should therefore not be used to determine scopes. |
| 1158 /// |
| 1159 /// The properties exposed are Dart-centric and should therefore, long-term, not |
| 1160 /// be used during codegen, expect for mirrors. |
| 1158 // TODO(johnniwinther): Split this into an element environment and a type query | 1161 // TODO(johnniwinther): Split this into an element environment and a type query |
| 1159 // interface, the first should only be used during resolution and the latter in | 1162 // interface, the first should only be used during resolution and the latter in |
| 1160 // both resolution and codegen. | 1163 // both resolution and codegen. |
| 1161 abstract class ElementEnvironment { | 1164 abstract class ElementEnvironment { |
| 1162 /// Returns the main library for the compilation. | 1165 /// Returns the main library for the compilation. |
| 1163 LibraryEntity get mainLibrary; | 1166 LibraryEntity get mainLibrary; |
| 1164 | 1167 |
| 1165 /// Returns the main method for the compilation. | 1168 /// Returns the main method for the compilation. |
| 1166 FunctionEntity get mainFunction; | 1169 FunctionEntity get mainFunction; |
| 1167 | 1170 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 /// where all types arguments are `dynamic`. | 1249 /// where all types arguments are `dynamic`. |
| 1247 InterfaceType getRawType(ClassEntity cls); | 1250 InterfaceType getRawType(ClassEntity cls); |
| 1248 | 1251 |
| 1249 /// Returns the 'this type' of [cls]. That is, the instantiation of [cls] | 1252 /// Returns the 'this type' of [cls]. That is, the instantiation of [cls] |
| 1250 /// where the type arguments are the type variables of [cls]. | 1253 /// where the type arguments are the type variables of [cls]. |
| 1251 InterfaceType getThisType(ClassEntity cls); | 1254 InterfaceType getThisType(ClassEntity cls); |
| 1252 | 1255 |
| 1253 /// Returns `true` if [cls] is generic. | 1256 /// Returns `true` if [cls] is generic. |
| 1254 bool isGenericClass(ClassEntity cls); | 1257 bool isGenericClass(ClassEntity cls); |
| 1255 | 1258 |
| 1259 /// Returns `true` if [cls] is an unnamed mixin application. |
| 1260 bool isUnnamedMixinApplication(ClassEntity cls); |
| 1261 |
| 1256 /// The upper bound on the [typeVariable]. If not explicitly declared, this is | 1262 /// The upper bound on the [typeVariable]. If not explicitly declared, this is |
| 1257 /// `Object`. | 1263 /// `Object`. |
| 1258 DartType getTypeVariableBound(TypeVariableEntity typeVariable); | 1264 DartType getTypeVariableBound(TypeVariableEntity typeVariable); |
| 1259 | 1265 |
| 1260 /// Returns the type if [function]. | 1266 /// Returns the type if [function]. |
| 1261 FunctionType getFunctionType(FunctionEntity function); | 1267 FunctionType getFunctionType(FunctionEntity function); |
| 1262 | 1268 |
| 1263 /// Returns the type of the [local] function. | 1269 /// Returns the type of the [local] function. |
| 1264 FunctionType getLocalFunctionType(Local local); | 1270 FunctionType getLocalFunctionType(Local local); |
| 1265 | 1271 |
| 1266 /// Returns the unaliased type of [type]. | 1272 /// Returns the unaliased type of [type]. |
| 1267 /// | 1273 /// |
| 1268 /// Use this during resolution to ensure that the alias has been computed. | 1274 /// Use this during resolution to ensure that the alias has been computed. |
| 1269 // TODO(johnniwinther): Remove this when the resolver is removed. | 1275 // TODO(johnniwinther): Remove this when the resolver is removed. |
| 1270 DartType getUnaliasedType(DartType type); | 1276 DartType getUnaliasedType(DartType type); |
| 1271 | 1277 |
| 1272 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected | 1278 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected |
| 1273 /// on deferred libraries. | 1279 /// on deferred libraries. |
| 1274 bool isDeferredLoadLibraryGetter(MemberEntity member); | 1280 bool isDeferredLoadLibraryGetter(MemberEntity member); |
| 1275 | 1281 |
| 1276 /// Returns the metadata constants declared on [member]. | 1282 /// Returns the metadata constants declared on [member]. |
| 1277 Iterable<ConstantValue> getMemberMetadata(MemberEntity member); | 1283 Iterable<ConstantValue> getMemberMetadata(MemberEntity member); |
| 1278 } | 1284 } |
| OLD | NEW |