Skip to content

Commit 2c7e2b0

Browse files
committed
Treat js namespace specially.
1 parent c033f84 commit 2c7e2b0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/backend/escodegen/writer.wisp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,11 @@
9797

9898
(defn translate-identifier
9999
[form]
100-
(str (if (namespace form)
101-
(str (translate-identifier-word (namespace form)) ".")
102-
"")
103-
(join \. (map translate-identifier-word (split (name form) \.)))))
100+
(let [ns (namespace form)]
101+
(str (if (and ns (not (= ns "js")))
102+
(str (translate-identifier-word (namespace form)) ".")
103+
"")
104+
(join \. (map translate-identifier-word (split (name form) \.))))))
104105

105106
(defn error-arg-count
106107
[callee n]

test/escodegen.wisp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
(is (= (transpile "what.man?.->you.**.=") "what.isMan.toYou.__.isEqual;"))
5555
(is (= (transpile "foo/bar") "foo.bar;"))
5656
(is (= (transpile "foo.bar/baz") "foo_bar.baz;"))
57+
(is (= (transpile "js/window") "window;"))
5758

5859
;; =>
5960
;; keywords

0 commit comments

Comments
 (0)