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

Unified Diff: pkg/kernel/test/interpreter/suite.dart

Issue 2953703002: Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service (Closed)
Patch Set: cl review updates: cleanup in kernel deserialization 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/kernel/test/closures/suite.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/test/interpreter/suite.dart
diff --git a/pkg/kernel/test/interpreter/suite.dart b/pkg/kernel/test/interpreter/suite.dart
index 6d4f7dcb26eab37e0a3696a08ea6b5d65dc583b1..8c84abd1e2e05d1c7fac4e0369963828ff0bb87e 100644
--- a/pkg/kernel/test/interpreter/suite.dart
+++ b/pkg/kernel/test/interpreter/suite.dart
@@ -8,99 +8,34 @@ import 'dart:async' show Future;
import 'dart:io' show File;
-import 'package:front_end/physical_file_system.dart' show PhysicalFileSystem;
-
import 'package:testing/testing.dart'
- show Chain, ChainContext, Result, Step, TestDescription, runMe;
-
-import 'package:front_end/src/fasta/testing/patched_sdk_location.dart'
- show computePatchedSdk;
+ show Chain, ChainContext, Result, Step, runMe;
import 'package:kernel/ast.dart' show Program, Library;
-import 'package:front_end/src/fasta/testing/kernel_chain.dart' show runDiff;
-
-import 'package:front_end/src/fasta/ticker.dart' show Ticker;
-
-import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget;
-
-import 'package:front_end/src/fasta/kernel/kernel_target.dart'
- show KernelTarget;
-
-import 'package:front_end/src/fasta/translate_uri.dart' show TranslateUri;
-
-import 'package:front_end/src/fasta/errors.dart' show InputError;
-
-import 'package:front_end/src/fasta/testing/patched_sdk_location.dart';
-
-import 'package:kernel/kernel.dart' show loadProgramFromBinary;
-
-import 'package:kernel/target/targets.dart' show TargetFlags;
-
-import 'package:kernel/target/vm_fasta.dart' show VmFastaTarget;
+import 'package:front_end/src/fasta/testing/kernel_chain.dart'
+ show runDiff, Compile, CompileContext;
import 'package:kernel/interpreter/interpreter.dart';
const String STRONG_MODE = " strong mode ";
-class InterpreterContext extends ChainContext {
+class InterpreterContext extends ChainContext implements CompileContext {
final bool strongMode;
- final TranslateUri uriTranslator;
-
final List<Step> steps;
- Future<Program> platform;
-
- InterpreterContext(this.strongMode, this.uriTranslator)
+ InterpreterContext(this.strongMode)
: steps = <Step>[
- const FastaCompile(),
+ const Compile(),
const Interpret(),
const MatchLogExpectation(".expect"),
];
- Future<Program> loadPlatform() async {
- Uri sdk = await computePatchedSdk();
- return loadProgramFromBinary(sdk.resolve('platform.dill').toFilePath());
- }
-
static Future<InterpreterContext> create(
Chain suite, Map<String, String> environment) async {
- Uri sdk = await computePatchedSdk();
- Uri packages = Uri.base.resolve(".packages");
bool strongMode = environment.containsKey(STRONG_MODE);
- TranslateUri uriTranslator = await TranslateUri
- .parse(PhysicalFileSystem.instance, sdk, packages: packages);
- return new InterpreterContext(strongMode, uriTranslator);
- }
-}
-
-class FastaCompile extends Step<TestDescription, Program, InterpreterContext> {
- const FastaCompile();
-
- String get name => "fasta compile";
-
- Future<Result<Program>> run(
- TestDescription description, InterpreterContext context) async {
- Program platform = await context.loadPlatform();
- Ticker ticker = new Ticker();
- DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator,
- new VmFastaTarget(new TargetFlags(strongMode: context.strongMode)));
- platform.unbindCanonicalNames();
- dillTarget.loader.appendLibraries(platform);
- KernelTarget sourceTarget = new KernelTarget(
- PhysicalFileSystem.instance, dillTarget, context.uriTranslator);
-
- Program p;
- try {
- sourceTarget.read(description.uri);
- await dillTarget.buildOutlines();
- await sourceTarget.buildOutlines();
- p = await sourceTarget.buildProgram();
- } on InputError catch (e, s) {
- return fail(null, e.error, s);
- }
- return pass(p);
+ return new InterpreterContext(strongMode);
}
}
« no previous file with comments | « pkg/kernel/test/closures/suite.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698