aboutsummaryrefslogtreecommitdiff
path: root/src/js_ast.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-06-29 20:14:12 -0700
committerGravatar GitHub <noreply@github.com> 2023-06-29 20:14:12 -0700
commitc42a00f9df7423e60a23a1194731ca7c85a7d16f (patch)
tree93e216076cc78cb8ca67218d1990e7ac8b3d4f86 /src/js_ast.zig
parent76b9cae25930db8a6293dcff3d3f55948aa896cf (diff)
downloadbun-c42a00f9df7423e60a23a1194731ca7c85a7d16f.tar.gz
bun-c42a00f9df7423e60a23a1194731ca7c85a7d16f.tar.zst
bun-c42a00f9df7423e60a23a1194731ca7c85a7d16f.zip
Fixes #3462 (#3465)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/js_ast.zig')
-rw-r--r--src/js_ast.zig8
1 files changed, 8 insertions, 0 deletions
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());