| 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 library fasta.testing.suite; | 5 library fasta.testing.suite; |
| 6 | 6 |
| 7 import 'dart:async' show | 7 import 'dart:async' show |
| 8 Future; | 8 Future; |
| 9 | 9 |
| 10 import 'dart:convert' show | 10 import 'dart:convert' show |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return fullCompile ? "${shortenAstKindName(astKind)} compile" : "outline"; | 162 return fullCompile ? "${shortenAstKindName(astKind)} compile" : "outline"; |
| 163 } | 163 } |
| 164 | 164 |
| 165 bool get isCompiler => fullCompile; | 165 bool get isCompiler => fullCompile; |
| 166 | 166 |
| 167 Future<Result<Program>> run( | 167 Future<Result<Program>> run( |
| 168 TestDescription description, FeContext context) async { | 168 TestDescription description, FeContext context) async { |
| 169 Program platform = await context.createPlatform(); | 169 Program platform = await context.createPlatform(); |
| 170 Ticker ticker = new Ticker(); | 170 Ticker ticker = new Ticker(); |
| 171 DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator); | 171 DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator); |
| 172 dillTarget.loader.setProgram(platform); | 172 dillTarget.loader |
| 173 ..input = Uri.parse("org.dartlang:platform") // Make up a name. |
| 174 ..setProgram(platform); |
| 173 KernelSourceTarget sourceTarget = | 175 KernelSourceTarget sourceTarget = |
| 174 new KernelSourceTarget(dillTarget, context.uriTranslator); | 176 new KernelSourceTarget(dillTarget, context.uriTranslator); |
| 175 Program p; | 177 Program p; |
| 176 try { | 178 try { |
| 177 sourceTarget.read(description.uri); | 179 sourceTarget.read(description.uri); |
| 178 await dillTarget.writeOutline(null); | 180 await dillTarget.writeOutline(null); |
| 179 p = await sourceTarget.writeOutline(null); | 181 p = await sourceTarget.writeOutline(null); |
| 180 if (fullCompile) { | 182 if (fullCompile) { |
| 181 p = await sourceTarget.writeProgram(null, astKind); | 183 p = await sourceTarget.writeProgram(null, astKind); |
| 182 } | 184 } |
| 183 } on InputError catch (e, s) { | 185 } on InputError catch (e, s) { |
| 184 return fail(null, e.error, s); | 186 return fail(null, e.error, s); |
| 185 } | 187 } |
| 186 return pass(p); | 188 return pass(p); |
| 187 } | 189 } |
| 188 } | 190 } |
| OLD | NEW |