about summary refs log tree commit diff stats
path: root/lib/quickjs/quickjs.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2024-01-02 16:09:30 +0100
committerbptato <nincsnevem662@gmail.com>2024-01-11 18:41:36 +0100
commitb3d63266e43d628e5135ce751820ea0d62596c04 (patch)
tree25e2a76686f2c925726b780ad8db5b19d16c6311 /lib/quickjs/quickjs.c
parentef449571b8e9be4eb098369d05fd679b432ba4f6 (diff)
downloadchawan-b3d63266e43d628e5135ce751820ea0d62596c04.tar.gz
allow 'await' in the REPL and added os.sleepAsync()
Diffstat (limited to 'lib/quickjs/quickjs.c')
-rw-r--r--lib/quickjs/quickjs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/quickjs/quickjs.c b/lib/quickjs/quickjs.c
index 87859259..0c90815e 100644
--- a/lib/quickjs/quickjs.c
+++ b/lib/quickjs/quickjs.c
@@ -33943,7 +33943,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);
     }
@@ -34075,7 +34075,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;
     }