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.

cleanup coro

+21 -20
+1 -1
meson.build
··· 41 41 build_date = run_command('date', '+%Y-%m-%d', check: true).stdout().strip() 42 42 43 43 version_conf = configuration_data() 44 - version_conf.set('ANT_VERSION', '0.0.5.41') 44 + version_conf.set('ANT_VERSION', '0.0.5.42') 45 45 version_conf.set('ANT_GIT_HASH', git_hash) 46 46 version_conf.set('ANT_BUILD_DATE', build_date) 47 47
+20 -19
src/ant.c
··· 37 37 int capacity; 38 38 } call_stack_t; 39 39 40 - // Coroutine support for async/await and generators 41 40 typedef enum { 42 - CORO_ASYNC_AWAIT, // Async function waiting on promise 43 - CORO_GENERATOR, // Generator function (function*) 44 - CORO_ASYNC_GENERATOR // Async generator (async function*) 41 + CORO_ASYNC_AWAIT, 42 + CORO_GENERATOR, 43 + CORO_ASYNC_GENERATOR 45 44 } coroutine_type_t; 46 45 47 46 typedef struct coroutine { 48 - struct js *js; // JS context 49 - coroutine_type_t type; // Type of coroutine 50 - jsval_t scope; // Captured scope 51 - jsval_t this_val; // Captured 'this' 52 - jsval_t awaited_promise; // Promise we're waiting on (for async) 53 - jsval_t result; // Result when resumed 54 - jsval_t async_func; // The async/generator function being executed 55 - jsval_t *args; // Function arguments 56 - int nargs; // Number of arguments 57 - bool is_settled; // Whether the awaited promise is settled 58 - bool is_error; // Whether promise was rejected 59 - bool is_done; // Whether generator is exhausted 60 - jsoff_t resume_point; // Code position to resume at 61 - jsval_t yield_value; // Value yielded by generator 62 - struct coroutine *next; // Next in scheduler queue 47 + struct js *js; 48 + coroutine_type_t type; 49 + jsval_t scope; 50 + jsval_t this_val; 51 + jsval_t awaited_promise; 52 + jsval_t result; 53 + jsval_t async_func; 54 + jsval_t *args; 55 + int nargs; 56 + bool is_settled; 57 + bool is_error; 58 + bool is_done; 59 + jsoff_t resume_point; 60 + jsval_t yield_value; 61 + struct coroutine *next; 63 62 } coroutine_t; 64 63 65 64 typedef struct { ··· 240 239 return coro; 241 240 } 242 241 242 + /* unused for now 243 243 static coroutine_t *create_generator(struct js *js, jsval_t gen_func, jsval_t *args, int nargs, bool is_async) { 244 244 coroutine_t *coro = (coroutine_t *)malloc(sizeof(coroutine_t)); 245 245 if (!coro) return NULL; ··· 271 271 272 272 return coro; 273 273 } 274 + */ 274 275 275 276 static void enqueue_coroutine(coroutine_t *coro) { 276 277 if (!coro) return;