allow 'await' in the REPL and added os.sleepAsync()

This commit is contained in:
Fabrice Bellard
2024-01-02 16:09:30 +01:00
parent 8de4538ff3
commit e44b793e38
5 changed files with 123 additions and 48 deletions

View File

@@ -33827,7 +33827,7 @@ static __exception int js_parse_program(JSParseState *s)
emit_op(s, OP_get_loc);
emit_u16(s, fd->eval_ret_idx);
emit_op(s, OP_return);
emit_return(s, TRUE);
} else {
emit_return(s, FALSE);
}
@@ -33959,7 +33959,7 @@ static JSValue __JS_EvalInternal(JSContext *ctx, JSValueConst this_obj,
goto fail;
}
fd->module = m;
if (m != NULL) {
if (m != NULL || (flags & JS_EVAL_FLAG_ASYNC)) {
fd->in_function_body = TRUE;
fd->func_kind = JS_FUNC_ASYNC;
}