Improve stack overflow, show more properties in Error objects (#15985)

Co-authored-by: Dave Caruso <me@paperdave.net>
This commit is contained in:
Jarred Sumner
2024-12-25 21:47:13 -08:00
committed by GitHub
parent 7317c7b4a2
commit 2b2ca3275c
43 changed files with 1735 additions and 324 deletions

View File

@@ -197,6 +197,14 @@ pub const WTFStringImplStruct = extern struct {
return this.is8Bit() and bun.strings.isAllASCII(this.latin1Slice());
}
pub fn utf16ByteLength(this: WTFStringImpl) usize {
if (this.is8Bit()) {
return this.length() * 2;
} else {
return this.length();
}
}
pub fn utf8ByteLength(this: WTFStringImpl) usize {
if (this.is8Bit()) {
const input = this.latin1Slice();
@@ -207,11 +215,6 @@ pub const WTFStringImplStruct = extern struct {
}
}
pub fn utf16ByteLength(this: WTFStringImpl) usize {
// All latin1 characters fit in a single UTF-16 code unit.
return this.length() * 2;
}
pub fn latin1ByteLength(this: WTFStringImpl) usize {
// Not all UTF-16 characters fit are representable in latin1.
// Those get truncated?