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

Unified Diff: pkg/front_end/test/fasta/testing/suite.dart

Issue 2980033004: Throw if there is no compiler context available (Closed)
Patch Set: cl comments, handle validate and deprecated_InputError 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/test/fasta/shaker_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/test/fasta/testing/suite.dart
diff --git a/pkg/front_end/test/fasta/testing/suite.dart b/pkg/front_end/test/fasta/testing/suite.dart
index e058f665ee081fa0b1e496e7694373b8ac357e23..67569099d34288ba7b6e020135069c5463f58078 100644
--- a/pkg/front_end/test/fasta/testing/suite.dart
+++ b/pkg/front_end/test/fasta/testing/suite.dart
@@ -12,6 +12,8 @@ import 'dart:convert' show JSON;
import 'package:front_end/physical_file_system.dart' show PhysicalFileSystem;
+import 'package:front_end/src/fasta/compiler_command_line.dart';
+
import 'package:front_end/src/fasta/testing/validating_instrumentation.dart'
show ValidatingInstrumentation;
@@ -222,54 +224,56 @@ class Outline extends Step<TestDescription, Program, FastaContext> {
Future<Result<Program>> run(
TestDescription description, FastaContext context) async {
- // Disable colors to ensure that expectation files are the same across
- // platforms and independent of stdin/stderr.
- CompilerContext.current.disableColors();
- Program platformOutline = await context.loadPlatformOutline();
- Ticker ticker = new Ticker();
- DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator,
- new TestVmFastaTarget(new TargetFlags(strongMode: strongMode)));
- platformOutline.unbindCanonicalNames();
- dillTarget.loader.appendLibraries(platformOutline);
- // We create a new URI translator to avoid reading platform libraries from
- // file system.
- UriTranslatorImpl uriTranslator = new UriTranslatorImpl(
- const <String, Uri>{},
- const <String, List<Uri>>{},
- context.uriTranslator.packages);
- KernelTarget sourceTarget = astKind == AstKind.Analyzer
- ? new AnalyzerTarget(dillTarget, uriTranslator, strongMode)
- : new KernelTarget(
- PhysicalFileSystem.instance, false, dillTarget, uriTranslator);
-
- Program p;
- try {
- sourceTarget.read(description.uri);
- await dillTarget.buildOutlines();
- ValidatingInstrumentation instrumentation;
- if (strongMode) {
- instrumentation = new ValidatingInstrumentation();
- await instrumentation.loadExpectations(description.uri);
- sourceTarget.loader.instrumentation = instrumentation;
- }
- p = await sourceTarget.buildOutlines();
- if (fullCompile) {
- p = await sourceTarget.buildProgram();
- instrumentation?.finish();
- if (instrumentation != null && instrumentation.hasProblems) {
- if (updateComments) {
- await instrumentation.fixSource(description.uri, false);
- } else {
- return fail(null, instrumentation.problemsAsString);
+ return await CompilerCommandLine.withGlobalOptions("", [""], (_) async {
+ // Disable colors to ensure that expectation files are the same across
+ // platforms and independent of stdin/stderr.
+ CompilerContext.current.disableColors();
+ Program platformOutline = await context.loadPlatformOutline();
+ Ticker ticker = new Ticker();
+ DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator,
+ new TestVmFastaTarget(new TargetFlags(strongMode: strongMode)));
+ platformOutline.unbindCanonicalNames();
+ dillTarget.loader.appendLibraries(platformOutline);
+ // We create a new URI translator to avoid reading platform libraries from
+ // file system.
+ UriTranslatorImpl uriTranslator = new UriTranslatorImpl(
+ const <String, Uri>{},
+ const <String, List<Uri>>{},
+ context.uriTranslator.packages);
+ KernelTarget sourceTarget = astKind == AstKind.Analyzer
+ ? new AnalyzerTarget(dillTarget, uriTranslator, strongMode)
+ : new KernelTarget(
+ PhysicalFileSystem.instance, false, dillTarget, uriTranslator);
+
+ Program p;
+ try {
+ sourceTarget.read(description.uri);
+ await dillTarget.buildOutlines();
+ ValidatingInstrumentation instrumentation;
+ if (strongMode) {
+ instrumentation = new ValidatingInstrumentation();
+ await instrumentation.loadExpectations(description.uri);
+ sourceTarget.loader.instrumentation = instrumentation;
+ }
+ p = await sourceTarget.buildOutlines();
+ if (fullCompile) {
+ p = await sourceTarget.buildProgram();
+ instrumentation?.finish();
+ if (instrumentation != null && instrumentation.hasProblems) {
+ if (updateComments) {
+ await instrumentation.fixSource(description.uri, false);
+ } else {
+ return fail(null, instrumentation.problemsAsString);
+ }
}
}
+ } on deprecated_InputError catch (e, s) {
+ return fail(null, e.error, s);
}
- } on deprecated_InputError catch (e, s) {
- return fail(null, e.error, s);
- }
- context.programToTarget.clear();
- context.programToTarget[p] = sourceTarget;
- return pass(p);
+ context.programToTarget.clear();
+ context.programToTarget[p] = sourceTarget;
+ return pass(p);
+ });
}
}
« no previous file with comments | « pkg/front_end/test/fasta/shaker_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698