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:io' show File; | 9 import 'dart:io' show File; |
10 | 10 |
11 import 'dart:convert' show JSON; | 11 import 'dart:convert' show JSON; |
12 | 12 |
13 import 'package:front_end/physical_file_system.dart' show PhysicalFileSystem; | 13 import 'package:front_end/physical_file_system.dart' show PhysicalFileSystem; |
14 | 14 |
15 import 'package:front_end/src/fasta/compiler_command_line.dart'; | |
16 | |
17 import 'package:front_end/src/fasta/testing/validating_instrumentation.dart' | 15 import 'package:front_end/src/fasta/testing/validating_instrumentation.dart' |
18 show ValidatingInstrumentation; | 16 show ValidatingInstrumentation; |
19 | 17 |
20 import 'package:front_end/src/fasta/testing/patched_sdk_location.dart' | 18 import 'package:front_end/src/fasta/testing/patched_sdk_location.dart' |
21 show computeDartVm, computePatchedSdk; | 19 show computeDartVm, computePatchedSdk; |
22 import 'package:front_end/src/fasta/uri_translator_impl.dart'; | 20 import 'package:front_end/src/fasta/uri_translator_impl.dart'; |
23 | 21 |
24 import 'package:kernel/ast.dart' show Library, Program; | 22 import 'package:kernel/ast.dart' show Library, Program; |
25 | 23 |
26 import 'package:testing/testing.dart' | 24 import 'package:testing/testing.dart' |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 final bool updateComments; | 215 final bool updateComments; |
218 | 216 |
219 String get name { | 217 String get name { |
220 return fullCompile ? "${astKind} compile" : "outline"; | 218 return fullCompile ? "${astKind} compile" : "outline"; |
221 } | 219 } |
222 | 220 |
223 bool get isCompiler => fullCompile; | 221 bool get isCompiler => fullCompile; |
224 | 222 |
225 Future<Result<Program>> run( | 223 Future<Result<Program>> run( |
226 TestDescription description, FastaContext context) async { | 224 TestDescription description, FastaContext context) async { |
227 return await CompilerCommandLine.withGlobalOptions("", [""], (_) async { | 225 return await CompilerContext.runWithDefaultOptions((_) async { |
228 // Disable colors to ensure that expectation files are the same across | 226 // Disable colors to ensure that expectation files are the same across |
229 // platforms and independent of stdin/stderr. | 227 // platforms and independent of stdin/stderr. |
230 CompilerContext.current.disableColors(); | 228 CompilerContext.current.disableColors(); |
231 Program platformOutline = await context.loadPlatformOutline(); | 229 Program platformOutline = await context.loadPlatformOutline(); |
232 Ticker ticker = new Ticker(); | 230 Ticker ticker = new Ticker(); |
233 DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator, | 231 DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator, |
234 new TestVmFastaTarget(new TargetFlags(strongMode: strongMode))); | 232 new TestVmFastaTarget(new TargetFlags(strongMode: strongMode))); |
235 platformOutline.unbindCanonicalNames(); | 233 platformOutline.unbindCanonicalNames(); |
236 dillTarget.loader.appendLibraries(platformOutline); | 234 dillTarget.loader.appendLibraries(platformOutline); |
237 // We create a new URI translator to avoid reading platform libraries from | 235 // We create a new URI translator to avoid reading platform libraries from |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 } | 313 } |
316 } | 314 } |
317 | 315 |
318 void performGlobalTransformations(CoreTypes coreTypes, Program program, | 316 void performGlobalTransformations(CoreTypes coreTypes, Program program, |
319 {void logger(String msg)}) { | 317 {void logger(String msg)}) { |
320 if (enabled) { | 318 if (enabled) { |
321 super.performGlobalTransformations(coreTypes, program, logger: logger); | 319 super.performGlobalTransformations(coreTypes, program, logger: logger); |
322 } | 320 } |
323 } | 321 } |
324 } | 322 } |
OLD | NEW |