Skip to content

Commit 57fffbb

Browse files
authored
Remove unused JSContext argument from JS_IsError (#1206)
Also remove it from JS_IsUncatchableError. Fixes: #1203
1 parent e1713ea commit 57fffbb

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

api-test.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static void cfunctions(void)
7373
ret = eval(ctx, "cfunc()");
7474
assert(JS_IsException(ret));
7575
ret = JS_GetException(ctx);
76-
assert(JS_IsError(ctx, ret));
76+
assert(JS_IsError(ret));
7777
stack = JS_GetPropertyStr(ctx, ret, "stack");
7878
assert(JS_IsString(stack));
7979
s = JS_ToCString(ctx, stack);
@@ -90,7 +90,7 @@ static void cfunctions(void)
9090
ret = eval(ctx, "cfuncdata()");
9191
assert(JS_IsException(ret));
9292
ret = JS_GetException(ctx);
93-
assert(JS_IsError(ctx, ret));
93+
assert(JS_IsError(ret));
9494
stack = JS_GetPropertyStr(ctx, ret, "stack");
9595
assert(JS_IsString(stack));
9696
s = JS_ToCString(ctx, stack);
@@ -137,7 +137,7 @@ static void sync_call(void)
137137
JS_FreeValue(ctx, ret);
138138
assert(JS_HasException(ctx));
139139
JSValue e = JS_GetException(ctx);
140-
assert(JS_IsUncatchableError(ctx, e));
140+
assert(JS_IsUncatchableError(e));
141141
JS_FreeValue(ctx, e);
142142
JS_FreeContext(ctx);
143143
JS_FreeRuntime(rt);
@@ -170,7 +170,7 @@ static void async_call(void)
170170
assert(r == -1);
171171
assert(JS_HasException(ctx));
172172
JSValue e = JS_GetException(ctx);
173-
assert(JS_IsUncatchableError(ctx, e));
173+
assert(JS_IsUncatchableError(e));
174174
JS_FreeValue(ctx, e);
175175
JS_FreeContext(ctx);
176176
JS_FreeRuntime(rt);
@@ -215,7 +215,7 @@ static void async_call_stack_overflow(void)
215215
}
216216
assert(r == 1);
217217
assert(!JS_HasException(ctx));
218-
assert(JS_IsError(ctx, value)); // stack overflow should be caught
218+
assert(JS_IsError(value)); // stack overflow should be caught
219219
JS_FreeValue(ctx, value);
220220
JS_FreeContext(ctx);
221221
JS_FreeRuntime(rt);
@@ -625,7 +625,7 @@ static void new_errors(void)
625625
JSValue obj = (*e->func)(ctx, "the %s", "needle");
626626
assert(!JS_IsException(obj));
627627
assert(JS_IsObject(obj));
628-
assert(JS_IsError(ctx, obj));
628+
assert(JS_IsError(obj));
629629
const char *haystack = JS_ToCString(ctx, obj);
630630
char needle[256];
631631
snprintf(needle, sizeof(needle), "%s: the needle", e->name);

quickjs-libc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4424,7 +4424,7 @@ static void js_std_dump_error1(JSContext *ctx, JSValueConst exception_val)
44244424
JSValue val;
44254425
bool is_error;
44264426

4427-
is_error = JS_IsError(ctx, exception_val);
4427+
is_error = JS_IsError(exception_val);
44284428
js_dump_obj(ctx, stderr, exception_val);
44294429
if (is_error) {
44304430
val = JS_GetPropertyStr(ctx, exception_val, "stack");

quickjs.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10419,13 +10419,13 @@ bool JS_IsDataView(JSValueConst val)
1041910419
return JS_CLASS_DATAVIEW == JS_GetClassID(val);
1042010420
}
1042110421

10422-
bool JS_IsError(JSContext *ctx, JSValueConst val)
10422+
bool JS_IsError(JSValueConst val)
1042310423
{
1042410424
return JS_CLASS_ERROR == JS_GetClassID(val);
1042510425
}
1042610426

1042710427
/* used to avoid catching interrupt exceptions */
10428-
bool JS_IsUncatchableError(JSContext *ctx, JSValueConst val)
10428+
bool JS_IsUncatchableError(JSValueConst val)
1042910429
{
1043010430
JSObject *p;
1043110431
if (JS_VALUE_GET_TAG(val) != JS_TAG_OBJECT)
@@ -18688,7 +18688,7 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValueConst func_obj,
1868818688
build_backtrace(ctx, rt->current_exception, JS_UNDEFINED,
1868918689
NULL, 0, 0, 0);
1869018690
}
18691-
if (!JS_IsUncatchableError(ctx, rt->current_exception)) {
18691+
if (!JS_IsUncatchableError(rt->current_exception)) {
1869218692
while (sp > stack_buf) {
1869318693
JSValue val = *--sp;
1869418694
JS_FreeValue(ctx, val);
@@ -19253,7 +19253,7 @@ static bool js_async_function_resume(JSContext *ctx, JSAsyncFunctionData *s)
1925319253
func_ret = async_func_resume(ctx, &s->func_state);
1925419254
if (JS_IsException(func_ret)) {
1925519255
fail:
19256-
if (unlikely(JS_IsUncatchableError(ctx, ctx->rt->current_exception))) {
19256+
if (unlikely(JS_IsUncatchableError(ctx->rt->current_exception))) {
1925719257
is_success = false;
1925819258
} else {
1925919259
JSValue error = JS_GetException(ctx);
@@ -19262,7 +19262,7 @@ static bool js_async_function_resume(JSContext *ctx, JSAsyncFunctionData *s)
1926219262
JS_FreeValue(ctx, error);
1926319263
resolved:
1926419264
if (unlikely(JS_IsException(ret2))) {
19265-
if (JS_IsUncatchableError(ctx, ctx->rt->current_exception)) {
19265+
if (JS_IsUncatchableError(ctx->rt->current_exception)) {
1926619266
is_success = false;
1926719267
} else {
1926819268
abort(); /* BUG */
@@ -39383,7 +39383,7 @@ static const JSCFunctionListEntry js_error_proto_funcs[] = {
3938339383
static JSValue js_error_isError(JSContext *ctx, JSValueConst this_val,
3938439384
int argc, JSValueConst *argv)
3938539385
{
39386-
return js_bool(JS_IsError(ctx, argv[0]));
39386+
return js_bool(JS_IsError(argv[0]));
3938739387
}
3938839388

3938939389
static JSValue js_error_get_stackTraceLimit(JSContext *ctx, JSValueConst this_val)
@@ -50500,7 +50500,7 @@ static JSValue promise_reaction_job(JSContext *ctx, int argc,
5050050500
}
5050150501
is_reject = JS_IsException(res);
5050250502
if (is_reject) {
50503-
if (unlikely(JS_IsUncatchableError(ctx, ctx->rt->current_exception)))
50503+
if (unlikely(JS_IsUncatchableError(ctx->rt->current_exception)))
5050450504
return JS_EXCEPTION;
5050550505
res = JS_GetException(ctx);
5050650506
}

quickjs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,8 +747,8 @@ static inline bool JS_IsModule(JSValueConst v)
747747
JS_EXTERN JSValue JS_Throw(JSContext *ctx, JSValue obj);
748748
JS_EXTERN JSValue JS_GetException(JSContext *ctx);
749749
JS_EXTERN bool JS_HasException(JSContext *ctx);
750-
JS_EXTERN bool JS_IsError(JSContext *ctx, JSValueConst val);
751-
JS_EXTERN bool JS_IsUncatchableError(JSContext* ctx, JSValueConst val);
750+
JS_EXTERN bool JS_IsError(JSValueConst val);
751+
JS_EXTERN bool JS_IsUncatchableError(JSValueConst val);
752752
JS_EXTERN void JS_SetUncatchableError(JSContext *ctx, JSValueConst val);
753753
JS_EXTERN void JS_ClearUncatchableError(JSContext *ctx, JSValueConst val);
754754
// Shorthand for:

run-test262.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ static int eval_buf(JSContext *ctx, const char *buf, size_t buf_len,
13891389

13901390
if (JS_IsException(res_val)) {
13911391
exception_val = JS_GetException(ctx);
1392-
is_error = JS_IsError(ctx, exception_val);
1392+
is_error = JS_IsError(exception_val);
13931393
js_print_262(ctx, JS_NULL, 1, (JSValueConst *)&exception_val);
13941394
if (is_error) {
13951395
JSValue name, stack;

0 commit comments

Comments
 (0)