Rich-Harris / code-red

Experimental toolkit for writing x-to-JavaScript compilers
MIT License
333 stars 22 forks source link

Incorrect code generated involving comments and ASI #36

Closed Conduitry closed 3 years ago

Conduitry commented 4 years ago
cr.print(cr.b`return (\n// comment\nfoo)`).code

evaluates to

'return // comment\nfoo;'

which is incorrect due to ASI. This seems to be handled correctly without the comment.

Conduitry commented 4 years ago

It looks like this is also present for /* comment */ as well.