You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
Interns leading and trailing comments for computed object property keys. Comments preceding the opening brace will be attached as leading comments, and comments succeeding the closing brace will be attached as trailing comments. Comments within the braces will be attached to the inner expression.
```
{ /* L computed */ [ /* L expr */ expr /* T expr */ ] /* T computed */ : value }
```
Both object expressions and patterns can have computed keys of the same form, so I created a new shared `ComputedKey` node in the AST to share logic between computd object keys and computed expression keys. This `ComputedKey` module contains a new record type so that both the coments and inner expression can be stored. The new `ComputedKey` node also keeps track of the loc for the overall computed key (beginning at the opening brace and ending at the closing brace), which is needed in the ast differ and the printer.
Reviewed By: pieterv
Differential Revision: D20350642
fbshipit-source-id: bff29e48e62e11e3456efec4fdfd13b82daae78b
0 commit comments