Open tdurieux opened 2 years ago
It requires the upstream project to support that, see also #20
I don't think we have node type info on the AST.
https://pkg.go.dev/mvdan.cc/sh/v3@v3.5.1/syntax#Node
You can post a feature request issue on the upstream project instead.
That is really unfortunate, I was hoping there would be a trick where we could include the go structure name inside the output. Thank you for your super fast answer. I am impatient to be able to compare the perf of WASM vs GopherJS.
I am impatient to be able to compare the perf of WASM vs GopherJS
We do have a benchmark at https://github.com/un-ts/sh-syntax/blob/main/benchmark/benchmark.txt
You can try it on your own machine easily by running node benchmark
, see also https://github.com/un-ts/sh-syntax/blob/main/benchmark/index.js.
That is really unfortunate, I was hoping there would be a trick where we could include the go structure name inside the output.
Maybe you can try to add the type info at
PR welcome.
Currently, the type is added in the interface between the JS and GopherJS output and is available in property '$type' and is exploited here: https://github.com/mvdan/sh/blob/f33507475241da6fc37b972d825c351b94300bab/_js/main.go#L39.
I can probably update the mapNode to have the same output as the GopherJS version. I will have a look.
Hello,
Thank you for providing the WASM version of mvdan-sh. Is there a way to obtain the node type?