| 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 transformMixinApplications(); | 658 backendTarget.performModularTransformationsOnLibraries( |
| 659 otherTransformations(); | 659 loader.coreTypes, loader.hierarchy, loader.libraries, |
| 660 } | 660 logger: (String msg) => ticker.logMs(msg)); |
| 661 | 661 backendTarget.performGlobalTransformations(loader.coreTypes, program, |
| 662 void transformMixinApplications() { | 662 logger: (String msg) => ticker.logMs(msg)); |
| 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"); | |
| 679 } | 663 } |
| 680 | 664 |
| 681 void verify() { | 665 void verify() { |
| 682 var verifyErrors = verifyProgram(program); | 666 var verifyErrors = verifyProgram(program); |
| 683 errors.addAll(verifyErrors.map((error) => '$error')); | 667 errors.addAll(verifyErrors.map((error) => '$error')); |
| 684 ticker.logMs("Verified program"); | 668 ticker.logMs("Verified program"); |
| 685 } | 669 } |
| 686 | 670 |
| 687 /// Tree-shakes most code from the [dillTarget] by visiting all other | 671 /// Tree-shakes most code from the [dillTarget] by visiting all other |
| 688 /// libraries in [program] and marking the APIs from the [dillTarget] | 672 /// libraries in [program] and marking the APIs from the [dillTarget] |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 } | 706 } |
| 723 for (Constructor constructor in superclass.constructors) { | 707 for (Constructor constructor in superclass.constructors) { |
| 724 if (constructor.name.name.isEmpty) { | 708 if (constructor.name.name.isEmpty) { |
| 725 return constructor.function.requiredParameterCount == 0 | 709 return constructor.function.requiredParameterCount == 0 |
| 726 ? constructor | 710 ? constructor |
| 727 : null; | 711 : null; |
| 728 } | 712 } |
| 729 } | 713 } |
| 730 return null; | 714 return null; |
| 731 } | 715 } |
| OLD | NEW |