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' show Backend, ForeignResolver; | 8 import '../common/backend_api.dart' show Backend, ForeignResolver; |
9 import '../common/resolution.dart' | 9 import '../common/resolution.dart' |
10 show Feature, ListLiteralUse, MapLiteralUse, ResolutionImpact; | 10 show Feature, ListLiteralUse, MapLiteralUse, ResolutionImpact; |
11 import '../common/registry.dart' show Registry; | 11 import '../common/registry.dart' show Registry; |
12 import '../compiler.dart' show Compiler; | 12 import '../compiler.dart' show Compiler; |
13 import '../constants/expressions.dart'; | 13 import '../constants/expressions.dart'; |
14 import '../dart_types.dart'; | 14 import '../dart_types.dart'; |
15 import '../diagnostics/source_span.dart'; | 15 import '../diagnostics/source_span.dart'; |
16 import '../enqueue.dart' show ResolutionEnqueuer; | 16 import '../enqueue.dart' show ResolutionEnqueuer; |
17 import '../elements/elements.dart'; | 17 import '../elements/elements.dart'; |
18 import '../tree/tree.dart'; | 18 import '../tree/tree.dart'; |
19 import '../util/util.dart' show Setlet; | 19 import '../util/util.dart' show Setlet; |
20 import '../universe/call_structure.dart' show CallStructure; | 20 import '../universe/call_structure.dart' show CallStructure; |
21 import '../universe/selector.dart' show Selector; | 21 import '../universe/selector.dart' show Selector; |
22 import '../universe/use.dart' show DynamicUse, StaticUse, TypeUse; | 22 import '../universe/use.dart' show DynamicUse, StaticUse, TypeUse; |
23 import '../universe/world_impact.dart' show WorldImpact, WorldImpactBuilder; | 23 import '../universe/world_impact.dart' show WorldImpact, WorldImpactBuilder; |
24 import '../util/enumset.dart' show EnumSet; | 24 import '../util/enumset.dart' show EnumSet; |
25 import '../world.dart' show World; | |
26 | 25 |
27 import 'send_structure.dart'; | 26 import 'send_structure.dart'; |
28 | 27 |
29 import 'members.dart' show ResolverVisitor; | 28 import 'members.dart' show ResolverVisitor; |
30 import 'tree_elements.dart' show TreeElementMapping; | 29 import 'tree_elements.dart' show TreeElementMapping; |
31 | 30 |
32 class _ResolutionWorldImpact extends ResolutionImpact with WorldImpactBuilder { | 31 class _ResolutionWorldImpact extends ResolutionImpact with WorldImpactBuilder { |
33 final String name; | 32 final String name; |
34 EnumSet<Feature> _features; | 33 EnumSet<Feature> _features; |
35 Setlet<MapLiteralUse> _mapLiterals; | 34 Setlet<MapLiteralUse> _mapLiterals; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 final _ResolutionWorldImpact worldImpact; | 162 final _ResolutionWorldImpact worldImpact; |
164 | 163 |
165 ResolutionRegistry(Compiler compiler, TreeElementMapping mapping) | 164 ResolutionRegistry(Compiler compiler, TreeElementMapping mapping) |
166 : this.compiler = compiler, | 165 : this.compiler = compiler, |
167 this.mapping = mapping, | 166 this.mapping = mapping, |
168 this.worldImpact = | 167 this.worldImpact = |
169 new _ResolutionWorldImpact(mapping.analyzedElement.toString()); | 168 new _ResolutionWorldImpact(mapping.analyzedElement.toString()); |
170 | 169 |
171 bool get isForResolution => true; | 170 bool get isForResolution => true; |
172 | 171 |
173 ResolutionEnqueuer get world => compiler.enqueuer.resolution; | |
174 | |
175 World get universe => compiler.world; | |
176 | |
177 Backend get backend => compiler.backend; | 172 Backend get backend => compiler.backend; |
178 | 173 |
179 String toString() => 'ResolutionRegistry for ${mapping.analyzedElement}'; | 174 String toString() => 'ResolutionRegistry for ${mapping.analyzedElement}'; |
180 | 175 |
181 ////////////////////////////////////////////////////////////////////////////// | 176 ////////////////////////////////////////////////////////////////////////////// |
182 // Node-to-Element mapping functionality. | 177 // Node-to-Element mapping functionality. |
183 ////////////////////////////////////////////////////////////////////////////// | 178 ////////////////////////////////////////////////////////////////////////////// |
184 | 179 |
185 /// Register [node] as the declaration of [element]. | 180 /// Register [node] as the declaration of [element]. |
186 void defineFunction(FunctionExpression node, FunctionElement element) { | 181 void defineFunction(FunctionExpression node, FunctionElement element) { |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 } | 387 } |
393 | 388 |
394 void registerConstantLiteral(ConstantExpression constant) { | 389 void registerConstantLiteral(ConstantExpression constant) { |
395 worldImpact.registerConstantLiteral(constant); | 390 worldImpact.registerConstantLiteral(constant); |
396 } | 391 } |
397 | 392 |
398 ClassElement defaultSuperclass(ClassElement element) { | 393 ClassElement defaultSuperclass(ClassElement element) { |
399 return backend.defaultSuperclass(element); | 394 return backend.defaultSuperclass(element); |
400 } | 395 } |
401 | 396 |
402 void registerMixinUse( | |
403 MixinApplicationElement mixinApplication, ClassElement mixin) { | |
404 universe.registerMixinUse(mixinApplication, mixin); | |
405 } | |
406 | |
407 void registerInstantiation(InterfaceType type) { | 397 void registerInstantiation(InterfaceType type) { |
408 worldImpact.registerTypeUse(new TypeUse.instantiation(type)); | 398 worldImpact.registerTypeUse(new TypeUse.instantiation(type)); |
409 } | 399 } |
410 | 400 |
411 void registerSendStructure(Send node, SendStructure sendStructure) { | 401 void registerSendStructure(Send node, SendStructure sendStructure) { |
412 mapping.setSendStructure(node, sendStructure); | 402 mapping.setSendStructure(node, sendStructure); |
413 } | 403 } |
414 | 404 |
415 void registerNewStructure(NewExpression node, NewStructure newStructure) { | 405 void registerNewStructure(NewExpression node, NewStructure newStructure) { |
416 mapping.setNewStructure(node, newStructure); | 406 mapping.setNewStructure(node, newStructure); |
(...skipping 24 matching lines...) Expand all Loading... |
441 @override | 431 @override |
442 void registerInstantiatedType(InterfaceType type) { | 432 void registerInstantiatedType(InterfaceType type) { |
443 registry.registerInstantiation(type); | 433 registry.registerInstantiation(type); |
444 } | 434 } |
445 | 435 |
446 @override | 436 @override |
447 DartType resolveTypeFromString(Node node, String typeName) { | 437 DartType resolveTypeFromString(Node node, String typeName) { |
448 return visitor.resolveTypeFromString(node, typeName); | 438 return visitor.resolveTypeFromString(node, typeName); |
449 } | 439 } |
450 } | 440 } |
OLD | NEW |