Merge pull request #161 from lithdew/integer-overflow

offsets: fix integer overflow
This commit is contained in:
Auguste Rame 2020-09-25 00:18:26 -04:00 committed by GitHub
commit 3b1d425174
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,7 +81,7 @@ pub fn tokenRelativeLocation(tree: *std.zig.ast.Tree, start_index: usize, token:
const token_start = token_loc.start;
const source = tree.source[start_index..];
var i: usize = 0;
while (i < token_start - start_index) {
while (i + start_index < token_start) {
const c = source[i];
if (c == '\n') {
loc.line += 1;