MichaelBuhler / razuberi

a JavaScript/TypeScript -> C++ transpiler
http://razuberi.org
4 stars 1 forks source link

consider removing `EmptyStatement` node from the AST #5

Open MichaelBuhler opened 1 year ago

MichaelBuhler commented 1 year ago

e.g. We could use Babel Traverse to pre-process the AST prior to code generation. An EmptyStatement visitor could remove such nodes from the AST.

concern: I wonder if for (;;) {} would produce EmptyStatement nodes?

MichaelBuhler commented 1 year ago

the previous concern about for (;;) {} seems to be no problem at all.

as for removing EmptyStatement nodes, I am thinking that there may be a variety of similar optimizations that could be enabled/disabled via a transpiler flag.