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; | 5 library fasta; |
6 | 6 |
7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
8 | 8 |
9 import 'dart:convert' show JSON; | 9 import 'dart:convert' show JSON; |
10 | 10 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 formatUnexpected(fileName, -1, "No such file.")); | 158 formatUnexpected(fileName, -1, "No such file.")); |
159 } | 159 } |
160 if (!await new Directory.fromUri(patchedSdk).exists()) { | 160 if (!await new Directory.fromUri(patchedSdk).exists()) { |
161 return new CompilationResult.error( | 161 return new CompilationResult.error( |
162 formatUnexpected(patchedSdk, -1, "Patched sdk directory not found.")); | 162 formatUnexpected(patchedSdk, -1, "Patched sdk directory not found.")); |
163 } | 163 } |
164 | 164 |
165 Target target = getTarget("vm", new TargetFlags(strongMode: false)); | 165 Target target = getTarget("vm", new TargetFlags(strongMode: false)); |
166 | 166 |
167 Program program; | 167 Program program; |
168 final uriTranslator = await TranslateUri.parse(null, packages); | |
169 final Ticker ticker = new Ticker(isVerbose: verbose); | |
170 final DillTarget dillTarget = new DillTarget(ticker, uriTranslator); | |
171 dillTarget.read(patchedSdk.resolve('platform.dill')); | |
172 final KernelTarget kernelTarget = | |
173 new KernelTarget(dillTarget, uriTranslator); | |
174 try { | 168 try { |
| 169 TranslateUri uriTranslator = await TranslateUri.parse(null, packages); |
| 170 final Ticker ticker = new Ticker(isVerbose: verbose); |
| 171 final DillTarget dillTarget = new DillTarget(ticker, uriTranslator); |
| 172 dillTarget.read(patchedSdk.resolve('platform.dill')); |
| 173 final KernelTarget kernelTarget = |
| 174 new KernelTarget(dillTarget, uriTranslator); |
175 kernelTarget.read(fileName); | 175 kernelTarget.read(fileName); |
176 await dillTarget.writeOutline(null); | 176 await dillTarget.writeOutline(null); |
177 program = await kernelTarget.writeOutline(null); | 177 program = await kernelTarget.writeOutline(null); |
178 program = await kernelTarget.writeProgram(null); | 178 program = await kernelTarget.writeProgram(null); |
179 if (kernelTarget.errors.isNotEmpty) { | 179 if (kernelTarget.errors.isNotEmpty) { |
180 return new CompilationResult.errors(kernelTarget.errors | 180 return new CompilationResult.errors(kernelTarget.errors |
181 .map((err) => err.toString()) | 181 .map((err) => err.toString()) |
182 .toList(growable: false)); | 182 .toList(growable: false)); |
183 } | 183 } |
184 } on InputError catch (e) { | 184 } on InputError catch (e) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 final BytesBuilder builder = new BytesBuilder(); | 244 final BytesBuilder builder = new BytesBuilder(); |
245 | 245 |
246 void add(List<int> data) { | 246 void add(List<int> data) { |
247 builder.add(data); | 247 builder.add(data); |
248 } | 248 } |
249 | 249 |
250 void close() { | 250 void close() { |
251 // Nothing to do. | 251 // Nothing to do. |
252 } | 252 } |
253 } | 253 } |
OLD | NEW |