Skip to content

Commit

Permalink
* src/clj/cljs/core.clj: switch to mapcat
Browse files Browse the repository at this point in the history
  • Loading branch information
David Nolen authored and David Nolen committed Apr 8, 2012
1 parent 3173f1a commit f02478a
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/clj/cljs/core.clj
Expand Up @@ -241,22 +241,22 @@
`(set! ~(symbol (str prototype-prefix f)) (fn ~@(map adapt-params meths)))) `(set! ~(symbol (str prototype-prefix f)) (fn ~@(map adapt-params meths))))
sigs)) sigs))
(cons `(set! ~(symbol (str prototype-prefix pprefix)) true) (cons `(set! ~(symbol (str prototype-prefix pprefix)) true)
(map (fn [[f & meths]] (mapcat (fn [[f & meths]]
(let [ifn? (= psym 'cljs.core.IFn) (let [ifn? (= psym 'cljs.core.IFn)
pf (if ifn? pf (if ifn?
(str prototype-prefix 'call) (str prototype-prefix 'call)
(str prototype-prefix pprefix f)) (str prototype-prefix pprefix f))
adapt-params (fn [[[targ & args :as sig] & body]] adapt-params (fn [[[targ & args :as sig] & body]]
(let [tsym (gensym "tsym")] (let [tsym (gensym "tsym")]
`(~(with-meta (vec (cons tsym args)) (meta sig)) `(~(with-meta (vec (cons tsym args)) (meta sig))
(this-as ~tsym (this-as ~tsym
(let [~targ ~tsym] (let [~targ ~tsym]
~@body))))) ~@body)))))
meths (if ifn? meths (if ifn?
(map adapt-params meths) (map adapt-params meths)
meths)] meths)]
`(set! ~(symbol pf) (fn ~@meths)))) [`(set! ~(symbol pf) (fn ~@meths))]))
sigs)))))] sigs)))))]
`(do ~@(mapcat assign-impls impl-map)))))) `(do ~@(mapcat assign-impls impl-map))))))


(defmacro deftype [t fields & impls] (defmacro deftype [t fields & impls]
Expand Down

0 comments on commit f02478a

Please sign in to comment.