From 69c0f84bfa3acbc9c8dd1bb5d475876b2c6632c2 Mon Sep 17 00:00:00 2001 From: davidnolen Date: Fri, 15 Nov 2024 07:33:52 -0500 Subject: [PATCH] * alphabetize specs --- src/test/clojure/cljs/analyzer/specs.cljc | 144 +++++++++++----------- 1 file changed, 70 insertions(+), 74 deletions(-) diff --git a/src/test/clojure/cljs/analyzer/specs.cljc b/src/test/clojure/cljs/analyzer/specs.cljc index 2ef433cd0..e64c02521 100644 --- a/src/test/clojure/cljs/analyzer/specs.cljc +++ b/src/test/clojure/cljs/analyzer/specs.cljc @@ -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) @@ -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 @@ -196,6 +138,12 @@ (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 [_] @@ -203,6 +151,30 @@ (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 [_] @@ -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 @@ -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 [_] @@ -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 [_] @@ -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