@@ -1467,6 +1467,14 @@ pub const SrcLoc = struct {
1467
1467
const end = start + @as (u32 , @intCast (tree .tokenSlice (tok_index ).len ));
1468
1468
return Span { .start = start , .end = end , .main = start };
1469
1469
},
1470
+ .node_offset_field_name_init = > | node_off | {
1471
+ const tree = try src_loc .file_scope .getTree (gpa );
1472
+ const node = src_loc .declRelativeToNodeIndex (node_off );
1473
+ const tok_index = tree .firstToken (node ) - 2 ;
1474
+ const start = tree .tokens .items (.start )[tok_index ];
1475
+ const end = start + @as (u32 , @intCast (tree .tokenSlice (tok_index ).len ));
1476
+ return Span { .start = start , .end = end , .main = start };
1477
+ },
1470
1478
.node_offset_deref_ptr = > | node_off | {
1471
1479
const tree = try src_loc .file_scope .getTree (gpa );
1472
1480
const node = src_loc .declRelativeToNodeIndex (node_off );
@@ -2132,10 +2140,14 @@ pub const LazySrcLoc = union(enum) {
2132
2140
/// The payload is offset from the containing Decl AST node.
2133
2141
/// The source location points to the field name of:
2134
2142
/// * a field access expression (`a.b`), or
2135
- /// * the callee of a method call (`a.b()`), or
2136
- /// * the operand ("b" node) of a field initialization expression (`.a = b`), or
2143
+ /// * the callee of a method call (`a.b()`)
2137
2144
/// The Decl is determined contextually.
2138
2145
node_offset_field_name : i32 ,
2146
+ /// The payload is offset from the containing Decl AST node.
2147
+ /// The source location points to the field name of the operand ("b" node)
2148
+ /// of a field initialization expression (`.a = b`)
2149
+ /// The Decl is determined contextually.
2150
+ node_offset_field_name_init : i32 ,
2139
2151
/// The source location points to the pointer of a pointer deref expression,
2140
2152
/// found by taking this AST node index offset from the containing
2141
2153
/// Decl AST node, which points to a pointer deref AST node. Next, navigate
@@ -2374,6 +2386,7 @@ pub const LazySrcLoc = union(enum) {
2374
2386
.node_offset_slice_sentinel ,
2375
2387
.node_offset_call_func ,
2376
2388
.node_offset_field_name ,
2389
+ .node_offset_field_name_init ,
2377
2390
.node_offset_deref_ptr ,
2378
2391
.node_offset_asm_source ,
2379
2392
.node_offset_asm_ret_ty ,
0 commit comments