File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 34
34
35
35
cond-> cond->> as-> some-> some->>
36
36
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])
38
38
(:require clojure.walk
39
39
clojure.set
40
40
cljs.compiler
1855
1855
(let [options (apply core/hash-map options)
1856
1856
default (core/get options :default :default )]
1857
1857
(check-valid-options options :default :hierarchy )
1858
- `(def ~(with-meta mm-name m)
1858
+ `(defonce ~(with-meta mm-name m)
1859
1859
(let [method-table# (atom {})
1860
1860
prefer-table# (atom {})
1861
1861
method-cache# (atom {})
1962
1962
`[(symbol ~(name sym)) (var ~(symbol (name ns ) (name sym)))])
1963
1963
(get-in @env/*compiler* [:cljs.analyzer/namespaces ns :defs ]))]))
1964
1964
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
+
1965
1974
(defmacro vswap!
1966
1975
" Non-atomically swaps the value of the volatile as if:
1967
1976
(apply f current-value-of-vol args). Returns the value that
You can’t perform that action at this time.
0 commit comments