Skip to content

Commit 627f7fd

Browse files
mfikesdnolen
authored andcommitted
CLJS-1636: Mark some symbols in core macros ns as private
1 parent 90fc275 commit 627f7fd

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

src/main/clojure/cljs/core.cljc

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@
610610
`(when-not (exists? ~x)
611611
(def ~x ~init)))
612612

613-
(core/defn destructure [bindings]
613+
(core/defn- destructure [bindings]
614614
(core/let [bents (partition 2 bindings)
615615
pb (core/fn pb [bvec b v]
616616
(core/let [pvec
@@ -779,7 +779,7 @@
779779
(let ~(vec (interleave bs gs))
780780
~@body)))))))
781781

782-
(def fast-path-protocols
782+
(def #^:private fast-path-protocols
783783
"protocol fqn -> [partition number, bit]"
784784
(zipmap (map #(symbol "cljs.core" (core/str %))
785785
'[IFn ICounted IEmptyableCollection ICollection IIndexed ASeq ISeq INext
@@ -797,7 +797,7 @@
797797
:cljs (core/* 2 b))]))
798798
[0 1])))
799799

800-
(def fast-path-protocol-partitions-count
800+
(def #^:private fast-path-protocol-partitions-count
801801
"total number of partitions"
802802
(core/let [c (count fast-path-protocols)
803803
m (core/mod c 32)]
@@ -862,45 +862,45 @@
862862
`(not (nil? ~x)))
863863

864864
;; internal - do not use.
865-
(core/defmacro coercive-not [x]
865+
(core/defmacro ^:private coercive-not [x]
866866
(bool-expr (core/list 'js* "(!~{})" x)))
867867

868868
;; internal - do not use.
869-
(core/defmacro coercive-not= [x y]
869+
(core/defmacro ^:private coercive-not= [x y]
870870
(bool-expr (core/list 'js* "(~{} != ~{})" x y)))
871871

872872
;; internal - do not use.
873-
(core/defmacro coercive-= [x y]
873+
(core/defmacro ^:private coercive-= [x y]
874874
(bool-expr (core/list 'js* "(~{} == ~{})" x y)))
875875

876876
;; internal - do not use.
877-
(core/defmacro coercive-boolean [x]
877+
(core/defmacro ^:private coercive-boolean [x]
878878
(with-meta (core/list 'js* "~{}" x)
879879
{:tag 'boolean}))
880880

881881
;; internal - do not use.
882-
(core/defmacro truth_ [x]
882+
(core/defmacro ^:private truth_ [x]
883883
(core/assert (core/symbol? x) "x is substituted twice")
884884
(core/list 'js* "(~{} != null && ~{} !== false)" x x))
885885

886886
;; internal - do not use
887-
(core/defmacro js-arguments []
887+
(core/defmacro ^:private js-arguments []
888888
(core/list 'js* "arguments"))
889889

890-
(core/defmacro js-delete [obj key]
890+
(core/defmacro ^:private js-delete [obj key]
891891
(core/list 'js* "delete ~{}[~{}]" obj key))
892892

893-
(core/defmacro js-in [key obj]
893+
(core/defmacro ^:private js-in [key obj]
894894
(core/list 'js* "~{} in ~{}" key obj))
895895

896-
(core/defmacro js-debugger
896+
(core/defmacro ^:private js-debugger
897897
"Emit JavaScript \"debugger;\" statement"
898898
[]
899899
(core/list 'do
900900
(core/list 'js* "debugger")
901901
nil))
902902

903-
(core/defmacro js-comment
903+
(core/defmacro ^:private js-comment
904904
"Emit a top-level JavaScript multi-line comment. New lines will create a
905905
new comment line. Comment block will be preceded and followed by a newline"
906906
[comment]
@@ -914,13 +914,13 @@
914914
(reduce core/str ""))
915915
" */\n"))))
916916

917-
(core/defmacro unsafe-cast
917+
(core/defmacro ^:private unsafe-cast
918918
"EXPERIMENTAL: Subject to change. Unsafely cast a value to a different type."
919919
[t x]
920920
(core/let [cast-expr (core/str "~{} = /** @type {" t "} */ (~{})")]
921921
(core/list 'js* cast-expr x x)))
922922

923-
(core/defmacro js-inline-comment
923+
(core/defmacro ^:private js-inline-comment
924924
"Emit an inline JavaScript comment."
925925
[comment]
926926
(core/list 'js* (core/str "/**" comment "*/")))
@@ -1127,7 +1127,7 @@
11271127
([x y & more] `(bit-and (bit-and ~x ~y) ~@more)))
11281128

11291129
;; internal do not use
1130-
(core/defmacro ^::ana/numeric unsafe-bit-and
1130+
(core/defmacro ^:private ^::ana/numeric unsafe-bit-and
11311131
([x y] (bool-expr (core/list 'js* "(~{} & ~{})" x y)))
11321132
([x y & more] `(unsafe-bit-and (unsafe-bit-and ~x ~y) ~@more)))
11331133

@@ -1171,15 +1171,15 @@
11711171
(core/list 'js* "(~{} | (1 << ~{}))" x n))
11721172

11731173
;; internal
1174-
(core/defmacro mask [hash shift]
1174+
(core/defmacro ^:private mask [hash shift]
11751175
(core/list 'js* "((~{} >>> ~{}) & 0x01f)" hash shift))
11761176

11771177
;; internal
1178-
(core/defmacro bitpos [hash shift]
1178+
(core/defmacro ^:private bitpos [hash shift]
11791179
(core/list 'js* "(1 << ~{})" `(mask ~hash ~shift)))
11801180

11811181
;; internal
1182-
(core/defmacro caching-hash [coll hash-fn hash-key]
1182+
(core/defmacro ^:private caching-hash [coll hash-fn hash-key]
11831183
(core/assert (clojure.core/symbol? hash-key) "hash-key is substituted twice")
11841184
`(let [h# ~hash-key]
11851185
(if-not (nil? h#)
@@ -1373,7 +1373,7 @@
13731373
~type ~(with-meta `(fn ~@meths) (meta form))))
13741374
sigs))))
13751375

1376-
(core/defmulti extend-prefix (core/fn [tsym sym] (core/-> tsym meta :extend)))
1376+
(core/defmulti ^:private extend-prefix (core/fn [tsym sym] (core/-> tsym meta :extend)))
13771377

13781378
(core/defmethod extend-prefix :instance
13791379
[tsym sym] `(.. ~tsym ~(to-property sym)))
@@ -1608,7 +1608,7 @@
16081608
(vary-meta (cons f (map #(cons (second %) (nnext %)) sigs))
16091609
merge annots)))
16101610

1611-
(core/defn dt->et
1611+
(core/defn- dt->et
16121612
([type specs fields]
16131613
(dt->et type specs fields false))
16141614
([type specs fields inline]
@@ -2644,7 +2644,7 @@
26442644
(~print-fn (str ~bs-str ", " ~expr-str ", "
26452645
~iterations " runs, " elapsed# " msecs"))))))
26462646

2647-
(def cs (into [] (map (comp gensym core/str core/char) (range 97 118))))
2647+
(def #^:private cs (into [] (map (comp gensym core/str core/char) (range 97 118))))
26482648

26492649
(core/defn- gen-apply-to-helper
26502650
([] (gen-apply-to-helper 1))
@@ -2661,7 +2661,7 @@
26612661
~(gen-apply-to-helper (core/inc n))))
26622662
`(throw (js/Error. "Only up to 20 arguments supported on functions"))))))
26632663

2664-
(core/defmacro gen-apply-to []
2664+
(core/defmacro ^:private gen-apply-to []
26652665
`(do
26662666
(set! ~'*unchecked-if* true)
26672667
(defn ~'apply-to [~'f ~'argc ~'args]
@@ -2691,10 +2691,10 @@
26912691
[& colls]
26922692
`(concat ~@(map #(core/list `lazy-seq %) colls)))
26932693

2694-
(core/defmacro js-str [s]
2694+
(core/defmacro ^:private js-str [s]
26952695
(core/list 'js* "''+~{}" s))
26962696

2697-
(core/defmacro es6-iterable [ty]
2697+
(core/defmacro ^:private es6-iterable [ty]
26982698
`(aset (.-prototype ~ty) cljs.core/ITER_SYMBOL
26992699
(fn []
27002700
(this-as this#
@@ -2832,7 +2832,7 @@
28322832
`(~'ns* ~(cons :refer-clojure args)))
28332833

28342834
;; INTERNAL - do not use, only for Node.js
2835-
(core/defmacro load-file* [f]
2835+
(core/defmacro ^:private load-file* [f]
28362836
`(. js/goog (~'nodeGlobalRequire ~f)))
28372837

28382838
(core/defmacro macroexpand-1
@@ -2901,7 +2901,7 @@
29012901
(set! (. ~sym ~'-cljs$lang$applyTo)
29022902
~(apply-to)))))))
29032903

2904-
(core/defmacro copy-arguments [dest]
2904+
(core/defmacro ^:private copy-arguments [dest]
29052905
`(let [len# (alength (js-arguments))]
29062906
(loop [i# 0]
29072907
(when (< i# len#)

0 commit comments

Comments
 (0)