mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
append if the previous part is not UTF8 (#2705)
This commit is contained in:
@@ -2325,12 +2325,16 @@ pub const E = struct {
|
||||
} else {
|
||||
var prev_part = &parts.items[parts.items.len - 1];
|
||||
|
||||
if (part.value.data.e_string.len() > 0) {
|
||||
prev_part.tail.push(part.value.data.e_string);
|
||||
}
|
||||
if (prev_part.tail.isUTF8()) {
|
||||
if (part.value.data.e_string.len() > 0) {
|
||||
prev_part.tail.push(part.value.data.e_string);
|
||||
}
|
||||
|
||||
if (part.tail.len() > 0) {
|
||||
prev_part.tail.push(Expr.init(E.String, part.tail, part.tail_loc).data.e_string);
|
||||
if (part.tail.len() > 0) {
|
||||
prev_part.tail.push(Expr.init(E.String, part.tail, part.tail_loc).data.e_string);
|
||||
}
|
||||
} else {
|
||||
parts.appendAssumeCapacity(part);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -9825,4 +9829,3 @@ pub const UseDirective = enum {
|
||||
// Stmt | 192
|
||||
// STry | 384
|
||||
// -- ESBuild bit sizes
|
||||
|
||||
|
||||
@@ -2152,7 +2152,7 @@ class Foo {
|
||||
|
||||
describe("simplification", () => {
|
||||
it("unary operator", () => {
|
||||
expectPrinted("a = !(b, c)", "a = (b , !c)");
|
||||
expectPrinted("a = !(b, c)", "a = (b, !c)");
|
||||
});
|
||||
|
||||
it("const inlining", () => {
|
||||
|
||||
Reference in New Issue
Block a user