| 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/backend_api.dart' show | 7 import '../common/backend_api.dart' show |
| 8 Backend; | 8 Backend; |
| 9 import '../common/registry.dart' show | 9 import '../common/registry.dart' show |
| 10 Registry; | 10 Registry; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 world.registerDynamicSetter(selector); | 78 world.registerDynamicSetter(selector); |
| 79 } | 79 } |
| 80 | 80 |
| 81 @override | 81 @override |
| 82 void registerGetOfStaticFunction(FunctionElement element) { | 82 void registerGetOfStaticFunction(FunctionElement element) { |
| 83 world.registerGetOfStaticFunction(element); | 83 world.registerGetOfStaticFunction(element); |
| 84 } | 84 } |
| 85 | 85 |
| 86 @override | 86 @override |
| 87 void registerInstantiation(InterfaceType type) { | 87 void registerInstantiation(InterfaceType type) { |
| 88 // TODO(johnniwinther): Remove the need for passing `this`. | 88 world.registerInstantiatedType(type); |
| 89 world.registerInstantiatedType(type, this); | |
| 90 } | 89 } |
| 91 | 90 |
| 92 @override | 91 @override |
| 93 void registerStaticInvocation(Element element) { | 92 void registerStaticInvocation(Element element) { |
| 94 registerDependency(element); | 93 registerDependency(element); |
| 95 world.registerStaticUse(element); | 94 world.registerStaticUse(element); |
| 96 } | 95 } |
| 97 | 96 |
| 98 String toString() => 'EagerRegistry for ${mapping.analyzedElement}'; | 97 String toString() => 'EagerRegistry for ${mapping.analyzedElement}'; |
| 99 } | 98 } |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 mapping.addRequiredType(type); | 440 mapping.addRequiredType(type); |
| 442 } | 441 } |
| 443 | 442 |
| 444 void registerAsCheck(DartType type) { | 443 void registerAsCheck(DartType type) { |
| 445 registerIsCheck(type); | 444 registerIsCheck(type); |
| 446 backend.resolutionCallbacks.onAsCheck(type, this); | 445 backend.resolutionCallbacks.onAsCheck(type, this); |
| 447 mapping.addRequiredType(type); | 446 mapping.addRequiredType(type); |
| 448 } | 447 } |
| 449 | 448 |
| 450 void registerClosure(LocalFunctionElement element) { | 449 void registerClosure(LocalFunctionElement element) { |
| 451 world.registerClosure(element, this); | 450 if (element.computeType(compiler).containsTypeVariables) { |
| 451 backend.registerClosureWithFreeTypeVariables(element, world, this); |
| 452 } |
| 453 world.registerClosure(element); |
| 452 } | 454 } |
| 453 | 455 |
| 454 void registerSuperUse(Node node) { | 456 void registerSuperUse(Node node) { |
| 455 mapping.addSuperUse(node); | 457 mapping.addSuperUse(node); |
| 456 } | 458 } |
| 457 | 459 |
| 458 void registerDynamicInvocation(UniverseSelector selector) { | 460 void registerDynamicInvocation(UniverseSelector selector) { |
| 459 worldImpact.registerDynamicInvocation(selector); | 461 worldImpact.registerDynamicInvocation(selector); |
| 460 } | 462 } |
| 461 | 463 |
| 462 void registerSuperNoSuchMethod() { | 464 void registerSuperNoSuchMethod() { |
| 463 backend.resolutionCallbacks.onSuperNoSuchMethod(this); | 465 backend.resolutionCallbacks.onSuperNoSuchMethod(this); |
| 464 } | 466 } |
| 465 | 467 |
| 466 void registerTypeVariableExpression(TypeVariableElement element) { | 468 void registerTypeVariableExpression(TypeVariableElement element) { |
| 467 backend.resolutionCallbacks.onTypeVariableExpression(this, element); | 469 backend.resolutionCallbacks.onTypeVariableExpression(this, element); |
| 468 } | 470 } |
| 469 | 471 |
| 470 void registerTypeLiteral(Send node, DartType type) { | 472 void registerTypeLiteral(Send node, DartType type) { |
| 471 mapping.setType(node, type); | 473 mapping.setType(node, type); |
| 472 backend.resolutionCallbacks.onTypeLiteral(type, this); | 474 backend.resolutionCallbacks.onTypeLiteral(type, this); |
| 473 world.registerInstantiatedType(compiler.coreTypes.typeType, this); | 475 backend.registerInstantiatedType(compiler.coreTypes.typeType, world, this); |
| 474 } | 476 } |
| 475 | 477 |
| 476 void registerMapLiteral(Node node, DartType type, bool isConstant) { | 478 void registerMapLiteral(Node node, DartType type, bool isConstant) { |
| 477 setType(node, type); | 479 setType(node, type); |
| 478 backend.resolutionCallbacks.onMapLiteral(this, type, isConstant); | 480 backend.resolutionCallbacks.onMapLiteral(this, type, isConstant); |
| 479 } | 481 } |
| 480 | 482 |
| 481 // TODO(johnniwinther): Remove the [ResolverVisitor] dependency. Its only | 483 // TODO(johnniwinther): Remove the [ResolverVisitor] dependency. Its only |
| 482 // needed to lookup types in the current scope. | 484 // needed to lookup types in the current scope. |
| 483 void registerJsCall(Node node, ResolverVisitor visitor) { | 485 void registerJsCall(Node node, ResolverVisitor visitor) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 512 | 514 |
| 513 void registerConstSymbol(String name) { | 515 void registerConstSymbol(String name) { |
| 514 backend.registerConstSymbol(name, this); | 516 backend.registerConstSymbol(name, this); |
| 515 } | 517 } |
| 516 | 518 |
| 517 void registerSymbolConstructor() { | 519 void registerSymbolConstructor() { |
| 518 backend.resolutionCallbacks.onSymbolConstructor(this); | 520 backend.resolutionCallbacks.onSymbolConstructor(this); |
| 519 } | 521 } |
| 520 | 522 |
| 521 void registerInstantiatedType(InterfaceType type) { | 523 void registerInstantiatedType(InterfaceType type) { |
| 522 world.registerInstantiatedType(type, this); | 524 backend.registerInstantiatedType(type, world, this); |
| 523 mapping.addRequiredType(type); | 525 mapping.addRequiredType(type); |
| 524 } | 526 } |
| 525 | 527 |
| 526 void registerAbstractClassInstantiation() { | 528 void registerAbstractClassInstantiation() { |
| 527 backend.resolutionCallbacks.onAbstractClassInstantiation(this); | 529 backend.resolutionCallbacks.onAbstractClassInstantiation(this); |
| 528 } | 530 } |
| 529 | 531 |
| 530 void registerNewSymbol() { | 532 void registerNewSymbol() { |
| 531 backend.registerNewSymbol(this); | 533 backend.registerNewSymbol(this); |
| 532 } | 534 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 | 579 |
| 578 void registerStaticInvocation(Element element) { | 580 void registerStaticInvocation(Element element) { |
| 579 // TODO(johnniwinther): Increase precision of [registerStaticUse] and | 581 // TODO(johnniwinther): Increase precision of [registerStaticUse] and |
| 580 // [registerDependency]. | 582 // [registerDependency]. |
| 581 if (element == null) return; | 583 if (element == null) return; |
| 582 registerStaticUse(element); | 584 registerStaticUse(element); |
| 583 registerDependency(element); | 585 registerDependency(element); |
| 584 } | 586 } |
| 585 | 587 |
| 586 void registerInstantiation(InterfaceType type) { | 588 void registerInstantiation(InterfaceType type) { |
| 587 world.registerInstantiatedType(type, this); | 589 backend.registerInstantiatedType(type, world, this); |
| 588 } | 590 } |
| 589 | 591 |
| 590 void registerAssert(bool hasMessage) { | 592 void registerAssert(bool hasMessage) { |
| 591 backend.resolutionCallbacks.onAssert(hasMessage, this); | 593 backend.resolutionCallbacks.onAssert(hasMessage, this); |
| 592 } | 594 } |
| 593 | 595 |
| 594 void registerSendStructure(Send node, SendStructure sendStructure) { | 596 void registerSendStructure(Send node, SendStructure sendStructure) { |
| 595 mapping.setSendStructure(node, sendStructure); | 597 mapping.setSendStructure(node, sendStructure); |
| 596 } | 598 } |
| 597 | 599 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 610 } | 612 } |
| 611 | 613 |
| 612 void registerIncDecOperation() { | 614 void registerIncDecOperation() { |
| 613 backend.resolutionCallbacks.onIncDecOperation(this); | 615 backend.resolutionCallbacks.onIncDecOperation(this); |
| 614 } | 616 } |
| 615 | 617 |
| 616 void registerTryStatement() { | 618 void registerTryStatement() { |
| 617 mapping.containsTryStatement = true; | 619 mapping.containsTryStatement = true; |
| 618 } | 620 } |
| 619 } | 621 } |
| OLD | NEW |