Merge branch 'json_gc_fix'
This commit is contained in:
@@ -11159,6 +11159,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;
|
||||
@@ -11344,6 +11354,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);
|
||||
|
||||
Reference in New Issue
Block a user