Merge branch 'improve_compile_error'

This commit is contained in:
2026-02-20 14:39:51 -06:00
65 changed files with 2255 additions and 1376 deletions

View File

@@ -30,6 +30,7 @@ cell_rt *root_cell = NULL;
static char *shop_path = NULL;
static char *core_path = NULL;
static int native_mode = 0;
static int warn_mode = 1;
static JSRuntime *g_runtime = NULL;
// Compute blake2b hash of data and return hex string (caller must free)
@@ -260,7 +261,7 @@ void actor_disrupt(cell_rt *crt)
actor_free(crt);
}
JSValue js_core_os_use(JSContext *js);
JSValue js_core_internal_os_use(JSContext *js);
JSValue js_core_json_use(JSContext *js);
void script_startup(cell_rt *prt)
@@ -316,7 +317,7 @@ void script_startup(cell_rt *prt)
JS_AddGCRef(js, &boot_env_ref);
boot_env_ref.val = JS_NewObject(js);
JSValue btmp;
btmp = js_core_os_use(js);
btmp = js_core_internal_os_use(js);
JS_SetPropertyStr(js, boot_env_ref.val, "os", btmp);
if (core_path) {
btmp = JS_NewString(js, core_path);
@@ -346,7 +347,7 @@ void script_startup(cell_rt *prt)
JS_AddGCRef(js, &env_ref);
env_ref.val = JS_NewObject(js);
JSValue tmp;
tmp = js_core_os_use(js);
tmp = js_core_internal_os_use(js);
JS_SetPropertyStr(js, env_ref.val, "os", tmp);
tmp = js_core_json_use(js);
JS_SetPropertyStr(js, env_ref.val, "json", tmp);
@@ -523,6 +524,9 @@ int cell_init(int argc, char **argv)
} else if (strcmp(argv[arg_start], "--native") == 0) {
native_mode = 1;
arg_start++;
} else if (strcmp(argv[arg_start], "--no-warn") == 0) {
warn_mode = 0;
arg_start++;
} else {
break;
}
@@ -608,7 +612,7 @@ int cell_init(int argc, char **argv)
JS_AddGCRef(ctx, &boot_env_ref);
boot_env_ref.val = JS_NewObject(ctx);
JSValue btmp;
btmp = js_core_os_use(ctx);
btmp = js_core_internal_os_use(ctx);
JS_SetPropertyStr(ctx, boot_env_ref.val, "os", btmp);
btmp = JS_NewString(ctx, core_path);
JS_SetPropertyStr(ctx, boot_env_ref.val, "core_path", btmp);
@@ -652,7 +656,7 @@ int cell_init(int argc, char **argv)
JS_AddGCRef(ctx, &env_ref);
env_ref.val = JS_NewObject(ctx);
JSValue tmp;
tmp = js_core_os_use(ctx);
tmp = js_core_internal_os_use(ctx);
JS_SetPropertyStr(ctx, env_ref.val, "os", tmp);
tmp = JS_NewString(ctx, core_path);
JS_SetPropertyStr(ctx, env_ref.val, "core_path", tmp);
@@ -661,11 +665,14 @@ int cell_init(int argc, char **argv)
JS_SetPropertyStr(ctx, env_ref.val, "actorsym", JS_DupValue(ctx, cli_rt->actor_sym_ref.val));
tmp = js_core_json_use(ctx);
JS_SetPropertyStr(ctx, env_ref.val, "json", tmp);
if (native_mode) {
if (native_mode || !warn_mode) {
JSGCRef init_ref;
JS_AddGCRef(ctx, &init_ref);
init_ref.val = JS_NewObject(ctx);
JS_SetPropertyStr(ctx, init_ref.val, "native_mode", JS_NewBool(ctx, 1));
if (native_mode)
JS_SetPropertyStr(ctx, init_ref.val, "native_mode", JS_NewBool(ctx, 1));
if (!warn_mode)
JS_SetPropertyStr(ctx, init_ref.val, "no_warn", JS_NewBool(ctx, 1));
JS_SetPropertyStr(ctx, env_ref.val, "init", init_ref.val);
JS_DeleteGCRef(ctx, &init_ref);
} else {

View File

@@ -1197,6 +1197,8 @@ int js_string_compare_value_nocase (JSContext *ctx, JSValue op1, JSValue op2);
JSValue js_regexp_constructor (JSContext *ctx, JSValue this_val, int argc, JSValue *argv);
int JS_HasProperty (JSContext *ctx, JSValue obj, JSValue prop);
int JS_HasPropertyKey (JSContext *ctx, JSValue obj, JSValue key);
JSValue JS_GetPropertyKey (JSContext *ctx, JSValue this_obj, JSValue key);
int JS_SetPropertyKey (JSContext *ctx, JSValue this_obj, JSValue key, JSValue val);
void *js_realloc_rt (void *ptr, size_t size);
char *js_strdup_rt (const char *str);
JSValue JS_ConcatString (JSContext *ctx, JSValue op1, JSValue op2);

File diff suppressed because it is too large Load Diff