cincheo / jsweet

A Java to JavaScript transpiler.
http://www.jsweet.org
Other
1.46k stars 160 forks source link

variable name a keyword: with #466

Open schaumb opened 6 years ago

schaumb commented 6 years ago

int with = 0; is not compiling. In javascript "with" is a keyword, which is not accepted to be a variable name.

The other restricted keywords translated with prefix "__". This would also need it.

renaudpawlak commented 6 years ago

That's a straitghtforward change to be made. Just add the "with" keyword to the list at https://github.com/cincheo/jsweet/blob/master/transpiler/src/main/java/org/jsweet/JSweetConfig.java#L389 (or maybe https://github.com/cincheo/jsweet/blob/master/transpiler/src/main/java/org/jsweet/JSweetConfig.java#L405). It should then work out of the box. A corresponding test would be welcome :)