aboutsummaryrefslogtreecommitdiff
path: root/src/js_ast.zig
diff options
context:
space:
mode:
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());