actors use hdiden symbol now

This commit is contained in:
2026-02-17 14:35:54 -06:00
parent 51815b66d8
commit 5415726e33
3 changed files with 15 additions and 6 deletions

View File

@@ -10933,6 +10933,16 @@ static JSValue js_cell_is_object (JSContext *ctx, JSValue this_val, int argc, JS
return JS_NewBool (ctx, mist_is_record (argv[0]));
}
/* is_actor(val) - true for actor objects (have actor_sym property) */
static JSValue js_cell_is_actor (JSContext *ctx, JSValue this_val, int argc, JSValue *argv) {
if (argc < 1) return JS_FALSE;
JSValue val = argv[0];
if (!mist_is_record (val)) return JS_FALSE;
if (JS_IsNull (ctx->actor_sym)) return JS_FALSE;
int has = JS_HasPropertyKey (ctx, val, ctx->actor_sym);
return JS_NewBool (ctx, has > 0);
}
/* is_stone(val) - check if value is immutable */
static JSValue js_cell_is_stone (JSContext *ctx, JSValue this_val, int argc, JSValue *argv) {
(void)this_val;
@@ -11118,6 +11128,7 @@ static void JS_AddIntrinsicBaseObjects (JSContext *ctx) {
js_set_global_cfunc(ctx, "is_null", js_cell_is_null, 1);
js_set_global_cfunc(ctx, "is_number", js_cell_is_number, 1);
js_set_global_cfunc(ctx, "is_object", js_cell_is_object, 1);
js_set_global_cfunc(ctx, "is_actor", js_cell_is_actor, 1);
js_set_global_cfunc(ctx, "is_stone", js_cell_is_stone, 1);
js_set_global_cfunc(ctx, "is_text", js_cell_is_text, 1);
js_set_global_cfunc(ctx, "is_proto", js_cell_is_proto, 2);