Chromium Code Reviews| 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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 647 initializer.parent = constructor; | 647 initializer.parent = constructor; |
| 648 constructor.initializers.insert(0, initializer); | 648 constructor.initializers.insert(0, initializer); |
| 649 } | 649 } |
| 650 } | 650 } |
| 651 }); | 651 }); |
| 652 } | 652 } |
| 653 | 653 |
| 654 /// Run all transformations that are needed when building a program for the | 654 /// Run all transformations that are needed when building a program for the |
| 655 /// first time. | 655 /// first time. |
| 656 void runBuildTransformations() { | 656 void runBuildTransformations() { |
| 657 transformMixinApplications(); | 657 backendTarget.performModularTransformationsOnLibraries( |
| 658 otherTransformations(); | 658 loader.coreTypes, loader.libraries, |
| 659 } | 659 logger: (String msg) => ticker.logMs(msg)); |
|
ahe
2017/06/01 11:44:54
Nice touch keeping the logging!
| |
| 660 | |
| 661 void transformMixinApplications() { | |
| 662 mix.transformLibraries(backendTarget, loader.coreTypes, loader.libraries); | |
| 663 ticker.logMs("Transformed mixin applications"); | |
| 664 } | |
| 665 | |
| 666 void otherTransformations() { | |
| 667 // TODO(ahe): Don't generate type variables in the first place. | |
| 668 if (!strongMode) { | |
| 669 _program.accept(new Erasure()); | |
| 670 ticker.logMs("Erased type variables in generic methods"); | |
| 671 } | |
| 672 // TODO(kmillikin): Make this run on a per-method basis. | |
| 673 transformAsync.transformLibraries(loader.coreTypes, loader.libraries); | |
| 674 ticker.logMs("Transformed async methods"); | |
| 675 } | 660 } |
| 676 | 661 |
| 677 void verify() { | 662 void verify() { |
| 678 var verifyErrors = verifyProgram(_program); | 663 var verifyErrors = verifyProgram(_program); |
| 679 errors.addAll(verifyErrors.map((error) => '$error')); | 664 errors.addAll(verifyErrors.map((error) => '$error')); |
| 680 ticker.logMs("Verified program"); | 665 ticker.logMs("Verified program"); |
| 681 } | 666 } |
| 682 | 667 |
| 683 /// Tree-shakes most code from the [dillTarget] by visiting all other | 668 /// Tree-shakes most code from the [dillTarget] by visiting all other |
| 684 /// libraries in [_program] and marking the APIs from the [dillTarget] | 669 /// libraries in [_program] and marking the APIs from the [dillTarget] |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 718 } | 703 } |
| 719 for (Constructor constructor in superclass.constructors) { | 704 for (Constructor constructor in superclass.constructors) { |
| 720 if (constructor.name.name.isEmpty) { | 705 if (constructor.name.name.isEmpty) { |
| 721 return constructor.function.requiredParameterCount == 0 | 706 return constructor.function.requiredParameterCount == 0 |
| 722 ? constructor | 707 ? constructor |
| 723 : null; | 708 : null; |
| 724 } | 709 } |
| 725 } | 710 } |
| 726 return null; | 711 return null; |
| 727 } | 712 } |
| OLD | NEW |