deno_swc
deno_swc copied to clipboard
Unexpected output and possible memory leak
It seems strange for these functions to be maintaining state and producing output that isn't expected from the given input.
For instance, manipulation of a string value results in the original input code when printed:
![Screen Shot 2021-09-04 at 10 59 29 AM](https://user-images.githubusercontent.com/5193330/132104123-bd9893a1-1b9a-4036-905f-8dd8e7de5f6e.png)
It appears that code is being kept in memory with seemingly no way to clear it and the span ranges used for each node are simply incremented:
![Screen Shot 2021-09-04 at 11 00 00 AM](https://user-images.githubusercontent.com/5193330/132104156-4f38b004-e148-446b-99d4-0b9eb591e052.png)
So the only way I've figured out to properly print a manipulated AST is to manually increment all the start & end values:
![Screen Shot 2021-09-04 at 11 21 08 AM](https://user-images.githubusercontent.com/5193330/132104472-1e170c71-dfed-4fcf-81fb-5d273dc55fbd.png)
Is this expected? I'm seeing this using deno 1.13.0.
Same here. I don't know the internals of swc at all, but wonder if this is related to the compiler instance being cached in swc_wasm/lib.rs