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

Unified Diff: pkg/front_end/lib/src/fasta/vm.dart

Issue 2880453005: Build up and pass MemoryFileSystem to fasta frontend. (Closed)
Patch Set: Use integer division 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
« no previous file with comments | « pkg/front_end/lib/src/fasta/fasta.dart ('k') | utils/kernel-service/kernel-service.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/vm.dart
diff --git a/pkg/front_end/lib/src/fasta/vm.dart b/pkg/front_end/lib/src/fasta/vm.dart
index 353a126b0222e113619cc0d575cc1d64599f8830..d4472a1a400cd8e7cd94344b6af81583f4b1103c 100644
--- a/pkg/front_end/lib/src/fasta/vm.dart
+++ b/pkg/front_end/lib/src/fasta/vm.dart
@@ -13,6 +13,8 @@ import 'dart:io' show File, Platform;
import 'dart:typed_data' show Uint8List;
+import 'package:front_end/physical_file_system.dart';
+
import 'fasta.dart' as fasta;
/// Compilation status codes.
@@ -54,9 +56,16 @@ abstract class CompilationResult {
Future<CompilationResult> parseScript(Uri script,
{bool verbose: false, bool strongMode: false}) async {
+ return parseScriptInFileSystem(script, PhysicalFileSystem.instance,
+ verbose: verbose, strongMode: strongMode);
+}
+
+Future<CompilationResult> parseScriptInFileSystem(
+ Uri script, FileSystem fileSystem,
+ {bool verbose: false, bool strongMode: false}) async {
final Uri packagesUri = (Platform.packageConfig != null)
? Uri.parse(Platform.packageConfig)
- : await _findPackagesFile(script);
+ : await _findPackagesFile(fileSystem, script);
if (packagesUri == null) {
throw "Could not find .packages";
}
@@ -74,7 +83,8 @@ Future<CompilationResult> parseScript(Uri script,
}
try {
- return await fasta.parseScript(script, packagesUri, patchedSdk,
+ return await fasta.parseScriptInFileSystem(
+ script, fileSystem, packagesUri, patchedSdk,
verbose: verbose, strongMode: strongMode);
} catch (err, stack) {
return new CompilationResult.crash(err, stack);
@@ -135,11 +145,11 @@ class _CompilationCrash extends _CompilationFail {
/// This duplicates functionality from the Loader which we can't easily
/// access from here.
-Future<Uri> _findPackagesFile(Uri base) async {
+Future<Uri> _findPackagesFile(FileSystem fileSystem, Uri base) async {
var dir = new File.fromUri(base).parent;
while (true) {
final packagesFile = dir.uri.resolve(".packages");
- if (await new File.fromUri(packagesFile).exists()) {
+ if (await fileSystem.entityForUri(packagesFile).exists()) {
return packagesFile;
}
if (dir.parent.path == dir.path) {
« no previous file with comments | « pkg/front_end/lib/src/fasta/fasta.dart ('k') | utils/kernel-service/kernel-service.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698