stage2: fix incorrect ast.Tree.getNodeSource impl

This commit is contained in:
Andrew Kelley 2021-02-19 20:28:47 -07:00
parent 70761d7c52
commit d8560edc29

View File

@ -1071,8 +1071,8 @@ pub const Tree = struct {
const first_token = tree.firstToken(node);
const last_token = tree.lastToken(node);
const start = token_starts[first_token];
const len = tree.tokenSlice(last_token).len;
return tree.source[start..][0..len];
const end = token_starts[last_token] + tree.tokenSlice(last_token).len;
return tree.source[start..end];
}
pub fn globalVarDecl(tree: Tree, node: Node.Index) full.VarDecl {