| 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 Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import 'dart:convert' show JSON; | 9 import 'dart:convert' show JSON; |
| 10 | 10 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 ..input = Uri.parse("org.dartlang:platform") // Make up a name. | 185 ..input = Uri.parse("org.dartlang:platform") // Make up a name. |
| 186 ..setProgram(platform); | 186 ..setProgram(platform); |
| 187 KernelTarget sourceTarget = astKind == AstKind.Analyzer | 187 KernelTarget sourceTarget = astKind == AstKind.Analyzer |
| 188 ? new AnalyzerTarget(dillTarget, context.uriTranslator, strongMode) | 188 ? new AnalyzerTarget(dillTarget, context.uriTranslator, strongMode) |
| 189 : new KernelTarget(dillTarget, context.uriTranslator, strongMode); | 189 : new KernelTarget(dillTarget, context.uriTranslator, strongMode); |
| 190 | 190 |
| 191 Program p; | 191 Program p; |
| 192 try { | 192 try { |
| 193 sourceTarget.read(description.uri); | 193 sourceTarget.read(description.uri); |
| 194 await dillTarget.writeOutline(null); | 194 await dillTarget.writeOutline(null); |
| 195 var instrumentation = new ValidatingInstrumentation(); | 195 ValidatingInstrumentation instrumentation; |
| 196 await instrumentation.loadExpectations(description.uri); | 196 if (strongMode) { |
| 197 sourceTarget.loader.instrumentation = instrumentation; | 197 instrumentation = new ValidatingInstrumentation(); |
| 198 await instrumentation.loadExpectations(description.uri); |
| 199 sourceTarget.loader.instrumentation = instrumentation; |
| 200 } |
| 198 p = await sourceTarget.writeOutline(null); | 201 p = await sourceTarget.writeOutline(null); |
| 199 if (fullCompile) { | 202 if (fullCompile) { |
| 200 p = await sourceTarget.writeProgram(null); | 203 p = await sourceTarget.writeProgram(null); |
| 201 instrumentation.finish(); | 204 instrumentation?.finish(); |
| 202 if (instrumentation.hasProblems) { | 205 if (instrumentation != null && instrumentation.hasProblems) { |
| 203 if (updateExpectations) { | 206 if (updateExpectations) { |
| 204 await instrumentation.fixSource(description.uri); | 207 await instrumentation.fixSource(description.uri); |
| 205 } else { | 208 } else { |
| 206 return fail(null, instrumentation.problemsAsString); | 209 return fail(null, instrumentation.problemsAsString); |
| 207 } | 210 } |
| 208 } | 211 } |
| 209 } | 212 } |
| 210 } on InputError catch (e, s) { | 213 } on InputError catch (e, s) { |
| 211 return fail(null, e.error, s); | 214 return fail(null, e.error, s); |
| 212 } | 215 } |
| 213 return pass(p); | 216 return pass(p); |
| 214 } | 217 } |
| 215 } | 218 } |
| OLD | NEW |