Skip to content

Commit 37574df

Browse files
natebiggsCommit Queue
authored andcommitted
[dart2wasm] Use file system to resolve URI for phase tfa/codegen main input.
Change-Id: I4a3083d377dd1ee47feea072417a8c4cb791940c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462020 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Nate Biggs <natebiggs@google.com>
1 parent e4cec87 commit 37574df

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pkg/dart2wasm/lib/compile.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ Future<CompilationResult> compile(
202202

203203
case compiler.CompilerPhase.tfa:
204204
lastResult = await _runTfaPhase(
205-
cfeResult ?? await _loadCfeResult(options),
205+
cfeResult ?? await _loadCfeResult(options, fileSystem),
206206
options,
207207
target,
208208
fileSystem,
@@ -222,9 +222,11 @@ Future<CompilationResult> compile(
222222
return lastResult!;
223223
}
224224

225-
Future<CfeResult> _loadCfeResult(compiler.WasmCompilerOptions options) async {
226-
final component =
227-
loadComponentFromBytes(await File.fromUri(options.mainUri).readAsBytes());
225+
Future<CfeResult> _loadCfeResult(
226+
compiler.WasmCompilerOptions options, FileSystem fileSystem) async {
227+
final component = loadComponentFromBytes(
228+
await File.fromUri((await _resolveUri(fileSystem, options.mainUri))!)
229+
.readAsBytes());
228230
final coreTypes = CoreTypes(component);
229231
return CfeResult(component, coreTypes);
230232
}
@@ -337,7 +339,9 @@ Future<TfaResult> _loadTfaResult(compiler.WasmCompilerOptions options,
337339
component.addMetadataRepository(recordClassesRepository);
338340
component.addMetadataRepository(interopMethodsRepository);
339341

340-
BinaryBuilderWithMetadata(await File.fromUri(options.mainUri).readAsBytes())
342+
BinaryBuilderWithMetadata(
343+
await File.fromUri((await _resolveUri(fileSystem, options.mainUri))!)
344+
.readAsBytes())
341345
.readComponent(component);
342346
final coreTypes = CoreTypes(component);
343347
final libraryIndex = LibraryIndex(component, _librariesToIndex);

0 commit comments

Comments
 (0)