Repository navigation
Commit 72eb028
committed
fix(compiler): decompose state-tuple bindings for destructured parameters in Strong mode
When a state-tuple was passed to a helper or Effect Event and the callee
destructured it in a parameter (e.g. function add([list]) { list.push(1); }),
visitParameters only called bindSnapshotPattern for kind === 'snapshot'.
The destructured elements stayed as OTHER_BINDING, so mutations on the
snapshot were not reported.
Add ArrayPattern and ObjectPattern decomposition for state-tuple parameters,
mirroring the existing logic in bindDeclarationValue. Index 0 is bound as the
snapshot, index 1 as the setter (index 2 / getter was already handled by
bindStateGetterPattern).
Add a regression test that passes a whole tuple to a helper with a destructured
array parameter.1 parent 0c1e251 commit 72eb028
2 files changed
Lines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2336 | 2336 | | |
2337 | 2337 | | |
2338 | 2338 | | |
| 2339 | + | |
| 2340 | + | |
| 2341 | + | |
| 2342 | + | |
| 2343 | + | |
| 2344 | + | |
| 2345 | + | |
| 2346 | + | |
| 2347 | + | |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
| 2359 | + | |
| 2360 | + | |
| 2361 | + | |
| 2362 | + | |
| 2363 | + | |
| 2364 | + | |
| 2365 | + | |
| 2366 | + | |
| 2367 | + | |
| 2368 | + | |
| 2369 | + | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
2339 | 2375 | | |
2340 | 2376 | | |
2341 | 2377 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
369 | 373 | | |
370 | 374 | | |
371 | 375 | | |
| |||
0 commit comments