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 library dart2js.resolution.registry; | 5 library dart2js.resolution.registry; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/backend_api.dart' | 8 import '../common/backend_api.dart' |
9 show Backend, ForeignResolver, NativeRegistry; | 9 show Backend, ForeignResolver, NativeRegistry; |
10 import '../common/registry.dart' show Registry; | 10 import '../common/registry.dart' show Registry; |
11 import '../common/resolution.dart' show ResolutionImpact, Target; | 11 import '../common/resolution.dart' show ResolutionImpact, Target; |
12 import '../constants/expressions.dart'; | 12 import '../constants/expressions.dart'; |
13 import '../dart_types.dart'; | 13 import '../dart_types.dart'; |
14 import '../diagnostics/source_span.dart'; | 14 import '../diagnostics/source_span.dart'; |
15 import '../elements/elements.dart'; | 15 import '../elements/elements.dart'; |
16 import '../tree/tree.dart'; | 16 import '../tree/tree.dart'; |
17 import '../universe/call_structure.dart' show CallStructure; | 17 import '../universe/call_structure.dart' show CallStructure; |
18 import '../universe/feature.dart'; | 18 import '../universe/feature.dart'; |
19 import '../universe/selector.dart' show Selector; | 19 import '../universe/selector.dart' show Selector; |
20 import '../universe/use.dart' show DynamicUse, StaticUse, TypeUse; | 20 import '../universe/use.dart' show DynamicUse, StaticUse, TypeUse; |
21 import '../universe/world_impact.dart' show WorldImpact, WorldImpactBuilder; | 21 import '../universe/world_impact.dart' show WorldImpact, WorldImpactBuilder; |
22 import '../util/enumset.dart' show EnumSet; | 22 import '../util/enumset.dart' show EnumSet; |
23 import '../util/util.dart' show Setlet; | 23 import '../util/util.dart' show Setlet; |
24 import 'members.dart' show ResolverVisitor; | 24 import 'members.dart' show ResolverVisitor; |
25 import 'send_structure.dart'; | 25 import 'send_structure.dart'; |
26 import 'tree_elements.dart' show TreeElementMapping; | 26 import 'tree_elements.dart' show TreeElementMapping; |
27 | 27 |
28 class _ResolutionWorldImpact extends ResolutionImpact | 28 class ResolutionWorldImpactBuilder extends ResolutionImpact |
29 with WorldImpactBuilder | 29 with WorldImpactBuilder |
30 implements NativeRegistry { | 30 implements NativeRegistry { |
31 final String name; | 31 final String name; |
32 EnumSet<Feature> _features; | 32 EnumSet<Feature> _features; |
33 Setlet<MapLiteralUse> _mapLiterals; | 33 Setlet<MapLiteralUse> _mapLiterals; |
34 Setlet<ListLiteralUse> _listLiterals; | 34 Setlet<ListLiteralUse> _listLiterals; |
35 Setlet<String> _constSymbolNames; | 35 Setlet<String> _constSymbolNames; |
36 Setlet<ConstantExpression> _constantLiterals; | 36 Setlet<ConstantExpression> _constantLiterals; |
37 Setlet<dynamic> _nativeData; | 37 Setlet<dynamic> _nativeData; |
38 | 38 |
39 _ResolutionWorldImpact(this.name); | 39 ResolutionWorldImpactBuilder(this.name); |
40 | 40 |
41 void registerMapLiteral(MapLiteralUse mapLiteralUse) { | 41 void registerMapLiteral(MapLiteralUse mapLiteralUse) { |
42 assert(mapLiteralUse != null); | 42 assert(mapLiteralUse != null); |
43 if (_mapLiterals == null) { | 43 if (_mapLiterals == null) { |
44 _mapLiterals = new Setlet<MapLiteralUse>(); | 44 _mapLiterals = new Setlet<MapLiteralUse>(); |
45 } | 45 } |
46 _mapLiterals.add(mapLiteralUse); | 46 _mapLiterals.add(mapLiteralUse); |
47 } | 47 } |
48 | 48 |
49 @override | 49 @override |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 /// [ResolutionRegistry] collects all resolution information. It stores node | 154 /// [ResolutionRegistry] collects all resolution information. It stores node |
155 /// related information in a [TreeElements] mapping and registers calls with | 155 /// related information in a [TreeElements] mapping and registers calls with |
156 /// [Backend], [World] and [Enqueuer]. | 156 /// [Backend], [World] and [Enqueuer]. |
157 // TODO(johnniwinther): Split this into an interface and implementation class. | 157 // TODO(johnniwinther): Split this into an interface and implementation class. |
158 class ResolutionRegistry extends Registry { | 158 class ResolutionRegistry extends Registry { |
159 final Target target; | 159 final Target target; |
160 final TreeElementMapping mapping; | 160 final TreeElementMapping mapping; |
161 final _ResolutionWorldImpact worldImpact; | 161 final ResolutionWorldImpactBuilder worldImpact; |
Harry Terkelsen
2016/09/08 16:46:28
also change variable name to worldImpactBuilder or
| |
162 | 162 |
163 ResolutionRegistry(this.target, TreeElementMapping mapping) | 163 ResolutionRegistry(this.target, TreeElementMapping mapping) |
164 : this.mapping = mapping, | 164 : this.mapping = mapping, |
165 this.worldImpact = | 165 this.worldImpact = new ResolutionWorldImpactBuilder( |
166 new _ResolutionWorldImpact(mapping.analyzedElement.toString()); | 166 mapping.analyzedElement.toString()); |
167 | 167 |
168 bool get isForResolution => true; | 168 bool get isForResolution => true; |
169 | 169 |
170 String toString() => 'ResolutionRegistry for ${mapping.analyzedElement}'; | 170 String toString() => 'ResolutionRegistry for ${mapping.analyzedElement}'; |
171 | 171 |
172 ////////////////////////////////////////////////////////////////////////////// | 172 ////////////////////////////////////////////////////////////////////////////// |
173 // Node-to-Element mapping functionality. | 173 // Node-to-Element mapping functionality. |
174 ////////////////////////////////////////////////////////////////////////////// | 174 ////////////////////////////////////////////////////////////////////////////// |
175 | 175 |
176 /// Register [node] as the declaration of [element]. | 176 /// Register [node] as the declaration of [element]. |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 @override | 423 @override |
424 void registerInstantiatedType(InterfaceType type) { | 424 void registerInstantiatedType(InterfaceType type) { |
425 registry.registerInstantiation(type); | 425 registry.registerInstantiation(type); |
426 } | 426 } |
427 | 427 |
428 @override | 428 @override |
429 DartType resolveTypeFromString(Node node, String typeName) { | 429 DartType resolveTypeFromString(Node node, String typeName) { |
430 return visitor.resolveTypeFromString(node, typeName); | 430 return visitor.resolveTypeFromString(node, typeName); |
431 } | 431 } |
432 } | 432 } |
OLD | NEW |