Fix off by one scope end index

This commit is contained in:
Luuk de Gram 2021-03-08 20:31:02 +01:00
parent 43ebfc7300
commit 20cb0b7307
No known key found for this signature in database
GPG Key ID: A002B174963DBB7D

View File

@ -2802,7 +2802,7 @@ fn makeScopeInternal(
scope.* = .{ scope.* = .{
.range = .{ .range = .{
.start = offsets.tokenLocation(tree, payload).start, .start = offsets.tokenLocation(tree, payload).start,
.end = offsets.tokenLocation(tree, tree.lastToken(if_node.ast.then_expr)).end, .end = offsets.tokenLocation(tree, tree.lastToken(if_node.ast.then_expr)).end + 1,
}, },
.decls = std.StringHashMap(Declaration).init(allocator), .decls = std.StringHashMap(Declaration).init(allocator),
.uses = &.{}, .uses = &.{},
@ -2887,7 +2887,7 @@ fn makeScopeInternal(
scope.* = .{ scope.* = .{
.range = .{ .range = .{
.start = offsets.tokenLocation(tree, payload).start, .start = offsets.tokenLocation(tree, payload).start,
.end = offsets.tokenLocation(tree, tree.lastToken(while_node.ast.then_expr)).end, .end = offsets.tokenLocation(tree, tree.lastToken(while_node.ast.then_expr)).end + 1,
}, },
.decls = std.StringHashMap(Declaration).init(allocator), .decls = std.StringHashMap(Declaration).init(allocator),
.uses = &.{}, .uses = &.{},