Fix tokenRelativeLocation

Closes #354

Closes #543
This commit is contained in:
Auguste Rame
2022-07-17 16:29:03 +02:00
parent 7f8c7430b1
commit 5f9b9c564c

View File

@@ -104,7 +104,9 @@ pub const TokenLocation = struct {
}; };
pub fn tokenRelativeLocation(tree: Ast, start_index: usize, token_start: usize, encoding: Encoding) !TokenLocation { 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{ var loc = TokenLocation{
.line = 0, .line = 0,
.column = 0, .column = 0,