aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorIntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>2022-12-11 20:41:42 +0100
committerGitHub <noreply@github.com>2022-12-11 14:41:42 -0500
commit15a6336bb40d413a7c7f140528268bb0397fdb41 (patch)
tree375e3eedd760a1172b5b303c6d67bbdbdb22045d /src/Module.zig
parentcd9af0f286725c19f5dc0335fb1db1ab8cf7af0d (diff)
downloadzig-15a6336bb40d413a7c7f140528268bb0397fdb41.tar.gz
zig-15a6336bb40d413a7c7f140528268bb0397fdb41.zip
Add a helpful note when using `**` on number types. (#13871)
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig
index 074e25470c..57745a3276 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -2215,6 +2215,12 @@ pub const SrcLoc = struct {
assert(src_loc.file_scope.tree_loaded);
return nodeToSpan(tree, node);
},
+ .node_offset_main_token => |node_off| {
+ const tree = try src_loc.file_scope.getTree(gpa);
+ const node = src_loc.declRelativeToNodeIndex(node_off);
+ const main_token = tree.nodes.items(.main_token)[node];
+ return tokensToSpan(tree, main_token, main_token, main_token);
+ },
.node_offset_bin_op => |node_off| {
const tree = try src_loc.file_scope.getTree(gpa);
const node = src_loc.declRelativeToNodeIndex(node_off);
@@ -3009,6 +3015,10 @@ pub const LazySrcLoc = union(enum) {
/// from its containing Decl node AST index.
/// The Decl is determined contextually.
node_offset: TracedOffset,
+ /// The source location points to the main token of an AST node, found
+ /// by taking this AST node index offset from the containing Decl AST node.
+ /// The Decl is determined contextually.
+ node_offset_main_token: i32,
/// The source location points to the beginning of a struct initializer.
/// The Decl is determined contextually.
node_offset_initializer: i32,
@@ -3275,6 +3285,7 @@ pub const LazySrcLoc = union(enum) {
.byte_offset,
.token_offset,
.node_offset,
+ .node_offset_main_token,
.node_offset_initializer,
.node_offset_var_decl_ty,
.node_offset_var_decl_align,