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
.expect("%Promise% constructor must return a `Promise` object"),
38
+
Ok(promise) => match promise.downcast::<Promise>().ok(){
39
+
Some(v) => v,
40
+
None => {
41
+
return context.handle_error(
42
+
PanicError::new("%Promise% constructor must return a `Promise` object")
43
+
.into(),
44
+
);
45
+
}
46
+
},
40
47
Err(err) => return context.handle_error(err),
41
48
};
42
49
@@ -61,7 +68,7 @@ impl Await {
61
68
// b. Suspend prevContext.
62
69
// c. Push asyncContext onto the execution context stack; asyncContext is now the running execution context.
63
70
// d. Resume the suspended evaluation of asyncContext using NormalCompletion(value) as the result of the operation that suspended it.
64
-
letmut r#gen = captures.take().expect("should only run once");
71
+
letmut r#gen = captures.take().js_expect("should only run once")?;
65
72
66
73
// NOTE: We need to get the object before resuming, since it could clear the stack.
67
74
let async_generator = r#gen.async_generator_object()?;
@@ -75,7 +82,7 @@ impl Await {
75
82
ifletSome(async_generator) = async_generator {
76
83
async_generator
77
84
.downcast_mut::<AsyncGenerator>()
78
-
.expect("must be async generator")
85
+
.js_expect("must be async generator")?
79
86
.context = Some(r#gen);
80
87
}
81
88
@@ -102,7 +109,7 @@ impl Await {
102
109
// d. Resume the suspended evaluation of asyncContext using ThrowCompletion(reason) as the result of the operation that suspended it.
103
110
// 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.
104
111
// f. Return undefined.
105
-
letmut r#gen = captures.take().expect("should only run once");
112
+
letmut r#gen = captures.take().js_expect("should only run once")?;
106
113
107
114
// NOTE: We need to get the object before resuming, since it could clear the stack.
108
115
let async_generator = r#gen.async_generator_object()?;
0 commit comments