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 | 14 import '../universe/universe.dart' show |
15 UniverseSelector; | 15 UniverseSelector; |
| 16 import '../universe/use.dart' show |
| 17 StaticUse; |
16 | 18 |
17 /// Interface for registration of element dependencies. | 19 /// Interface for registration of element dependencies. |
18 abstract class Registry { | 20 abstract class Registry { |
19 // TODO(johnniwinther): Remove this. | 21 // TODO(johnniwinther): Remove this. |
20 void registerDependency(Element element) {} | 22 void registerDependency(Element element) {} |
21 | 23 |
22 bool get isForResolution; | 24 bool get isForResolution; |
23 | 25 |
24 void registerDynamicInvocation(UniverseSelector selector); | 26 void registerDynamicUse(UniverseSelector staticUse); |
25 | 27 |
26 void registerDynamicGetter(UniverseSelector selector); | 28 void registerStaticUse(StaticUse staticUse); |
27 | |
28 void registerDynamicSetter(UniverseSelector selector); | |
29 | |
30 void registerStaticInvocation(Element element); | |
31 | 29 |
32 void registerInstantiation(InterfaceType type); | 30 void registerInstantiation(InterfaceType type); |
33 | |
34 void registerGetOfStaticFunction(FunctionElement element); | |
35 } | 31 } |
36 | 32 |
37 // TODO(johnniwinther): Remove this. | 33 // TODO(johnniwinther): Remove this. |
38 class EagerRegistry extends Registry { | 34 class EagerRegistry extends Registry { |
39 final String name; | 35 final String name; |
40 final Enqueuer world; | 36 final Enqueuer world; |
41 | 37 |
42 EagerRegistry(this.name, this.world); | 38 EagerRegistry(this.name, this.world); |
43 | 39 |
44 bool get isForResolution => world.isResolutionQueue; | 40 bool get isForResolution => world.isResolutionQueue; |
45 | 41 |
46 @override | 42 @override |
47 void registerDynamicGetter(UniverseSelector selector) { | 43 void registerDynamicUse(UniverseSelector selector) { |
48 world.registerDynamicGetter(selector); | 44 world.registerDynamicUse(selector); |
49 } | 45 } |
50 | 46 |
51 @override | 47 @override |
52 void registerDynamicInvocation(UniverseSelector selector) { | |
53 world.registerDynamicInvocation(selector); | |
54 } | |
55 | |
56 @override | |
57 void registerDynamicSetter(UniverseSelector selector) { | |
58 world.registerDynamicSetter(selector); | |
59 } | |
60 | |
61 @override | |
62 void registerGetOfStaticFunction(FunctionElement element) { | |
63 world.registerGetOfStaticFunction(element); | |
64 } | |
65 | |
66 @override | |
67 void registerInstantiation(InterfaceType type) { | 48 void registerInstantiation(InterfaceType type) { |
68 world.registerInstantiatedType(type); | 49 world.registerInstantiatedType(type); |
69 } | 50 } |
70 | 51 |
71 @override | 52 @override |
72 void registerStaticInvocation(Element element) { | 53 void registerStaticUse(StaticUse staticUse) { |
73 world.registerStaticUse(element); | 54 world.registerStaticUse(staticUse); |
74 } | 55 } |
75 | 56 |
76 String toString() => name; | 57 String toString() => name; |
77 } | 58 } |
OLD | NEW |