Commit 6aa3ebc
committed
Fix crash on an endless method with empty parentheses
Formatting "def foo() = 1" raised Rufo::Bug. The empty-parameters branch
of visit_def_from_name wrote "()" but, unlike the other two branches, did
not skip the space after the closing parenthesis. The endless-method
check (current_token_kind == :on_op) therefore saw the space instead of
"=", skipped format_endless_method, and visiting the body then hit the
unconsumed " = 1".
Skip the space after "()" like the sibling branches do.
Fixes #3611 parent 5186ef6 commit 6aa3ebc
2 files changed
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2015 | 2015 | | |
2016 | 2016 | | |
2017 | 2017 | | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
2018 | 2021 | | |
2019 | 2022 | | |
2020 | 2023 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments