Commit a7bea50
committed
fix(hir): #154 using/await using dispose hooks (v0.5.317)
Lowers `using x = expr` / `await using x = expr` into nested
try/finally chains that invoke `[Symbol.dispose]()` (sync) or
`await [Symbol.asyncDispose]()` (async) in reverse declaration order
on block exit. Computed-key class methods `[Symbol.dispose]` and
`[Symbol.asyncDispose]` are renamed to stable `__perry_dispose__` /
`__perry_async_dispose__` names so the desugarer can dispatch via
plain class-method-call. Module-level classes work end-to-end;
class-in-function with enclosing-fn-local capture is dropped silently
(separate codegen gap, filed as #212).
Closes #154.1 parent a34ca55 commit a7bea50
6 files changed
Lines changed: 330 additions & 49 deletions
File tree
- crates/perry-hir/src
- test-files
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9252 | 9252 | | |
9253 | 9253 | | |
9254 | 9254 | | |
9255 | | - | |
9256 | | - | |
9257 | | - | |
9258 | | - | |
9259 | | - | |
| 9255 | + | |
| 9256 | + | |
| 9257 | + | |
| 9258 | + | |
| 9259 | + | |
9260 | 9260 | | |
9261 | 9261 | | |
9262 | 9262 | | |
| |||
9268 | 9268 | | |
9269 | 9269 | | |
9270 | 9270 | | |
| 9271 | + | |
| 9272 | + | |
9271 | 9273 | | |
9272 | 9274 | | |
9273 | 9275 | | |
| |||
0 commit comments