aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig
index 1f70a44df5..d4e981f834 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -2501,6 +2501,16 @@ pub const SrcLoc = struct {
const token_starts = tree.tokens.items(.start);
return token_starts[tok_index];
},
+ .node_offset_un_op => |node_off| {
+ const tree = try src_loc.file_scope.getTree(gpa);
+ const node_datas = tree.nodes.items(.data);
+ const node = src_loc.declRelativeToNodeIndex(node_off);
+
+ const main_tokens = tree.nodes.items(.main_token);
+ const tok_index = main_tokens[node_datas[node].lhs];
+ const token_starts = tree.tokens.items(.start);
+ return token_starts[tok_index];
+ },
}
}
@@ -2728,6 +2738,9 @@ pub const LazySrcLoc = union(enum) {
/// to the elem expression.
/// The Decl is determined contextually.
node_offset_array_type_elem: i32,
+ /// The source location points to the operand of an unary expression.
+ /// The Decl is determined contextually.
+ node_offset_un_op: i32,
pub const nodeOffset = if (TracedOffset.want_tracing) nodeOffsetDebug else nodeOffsetRelease;
@@ -2788,6 +2801,7 @@ pub const LazySrcLoc = union(enum) {
.node_offset_array_type_len,
.node_offset_array_type_sentinel,
.node_offset_array_type_elem,
+ .node_offset_un_op,
=> .{
.file_scope = decl.getFileScope(),
.parent_decl_node = decl.src_node,