summaryrefslogtreecommitdiffstats
path: root/js/src/builtin/String.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/builtin/String.cpp')
-rw-r--r--js/src/builtin/String.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/js/src/builtin/String.cpp b/js/src/builtin/String.cpp
index 16e92b554c..1da2270cfb 100644
--- a/js/src/builtin/String.cpp
+++ b/js/src/builtin/String.cpp
@@ -566,15 +566,10 @@ static inline void CopyChars(CharT* to, const JSLinearString* from,
MOZ_ASSERT(begin + length <= from->length());
JS::AutoCheckCannotGC nogc;
- if constexpr (std::is_same_v<CharT, Latin1Char>) {
- MOZ_ASSERT(from->hasLatin1Chars());
+ if (from->hasLatin1Chars()) {
CopyChars(to, from->latin1Chars(nogc) + begin, length);
} else {
- if (from->hasLatin1Chars()) {
- CopyChars(to, from->latin1Chars(nogc) + begin, length);
- } else {
- CopyChars(to, from->twoByteChars(nogc) + begin, length);
- }
+ CopyChars(to, from->twoByteChars(nogc) + begin, length);
}
}