@@ -41531,11 +41531,10 @@ static JSValue js_array_toSorted(JSContext *ctx, JSValueConst this_val,
4153141531 JSObject *p;
4153241532 int64_t i, len;
4153341533 uint32_t count32;
41534- int ok;
4153541534
41536- ok = JS_IsUndefined(argv[0]) || JS_IsFunction(ctx, argv[0]);
41537- if (!ok )
41538- return JS_ThrowTypeErrorNotAFunction(ctx) ;
41535+ if (! JS_IsUndefined(argv[0]))
41536+ if (check_function(ctx, argv[0]) )
41537+ return JS_EXCEPTION ;
4153941538
4154041539 ret = JS_EXCEPTION;
4154141540 arr = JS_UNDEFINED;
@@ -49069,8 +49068,8 @@ static JSValue js_map_getOrInsert(JSContext *ctx, JSValueConst this_val,
4906949068
4907049069 if (!s)
4907149070 return JS_EXCEPTION;
49072- if (computed && !JS_IsFunction (ctx, argv[1]))
49073- return JS_ThrowTypeError(ctx, "not a function") ;
49071+ if (computed && check_function (ctx, argv[1]))
49072+ return JS_EXCEPTION ;
4907449073 key = map_normalize_key_const(ctx, argv[0]);
4907549074 if (s->is_weak && !is_valid_weakref_target(key))
4907649075 return JS_ThrowTypeError(ctx, "invalid value used as WeakMap key");
@@ -57436,9 +57435,8 @@ static JSValue js_finrec_constructor(JSContext *ctx, JSValueConst new_target,
5743657435 if (JS_IsUndefined(new_target))
5743757436 return JS_ThrowTypeError(ctx, "constructor requires 'new'");
5743857437 JSValueConst cb = argv[0];
57439- if (!JS_IsFunction(ctx, cb))
57440- return JS_ThrowTypeError(ctx, "argument must be a function");
57441-
57438+ if (check_function(ctx, cb))
57439+ return JS_EXCEPTION;
5744257440 JSValue obj = js_create_from_ctor(ctx, new_target, JS_CLASS_FINALIZATION_REGISTRY);
5744357441 if (JS_IsException(obj))
5744457442 return JS_EXCEPTION;
0 commit comments