From 8d8a55a390772046393b203cf4fdca8e38851ecf Mon Sep 17 00:00:00 2001 From: davidnolen Date: Wed, 23 Oct 2024 18:16:02 -0400 Subject: [PATCH] * rest of the bits from the ast-ref --- src/test/clojure/cljs/analyzer/specs.cljc | 99 +++++++++++++++++++++-- 1 file changed, 94 insertions(+), 5 deletions(-) diff --git a/src/test/clojure/cljs/analyzer/specs.cljc b/src/test/clojure/cljs/analyzer/specs.cljc index 65868c7ab..60d264b0f 100644 --- a/src/test/clojure/cljs/analyzer/specs.cljc +++ b/src/test/clojure/cljs/analyzer/specs.cljc @@ -84,6 +84,11 @@ (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 [_] @@ -91,11 +96,6 @@ (s/keys :req-un [::ns ::name]))) -(defmethod node :js-array [_] - (s/merge ::base - (s/keys - :req-un [::items]))) - (s/def ::var ::node) (s/def ::sym ::node) (s/def ::meta map?) @@ -200,6 +200,95 @@ (s/keys :req-un [::fn ::args]))) +(s/def ::bindings (s/* ::node)) + +(defmethod node :let [_] + (s/merge ::base + (s/keys + :req-un [::bindings ::body]))) + +(defmethod node :letfn [_] + (s/merge ::base + (s/keys + :req-un [::bindings ::body]))) + +(defmethod node :local [_] + (s/merge ::base + (s/keys + :req-un [:cljs.analyzer.specs.binding/local ::name]))) + +(defmethod node :loop [_] + (s/merge ::base + (s/keys + :req-un [::bindings ::body]))) + +(s/def ::class ::node) + +(defmethod node :new [_] + (s/merge ::base + (s/keys + :req-un [::class ::args]))) + +(defmethod node :no-op [_] + ::base) + +(defmethod node :no-op [_] + ::base) + +(defmethod node :no-op [_] + ::base) + +(s/def ::expr ::node) + +(defmethod node :quote [_] + (s/merge ::base + (s/keys + :req-un [::expr ::literal?]))) + +(s/def ::exprs (s/* ::nodes)) + +(defmethod node :recur [_] + (s/merge ::base + (s/keys + :req-un [::exprs]))) + +(defmethod node :set [_] + (s/merge ::base + (s/keys + :req-un [::items]))) + +(defmethod node :set! [_] + (s/merge ::base + (s/keys + :req-un [::target ::val]))) + +(s/def ::exception ::node) + +(defmethod node :throw [_] + (s/merge ::base + (s/keys + :req-un [::exception]))) + +(s/def ::catch ::node) +(s/def ::finally ::node) + +(defmethod node :try [_] + (s/merge ::base + (s/keys + :req-un [::body ::catch ::name ::finally]))) + +(defmethod node :var [_] + (s/merge ::base + (s/keys + :req-un [::ns ::name]))) + +(s/def ::meta ::node) + +(defmethod node :with-meta [_] + (s/merge ::base + (s/keys + :req-un [::meta ::expr]))) + (comment (s/valid? ::node 1)