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
// 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.
// 5. Let rejectedClosure be a new Abstract Closure with parameters (reason) that captures asyncContext and performs the following steps when called:
1230
+
// 6. Let onRejected be CreateBuiltinFunction(rejectedClosure, 1, "", « »).
1231
+
let on_rejected = FunctionObjectBuilder::new(
1232
+
context.realm(),
1233
+
NativeFunction::from_copy_closure_with_captures(
1234
+
|_this, args, captures, context| {
1235
+
// a. Let prevContext be the running execution context.
1236
+
// b. Suspend prevContext.
1237
+
// c. Push asyncContext onto the execution context stack; asyncContext is now the running execution context.
1238
+
// d. Resume the suspended evaluation of asyncContext using ThrowCompletion(reason) as the result of the operation that suspended it.
1239
+
// 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.
1240
+
// f. Return undefined.
1241
+
let continuation = &captures.0;
1242
+
letmut gen = captures.1.take().expect("should only run once");
1243
+
1244
+
// NOTE: We need to get the object before resuming, since it could clear the stack.
1245
+
let async_generator = gen.async_generator_object();
0 commit comments