Skip to content

Commit

Permalink
CLJS-303: fix case so it only evaluates its first argument once
Browse files Browse the repository at this point in the history
  • Loading branch information
michalmarczyk authored and David Nolen committed Jun 6, 2012
1 parent ef25b60 commit 77d2946
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/clj/cljs/core.clj
Expand Up @@ -713,10 +713,12 @@
(if (seq? test)
(reduce #(assoc-test %1 %2 expr) m test)
(assoc-test m test expr)))
{} (partition 2 clauses))]
`(cond
~@(mapcat (fn [[m c]] `((cljs.core/= ~m ~e) ~c)) pairs)
:else ~default)))
{} (partition 2 clauses))
esym (gensym)]
`(let [~esym ~e]
(cond
~@(mapcat (fn [[m c]] `((cljs.core/= ~m ~esym) ~c)) pairs)
:else ~default))))

(defmacro try
"(try expr* catch-clause* finally-clause?)
Expand Down

0 comments on commit 77d2946

Please sign in to comment.