MCPcopy Create free account
hub / github.com/buke/quickjs-go / js_std_eval_binary

Function js_std_eval_binary

deps/quickjs/quickjs-libc.c:4930–4963  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4928}
4929
4930void js_std_eval_binary(JSContext *ctx, const uint8_t *buf, size_t buf_len,
4931 int load_only)
4932{
4933 JSValue obj, val;
4934 obj = JS_ReadObject(ctx, buf, buf_len, JS_READ_OBJ_BYTECODE);
4935 if (JS_IsException(obj))
4936 goto exception;
4937 if (load_only) {
4938 if (JS_VALUE_GET_TAG(obj) == JS_TAG_MODULE) {
4939 if (js_module_set_import_meta(ctx, obj, false, false) < 0)
4940 goto exception;
4941 }
4942 JS_FreeValue(ctx, obj);
4943 } else {
4944 if (JS_VALUE_GET_TAG(obj) == JS_TAG_MODULE) {
4945 if (JS_ResolveModule(ctx, obj) < 0) {
4946 JS_FreeValue(ctx, obj);
4947 goto exception;
4948 }
4949 if (js_module_set_import_meta(ctx, obj, false, true) < 0)
4950 goto exception;
4951 val = JS_EvalFunction(ctx, obj);
4952 val = js_std_await(ctx, val);
4953 } else {
4954 val = JS_EvalFunction(ctx, obj);
4955 }
4956 if (JS_IsException(val)) {
4957 exception:
4958 js_std_dump_error(ctx);
4959 exit(1);
4960 }
4961 JS_FreeValue(ctx, val);
4962 }
4963}
4964
4965static JSValue js_bjson_read(JSContext *ctx, JSValueConst this_val,
4966 int argc, JSValueConst *argv)

Callers 6

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
JS_NewCustomContextFunction · 0.85
mainFunction · 0.85

Calls 5

JS_IsExceptionFunction · 0.85
js_std_awaitFunction · 0.85
js_std_dump_errorFunction · 0.85
exitFunction · 0.85

Tested by 1

mainFunction · 0.68