Skip to content

Commit fe25708

Browse files
authored
Merge pull request #76 from astral-sh/match-case-end-location
2 parents ae3a477 + 342cd19 commit fe25708

File tree

2 files changed

+1203
-1229
lines changed

2 files changed

+1203
-1229
lines changed

parser/src/python.lalrpop

+3-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,9 @@ MatchStatement: ast::Stmt = {
387387
}
388388

389389
MatchCase: ast::MatchCase = {
390-
<start:@L> "case" <pattern:Patterns> <guard:(Guard)?> ":" <body:Suite> <end:@R> => {
390+
<start:@L> "case" <pattern:Patterns> <guard:(Guard)?> ":" <body:Suite> => {
391+
// SAFETY: `body` is never empty because it is non-optional and `Suite` matches one or more statements.
392+
let end = body.last().unwrap().end();
391393
ast::MatchCase {
392394
pattern,
393395
guard: guard.map(Box::new),

0 commit comments

Comments
 (0)