@@ -41531,11 +41531,10 @@ static JSValue js_array_toSorted(JSContext *ctx, JSValueConst this_val,
41531
41531
JSObject *p;
41532
41532
int64_t i, len;
41533
41533
uint32_t count32;
41534
- int ok;
41535
41534
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 ;
41539
41538
41540
41539
ret = JS_EXCEPTION;
41541
41540
arr = JS_UNDEFINED;
@@ -49069,8 +49068,8 @@ static JSValue js_map_getOrInsert(JSContext *ctx, JSValueConst this_val,
49069
49068
49070
49069
if (!s)
49071
49070
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 ;
49074
49073
key = map_normalize_key_const(ctx, argv[0]);
49075
49074
if (s->is_weak && !is_valid_weakref_target(key))
49076
49075
return JS_ThrowTypeError(ctx, "invalid value used as WeakMap key");
@@ -57436,9 +57435,8 @@ static JSValue js_finrec_constructor(JSContext *ctx, JSValueConst new_target,
57436
57435
if (JS_IsUndefined(new_target))
57437
57436
return JS_ThrowTypeError(ctx, "constructor requires 'new'");
57438
57437
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;
57442
57440
JSValue obj = js_create_from_ctor(ctx, new_target, JS_CLASS_FINALIZATION_REGISTRY);
57443
57441
if (JS_IsException(obj))
57444
57442
return JS_EXCEPTION;
0 commit comments