| 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.dart'; | 8 import 'common.dart'; |
| 9 import 'common/names.dart' show Identifiers, Uris; | 9 import 'common/names.dart' show Identifiers, Uris; |
| 10 import 'constants/values.dart'; | 10 import 'constants/values.dart'; |
| 11 import 'elements/entities.dart'; | 11 import 'elements/entities.dart'; |
| 12 import 'elements/names.dart' show PublicName; | 12 import 'elements/names.dart' show PublicName; |
| 13 import 'elements/types.dart'; | 13 import 'elements/types.dart'; |
| 14 import 'js_backend/backend.dart' show JavaScriptBackend; | 14 import 'js_backend/backend.dart' show JavaScriptBackend; |
| 15 import 'js_backend/constant_system_javascript.dart'; | 15 import 'js_backend/constant_system_javascript.dart'; |
| 16 import 'js_backend/native_data.dart' show NativeBasicData; | 16 import 'js_backend/native_data.dart' show NativeBasicData; |
| 17 import 'constants/expressions.dart' show ConstantExpression; |
| 17 import 'universe/call_structure.dart' show CallStructure; | 18 import 'universe/call_structure.dart' show CallStructure; |
| 18 import 'universe/selector.dart' show Selector; | 19 import 'universe/selector.dart' show Selector; |
| 19 import 'universe/call_structure.dart'; | 20 import 'universe/call_structure.dart'; |
| 20 | 21 |
| 21 /// The common elements and types in Dart. | 22 /// The common elements and types in Dart. |
| 22 class CommonElements { | 23 class CommonElements { |
| 23 final ElementEnvironment _env; | 24 final ElementEnvironment _env; |
| 24 | 25 |
| 25 CommonElements(this._env); | 26 CommonElements(this._env); |
| 26 | 27 |
| (...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 | 1246 |
| 1246 /// Calls [f] for each class member declared or inherited in [cls] together | 1247 /// Calls [f] for each class member declared or inherited in [cls] together |
| 1247 /// with the class that declared the member. | 1248 /// with the class that declared the member. |
| 1248 /// | 1249 /// |
| 1249 /// TODO(johnniwinther): This should not include static members of | 1250 /// TODO(johnniwinther): This should not include static members of |
| 1250 /// superclasses. | 1251 /// superclasses. |
| 1251 void forEachClassMember( | 1252 void forEachClassMember( |
| 1252 ClassEntity cls, void f(ClassEntity declarer, MemberEntity member)); | 1253 ClassEntity cls, void f(ClassEntity declarer, MemberEntity member)); |
| 1253 | 1254 |
| 1254 /// Calls [f] for every constructor declared in [cls]. | 1255 /// Calls [f] for every constructor declared in [cls]. |
| 1256 /// |
| 1257 /// Will ensure that the class and all constructors are resolved if |
| 1258 /// [ensureResolved] is `true`. |
| 1259 // TODO(redemption): Remove the 'ensureResolved' parameter |
| 1255 void forEachConstructor( | 1260 void forEachConstructor( |
| 1256 ClassEntity cls, void f(ConstructorEntity constructor)); | 1261 ClassEntity cls, void f(ConstructorEntity constructor), |
| 1262 {bool ensureResolved: true}); |
| 1257 | 1263 |
| 1258 /// Calls [f] for every constructor body in [cls]. | 1264 /// Calls [f] for every constructor body in [cls]. |
| 1259 void forEachConstructorBody( | 1265 void forEachConstructorBody( |
| 1260 ClassEntity cls, void f(ConstructorBodyEntity constructorBody)); | 1266 ClassEntity cls, void f(ConstructorBodyEntity constructorBody)); |
| 1261 | 1267 |
| 1268 /// Calls [f] for each nested closure in [member]. |
| 1269 void forEachNestedClosure( |
| 1270 MemberEntity member, void f(FunctionEntity closure)); |
| 1271 |
| 1262 /// Returns the superclass of [cls]. | 1272 /// Returns the superclass of [cls]. |
| 1263 /// | 1273 /// |
| 1264 /// If [skipUnnamedMixinApplications] is `true`, unnamed mixin applications | 1274 /// If [skipUnnamedMixinApplications] is `true`, unnamed mixin applications |
| 1265 /// are excluded, for instance for these classes | 1275 /// are excluded, for instance for these classes |
| 1266 /// | 1276 /// |
| 1267 /// class S {} | 1277 /// class S {} |
| 1268 /// class M {} | 1278 /// class M {} |
| 1269 /// class C extends S with M {} | 1279 /// class C extends S with M {} |
| 1270 /// | 1280 /// |
| 1271 /// the result of `getSuperClass(C)` is the unnamed mixin application | 1281 /// the result of `getSuperClass(C)` is the unnamed mixin application |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 | 1341 |
| 1332 /// Returns the type of [function]. | 1342 /// Returns the type of [function]. |
| 1333 FunctionType getFunctionType(FunctionEntity function); | 1343 FunctionType getFunctionType(FunctionEntity function); |
| 1334 | 1344 |
| 1335 /// Returns the type of [field]. | 1345 /// Returns the type of [field]. |
| 1336 DartType getFieldType(FieldEntity field); | 1346 DartType getFieldType(FieldEntity field); |
| 1337 | 1347 |
| 1338 /// Returns the type of the [local] function. | 1348 /// Returns the type of the [local] function. |
| 1339 FunctionType getLocalFunctionType(Local local); | 1349 FunctionType getLocalFunctionType(Local local); |
| 1340 | 1350 |
| 1351 /// Gets the constant value of [field], or `null` if [field] is non-const. |
| 1352 ConstantExpression getFieldConstant(FieldEntity field); |
| 1353 |
| 1341 /// Returns the 'unaliased' type of [type]. For typedefs this is the function | 1354 /// Returns the 'unaliased' type of [type]. For typedefs this is the function |
| 1342 /// type it is an alias of, for other types it is the type itself. | 1355 /// type it is an alias of, for other types it is the type itself. |
| 1343 /// | 1356 /// |
| 1344 /// Use this during resolution to ensure that the alias has been computed. | 1357 /// Use this during resolution to ensure that the alias has been computed. |
| 1345 // TODO(johnniwinther): Remove this when the resolver is removed. | 1358 // TODO(johnniwinther): Remove this when the resolver is removed. |
| 1346 DartType getUnaliasedType(DartType type); | 1359 DartType getUnaliasedType(DartType type); |
| 1347 | 1360 |
| 1348 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected | 1361 /// Returns `true` if [member] a the synthetic getter `loadLibrary` injected |
| 1349 /// on deferred libraries. | 1362 /// on deferred libraries. |
| 1350 bool isDeferredLoadLibraryGetter(MemberEntity member); | 1363 bool isDeferredLoadLibraryGetter(MemberEntity member); |
| 1351 | 1364 |
| 1352 /// Returns the metadata constants declared on [library]. | 1365 /// Returns the metadata constants declared on [library]. |
| 1353 Iterable<ConstantValue> getLibraryMetadata(LibraryEntity library); | 1366 Iterable<ConstantValue> getLibraryMetadata(LibraryEntity library); |
| 1354 | 1367 |
| 1355 /// Returns the metadata constants declared on [cls]. | 1368 /// Returns the metadata constants declared on [cls]. |
| 1356 Iterable<ConstantValue> getClassMetadata(ClassEntity cls); | 1369 Iterable<ConstantValue> getClassMetadata(ClassEntity cls); |
| 1357 | 1370 |
| 1358 /// Returns the metadata constants declared on [typedef]. | 1371 /// Returns the metadata constants declared on [typedef]. |
| 1359 Iterable<ConstantValue> getTypedefMetadata(TypedefEntity typedef); | 1372 Iterable<ConstantValue> getTypedefMetadata(TypedefEntity typedef); |
| 1360 | 1373 |
| 1361 /// Returns the metadata constants declared on [member]. | 1374 /// Returns the metadata constants declared on [member]. |
| 1362 Iterable<ConstantValue> getMemberMetadata(MemberEntity member, | 1375 Iterable<ConstantValue> getMemberMetadata(MemberEntity member, |
| 1363 {bool includeParameterMetadata: false}); | 1376 {bool includeParameterMetadata: false}); |
| 1364 | 1377 |
| 1365 /// Returns the function type that is an alias of a [typedef]. | 1378 /// Returns the function type that is an alias of a [typedef]. |
| 1366 FunctionType getFunctionTypeOfTypedef(TypedefEntity typedef); | 1379 FunctionType getFunctionTypeOfTypedef(TypedefEntity typedef); |
| 1367 } | 1380 } |
| OLD | NEW |