| ... | @@ -91,9 +91,6 @@ const Parser = struct { | ... | @@ -91,9 +91,6 @@ const Parser = struct { |
| 91 | extra_data: std.ArrayListUnmanaged(Node.Index), | 91 | extra_data: std.ArrayListUnmanaged(Node.Index), |
| 92 | scratch: std.ArrayListUnmanaged(Node.Index), | 92 | scratch: std.ArrayListUnmanaged(Node.Index), |
| 93 | | 93 | |
| 94 | /// Used for the error note of decl_between_fields error. | | |
| 95 | last_field: TokenIndex = undefined, | | |
| 96 | | | |
| 97 | const SmallSpan = union(enum) { | 94 | const SmallSpan = union(enum) { |
| 98 | zero_or_one: Node.Index, | 95 | zero_or_one: Node.Index, |
| 99 | multi: Node.SubRange, | 96 | multi: Node.SubRange, |
| ... | @@ -252,6 +249,8 @@ const Parser = struct { | ... | @@ -252,6 +249,8 @@ const Parser = struct { |
| 252 | err, | 249 | err, |
| 253 | } = .none; | 250 | } = .none; |
| 254 | | 251 | |
| | 252 | var last_field: TokenIndex = undefined; |
| | 253 | |
| 255 | // Skip container doc comments. | 254 | // Skip container doc comments. |
| 256 | while (p.eatToken(.container_doc_comment)) |_| {} | 255 | while (p.eatToken(.container_doc_comment)) |_| {} |
| 257 | | 256 | |
| ... | @@ -274,7 +273,7 @@ const Parser = struct { | ... | @@ -274,7 +273,7 @@ const Parser = struct { |
| 274 | .identifier => { | 273 | .identifier => { |
| 275 | p.tok_i += 1; | 274 | p.tok_i += 1; |
| 276 | const identifier = p.tok_i; | 275 | const identifier = p.tok_i; |
| 277 | defer p.last_field = identifier; | 276 | defer last_field = identifier; |
| 278 | const container_field = try p.expectContainerFieldRecoverable(); | 277 | const container_field = try p.expectContainerFieldRecoverable(); |
| 279 | if (container_field != 0) { | 278 | if (container_field != 0) { |
| 280 | switch (field_state) { | 279 | switch (field_state) { |
| ... | @@ -288,7 +287,7 @@ const Parser = struct { | ... | @@ -288,7 +287,7 @@ const Parser = struct { |
| 288 | try p.warnMsg(.{ | 287 | try p.warnMsg(.{ |
| 289 | .tag = .previous_field, | 288 | .tag = .previous_field, |
| 290 | .is_note = true, | 289 | .is_note = true, |
| 291 | .token = p.last_field, | 290 | .token = last_field, |
| 292 | }); | 291 | }); |
| 293 | try p.warnMsg(.{ | 292 | try p.warnMsg(.{ |
| 294 | .tag = .next_field, | 293 | .tag = .next_field, |
| ... | @@ -389,7 +388,7 @@ const Parser = struct { | ... | @@ -389,7 +388,7 @@ const Parser = struct { |
| 389 | }, | 388 | }, |
| 390 | .identifier => { | 389 | .identifier => { |
| 391 | const identifier = p.tok_i; | 390 | const identifier = p.tok_i; |
| 392 | defer p.last_field = identifier; | 391 | defer last_field = identifier; |
| 393 | const container_field = try p.expectContainerFieldRecoverable(); | 392 | const container_field = try p.expectContainerFieldRecoverable(); |
| 394 | if (container_field != 0) { | 393 | if (container_field != 0) { |
| 395 | switch (field_state) { | 394 | switch (field_state) { |
| ... | @@ -402,7 +401,7 @@ const Parser = struct { | ... | @@ -402,7 +401,7 @@ const Parser = struct { |
| 402 | }); | 401 | }); |
| 403 | try p.warnMsg(.{ | 402 | try p.warnMsg(.{ |
| 404 | .tag = .previous_field, | 403 | .tag = .previous_field, |
| 405 | .token = p.last_field, | 404 | .token = last_field, |
| 406 | }); | 405 | }); |
| 407 | try p.warnMsg(.{ | 406 | try p.warnMsg(.{ |
| 408 | .tag = .next_field, | 407 | .tag = .next_field, |