diff --git a/src/dev/onionpancakes/chassis/compiler.clj b/src/dev/onionpancakes/chassis/compiler.clj index 67efb23..68c0a3a 100644 --- a/src/dev/onionpancakes/chassis/compiler.clj +++ b/src/dev/onionpancakes/chassis/compiler.clj @@ -486,19 +486,26 @@ (send-warn-on-ambig-attrs! *form* elem)) (compilable-element-children-attrs-ambig elem))))) +(defn compilable-vector-children + [this] + (if (c/element-vector? this) + (if (c/alias-element? this) + (compilable-alias-element-children this) + (compilable-element-children this)) + this)) + +(defn vector-children + [this] + (if *evaluated* + (c/vector-children this) + (compilable-vector-children this))) + +(extend clojure.lang.IPersistentVector + CompilableNode + {:branch? (fn [_] true) + :children vector-children}) + (extend-protocol CompilableNode - clojure.lang.IPersistentVector - (branch? [_] true) - (children [this] - (if (c/element-vector? this) - (if (c/alias-element? this) - (if *evaluated* - (c/alias-element-children this) - (compilable-alias-element-children this)) - (if *evaluated* - (c/element-children this) - (compilable-element-children this))) - this)) clojure.lang.ISeq (branch? [_] (boolean *evaluated*)) diff --git a/src/dev/onionpancakes/chassis/core.clj b/src/dev/onionpancakes/chassis/core.clj index c9a0456..6d178bb 100644 --- a/src/dev/onionpancakes/chassis/core.clj +++ b/src/dev/onionpancakes/chassis/core.clj @@ -1346,15 +1346,20 @@ (let [head (.nth elem 0 nil)] (some? (namespace head)))) +(defn vector-children + [this] + (if (element-vector? this) + (if (alias-element? this) + (alias-element-children this) + (element-children this)) + this)) + +(extend clojure.lang.IPersistentVector + Node + {:branch? (fn [_] true) + :children vector-children}) + (extend-protocol Node - clojure.lang.IPersistentVector - (branch? [this] true) - (children [this] - (if (element-vector? this) - (if (alias-element? this) - (alias-element-children this) - (element-children this)) - this)) clojure.lang.ISeq (branch? [this] true) (children [this] this)