implements?
(implements? psym x)
Source docstring:
EXPERIMENTAL
(core/defmacro implements?
[psym x]
(core/let [p (:name
(cljs.analyzer/resolve-var
(dissoc &env :locals) psym))
prefix (protocol-prefix p)
xsym (bool-expr (gensym))
[part bit] (fast-path-protocols p)
msym (symbol
(core/str "-cljs$lang$protocol_mask$partition" part "$"))]
(core/if-not (core/symbol? x)
`(let [~xsym ~x]
(if ~xsym
(if (or ~(if bit `(unsafe-bit-and (. ~xsym ~msym) ~bit) false)
(identical? cljs.core/PROTOCOL_SENTINEL (. ~xsym ~(symbol (core/str "-" prefix)))))
true
false)
false))
`(if-not (nil? ~x)
(if (or ~(if bit `(unsafe-bit-and (. ~x ~msym) ~bit) false)
(identical? cljs.core/PROTOCOL_SENTINEL (. ~x ~(symbol (core/str "-" prefix)))))
true
false)
false))))