You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 3. Let fulfilledClosure be a new Abstract Closure with parameters (value) that captures asyncContext and performs the following steps when called:
@@ -111,7 +101,6 @@ impl Operation for Await {
111
101
// d. Resume the suspended evaluation of asyncContext using ThrowCompletion(reason) as the result of the operation that suspended it.
112
102
// e. Assert: When we reach this step, asyncContext has already been removed from the execution context stack and prevContext is the currently running execution context.
113
103
// f. Return undefined.
114
-
115
104
letmut gen = captures.take().expect("should only run once");
116
105
117
106
// NOTE: We need to get the object before resuming, since it could clear the stack.
Copy file name to clipboardExpand all lines: core/engine/src/vm/opcode/generator/mod.rs
+14-10Lines changed: 14 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ use crate::{
15
15
opcode::{Operation,ReThrow},
16
16
CallFrame,CompletionType,
17
17
},
18
-
Context,JsError,JsObject,JsResult,JsValue,
18
+
Context,JsError,JsObject,JsResult,
19
19
};
20
20
21
21
pub(crate)use yield_stm::*;
@@ -128,26 +128,30 @@ impl Operation for AsyncGeneratorClose {
128
128
129
129
letmut gen = generator.borrow_mut();
130
130
131
-
gen.data.state = AsyncGeneratorState::Completed;
132
-
gen.data.context= None;
131
+
// e. Assert: If we return here, the async generator either threw an exception or performed either an implicit or explicit return.
132
+
// f. Remove acGenContext from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context.
133
133
134
-
let next = gen.data.queue.pop_front().expect("must have item in queue");
134
+
// g. Set acGenerator.[[AsyncGeneratorState]] to draining-queue.
// TODO: b. Remove genContext from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context.
101
+
// TODO: c. Let callerContext be the running execution context.
102
+
// d. Resume callerContext passing undefined. If genContext is ever resumed again, let resumptionValue be the Completion Record with which it is resumed.
103
+
// e. Assert: If control reaches here, then genContext is the running execution context again.
104
+
// f. Return ? AsyncGeneratorUnwrapYieldResumption(resumptionValue).
0 commit comments