8000 * src/clj/cljs/core.clj: use Michal Marczyk's this patch for IFn · clojure/clojurescript@7cee8ab · GitHub
[go: up one dir, main page]

Skip to content

Commit 7cee8ab

Browse files
committed
* src/clj/cljs/core.clj: use Michal Marczyk's this patch for IFn
1 parent e8c55da commit 7cee8ab

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/clj/cljs/core.clj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,12 @@
246246
pf (if ifn?
247247
(str prototype-prefix 'call)
248248
(str prototype-prefix pprefix f))
249-
adapt-params (fn [[[tname :as args] & body]]
250-
`(~args
251-
(let [~tname (~'js* "this")]
252-
~@body)))
249+
adapt-params (fn [[[targ & args :as sig] & body]]
250+
(let [tsym (gensym "tsym")]
251+
`(~(with-meta (vec (cons tsym args)) (meta sig))
252+
(this-as ~tsym
253+
(let [~targ ~tsym]
254+
~@body)))))
253255
meths (if ifn?
254256
(map adapt-params meths)
255257
meths)]

0 commit comments

Comments
 (0)
0