diff --git a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart index 5f6d7b29677..97944dfb18e 100644 --- a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart +++ b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart @@ -815,15 +815,17 @@ final deferredImports = JS('!', 'new Map()'); /// /// Libraries are not actually deferred in DDC, so this just records the import /// for runtime validation, then returns a future that completes immediately. -Future loadLibrary( +Future loadLibrary( @notNull String enclosingLibrary, @notNull String importPrefix) { - var result = JS('', '#.get(#)', deferredImports, enclosingLibrary); - if (JS('', '# === void 0', result)) { - JS('', '#.set(#, # = new Set())', deferredImports, enclosingLibrary, - result); + _loadLibrary() { + var result = JS('', '#.get(#)', deferredImports, enclosingLibrary); + if (JS('', '# === void 0', result)) { + JS('', '#.set(#, # = new Set())', deferredImports, enclosingLibrary, + result); + } + JS('', '#.add(#)', result, importPrefix); } - JS('', '#.add(#)', result, importPrefix); - return Future.value(); + return Future(_loadLibrary); } void checkDeferredIsLoaded(