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 | 8 import '../common/backend_api.dart' show |
9 Backend, | 9 Backend, |
10 ForeignResolver; | 10 ForeignResolver; |
(...skipping 13 matching lines...) Expand all Loading... |
24 import '../elements/elements.dart'; | 24 import '../elements/elements.dart'; |
25 import '../tree/tree.dart'; | 25 import '../tree/tree.dart'; |
26 import '../util/util.dart' show | 26 import '../util/util.dart' show |
27 Setlet; | 27 Setlet; |
28 import '../universe/call_structure.dart' show | 28 import '../universe/call_structure.dart' show |
29 CallStructure; | 29 CallStructure; |
30 import '../universe/selector.dart' show | 30 import '../universe/selector.dart' show |
31 Selector; | 31 Selector; |
32 import '../universe/universe.dart' show | 32 import '../universe/universe.dart' show |
33 UniverseSelector; | 33 UniverseSelector; |
| 34 import '../universe/use.dart' show |
| 35 StaticUse; |
34 import '../universe/world_impact.dart' show | 36 import '../universe/world_impact.dart' show |
35 WorldImpactBuilder; | 37 WorldImpactBuilder; |
36 import '../world.dart' show World; | 38 import '../world.dart' show World; |
37 | 39 |
38 import 'send_structure.dart'; | 40 import 'send_structure.dart'; |
39 | 41 |
40 import 'members.dart' show | 42 import 'members.dart' show |
41 ResolverVisitor; | 43 ResolverVisitor; |
42 import 'tree_elements.dart' show | 44 import 'tree_elements.dart' show |
43 TreeElementMapping; | 45 TreeElementMapping; |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 295 |
294 void registerPotentialMutationIn(Node contextNode, VariableElement element, | 296 void registerPotentialMutationIn(Node contextNode, VariableElement element, |
295 Node mutationNode) { | 297 Node mutationNode) { |
296 mapping.registerPotentialMutationIn(contextNode, element, mutationNode); | 298 mapping.registerPotentialMutationIn(contextNode, element, mutationNode); |
297 } | 299 } |
298 | 300 |
299 ////////////////////////////////////////////////////////////////////////////// | 301 ////////////////////////////////////////////////////////////////////////////// |
300 // Various Backend/Enqueuer/World registration. | 302 // Various Backend/Enqueuer/World registration. |
301 ////////////////////////////////////////////////////////////////////////////// | 303 ////////////////////////////////////////////////////////////////////////////// |
302 | 304 |
303 void registerStaticUse(Element element) { | 305 void registerStaticUse(StaticUse staticUse) { |
304 worldImpact.registerStaticUse(element); | 306 worldImpact.registerStaticUse(staticUse); |
305 } | |
306 | |
307 void registerImplicitSuperCall(FunctionElement superConstructor) { | |
308 registerStaticUse(superConstructor); | |
309 } | 307 } |
310 | 308 |
311 void registerLazyField() { | 309 void registerLazyField() { |
312 worldImpact.registerFeature(Feature.LAZY_FIELD); | 310 worldImpact.registerFeature(Feature.LAZY_FIELD); |
313 } | 311 } |
314 | 312 |
315 void registerMetadataConstant(MetadataAnnotation metadata) { | 313 void registerMetadataConstant(MetadataAnnotation metadata) { |
316 backend.registerMetadataConstant(metadata, metadata.annotatedElement, this); | 314 backend.registerMetadataConstant(metadata, metadata.annotatedElement, this); |
317 } | 315 } |
318 | 316 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 } | 351 } |
354 | 352 |
355 void registerClosure(LocalFunctionElement element) { | 353 void registerClosure(LocalFunctionElement element) { |
356 worldImpact.registerClosure(element); | 354 worldImpact.registerClosure(element); |
357 } | 355 } |
358 | 356 |
359 void registerSuperUse(Node node) { | 357 void registerSuperUse(Node node) { |
360 mapping.addSuperUse(node); | 358 mapping.addSuperUse(node); |
361 } | 359 } |
362 | 360 |
363 void registerDynamicInvocation(UniverseSelector selector) { | |
364 worldImpact.registerDynamicInvocation(selector); | |
365 } | |
366 | |
367 void registerSuperNoSuchMethod() { | 361 void registerSuperNoSuchMethod() { |
368 worldImpact.registerFeature(Feature.SUPER_NO_SUCH_METHOD); | 362 worldImpact.registerFeature(Feature.SUPER_NO_SUCH_METHOD); |
369 } | 363 } |
370 | 364 |
371 void registerTypeLiteral(Send node, DartType type) { | 365 void registerTypeLiteral(Send node, DartType type) { |
372 mapping.setType(node, type); | 366 mapping.setType(node, type); |
373 worldImpact.registerTypeLiteral(type); | 367 worldImpact.registerTypeLiteral(type); |
374 } | 368 } |
375 | 369 |
376 void registerLiteralList(Node node, | 370 void registerLiteralList(Node node, |
(...skipping 16 matching lines...) Expand all Loading... |
393 | 387 |
394 void registerForeignCall(Node node, | 388 void registerForeignCall(Node node, |
395 Element element, | 389 Element element, |
396 CallStructure callStructure, | 390 CallStructure callStructure, |
397 ResolverVisitor visitor) { | 391 ResolverVisitor visitor) { |
398 backend.registerForeignCall( | 392 backend.registerForeignCall( |
399 node, element, callStructure, | 393 node, element, callStructure, |
400 new ForeignResolutionResolver(visitor, this)); | 394 new ForeignResolutionResolver(visitor, this)); |
401 } | 395 } |
402 | 396 |
403 void registerGetOfStaticFunction(FunctionElement element) { | 397 void registerDynamicUse(UniverseSelector selector) { |
404 worldImpact.registerClosurizedFunction(element); | 398 worldImpact.registerDynamicUse(selector); |
405 } | |
406 | |
407 void registerDynamicGetter(UniverseSelector selector) { | |
408 assert(selector.selector.isGetter); | |
409 worldImpact.registerDynamicGetter(selector); | |
410 } | |
411 | |
412 void registerDynamicSetter(UniverseSelector selector) { | |
413 assert(selector.selector.isSetter); | |
414 worldImpact.registerDynamicSetter(selector); | |
415 } | 399 } |
416 | 400 |
417 void registerConstSymbol(String name) { | 401 void registerConstSymbol(String name) { |
418 worldImpact.registerConstSymbolName(name); | 402 worldImpact.registerConstSymbolName(name); |
419 } | 403 } |
420 | 404 |
421 void registerSymbolConstructor() { | 405 void registerSymbolConstructor() { |
422 worldImpact.registerFeature(Feature.SYMBOL_CONSTRUCTOR); | 406 worldImpact.registerFeature(Feature.SYMBOL_CONSTRUCTOR); |
423 } | 407 } |
424 | 408 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 440 |
457 void registerMixinUse(MixinApplicationElement mixinApplication, | 441 void registerMixinUse(MixinApplicationElement mixinApplication, |
458 ClassElement mixin) { | 442 ClassElement mixin) { |
459 universe.registerMixinUse(mixinApplication, mixin); | 443 universe.registerMixinUse(mixinApplication, mixin); |
460 } | 444 } |
461 | 445 |
462 void registerThrowExpression() { | 446 void registerThrowExpression() { |
463 worldImpact.registerFeature(Feature.THROW_EXPRESSION); | 447 worldImpact.registerFeature(Feature.THROW_EXPRESSION); |
464 } | 448 } |
465 | 449 |
466 void registerStaticInvocation(Element element) { | |
467 // TODO(johnniwinther): Increase precision of [registerStaticUse]. | |
468 if (element == null) return; | |
469 registerStaticUse(element); | |
470 } | |
471 | |
472 void registerInstantiation(InterfaceType type) { | 450 void registerInstantiation(InterfaceType type) { |
473 registerInstantiatedType(type); | 451 registerInstantiatedType(type); |
474 } | 452 } |
475 | 453 |
476 void registerAssert(bool hasMessage) { | 454 void registerAssert(bool hasMessage) { |
477 worldImpact.registerFeature( | 455 worldImpact.registerFeature( |
478 hasMessage ? Feature.ASSERT_WITH_MESSAGE : Feature.ASSERT); | 456 hasMessage ? Feature.ASSERT_WITH_MESSAGE : Feature.ASSERT); |
479 } | 457 } |
480 | 458 |
481 void registerSendStructure(Send node, SendStructure sendStructure) { | 459 void registerSendStructure(Send node, SendStructure sendStructure) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 @override | 509 @override |
532 void registerInstantiatedType(InterfaceType type) { | 510 void registerInstantiatedType(InterfaceType type) { |
533 registry.registerInstantiatedType(type); | 511 registry.registerInstantiatedType(type); |
534 } | 512 } |
535 | 513 |
536 @override | 514 @override |
537 DartType resolveTypeFromString(Node node, String typeName) { | 515 DartType resolveTypeFromString(Node node, String typeName) { |
538 return visitor.resolveTypeFromString(node, typeName); | 516 return visitor.resolveTypeFromString(node, typeName); |
539 } | 517 } |
540 } | 518 } |
OLD | NEW |