mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 10:18:13 +00:00
[ddc] Wrapping loadLibrary checks in a future to obey eval order rules
These checks are cosmetic right now in DDC, but the load check was happening synchronously rather than after the future returned by loadLibrary completed. Change-Id: I867779605ddfe4f63b83b47418994e0c5e68572a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274087 Reviewed-by: Nicholas Shahan <nshahan@google.com> Commit-Queue: Mark Zhou <markzipan@google.com> Reviewed-by: Anna Gringauze <annagrin@google.com>
This commit is contained in:
parent
4be2981c2d
commit
d9ea7207e8
|
@ -815,15 +815,17 @@ final deferredImports = JS<Object>('!', '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<void> loadLibrary(
|
||||
@notNull String enclosingLibrary, @notNull String importPrefix) {
|
||||
var result = JS('', '#.get(#)', deferredImports, enclosingLibrary);
|
||||
if (JS<bool>('', '# === void 0', result)) {
|
||||
JS('', '#.set(#, # = new Set())', deferredImports, enclosingLibrary,
|
||||
result);
|
||||
_loadLibrary() {
|
||||
var result = JS('', '#.get(#)', deferredImports, enclosingLibrary);
|
||||
if (JS<bool>('', '# === 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(
|
||||
|
|
Loading…
Reference in a new issue