diff options
author | Rich Trott <rtrott@gmail.com> | 2020-02-11 14:31:25 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-02-13 23:04:21 +0300 |
commit | a18b437e6a6115e30309a1f200f614e27e650aa4 (patch) | |
tree | 86a99695157eef0f21d60235b4e75f68c5af54af /lib/internal/util | |
parent | 481fa1ca989a36f850f844f1df50a6db0cfb1dd3 (diff) |
util: throw if unreachable TypedArray checking 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: https://github.com/nodejs/node/pull/31737
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'lib/internal/util')
-rw-r--r-- | lib/internal/util/comparisons.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/internal/util/comparisons.js b/lib/internal/util/comparisons.js index ed320995b83..3cc593ae27f 100644 --- a/lib/internal/util/comparisons.js +++ b/lib/internal/util/comparisons.js @@ -147,7 +147,11 @@ function isIdenticalTypedArrayType(a, b) { return check(b); } } - return false; + /* c8 ignore next */ + assert.fail( + `Unknown TypedArray type checking ${a[SymbolToStringTag]} ${a}\n` + + `and ${b[SymbolToStringTag]} ${b}` + ); } // Notes: Type tags are historical [[Class]] properties that can be set by |