From dec5b07782d80e972885df2a750ffb76ef05a884 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Mon, 17 Apr 2023 18:01:38 -0700 Subject: [PATCH] Fix template string folding bug --- src/js_ast.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js_ast.zig b/src/js_ast.zig index 8967d2c6d4..e9cb6f2a47 100644 --- a/src/js_ast.zig +++ b/src/js_ast.zig @@ -2085,7 +2085,8 @@ pub const E = struct { allocator: std.mem.Allocator, loc: logger.Loc, ) Expr { - if (this.tag != null) { + if (this.tag != null or !this.head.isUTF8()) { + // we only fold utf-8/ascii for now return Expr{ .data = .{ .e_template = this, @@ -2094,8 +2095,7 @@ pub const E = struct { }; } - // we only fold utf-8/ascii for now - if (this.parts.len == 0 or !this.head.isUTF8()) { + if (this.parts.len == 0) { return Expr.init(E.String, this.head, loc); }