File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed
Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -3393,7 +3393,7 @@ reduces them without incurring seq initialization"
33933393 nsc)))
33943394 :default (garray/defaultCompare (.-name a) (.-name b))))
33953395
3396- (deftype Keyword [ns name fqn ^:mutable _hash]
3396+ (deftype Keyword [ns name ^string fqn ^:mutable _hash]
33973397 Object
33983398 (toString [_] (str " :" fqn))
33993399 (equiv [this other]
Original file line number Diff line number Diff line change 936936 (core/list 'js* " debugger" )
937937 nil ))
938938
939+ (core/defmacro js-doc
940+ [comment]
941+ (core/let [[x & ys] (string/split comment #"\n " )]
942+ (core/list 'js*
943+ (core/str
944+ " /**\n "
945+ (core/str " * " x " \n " )
946+ (core/->> ys
947+ (map #(core/str " * " (string/replace % #"^ " " " ) " \n " ))
948+ (reduce core/str " " ))
949+ " */" ))))
950+
939951(core/defmacro js-comment
940952 " Emit a top-level JavaScript multi-line comment. New lines will create a
941953 new comment line. Comment block will be preceded and followed by a newline"
14851497 ~@body))))
14861498
14871499(core/defn- add-obj-methods [type type-sym sigs]
1488- (map (core/fn [[f & meths :as form]]
1489- (core/let [[f meths] (if (vector? (first meths))
1490- [f [(rest form)]]
1491- [f meths])]
1492- `(set! ~(extend-prefix type-sym f)
1493- ~(with-meta `(fn ~@(map #(adapt-obj-params type %) meths)) (meta form)))))
1500+ (mapcat
1501+ (core/fn [[f & meths :as form]]
1502+ (core/let [[f meths] (if (vector? (first meths))
1503+ [f [(rest form)]]
1504+ [f meths])
1505+ exp [`(set! ~(extend-prefix type-sym f)
1506+ ~(with-meta `(fn ~@(map #(adapt-obj-params type %) meths)) (meta form)))]]
1507+ (if (= f 'toString)
1508+ (into [`(js-doc " @return {string}\n @override" )] exp)
1509+ exp)))
14941510 sigs))
14951511
14961512(core/defn- ifn-invoke-methods [type type-sym [f & meths :as form]]
You can’t perform that action at this time.
0 commit comments