Skip to content

Commit

Permalink
* alphabetize specs
Browse files Browse the repository at this point in the history
  • Loading branch information
swannodette committed Nov 15, 2024
1 parent 6a353c3 commit 69c0f84
Showing 1 changed file with 70 additions and 74 deletions.
144 changes: 70 additions & 74 deletions src/test/clojure/cljs/analyzer/specs.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -42,73 +42,6 @@
:req-un [::name :cljs.analyzer.specs.binding/local]
:opt-un [::variadic? ::init ::shadow])))

(defmethod node :if [_]
(s/merge ::base
(s/keys
:req-un [::test ::then]
:opt-un [::else])))

(s/def ::literal? boolean?)
(s/def ::val any?)

(defmethod node :const [_]
(s/merge ::base
(s/keys
:req-un [::val]
;; ::literal? is required in the AST REF, but we don't actually use it
;; should check tools.analyzer
:opt-un [::literal?])))

(s/def ::keys (s/* ::node))
(s/def ::vals (s/* ::node))

(defmethod node :map [_]
(s/merge ::base
(s/keys :req-un [::keys ::vals])))

(s/def ::items (s/* ::node))

(defmethod node :list [_]
(s/merge ::base
(s/keys
:req-un [::items])))

(defmethod node :vector [_]
(s/merge ::base
(s/keys
:req-un [::items])))

(defmethod node :set [_]
(s/merge ::base
(s/keys
:req-un [::items])))

(defmethod node :js-object [_]
(s/merge ::base
(s/keys
:req-un [::keys ::vals])))

(defmethod node :js-array [_]
(s/merge ::base
(s/keys
:req-un [::items])))

(s/def ::ns symbol?)

(defmethod node :js-var [_]
(s/merge ::base
(s/keys
:req-un [::ns ::name])))

(s/def ::var ::node)
(s/def ::sym ::node)
(s/def ::meta map?)

(defmethod node :the-var [_]
(s/merge ::base
(s/keys
:opt-un [::var ::sym ::meta])))

(s/def ::nodes (s/* ::node))
(s/def ::default ::node)

Expand All @@ -131,7 +64,16 @@
(s/keys
:req-un [::then])))

(s/def ::the-var ::node)
(s/def ::literal? boolean?)
(s/def ::val any?)

(defmethod node :const [_]
(s/merge ::base
(s/keys
:req-un [::val]
;; ::literal? is required in the AST REF, but we don't actually use it
;; should check tools.analyzer
:opt-un [::literal?])))

(defmethod node :def [_]
(s/merge ::base
Expand Down Expand Up @@ -196,13 +138,43 @@
(s/keys
:req-un [::field ::target])))

(defmethod node :if [_]
(s/merge ::base
(s/keys
:req-un [::test ::then]
:opt-un [::else])))

(s/def ::fn ::node)

(defmethod node :invoke [_]
(s/merge ::base
(s/keys
:req-un [::fn ::args])))

(s/def ::code string?)

(defmethod node :js [_]
(s/merge ::base
(s/keys
:opt-un [::code])))

(defmethod node :js-array [_]
(s/merge ::base
(s/keys
:req-un [::items])))

(defmethod node :js-object [_]
(s/merge ::base
(s/keys
:req-un [::keys ::vals])))

(s/def ::ns symbol?)

(defmethod node :js-var [_]
(s/merge ::base
(s/keys
:req-un [::ns ::name])))

(s/def ::bindings (s/* ::node))

(defmethod node :let [_]
Expand All @@ -215,6 +187,14 @@
(s/keys
:req-un [::bindings ::body])))

(s/def ::items (s/* ::node))

;; TODO: not in ast-ref
(defmethod node :list [_]
(s/merge ::base
(s/keys
:req-un [::items])))

(defmethod node :local [_]
(s/merge ::base
(s/keys
Expand All @@ -225,6 +205,13 @@
(s/keys
:req-un [::bindings ::body])))

(s/def ::keys (s/* ::node))
(s/def ::vals (s/* ::node))

(defmethod node :map [_]
(s/merge ::base
(s/keys :req-un [::keys ::vals])))

(s/def ::class ::node)

(defmethod node :new [_]
Expand Down Expand Up @@ -259,6 +246,17 @@
(s/keys
:req-un [::target ::val])))

(s/def ::var ::node)
(s/def ::sym ::node)
(s/def ::meta map?)

(defmethod node :the-var [_]
(s/merge ::base
(s/keys
:opt-un [::var ::sym ::meta])))

(s/def ::the-var ::node)

(s/def ::exception ::node)

(defmethod node :throw [_]
Expand All @@ -281,17 +279,15 @@

(s/def ::meta ::node)

(defmethod node :with-meta [_]
(defmethod node :vector [_]
(s/merge ::base
(s/keys
:req-un [::meta ::expr])))

(s/def ::code string?)
:req-un [::items])))

(defmethod node :js [_]
(defmethod node :with-meta [_]
(s/merge ::base
(s/keys
:opt-un [::code])))
:req-un [::meta ::expr])))

(comment

Expand Down

0 comments on commit 69c0f84

Please sign in to comment.