mirror of
https://github.com/astral-sh/ruff
synced 2026-01-08 15:14:19 -05:00
Fix end location for elif blocks
Since we parse an `elif:` block as an `If` node, its location should include its `orelse` node like it would for an `if:` block. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
@@ -372,7 +372,7 @@ IfStatement: ast::Stmt = {
|
||||
let x = ast::Stmt {
|
||||
custom: (),
|
||||
location: i.0,
|
||||
end_location: i.4.last().unwrap().end_location,
|
||||
end_location,
|
||||
node: ast::StmtKind::If { test: Box::new(i.2), body: i.4, orelse: last },
|
||||
};
|
||||
last = vec![x];
|
||||
|
||||
Reference in New Issue
Block a user