From c42a00f9df7423e60a23a1194731ca7c85a7d16f Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Thu, 29 Jun 2023 20:14:12 -0700 Subject: Fixes #3462 (#3465) Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> --- src/js_ast.zig | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/js_ast.zig') diff --git a/src/js_ast.zig b/src/js_ast.zig index 9ec14e158..8ae652bb9 100644 --- a/src/js_ast.zig +++ b/src/js_ast.zig @@ -2140,6 +2140,14 @@ pub const E = struct { rope_len: u32 = 0, is_utf16: bool = false, + pub fn isIdentifier(this: *String, allocator: std.mem.Allocator) bool { + if (!this.isUTF8()) { + return bun.js_lexer.isIdentifierUTF16(this.slice16()); + } + + return bun.js_lexer.isIdentifier(this.slice(allocator)); + } + pub var class = E.String{ .data = "class" }; pub fn push(this: *String, other: *String) void { std.debug.assert(this.isUTF8()); -- cgit v1.2.3