append if the previous part is not UTF8 (#2705)

This commit is contained in:
Dylan Conway
2023-04-20 16:35:01 -07:00
committed by GitHub
parent 6d5378566a
commit 94cd68d7a6
2 changed files with 10 additions and 7 deletions

View File

@@ -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