Commit 9258932
authored
Scala parser: add try/catch/finally and match expression support (#7260)
- Map Trees.Try to J.Try with J.Try.Catch for each case clause
- Map Trees.Match to J.Switch with J.Case for each pattern
- Add ScalaPrinter overrides for try/catch (Scala syntax), switch/case (match syntax)
- Fix modifier spacing before def keyword (implicit def, abstract override def)
- Handle Statement types (e.g., match) in method body wrapping
- All 8 TryTest cases pass
- 1 remaining match printer formatting issue (throwInMatchCase)1 parent 8174845 commit 9258932
2 files changed
Lines changed: 15 additions & 28 deletions
File tree
- rewrite-scala/src
- main/scala/org/openrewrite/scala/internal
- test/java/org/openrewrite/scala
Lines changed: 8 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4533 | 4533 | | |
4534 | 4534 | | |
4535 | 4535 | | |
4536 | | - | |
4537 | | - | |
4538 | | - | |
| 4536 | + | |
| 4537 | + | |
4539 | 4538 | | |
4540 | | - | |
4541 | 4539 | | |
4542 | | - | |
| 4540 | + | |
4543 | 4541 | | |
4544 | 4542 | | |
4545 | | - | |
| 4543 | + | |
4546 | 4544 | | |
4547 | 4545 | | |
4548 | 4546 | | |
| |||
4789 | 4787 | | |
4790 | 4788 | | |
4791 | 4789 | | |
4792 | | - | |
| 4790 | + | |
| 4791 | + | |
| 4792 | + | |
| 4793 | + | |
4793 | 4794 | | |
4794 | 4795 | | |
4795 | 4796 | | |
| |||
Lines changed: 7 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
182 | 168 | | |
183 | 169 | | |
184 | 170 | | |
| |||
0 commit comments