summaryrefslogtreecommitdiff
path: root/quickjs.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2024-01-02 16:09:30 +0100
committerFabrice Bellard <fabrice@bellard.org>2024-01-02 16:09:30 +0100
commite44b793e3817766d9045ed2a776658fcbe0f2790 (patch)
tree8aa3974ff1c0658f1f986ac0868cd72f7cd6c8f7 /quickjs.c
parent8de4538ff3761e5d0adfa317069a722941848ce1 (diff)
downloadquickjs-e44b793e3817766d9045ed2a776658fcbe0f2790.tar.gz
quickjs-e44b793e3817766d9045ed2a776658fcbe0f2790.zip
allow 'await' in the REPL and added os.sleepAsync()
Diffstat (limited to 'quickjs.c')
-rw-r--r--quickjs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/quickjs.c b/quickjs.c
index 06cf581..bac4aea 100644
--- a/quickjs.c
+++ b/quickjs.c
@@ -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;
}