File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 3434
3535 cond-> cond->> as-> some-> some->>
3636
37- if-some when-some test ns-interns var vswap! macroexpand-1 macroexpand])
37+ if-some when-some test ns-interns ns-unmap var vswap! macroexpand-1 macroexpand])
3838 (:require clojure.walk
3939 clojure.set
4040 cljs.compiler
18551855 (let [options (apply core/hash-map options)
18561856 default (core/get options :default :default )]
18571857 (check-valid-options options :default :hierarchy )
1858- `(def ~(with-meta mm-name m)
1858+ `(defonce ~(with-meta mm-name m)
18591859 (let [method-table# (atom {})
18601860 prefer-table# (atom {})
18611861 method-cache# (atom {})
19621962 `[(symbol ~(name sym)) (var ~(symbol (name ns ) (name sym)))])
19631963 (get-in @env/*compiler* [:cljs.analyzer/namespaces ns :defs ]))]))
19641964
1965+ (defmacro ns-unmap
1966+ " Removes the mappings for the symbol from the namespace."
1967+ [[quote0 ns ] [quote1 sym]]
1968+ (core/assert (core/and (= quote0 'quote) (core/symbol? ns )
1969+ (= quote1 'quote) (core/symbol? sym))
1970+ " Arguments to ns-unmap must be quoted symbols" )
1971+ (swap! env/*compiler* update-in [::ana/namespaces ns :defs ] dissoc sym)
1972+ `(js-delete ~(cljs.compiler/munge ns ) ~(cljs.compiler/munge (core/str sym))))
1973+
19651974(defmacro vswap!
19661975 " Non-atomically swaps the value of the volatile as if:
19671976 (apply f current-value-of-vol args). Returns the value that
You can’t perform that action at this time.
0 commit comments