js*
special form | since v0.0-927 | Edit |
(defmethod parse 'js*
[op env [_ jsform & args :as form] _ _]
(when-not (string? jsform)
(throw (error env "Invalid js* form")))
(if (some? args)
(analyze-js-star env jsform args form)
(let [code (apply str (js-star-interp env jsform))
tag (get-js-tag form)
form-meta (meta form)
js-op (:js-op form-meta)
numeric (:numeric form-meta)]
{:op :js
:env env
:form form
:code code
:tag tag
:js-op js-op
:numeric numeric})))
(defmethod emit* :js
[{:keys [op env code segs args]}]
(if (and code #?(:clj (.startsWith ^String (string/trim code) "/*")
:cljs (gstring/startsWith (string/trim code) "/*")))
(emits code)
(emit-wrap env
(if code
(emits code)
(emits (interleave (concat segs (repeat nil))
(concat args [nil])))))))