Commit a379b03
committed
fix gkz#1096
The minor code optimization of omitting parentheses around a single
destructuring assignment is incorrect when the assignment is produced
inside a binary expression, as the binary operator interferes with the
parsing of the assignment's LHS in the generated JS.
This change restricts the optimization to cases where the current
precedence level is lower than that of binary operators. Since the
number of expressions includes a final expression that captures the
original RHS of the destructuring assignment if that value is needed,
and since the optimization is always applied to top-level and
parenthesis-level expressions by the second half of the if condition,
this change only has an effect on single-assignment destructuring
assignments that are direct children of a list or conditional
expression, where the value of the destructuring assignment expression
is not used (which rules out lists and most conditionals as well). gkz#1096
illustrates one of the only ways such a circumstance is likely to arise
in natural code.1 parent bc1c188 commit a379b03
4 files changed
Lines changed: 20 additions & 2 deletions
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 | |
|---|---|---|---|
| |||
1725 | 1725 | | |
1726 | 1726 | | |
1727 | 1727 | | |
1728 | | - | |
| 1728 | + | |
1729 | 1729 | | |
1730 | 1730 | | |
1731 | 1731 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
407 | 416 | | |
408 | 417 | | |
409 | 418 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
0 commit comments