| 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 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 import 'package:front_end/src/fasta/kernel/kernel_target.dart' | 46 import 'package:front_end/src/fasta/kernel/kernel_target.dart' |
| 47 show KernelTarget; | 47 show KernelTarget; |
| 48 | 48 |
| 49 import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget; | 49 import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget; |
| 50 | 50 |
| 51 import 'package:kernel/kernel.dart' show loadProgramFromBytes; | 51 import 'package:kernel/kernel.dart' show loadProgramFromBytes; |
| 52 | 52 |
| 53 import 'package:kernel/target/targets.dart' show TargetFlags; | 53 import 'package:kernel/target/targets.dart' show TargetFlags; |
| 54 | 54 |
| 55 import 'package:kernel/target/vm_fasta.dart' show VmFastaTarget; |
| 56 |
| 55 export 'package:testing/testing.dart' show Chain, runMe; | 57 export 'package:testing/testing.dart' show Chain, runMe; |
| 56 | 58 |
| 57 const String STRONG_MODE = " strong mode "; | 59 const String STRONG_MODE = " strong mode "; |
| 58 | 60 |
| 59 const String ENABLE_FULL_COMPILE = " full compile "; | 61 const String ENABLE_FULL_COMPILE = " full compile "; |
| 60 | 62 |
| 61 const String AST_KIND_INDEX = " AST kind index "; | 63 const String AST_KIND_INDEX = " AST kind index "; |
| 62 | 64 |
| 63 const String EXPECTATIONS = ''' | 65 const String EXPECTATIONS = ''' |
| 64 [ | 66 [ |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 213 |
| 212 bool get isCompiler => fullCompile; | 214 bool get isCompiler => fullCompile; |
| 213 | 215 |
| 214 Future<Result<Program>> run( | 216 Future<Result<Program>> run( |
| 215 TestDescription description, FastaContext context) async { | 217 TestDescription description, FastaContext context) async { |
| 216 // Disable colors to ensure that expectation files are the same across | 218 // Disable colors to ensure that expectation files are the same across |
| 217 // platforms and independent of stdin/stderr. | 219 // platforms and independent of stdin/stderr. |
| 218 CompilerContext.current.disableColors(); | 220 CompilerContext.current.disableColors(); |
| 219 Program platformOutline = await context.loadPlatformOutline(); | 221 Program platformOutline = await context.loadPlatformOutline(); |
| 220 Ticker ticker = new Ticker(); | 222 Ticker ticker = new Ticker(); |
| 221 DillTarget dillTarget = new DillTarget( | 223 DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator, |
| 222 ticker, context.uriTranslator, "vm_fasta", | 224 new VmFastaTarget(new TargetFlags(strongMode: strongMode))); |
| 223 flags: new TargetFlags(strongMode: strongMode)); | |
| 224 platformOutline.unbindCanonicalNames(); | 225 platformOutline.unbindCanonicalNames(); |
| 225 dillTarget.loader.appendLibraries(platformOutline); | 226 dillTarget.loader.appendLibraries(platformOutline); |
| 226 // We create a new URI translator to avoid reading plaform libraries from | 227 // We create a new URI translator to avoid reading plaform libraries from |
| 227 // file system. | 228 // file system. |
| 228 TranslateUri uriTranslator = new TranslateUri( | 229 TranslateUri uriTranslator = new TranslateUri( |
| 229 context.uriTranslator.packages, | 230 context.uriTranslator.packages, |
| 230 const <String, Uri>{}, | 231 const <String, Uri>{}, |
| 231 const <String, List<Uri>>{}); | 232 const <String, List<Uri>>{}); |
| 232 KernelTarget sourceTarget = astKind == AstKind.Analyzer | 233 KernelTarget sourceTarget = astKind == AstKind.Analyzer |
| 233 ? new AnalyzerTarget(dillTarget, uriTranslator, strongMode) | 234 ? new AnalyzerTarget(dillTarget, uriTranslator, strongMode) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 255 return fail(null, instrumentation.problemsAsString); | 256 return fail(null, instrumentation.problemsAsString); |
| 256 } | 257 } |
| 257 } | 258 } |
| 258 } | 259 } |
| 259 } on InputError catch (e, s) { | 260 } on InputError catch (e, s) { |
| 260 return fail(null, e.error, s); | 261 return fail(null, e.error, s); |
| 261 } | 262 } |
| 262 return pass(p); | 263 return pass(p); |
| 263 } | 264 } |
| 264 } | 265 } |
| OLD | NEW |