diff options
| author | 2021-04-21 16:40:34 -0700 | |
|---|---|---|
| committer | 2021-04-21 16:40:34 -0700 | |
| commit | ad46a05ea5b2f1a86ef56bc946ebbe3589e21d43 (patch) | |
| tree | 064e548d925a994b3a024593c4d679ec8ef2f2d3 /src/js_lexer.zig | |
| parent | 9d8f5996d43e468958ea1cae65675fa60e9111f9 (diff) | |
| download | bun-ad46a05ea5b2f1a86ef56bc946ebbe3589e21d43.tar.gz bun-ad46a05ea5b2f1a86ef56bc946ebbe3589e21d43.tar.zst bun-ad46a05ea5b2f1a86ef56bc946ebbe3589e21d43.zip | |
hm
Diffstat (limited to 'src/js_lexer.zig')
| -rw-r--r-- | src/js_lexer.zig | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/js_lexer.zig b/src/js_lexer.zig index 56b824ffa..303f2e4f3 100644 --- a/src/js_lexer.zig +++ b/src/js_lexer.zig @@ -18,6 +18,7 @@ pub const CodePoint = tables.CodePoint; pub const Keywords = tables.Keywords; pub const tokenToString = tables.tokenToString; pub const jsxEntity = tables.jsxEntity; +pub const StrictModeReservedWords = tables.StrictModeReservedWords; // TODO: JSON const IS_JSON_FILE = false; @@ -1179,12 +1180,13 @@ fn isWhitespace(codepoint: CodePoint) bool { // this fn is a stub! pub fn rangeOfIdentifier(source: *Source, loc: logger.Loc) logger.Range { var r = logger.Range{ .loc = loc, .len = 0 }; + const offset = @intCast(usize, loc.start); var i: usize = 0; - for (source.contents[loc..]) |c| { - if (isIdentifierStart(@as(c, CodePoint))) { - for (source.contents[loc + i ..]) |c_| { + for (source.contents[offset..]) |c| { + if (isIdentifierStart(@as(CodePoint, c))) { + for (source.contents[offset + i ..]) |c_| { if (!isIdentifierContinue(c_)) { - r.len = i; + r.len = std.math.lossyCast(i32, i); return r; } i += 1; |
