Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: pkg/front_end/test/fasta/testing/suite.dart

Issue 2982093003: Unifying compiler context (Closed)
Patch Set: revert change to kernel-service.dart Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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'
27 show 25 show
28 Chain, 26 Chain,
29 ChainContext, 27 ChainContext,
30 ExpectationSet, 28 ExpectationSet,
31 Result, 29 Result,
32 Step, 30 Step,
33 TestDescription, 31 TestDescription,
34 StdioProcess; 32 StdioProcess;
35 33
34 import 'package:front_end/compiler_options.dart' show CompilerOptions;
35
36 import 'package:front_end/src/base/processed_options.dart'
37 show ProcessedOptions;
38
36 import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext; 39 import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
37 40
38 import 'package:front_end/src/fasta/deprecated_problems.dart' 41 import 'package:front_end/src/fasta/deprecated_problems.dart'
39 show deprecated_InputError; 42 show deprecated_InputError;
40 43
41 import 'package:front_end/src/fasta/testing/kernel_chain.dart' 44 import 'package:front_end/src/fasta/testing/kernel_chain.dart'
42 show MatchExpectation, Print, Verify, WriteDill; 45 show MatchExpectation, Print, Verify, WriteDill;
43 46
44 import 'package:front_end/src/fasta/ticker.dart' show Ticker; 47 import 'package:front_end/src/fasta/ticker.dart' show Ticker;
45 48
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 final bool updateComments; 220 final bool updateComments;
218 221
219 String get name { 222 String get name {
220 return fullCompile ? "${astKind} compile" : "outline"; 223 return fullCompile ? "${astKind} compile" : "outline";
221 } 224 }
222 225
223 bool get isCompiler => fullCompile; 226 bool get isCompiler => fullCompile;
224 227
225 Future<Result<Program>> run( 228 Future<Result<Program>> run(
226 TestDescription description, FastaContext context) async { 229 TestDescription description, FastaContext context) async {
227 return await CompilerCommandLine.withGlobalOptions("", [""], (_) async { 230 var options =
231 new ProcessedOptions(new CompilerOptions()..throwOnErrors = false);
232 return await CompilerContext.runWithOptions(options, (_) async {
228 // Disable colors to ensure that expectation files are the same across 233 // Disable colors to ensure that expectation files are the same across
229 // platforms and independent of stdin/stderr. 234 // platforms and independent of stdin/stderr.
230 CompilerContext.current.disableColors(); 235 CompilerContext.current.disableColors();
231 Program platformOutline = await context.loadPlatformOutline(); 236 Program platformOutline = await context.loadPlatformOutline();
232 Ticker ticker = new Ticker(); 237 Ticker ticker = new Ticker();
233 DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator, 238 DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator,
234 new TestVmFastaTarget(new TargetFlags(strongMode: strongMode))); 239 new TestVmFastaTarget(new TargetFlags(strongMode: strongMode)));
235 platformOutline.unbindCanonicalNames(); 240 platformOutline.unbindCanonicalNames();
236 dillTarget.loader.appendLibraries(platformOutline); 241 dillTarget.loader.appendLibraries(platformOutline);
237 // We create a new URI translator to avoid reading platform libraries from 242 // We create a new URI translator to avoid reading platform libraries from
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 320 }
316 } 321 }
317 322
318 void performGlobalTransformations(CoreTypes coreTypes, Program program, 323 void performGlobalTransformations(CoreTypes coreTypes, Program program,
319 {void logger(String msg)}) { 324 {void logger(String msg)}) {
320 if (enabled) { 325 if (enabled) {
321 super.performGlobalTransformations(coreTypes, program, logger: logger); 326 super.performGlobalTransformations(coreTypes, program, logger: logger);
322 } 327 }
323 } 328 }
324 } 329 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698