| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 final List<String> errors = <String>[]; | 103 final List<String> errors = <String>[]; |
| 104 | 104 |
| 105 final TypeBuilder dynamicType = | 105 final TypeBuilder dynamicType = |
| 106 new KernelNamedTypeBuilder("dynamic", null, -1, null); | 106 new KernelNamedTypeBuilder("dynamic", null, -1, null); |
| 107 | 107 |
| 108 KernelTarget(this.fileSystem, DillTarget dillTarget, | 108 KernelTarget(this.fileSystem, DillTarget dillTarget, |
| 109 TranslateUri uriTranslator, this.strongMode, | 109 TranslateUri uriTranslator, this.strongMode, |
| 110 [Map<String, Source> uriToSource]) | 110 [Map<String, Source> uriToSource]) |
| 111 : dillTarget = dillTarget, | 111 : dillTarget = dillTarget, |
| 112 uriToSource = uriToSource ?? CompilerContext.current.uriToSource, | 112 uriToSource = uriToSource ?? CompilerContext.current.uriToSource, |
| 113 super(dillTarget.ticker, uriTranslator) { | 113 super(dillTarget.ticker, uriTranslator, dillTarget.backendTarget) { |
| 114 resetCrashReporting(); | 114 resetCrashReporting(); |
| 115 loader = createLoader(); | 115 loader = createLoader(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void addError(file, int charOffset, String message) { | 118 void addError(file, int charOffset, String message) { |
| 119 Uri uri = file is String ? Uri.parse(file) : file; | 119 Uri uri = file is String ? Uri.parse(file) : file; |
| 120 InputError error = new InputError(uri, charOffset, message); | 120 InputError error = new InputError(uri, charOffset, message); |
| 121 String formatterMessage = error.format(); | 121 String formatterMessage = error.format(); |
| 122 print(formatterMessage); | 122 print(formatterMessage); |
| 123 errors.add(formatterMessage); | 123 errors.add(formatterMessage); |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 transformMixinApplications(); |
| 659 otherTransformations(); | 659 otherTransformations(); |
| 660 } | 660 } |
| 661 | 661 |
| 662 void transformMixinApplications() { | 662 void transformMixinApplications() { |
| 663 new MixinFullResolution().transform(_program); | 663 new MixinFullResolution(backendTarget).transform(_program); |
| 664 ticker.logMs("Transformed mixin applications"); | 664 ticker.logMs("Transformed mixin applications"); |
| 665 } | 665 } |
| 666 | 666 |
| 667 void otherTransformations() { | 667 void otherTransformations() { |
| 668 // TODO(ahe): Don't generate type variables in the first place. | 668 // TODO(ahe): Don't generate type variables in the first place. |
| 669 if (!strongMode) { | 669 if (!strongMode) { |
| 670 _program.accept(new Erasure()); | 670 _program.accept(new Erasure()); |
| 671 ticker.logMs("Erased type variables in generic methods"); | 671 ticker.logMs("Erased type variables in generic methods"); |
| 672 } | 672 } |
| 673 // TODO(kmillikin): Make this run on a per-method basis. | 673 // TODO(kmillikin): Make this run on a per-method basis. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 } | 707 } |
| 708 for (Constructor constructor in superclass.constructors) { | 708 for (Constructor constructor in superclass.constructors) { |
| 709 if (constructor.name.name.isEmpty) { | 709 if (constructor.name.name.isEmpty) { |
| 710 return constructor.function.requiredParameterCount == 0 | 710 return constructor.function.requiredParameterCount == 0 |
| 711 ? constructor | 711 ? constructor |
| 712 : null; | 712 : null; |
| 713 } | 713 } |
| 714 } | 714 } |
| 715 return null; | 715 return null; |
| 716 } | 716 } |
| OLD | NEW |