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.common.registry; | 5 library dart2js.common.registry; |
6 | 6 |
7 import '../dart_types.dart' show | 7 import '../dart_types.dart' show |
8 InterfaceType; | 8 InterfaceType; |
9 import '../enqueue.dart' show | 9 import '../enqueue.dart' show |
10 Enqueuer; | 10 Enqueuer; |
11 import '../elements/elements.dart' show | 11 import '../elements/elements.dart' show |
12 Element, | 12 Element, |
13 FunctionElement; | 13 FunctionElement; |
14 import '../universe/universe.dart' show | |
15 UniverseSelector; | |
16 import '../universe/use.dart' show | 14 import '../universe/use.dart' show |
| 15 DynamicUse, |
17 StaticUse; | 16 StaticUse; |
18 | 17 |
19 /// Interface for registration of element dependencies. | 18 /// Interface for registration of element dependencies. |
20 abstract class Registry { | 19 abstract class Registry { |
21 // TODO(johnniwinther): Remove this. | 20 // TODO(johnniwinther): Remove this. |
22 void registerDependency(Element element) {} | 21 void registerDependency(Element element) {} |
23 | 22 |
24 bool get isForResolution; | 23 bool get isForResolution; |
25 | 24 |
26 void registerDynamicUse(UniverseSelector staticUse); | 25 void registerDynamicUse(DynamicUse staticUse); |
27 | 26 |
28 void registerStaticUse(StaticUse staticUse); | 27 void registerStaticUse(StaticUse staticUse); |
29 | 28 |
30 void registerInstantiation(InterfaceType type); | 29 void registerInstantiation(InterfaceType type); |
31 } | 30 } |
32 | 31 |
33 // TODO(johnniwinther): Remove this. | 32 // TODO(johnniwinther): Remove this. |
34 class EagerRegistry extends Registry { | 33 class EagerRegistry extends Registry { |
35 final String name; | 34 final String name; |
36 final Enqueuer world; | 35 final Enqueuer world; |
37 | 36 |
38 EagerRegistry(this.name, this.world); | 37 EagerRegistry(this.name, this.world); |
39 | 38 |
40 bool get isForResolution => world.isResolutionQueue; | 39 bool get isForResolution => world.isResolutionQueue; |
41 | 40 |
42 @override | 41 @override |
43 void registerDynamicUse(UniverseSelector selector) { | 42 void registerDynamicUse(DynamicUse dynamicUse) { |
44 world.registerDynamicUse(selector); | 43 world.registerDynamicUse(dynamicUse); |
45 } | 44 } |
46 | 45 |
47 @override | 46 @override |
48 void registerInstantiation(InterfaceType type) { | 47 void registerInstantiation(InterfaceType type) { |
49 world.registerInstantiatedType(type); | 48 world.registerInstantiatedType(type); |
50 } | 49 } |
51 | 50 |
52 @override | 51 @override |
53 void registerStaticUse(StaticUse staticUse) { | 52 void registerStaticUse(StaticUse staticUse) { |
54 world.registerStaticUse(staticUse); | 53 world.registerStaticUse(staticUse); |
55 } | 54 } |
56 | 55 |
57 String toString() => name; | 56 String toString() => name; |
58 } | 57 } |
OLD | NEW |