Bail early if _eq raises an exception

This commit is contained in:
K. Lange 2022-07-03 18:44:47 +09:00
parent 33946d8675
commit 1d828addc0

View File

@ -174,6 +174,7 @@ int krk_valuesEqual(KrkValue a, KrkValue b) {
krk_push(a);
krk_push(b);
KrkValue result = krk_callDirect(type->_eq,2);
if (unlikely(krk_currentThread.flags & KRK_THREAD_HAS_EXCEPTION)) return 0;
if (IS_BOOLEAN(result)) return AS_BOOLEAN(result);
if (IS_NOTIMPL(result)) goto _next;
return !krk_isFalsey(result);
@ -186,6 +187,7 @@ _next:
krk_push(a);
KrkValue result = krk_callDirect(type->_eq,2);
if (IS_BOOLEAN(result)) return AS_BOOLEAN(result);
if (unlikely(krk_currentThread.flags & KRK_THREAD_HAS_EXCEPTION)) return 0;
return !krk_isFalsey(result);
}