[CLJS-813] Warn about reserved JS keyword usage in namespace names Created: 11/Jun/14 Updated: 14/Mar/15 Resolved: 14/Mar/15
|Reporter:||David Nolen||Assignee:||David Nolen|
If a namespace is identified as foo.long.core it will get munged into foo.long$.core. This is unexpected and a source of confusion when goog.require("foo.long.core") fails.
|Comment by Max Veytsman [ 15/Jul/14 4:50 PM ]|
I'm starting to take a look at this.
Would it be most appropriate to add this check into compiler.cljs where the munging actually happens, or into analyzer.cljs where most of the warnings of this type live?
|Comment by Mike Fikes [ 15/Jul/14 5:34 PM ]|
If a solution is identified that eliminates “overly aggressive” munging for certain cases, then
|Comment by Max Veytsman [ 16/Jul/14 2:44 PM ]|
Currently, when munging "foo.bar.baz", we map over ["foo", "bar", "baz"] and check if each is a reserved word (https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/compiler.clj#L94-L95)
For our purposes, it could be enough to check if the entire token and the first period-seperated element is reserved. I.e. long becomes long$, long.night.ahead becomes long$.night.ahead, but foo.long.core remains foo.long.core.
Mike, this unfortunately won't affect
Does that sound like a good approach?
|Comment by David Nolen [ 14/Mar/15 8:27 AM ]|