mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +00:00
Improve stack overflow, show more properties in Error objects (#15985)
Co-authored-by: Dave Caruso <me@paperdave.net>
This commit is contained in:
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user