Skip to content

Commit

Permalink
CLJS-405: fix reify regression caused by CLJS-369 and add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Nolen authored and David Nolen committed Oct 23, 2012
1 parent a7715c6 commit a6fa901
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/clj/cljs/compiler.clj
Expand Up @@ -49,12 +49,10 @@
shadow (recur (inc d) shadow)
(@ns-first-segments (str name)) (inc d)
:else d))
name (if field
(str "self__." name)
name)]
(if (zero? depth)
(munge name reserved)
(symbol (str (munge name reserved) "__$" depth))))
munged-name (munge (if field (str "self__." name) name) reserved)]
(if (or field (zero? depth))
munged-name
(symbol (str munged-name "__$" depth))))
; String munging
(let [ss (string/replace (str s) #"\/(.)" ".$1") ; Division is special
ss (apply str (map #(if (reserved %) (str % "$") %)
Expand Down
12 changes: 12 additions & 0 deletions test/cljs/cljs/core_test.cljs
Expand Up @@ -1687,5 +1687,17 @@
uuid (UUID. uuid-str)]
(assert (= (pr-str uuid) (str "#uuid \"" uuid-str "\""))))

;; CLJS-405

(defprotocol IBar (-bar [this x]))

(defn baz [f]
(reify
IBar
(-bar [_ x]
(f x))))

(assert (= 2 (-bar (baz inc) 1)))

:ok
)

0 comments on commit a6fa901

Please sign in to comment.