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

Unified Diff: pkg/front_end/lib/kernel_generator.dart

Issue 2844903002: Extend file-system abstraction with a couple methods, remove context (Closed)
Patch Set: fix test in windows bot Created 3 years, 8 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/file_system.dart ('k') | pkg/front_end/lib/memory_file_system.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/kernel_generator.dart
diff --git a/pkg/front_end/lib/kernel_generator.dart b/pkg/front_end/lib/kernel_generator.dart
index e1f5ab66d950cceefab52b408fb209e95716519f..42fd4666d959d4d4f6e74074a9eaa58a9b2263a8 100644
--- a/pkg/front_end/lib/kernel_generator.dart
+++ b/pkg/front_end/lib/kernel_generator.dart
@@ -133,8 +133,7 @@ Future<Program> kernelForBuildUnit(
Future<DartLoader> _createLoader(CompilerOptions options,
{Program program, Uri entry}) async {
var kernelOptions = _convertOptions(options);
- var packages = await createPackages(
- _uriToPath(options.packagesFileUri, options),
+ var packages = await createPackages(_uriToPath(options.packagesFileUri),
discoveryPath: entry?.path);
var loader =
new DartLoader(program ?? new Program(), kernelOptions, packages);
@@ -142,8 +141,7 @@ Future<DartLoader> _createLoader(CompilerOptions options,
// TODO(sigmund,paulberry): use ProcessedOptions so that we can resolve the
// URIs correctly even if sdkRoot is inferred and not specified explicitly.
- String resolve(Uri patch) =>
- options.fileSystem.context.fromUri(options.sdkRoot.resolveUri(patch));
+ String resolve(Uri patch) => _uriToPath(options.sdkRoot.resolveUri(patch));
options.targetPatches.forEach((uri, patches) {
patchPaths['$uri'] = patches.map(resolve).toList();
@@ -156,12 +154,11 @@ Future<DartLoader> _createLoader(CompilerOptions options,
DartOptions _convertOptions(CompilerOptions options) {
return new DartOptions(
strongMode: options.strongMode,
- sdk: _uriToPath(options.sdkRoot, options),
+ sdk: _uriToPath(options.sdkRoot),
// TODO(sigmund): make it possible to use summaries and still compile the
// sdk sources.
- sdkSummary:
- options.compileSdk ? null : _uriToPath(options.sdkSummary, options),
- packagePath: _uriToPath(options.packagesFileUri, options),
+ sdkSummary: options.compileSdk ? null : _uriToPath(options.sdkSummary),
+ packagePath: _uriToPath(options.packagesFileUri),
customUriMappings: options.uriOverride,
declaredVariables: options.declaredVariables);
}
@@ -173,12 +170,12 @@ void _reportErrors(List errors, ErrorHandler onError) {
}
}
-String _uriToPath(Uri uri, CompilerOptions options) {
+String _uriToPath(Uri uri) {
if (uri == null) return null;
if (uri.scheme != 'file') {
throw new StateError('Only file URIs are supported: $uri');
}
- return options.fileSystem.context.fromUri(uri);
+ return uri.toFilePath();
}
// TODO(sigmund): delete this class. Dartk should not format errors itself, we
« no previous file with comments | « pkg/front_end/lib/file_system.dart ('k') | pkg/front_end/lib/memory_file_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698