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
I'm using rust to parse a js module into an ast that I use for an interpreter. In certain cases I would like to turn a part of the ast into js code again. I'm using the Compiler.print() method for that.
This works great but when the code contains a ArrayLiteral like "[1,2]" the process panics with "position 50 does not resolve to a source location".
It seems to come from swc_common/source_map.rs:906.
I don't really understand why the compiler wants to access a sourcefile. And since I only want to print a part of the ast, I don't really have a source file.
Do you have an idea how I could avoid this problem. I would really appreciate the help.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I'm using rust to parse a js module into an ast that I use for an interpreter. In certain cases I would like to turn a part of the ast into js code again. I'm using the Compiler.print() method for that.
This works great but when the code contains a ArrayLiteral like "[1,2]" the process panics with "position 50 does not resolve to a source location".
It seems to come from swc_common/source_map.rs:906.
I don't really understand why the compiler wants to access a sourcefile. And since I only want to print a part of the ast, I don't really have a source file.
Do you have an idea how I could avoid this problem. I would really appreciate the help.
Great project btw.
Beta Was this translation helpful? Give feedback.
All reactions