mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 12:57:42 +00:00
[test_runner] Use constructor to detect async main
This is needed to avoid the dependency on the current runtime type representation. This is still not an ideal solution and should be moved into a logic that DDC controls. Issue: https://github.com/dart-lang/sdk/issues/46377 Change-Id: I6418bff546e63b01059841c1128b4ebeeacdcc39 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265564 Reviewed-by: Sigmund Cherem <sigmund@google.com> Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
parent
278815b192
commit
1e9445060a
|
@ -242,7 +242,9 @@ requirejs(["$testName", "dart_sdk", "async_helper"],
|
|||
// go through our async tracking (e.g. DOM events). For those tests, check
|
||||
// if the result of calling `main()` is a Future, and if so, wait for it.
|
||||
let result = $testId.$testIdAlias.main();
|
||||
if (sdk.async.Future.is(result)) {
|
||||
// TODO(46377) DDC should control this code and expose a mechanism to run
|
||||
// the main method that properly waits for completion.
|
||||
if (result?.constructor?.name == '_Future') {
|
||||
sdk.dart.addAsyncCallback();
|
||||
result.whenComplete(sdk.dart.removeAsyncCallback);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue