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
This Rollup issue got me thinking. #992 moved away from the concept of 'visitors' to the current approach, whereby AST nodes are converted into classes that implement common methods like build alongside more specialised ones.
It works, but:
it means we have to clone the AST, so that it can be included in the svelte.compile output
there are performance downsides to changing prototypes
we're locked in to the structure of the AST generated by svelte.parse, which isn't necessarily the best structure for later phases (e.g. bindings and event handlers are lumped in with attributes). I don't think there's any guarantee that the parser could create the optimal structure
So what I propose, in essence, is that instead of augmenting the existing AST nodes we create entirely new objects. Instead of
Object.setPrototypeOf(node, EachBlock.prototype);
it would be
new EachBlock(node);
and the EachBlock constructor would be responsible for instantiating its children.
The text was updated successfully, but these errors were encountered:
This Rollup issue got me thinking. #992 moved away from the concept of 'visitors' to the current approach, whereby AST nodes are converted into classes that implement common methods like
build
alongside more specialised ones.It works, but:
svelte.compile
outputsvelte.parse
, which isn't necessarily the best structure for later phases (e.g. bindings and event handlers are lumped in with attributes). I don't think there's any guarantee that the parser could create the optimal structureSo what I propose, in essence, is that instead of augmenting the existing AST nodes we create entirely new objects. Instead of
it would be
and the
EachBlock
constructor would be responsible for instantiating its children.The text was updated successfully, but these errors were encountered: