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 /// Defines the front-end API for converting source code to Dart Kernel objects. | 5 /// Defines the front-end API for converting source code to Dart Kernel objects. |
6 library front_end.kernel_generator; | 6 library front_end.kernel_generator; |
7 | 7 |
8 import 'compiler_options.dart'; | 8 import 'compiler_options.dart'; |
9 import 'dart:async' show Future; | 9 import 'dart:async' show Future; |
10 import 'dart:async'; | 10 import 'dart:async'; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 | 47 |
48 var pOptions = new ProcessedOptions(options); | 48 var pOptions = new ProcessedOptions(options); |
49 | 49 |
50 if (!await pOptions.validateOptions()) return null; | 50 if (!await pOptions.validateOptions()) return null; |
51 | 51 |
52 try { | 52 try { |
53 TranslateUri uriTranslator = await pOptions.getUriTranslator(); | 53 TranslateUri uriTranslator = await pOptions.getUriTranslator(); |
54 | 54 |
55 var dillTarget = | 55 var dillTarget = |
56 new DillTarget(new Ticker(isVerbose: false), uriTranslator, "vm"); | 56 new DillTarget(new Ticker(isVerbose: false), uriTranslator, "vm_fasta"); |
57 var summary = await pOptions.sdkSummaryProgram; | 57 var summary = await pOptions.sdkSummaryProgram; |
58 if (summary != null) { | 58 if (summary != null) { |
59 dillTarget.loader.appendLibraries(summary); | 59 dillTarget.loader.appendLibraries(summary); |
60 } | 60 } |
61 | 61 |
62 var kernelTarget = new KernelTarget( | 62 var kernelTarget = new KernelTarget( |
63 options.fileSystem, dillTarget, uriTranslator, options.strongMode); | 63 options.fileSystem, dillTarget, uriTranslator, options.strongMode); |
64 kernelTarget.read(source); | 64 kernelTarget.read(source); |
65 | 65 |
66 await dillTarget.buildOutlines(); | 66 await dillTarget.buildOutlines(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 142 } |
143 | 143 |
144 var pOptions = new ProcessedOptions(options); | 144 var pOptions = new ProcessedOptions(options); |
145 | 145 |
146 if (!await pOptions.validateOptions()) return null; | 146 if (!await pOptions.validateOptions()) return null; |
147 | 147 |
148 try { | 148 try { |
149 TranslateUri uriTranslator = await pOptions.getUriTranslator(); | 149 TranslateUri uriTranslator = await pOptions.getUriTranslator(); |
150 | 150 |
151 var dillTarget = | 151 var dillTarget = |
152 new DillTarget(new Ticker(isVerbose: false), uriTranslator, "vm"); | 152 new DillTarget(new Ticker(isVerbose: false), uriTranslator, "vm_fasta"); |
153 var summary = await pOptions.sdkSummaryProgram; | 153 var summary = await pOptions.sdkSummaryProgram; |
154 if (summary != null) { | 154 if (summary != null) { |
155 dillTarget.loader.appendLibraries(summary); | 155 dillTarget.loader.appendLibraries(summary); |
156 } | 156 } |
157 | 157 |
158 // TODO(sigmund): this is likely not going to work if done naively: if | 158 // TODO(sigmund): this is likely not going to work if done naively: if |
159 // summaries contain external references we need to ensure they are loaded | 159 // summaries contain external references we need to ensure they are loaded |
160 // in a specific order. | 160 // in a specific order. |
161 for (var inputSummary in await pOptions.inputSummariesPrograms) { | 161 for (var inputSummary in await pOptions.inputSummariesPrograms) { |
162 dillTarget.loader.appendLibraries(inputSummary); | 162 dillTarget.loader.appendLibraries(inputSummary); |
(...skipping 12 matching lines...) Expand all Loading... |
175 kernelTarget.errors.forEach(report); | 175 kernelTarget.errors.forEach(report); |
176 return null; | 176 return null; |
177 } | 177 } |
178 | 178 |
179 return program; | 179 return program; |
180 } on InputError catch (e) { | 180 } on InputError catch (e) { |
181 options.onError(new SimpleError(e.format())); | 181 options.onError(new SimpleError(e.format())); |
182 return null; | 182 return null; |
183 } | 183 } |
184 } | 184 } |
OLD | NEW |