Use async reads if possible

Change-Id: Ib7ae51e5f79e10797376cc3e4ca1a5bf6708fa30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185307
Auto-Submit: Gary Roumanis <grouma@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Gary Roumanis
2021-02-17 19:30:30 +00:00
committed by commit-bot@chromium.org
parent ba48cce470
commit dfd52f60a1
@@ -463,8 +463,8 @@ class ExpressionCompilerWorker {
Future<Component> _loadComponent(Uri uri) async {
var file = _processedOptions.fileSystem.entityForUri(uri);
if (await file.exists()) {
var bytes = await file.readAsBytes();
if (await file.existsAsyncIfPossible()) {
var bytes = await file.readAsBytesAsyncIfPossible();
var component = _processedOptions.loadComponent(bytes, _sdkComponent.root,
alwaysCreateNewNamedNodes: true);
return component;