OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 fasta.kernel_target; | 5 library fasta.kernel_target; |
6 | 6 |
7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
8 | 8 |
9 import 'dart:io' show File; | 9 import 'dart:io' show File; |
10 | 10 |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 initializer.parent = constructor; | 648 initializer.parent = constructor; |
649 constructor.initializers.insert(0, initializer); | 649 constructor.initializers.insert(0, initializer); |
650 } | 650 } |
651 } | 651 } |
652 }); | 652 }); |
653 } | 653 } |
654 | 654 |
655 /// Run all transformations that are needed when building a program for the | 655 /// Run all transformations that are needed when building a program for the |
656 /// first time. | 656 /// first time. |
657 void runBuildTransformations() { | 657 void runBuildTransformations() { |
658 backendTarget.performModularTransformationsOnLibraries( | 658 transformMixinApplications(); |
659 loader.coreTypes, loader.hierarchy, loader.libraries, | 659 otherTransformations(); |
660 logger: (String msg) => ticker.logMs(msg)); | 660 } |
661 backendTarget.performGlobalTransformations(loader.coreTypes, program, | 661 |
662 logger: (String msg) => ticker.logMs(msg)); | 662 void transformMixinApplications() { |
| 663 mix.transformLibraries( |
| 664 backendTarget, loader.coreTypes, loader.hierarchy, loader.libraries); |
| 665 ticker.logMs("Transformed mixin applications"); |
| 666 } |
| 667 |
| 668 void otherTransformations() { |
| 669 if (!strongMode) { |
| 670 // TODO(ahe): Don't generate type variables in the first place. |
| 671 program.accept(new Erasure()); |
| 672 ticker.logMs("Erased type variables in generic methods"); |
| 673 } |
| 674 if (errors.isEmpty && loader.collectCompileTimeErrors().isEmpty) { |
| 675 // TODO(kmillikin): Make this run on a per-method basis. |
| 676 transformAsync.transformLibraries(loader.coreTypes, loader.libraries); |
| 677 } |
| 678 ticker.logMs("Transformed async methods"); |
663 } | 679 } |
664 | 680 |
665 void verify() { | 681 void verify() { |
666 var verifyErrors = verifyProgram(program); | 682 var verifyErrors = verifyProgram(program); |
667 errors.addAll(verifyErrors.map((error) => '$error')); | 683 errors.addAll(verifyErrors.map((error) => '$error')); |
668 ticker.logMs("Verified program"); | 684 ticker.logMs("Verified program"); |
669 } | 685 } |
670 | 686 |
671 /// Tree-shakes most code from the [dillTarget] by visiting all other | 687 /// Tree-shakes most code from the [dillTarget] by visiting all other |
672 /// libraries in [program] and marking the APIs from the [dillTarget] | 688 /// libraries in [program] and marking the APIs from the [dillTarget] |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 } | 722 } |
707 for (Constructor constructor in superclass.constructors) { | 723 for (Constructor constructor in superclass.constructors) { |
708 if (constructor.name.name.isEmpty) { | 724 if (constructor.name.name.isEmpty) { |
709 return constructor.function.requiredParameterCount == 0 | 725 return constructor.function.requiredParameterCount == 0 |
710 ? constructor | 726 ? constructor |
711 : null; | 727 : null; |
712 } | 728 } |
713 } | 729 } |
714 return null; | 730 return null; |
715 } | 731 } |
OLD | NEW |