| 4928 | } |
| 4929 | |
| 4930 | void 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 | |
| 4965 | static JSValue js_bjson_read(JSContext *ctx, JSValueConst this_val, |
| 4966 | int argc, JSValueConst *argv) |