Skip to content

Commit 3eba33e

Browse files
committed
util: throw if unreachable code is reached
If a comparison code path that is supposed to be unreachable is reached, throw. Add a c8 comment to ignore coverage for the line, as it should be unreachable. PR-URL: #31712 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Yosuke Furukawa <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 9fdb6e6 commit 3eba33e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/internal/util/comparisons.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const {
2323
} = primordials;
2424

2525
const { compare } = internalBinding('buffer');
26+
const assert = require('internal/assert');
2627
const types = require('internal/util/types');
2728
const {
2829
isAnyArrayBuffer,
@@ -118,7 +119,8 @@ function isEqualBoxedPrimitive(val1, val2) {
118119
return isSymbolObject(val2) &&
119120
SymbolPrototypeValueOf(val1) === SymbolPrototypeValueOf(val2);
120121
}
121-
return false;
122+
/* c8 ignore next */
123+
assert.fail(`Unknown boxed type ${val1}`);
122124
}
123125

124126
function isIdenticalTypedArrayType(a, b) {

0 commit comments

Comments
 (0)