jashkenas/coffee-script — Issue #2046: usage of `static` keyword in cs compiler breaks js compilers that honor it
Author: softprops
Created: 2012-01-16 21:19:43+00:00
State: open

I use coffeescript's compiler though mozilla's rhino project.

I just switched coffeescript compiler versions from 1.1.1 to 1.2.0 and noticed an odd error of `org.mozilla.javascript.EvaluatorException: missing name after . operator` when evaluating coffeescript's compiler source. Not very helpful for 165K of minified javascript :).

I spent this afternoon trying to track down the issue and eventually narrowed it down after running the minified compiler through jsbeautifier to get actual line numbers. It looks like it was the usage of the `static` property on objects, used 3 times I think. I verified that the `static` was not used in the source of cs's 1.1.1 compiler. My quick fix locally was to just do a string replace of `static` to `_static` but that will only hold me over for this compiler version. I'll have to do it in all future cs releases that use the static keyword as an object's property name.

According to [this][this], `static` is a "future" reserved word in ecmascript which means that this will only be an issue for js compilers that interpret it as such.

[this]: https://developer.mozilla.org/en/JavaScript/Reference/Reserved_Words