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

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

Issue 2894283002: Reapply CL: first step for modular support in fasta (Closed)
Patch Set: new changes since first CL Created 3 years, 7 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
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 50f369bd2f1556a38b35d7df36d5c79ecbaa5a1a..d9a1c09c2d05871bfa9e0420f213f1815fe9c748 100644
--- a/pkg/front_end/test/fasta/testing/suite.dart
+++ b/pkg/front_end/test/fasta/testing/suite.dart
@@ -44,7 +44,7 @@ import 'package:front_end/src/fasta/kernel/kernel_target.dart'
import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget;
-import 'package:kernel/kernel.dart' show loadProgramFromBinary;
+import 'package:kernel/kernel.dart' show loadProgramFromBytes;
export 'package:testing/testing.dart' show Chain, runMe;
@@ -85,12 +85,11 @@ class FastaContext extends ChainContext {
Uri sdk;
Uri platformUri;
Uri outlineUri;
+ List<int> outlineBytes;
final ExpectationSet expectationSet =
new ExpectationSet.fromJsonList(JSON.decode(EXPECTATIONS));
- Future<Program> outline;
-
FastaContext(
this.vm,
bool strongMode,
@@ -125,11 +124,16 @@ class FastaContext extends ChainContext {
}
}
- Future<Program> loadPlatformOutline() {
- return outline ??= new Future<Program>(() async {
+ Future<Program> loadPlatformOutline() async {
+ if (outlineBytes == null) {
await ensurePlatformUris();
- return loadProgramFromBinary(outlineUri.toFilePath());
- });
+ outlineBytes = new File.fromUri(outlineUri).readAsBytesSync();
+ }
+ // Note: we rebuild the platform outline on every test because the compiler
+ // currently mutates the in-memory representation of the program without
+ // cloning it.
+ // TODO(sigmund): investigate alternatives to this approach.
+ return loadProgramFromBytes(outlineBytes);
}
static Future<FastaContext> create(
@@ -225,7 +229,7 @@ class Outline extends Step<TestDescription, Program, FastaContext> {
}
p = await sourceTarget.buildOutlines();
if (fullCompile) {
- p = await sourceTarget.buildProgram();
+ p = await sourceTarget.buildProgram(trimDependencies: true);
instrumentation?.finish();
if (instrumentation != null && instrumentation.hasProblems) {
if (updateComments) {

Powered by Google App Engine
This is Rietveld 408576698