OLD | NEW |
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.world; | 5 library dart2js.world; |
6 | 6 |
7 import 'cache_strategy.dart'; | 7 import 'cache_strategy.dart'; |
8 import 'closure.dart' show SynthesizedCallMethodElementX; | 8 import 'closure.dart' show SynthesizedCallMethodElementX; |
9 import 'common/backend_api.dart' show BackendClasses; | 9 import 'common/backend_api.dart' show BackendClasses; |
10 import 'common.dart'; | 10 import 'common.dart'; |
11 import 'core_types.dart' show CoreClasses, CommonElements; | 11 import 'core_types.dart' show CoreTypes, CoreClasses, CommonElements; |
12 import 'dart_types.dart'; | 12 import 'dart_types.dart'; |
13 import 'elements/elements.dart' | 13 import 'elements/elements.dart' |
14 show | 14 show |
15 ClassElement, | 15 ClassElement, |
16 Element, | 16 Element, |
17 FunctionElement, | 17 FunctionElement, |
18 MixinApplicationElement, | 18 MixinApplicationElement, |
19 TypedefElement, | 19 TypedefElement, |
20 FieldElement; | 20 FieldElement; |
21 import 'js_backend/backend.dart' show JavaScriptBackend; | 21 import 'js_backend/backend.dart' show JavaScriptBackend; |
(...skipping 18 matching lines...) Expand all Loading... |
40 /// JavaScript types are touched, what language features are used, and so on. | 40 /// JavaScript types are touched, what language features are used, and so on. |
41 /// This precise knowledge about what's live in the program is later used in | 41 /// This precise knowledge about what's live in the program is later used in |
42 /// optimizations and other compiler decisions during code generation. | 42 /// optimizations and other compiler decisions during code generation. |
43 abstract class ClosedWorld implements World { | 43 abstract class ClosedWorld implements World { |
44 /// Access to core classes used by the backend. | 44 /// Access to core classes used by the backend. |
45 BackendClasses get backendClasses; | 45 BackendClasses get backendClasses; |
46 | 46 |
47 /// Access to core classes used in the Dart language. | 47 /// Access to core classes used in the Dart language. |
48 CoreClasses get coreClasses; | 48 CoreClasses get coreClasses; |
49 | 49 |
| 50 CoreTypes get coreTypes; |
| 51 |
50 CommonElements get commonElements; | 52 CommonElements get commonElements; |
51 | 53 |
52 CommonMasks get commonMasks; | 54 CommonMasks get commonMasks; |
53 | 55 |
54 /// Returns `true` if [cls] is either directly or indirectly instantiated. | 56 /// Returns `true` if [cls] is either directly or indirectly instantiated. |
55 bool isInstantiated(ClassElement cls); | 57 bool isInstantiated(ClassElement cls); |
56 | 58 |
57 /// Returns `true` if [cls] is directly instantiated. This means that at | 59 /// Returns `true` if [cls] is directly instantiated. This means that at |
58 /// runtime instances of exactly [cls] are assumed to exist. | 60 /// runtime instances of exactly [cls] are assumed to exist. |
59 bool isDirectlyInstantiated(ClassElement cls); | 61 bool isDirectlyInstantiated(ClassElement cls); |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 | 873 |
872 final Set<Element> functionsThatMightBePassedToApply = | 874 final Set<Element> functionsThatMightBePassedToApply = |
873 new Set<FunctionElement>(); | 875 new Set<FunctionElement>(); |
874 | 876 |
875 final Set<Element> alreadyPopulated; | 877 final Set<Element> alreadyPopulated; |
876 | 878 |
877 CommonMasks _commonMasks; | 879 CommonMasks _commonMasks; |
878 | 880 |
879 final CommonElements commonElements; | 881 final CommonElements commonElements; |
880 | 882 |
| 883 final CoreTypes coreTypes; |
| 884 |
881 final CacheStrategy cacheStrategy; | 885 final CacheStrategy cacheStrategy; |
882 | 886 |
883 final ResolutionWorldBuilder resolverWorld; | 887 final ResolutionWorldBuilder resolverWorld; |
884 | 888 |
885 bool get isClosed => _closed; | 889 bool get isClosed => _closed; |
886 | 890 |
887 Set<ClassElement> typesImplementedBySubclassesOf(ClassElement cls) { | 891 Set<ClassElement> typesImplementedBySubclassesOf(ClassElement cls) { |
888 return _typesImplementedBySubclasses[cls.declaration]; | 892 return _typesImplementedBySubclasses[cls.declaration]; |
889 } | 893 } |
890 | 894 |
891 WorldImpl(this.resolverWorld, this._backend, this.commonElements, | 895 WorldImpl(this.resolverWorld, this._backend, this.commonElements, |
892 CacheStrategy cacheStrategy) | 896 this.coreTypes, CacheStrategy cacheStrategy) |
893 : this.cacheStrategy = cacheStrategy, | 897 : this.cacheStrategy = cacheStrategy, |
894 alreadyPopulated = cacheStrategy.newSet() { | 898 alreadyPopulated = cacheStrategy.newSet() { |
895 _allFunctions = new FunctionSet(this); | 899 _allFunctions = new FunctionSet(this); |
896 } | 900 } |
897 | 901 |
898 FunctionSet get allFunctions => _allFunctions; | 902 FunctionSet get allFunctions => _allFunctions; |
899 | 903 |
900 CommonMasks get commonMasks { | 904 CommonMasks get commonMasks { |
901 assert(isClosed); | 905 assert(isClosed); |
902 return _commonMasks; | 906 return _commonMasks; |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 /// Only the class itself is included. | 1227 /// Only the class itself is included. |
1224 EXACT, | 1228 EXACT, |
1225 | 1229 |
1226 /// The class and all subclasses (transitively) are included. | 1230 /// The class and all subclasses (transitively) are included. |
1227 SUBCLASS, | 1231 SUBCLASS, |
1228 | 1232 |
1229 /// The class and all classes that implement or subclass it (transitively) | 1233 /// The class and all classes that implement or subclass it (transitively) |
1230 /// are included. | 1234 /// are included. |
1231 SUBTYPE, | 1235 SUBTYPE, |
1232 } | 1236 } |
OLD | NEW |