Merge pull request #547 from zigtools/tokenRelativeLocation-fix-hopefully

Fix tokenRelativeLocation
This commit is contained in:
Auguste Rame 2022-07-17 10:40:58 -04:00 committed by GitHub
commit 949e4fe525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,7 +104,9 @@ pub const TokenLocation = struct {
};
pub fn tokenRelativeLocation(tree: Ast, start_index: usize, token_start: usize, encoding: Encoding) !TokenLocation {
std.debug.assert(token_start >= start_index);
if (token_start < start_index)
return error.InvalidParams;
var loc = TokenLocation{
.line = 0,
.column = 0,