| 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, IOSink; | 9 import 'dart:io' show File, IOSink; |
| 10 | 10 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 LibraryBuilder, | 85 LibraryBuilder, |
| 86 MixinApplicationBuilder, | 86 MixinApplicationBuilder, |
| 87 NamedMixinApplicationBuilder, | 87 NamedMixinApplicationBuilder, |
| 88 NamedTypeBuilder, | 88 NamedTypeBuilder, |
| 89 TypeBuilder, | 89 TypeBuilder, |
| 90 TypeVariableBuilder; | 90 TypeVariableBuilder; |
| 91 | 91 |
| 92 import 'verifier.dart' show verifyProgram; | 92 import 'verifier.dart' show verifyProgram; |
| 93 | 93 |
| 94 class KernelTarget extends TargetImplementation { | 94 class KernelTarget extends TargetImplementation { |
| 95 final bool strongMode; | |
| 96 | |
| 97 final DillTarget dillTarget; | 95 final DillTarget dillTarget; |
| 98 | 96 |
| 99 /// Shared with [CompilerContext]. | 97 /// Shared with [CompilerContext]. |
| 100 final Map<String, Source> uriToSource; | 98 final Map<String, Source> uriToSource; |
| 101 | 99 |
| 102 SourceLoader<Library> loader; | 100 SourceLoader<Library> loader; |
| 103 Program program; | 101 Program program; |
| 104 | 102 |
| 105 final List errors = []; | 103 final List errors = []; |
| 106 | 104 |
| 107 final TypeBuilder dynamicType = | 105 final TypeBuilder dynamicType = |
| 108 new KernelNamedTypeBuilder("dynamic", null, -1, null); | 106 new KernelNamedTypeBuilder("dynamic", null, -1, null); |
| 109 | 107 |
| 110 KernelTarget( | 108 KernelTarget( |
| 111 DillTarget dillTarget, TranslateUri uriTranslator, this.strongMode, | 109 DillTarget dillTarget, TranslateUri uriTranslator, bool strongMode, |
| 112 [Map<String, Source> uriToSource]) | 110 [Map<String, Source> uriToSource]) |
| 113 : dillTarget = dillTarget, | 111 : dillTarget = dillTarget, |
| 114 uriToSource = uriToSource ?? CompilerContext.current.uriToSource, | 112 uriToSource = uriToSource ?? CompilerContext.current.uriToSource, |
| 115 super(dillTarget.ticker, uriTranslator) { | 113 super(dillTarget.ticker, uriTranslator, strongMode) { |
| 116 resetCrashReporting(); | 114 resetCrashReporting(); |
| 117 loader = createLoader(); | 115 loader = createLoader(); |
| 118 } | 116 } |
| 119 | 117 |
| 120 void addError(file, int charOffset, String message) { | 118 void addError(file, int charOffset, String message) { |
| 121 Uri uri = file is String ? Uri.parse(file) : file; | 119 Uri uri = file is String ? Uri.parse(file) : file; |
| 122 InputError error = new InputError(uri, charOffset, message); | 120 InputError error = new InputError(uri, charOffset, message); |
| 123 print(error.format()); | 121 print(error.format()); |
| 124 errors.add(error); | 122 errors.add(error); |
| 125 } | 123 } |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 } | 717 } |
| 720 for (Constructor constructor in superclass.constructors) { | 718 for (Constructor constructor in superclass.constructors) { |
| 721 if (constructor.name.name.isEmpty) { | 719 if (constructor.name.name.isEmpty) { |
| 722 return constructor.function.requiredParameterCount == 0 | 720 return constructor.function.requiredParameterCount == 0 |
| 723 ? constructor | 721 ? constructor |
| 724 : null; | 722 : null; |
| 725 } | 723 } |
| 726 } | 724 } |
| 727 return null; | 725 return null; |
| 728 } | 726 } |
| OLD | NEW |