2 ms·
> it seems that a separate AST is created just for this bracket-pair problem, is that right? That is right. > I imagine there was/is already (at least one) an
by Gehinnn 5y ago
> it seems that a separate AST is created just for this bracket-pair problem, is that right?
That is right.
> I imagine there was/is already (at least one) another AST already being computed in the editor, for other reasons
Not in the renderer process.
The point is that more concrete ASTs that model more features of the language are less likely to have reusable nodes. When you have just bracket pairs, you can reuse any bracket pair that was not modified!
However, when prepending a JS file with `[`, a class declaration probably does not parse as class declaration anymore, so you cannot just reuse it and make it child of the array expression (what you could do if it was just another bracket pair).