Commit db4ecd5
committed
Fix formatter crash on bare return in lambda
The return_stmt handler unconditionally accessed s.children[0], but a
bare `return` (without expression) has zero children. This caused an
IndexError when formatting lambdas like `func(): return`.
The grammar correctly defines return_stmt with an optional expression
(`return_stmt: "return" [expr]`), so the formatter now checks for
empty children before accessing the list.1 parent 9d84051 commit db4ecd5
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
0 commit comments