| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 final List<String> errors = <String>[]; | 101 final List<String> errors = <String>[]; |
| 102 | 102 |
| 103 final TypeBuilder dynamicType = | 103 final TypeBuilder dynamicType = |
| 104 new KernelNamedTypeBuilder("dynamic", null, -1, null); | 104 new KernelNamedTypeBuilder("dynamic", null, -1, null); |
| 105 | 105 |
| 106 KernelTarget(this.fileSystem, DillTarget dillTarget, | 106 KernelTarget(this.fileSystem, DillTarget dillTarget, |
| 107 TranslateUri uriTranslator, this.strongMode, | 107 TranslateUri uriTranslator, this.strongMode, |
| 108 [Map<String, Source> uriToSource]) | 108 [Map<String, Source> uriToSource]) |
| 109 : dillTarget = dillTarget, | 109 : dillTarget = dillTarget, |
| 110 uriToSource = uriToSource ?? CompilerContext.current.uriToSource, | 110 uriToSource = uriToSource ?? CompilerContext.current.uriToSource, |
| 111 super(dillTarget.ticker, uriTranslator) { | 111 super(dillTarget.ticker, uriTranslator, dillTarget.backendTarget) { |
| 112 resetCrashReporting(); | 112 resetCrashReporting(); |
| 113 loader = createLoader(); | 113 loader = createLoader(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void addError(file, int charOffset, String message) { | 116 void addError(file, int charOffset, String message) { |
| 117 Uri uri = file is String ? Uri.parse(file) : file; | 117 Uri uri = file is String ? Uri.parse(file) : file; |
| 118 InputError error = new InputError(uri, charOffset, message); | 118 InputError error = new InputError(uri, charOffset, message); |
| 119 String formatterMessage = error.format(); | 119 String formatterMessage = error.format(); |
| 120 print(formatterMessage); | 120 print(formatterMessage); |
| 121 errors.add(formatterMessage); | 121 errors.add(formatterMessage); |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 /// first time. | 635 /// first time. |
| 636 void runBuildTransformations() { | 636 void runBuildTransformations() { |
| 637 transformMixinApplications(); | 637 transformMixinApplications(); |
| 638 otherTransformations(); | 638 otherTransformations(); |
| 639 } | 639 } |
| 640 | 640 |
| 641 /// Run all transformations that are needed when linking a program. | 641 /// Run all transformations that are needed when linking a program. |
| 642 void runLinkTransformations(Program program) {} | 642 void runLinkTransformations(Program program) {} |
| 643 | 643 |
| 644 void transformMixinApplications() { | 644 void transformMixinApplications() { |
| 645 new MixinFullResolution().transform(_program); | 645 new MixinFullResolution(backendTarget).transform(_program); |
| 646 ticker.logMs("Transformed mixin applications"); | 646 ticker.logMs("Transformed mixin applications"); |
| 647 } | 647 } |
| 648 | 648 |
| 649 void otherTransformations() { | 649 void otherTransformations() { |
| 650 // TODO(ahe): Don't generate type variables in the first place. | 650 // TODO(ahe): Don't generate type variables in the first place. |
| 651 if (!strongMode) { | 651 if (!strongMode) { |
| 652 _program.accept(new Erasure()); | 652 _program.accept(new Erasure()); |
| 653 ticker.logMs("Erased type variables in generic methods"); | 653 ticker.logMs("Erased type variables in generic methods"); |
| 654 } | 654 } |
| 655 // TODO(kmillikin): Make this run on a per-method basis. | 655 // TODO(kmillikin): Make this run on a per-method basis. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 674 } | 674 } |
| 675 for (Constructor constructor in superclass.constructors) { | 675 for (Constructor constructor in superclass.constructors) { |
| 676 if (constructor.name.name.isEmpty) { | 676 if (constructor.name.name.isEmpty) { |
| 677 return constructor.function.requiredParameterCount == 0 | 677 return constructor.function.requiredParameterCount == 0 |
| 678 ? constructor | 678 ? constructor |
| 679 : null; | 679 : null; |
| 680 } | 680 } |
| 681 } | 681 } |
| 682 return null; | 682 return null; |
| 683 } | 683 } |
| OLD | NEW |