@@ -2171,7 +2171,11 @@ pub const SrcLoc = struct {
2171
2171
const token_starts = tree .tokens .items (.start );
2172
2172
return token_starts [tok_index ];
2173
2173
},
2174
- .node_offset_slice_sentinel = > | node_off | {
2174
+ .node_offset_slice_ptr ,
2175
+ .node_offset_slice_start ,
2176
+ .node_offset_slice_end ,
2177
+ .node_offset_slice_sentinel ,
2178
+ = > | node_off | {
2175
2179
const tree = try src_loc .file_scope .getTree (gpa );
2176
2180
const node_tags = tree .nodes .items (.tag );
2177
2181
const node = src_loc .declRelativeToNodeIndex (node_off );
@@ -2182,7 +2186,15 @@ pub const SrcLoc = struct {
2182
2186
else = > unreachable ,
2183
2187
};
2184
2188
const main_tokens = tree .nodes .items (.main_token );
2185
- const tok_index = main_tokens [full .ast .sentinel ];
2189
+ const tok_index = main_tokens [
2190
+ switch (src_loc .lazy ) {
2191
+ .node_offset_slice_ptr = > full .ast .sliced ,
2192
+ .node_offset_slice_start = > full .ast .start ,
2193
+ .node_offset_slice_end = > full .ast .end ,
2194
+ .node_offset_slice_sentinel = > full .ast .sentinel ,
2195
+ else = > unreachable ,
2196
+ }
2197
+ ];
2186
2198
const token_starts = tree .tokens .items (.start );
2187
2199
return token_starts [tok_index ];
2188
2200
},
@@ -2624,6 +2636,24 @@ pub const LazySrcLoc = union(enum) {
2624
2636
/// to the index expression.
2625
2637
/// The Decl is determined contextually.
2626
2638
node_offset_array_access_index : i32 ,
2639
+ /// The source location points to the LHS of a slice expression
2640
+ /// expression, found by taking this AST node index offset from the containing
2641
+ /// Decl AST node, which points to a slice AST node. Next, navigate
2642
+ /// to the sentinel expression.
2643
+ /// The Decl is determined contextually.
2644
+ node_offset_slice_ptr : i32 ,
2645
+ /// The source location points to start expression of a slice expression
2646
+ /// expression, found by taking this AST node index offset from the containing
2647
+ /// Decl AST node, which points to a slice AST node. Next, navigate
2648
+ /// to the sentinel expression.
2649
+ /// The Decl is determined contextually.
2650
+ node_offset_slice_start : i32 ,
2651
+ /// The source location points to the end expression of a slice
2652
+ /// expression, found by taking this AST node index offset from the containing
2653
+ /// Decl AST node, which points to a slice AST node. Next, navigate
2654
+ /// to the sentinel expression.
2655
+ /// The Decl is determined contextually.
2656
+ node_offset_slice_end : i32 ,
2627
2657
/// The source location points to the sentinel expression of a slice
2628
2658
/// expression, found by taking this AST node index offset from the containing
2629
2659
/// Decl AST node, which points to a slice AST node. Next, navigate
@@ -2781,6 +2811,9 @@ pub const LazySrcLoc = union(enum) {
2781
2811
.node_offset_builtin_call_arg4 ,
2782
2812
.node_offset_builtin_call_arg5 ,
2783
2813
.node_offset_array_access_index ,
2814
+ .node_offset_slice_ptr ,
2815
+ .node_offset_slice_start ,
2816
+ .node_offset_slice_end ,
2784
2817
.node_offset_slice_sentinel ,
2785
2818
.node_offset_call_func ,
2786
2819
.node_offset_field_name ,
0 commit comments