mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
[dart2wasm] Restore caller's zone when returning from await.
Change-Id: Ifd0013eb130ff98bf2127991b685258ced115824 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262480 Commit-Queue: Joshua Litt <joshualitt@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com>
This commit is contained in:
parent
683e2419da
commit
16d06dac06
1 changed files with 5 additions and 0 deletions
|
@ -86,8 +86,13 @@ class _FutureError {
|
|||
|
||||
@pragma("wasm:entry-point")
|
||||
Object? _awaitHelper(Object? operand, WasmExternRef? stack) {
|
||||
// Save the existing zone in a local, and restore('_leave') upon returning. We
|
||||
// ensure that the zone will be restored in the event of an exception by
|
||||
// restoring the original zone before we throw the exception.
|
||||
_Zone current = Zone._current;
|
||||
if (operand is! Future) return operand;
|
||||
Object? result = _futurePromise(stack, operand);
|
||||
Zone._leave(current);
|
||||
if (result is _FutureError) {
|
||||
// TODO(askesc): Combine stack traces
|
||||
throw result.exception;
|
||||
|
|
Loading…
Reference in a new issue