MIRROR: javascript for 馃悳's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at type-hints-typescript 27 lines 855 B view raw
1#ifndef ANT_ASSERT_MODULE_H 2#define ANT_ASSERT_MODULE_H 3 4#include "internal.h" 5#include "silver/engine.h" 6 7ant_value_t assert_library(ant_t *js); 8 9static inline bool promise_was_rejected(ant_value_t result) { 10 if (vtype(result) != T_PROMISE) return false; 11 ant_object_t *obj = js_obj_ptr(js_as_obj(result)); 12 return obj && obj->promise_state && obj->promise_state->state == 2; 13} 14 15static inline void promise_mark_handled(ant_value_t v) { 16 if (vtype(v) != T_PROMISE) return; 17 ant_object_t *obj = js_obj_ptr(js_as_obj(v)); 18 if (obj && obj->promise_state) obj->promise_state->has_rejection_handler = true; 19} 20 21static inline bool promise_was_fulfilled(ant_value_t result) { 22 if (vtype(result) != T_PROMISE) return false; 23 ant_object_t *obj = js_obj_ptr(js_as_obj(result)); 24 return obj && obj->promise_state && obj->promise_state->state == 1; 25} 26 27#endif