aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-02-19 20:28:47 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-02-19 20:28:47 -0700
commitd8560edc2941016a12a03df36035cabd537dde77 (patch)
tree76d2679211958ebbae039db36af4ce1ff34d85a7
parent70761d7c52cd3634e086b0914c9520ef4dc01eee (diff)
downloadzig-d8560edc2941016a12a03df36035cabd537dde77.tar.gz
zig-d8560edc2941016a12a03df36035cabd537dde77.zip
stage2: fix incorrect ast.Tree.getNodeSource impl
-rw-r--r--lib/std/zig/ast.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/zig/ast.zig b/lib/std/zig/ast.zig
index fda2916af4..943ddd30db 100644
--- a/lib/std/zig/ast.zig
+++ b/lib/std/zig/ast.zig
@@ -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 {