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