From c502b85fe7c6fc50a2bb37e85070a056dbfdc95d Mon Sep 17 00:00:00 2001 From: Julien Eluard Date: Sun, 14 Oct 2018 15:45:39 +0200 Subject: [PATCH] Replace unknown symbols with nil --- examples/src/pluto/examples.cljs | 3 ++- src/pluto/reader/blocks.cljc | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/examples/src/pluto/examples.cljs b/examples/src/pluto/examples.cljs index 006edab..e12a678 100644 --- a/examples/src/pluto/examples.cljs +++ b/examples/src/pluto/examples.cljs @@ -63,7 +63,8 @@ :properties {:view :view}}} :events {'alert {:permissions [:read] - :value :alert}}}} + :value :alert + :arguments {:value :string}}}}} m)) (defn render-extension [m el el-errors] diff --git a/src/pluto/reader/blocks.cljc b/src/pluto/reader/blocks.cljc index 49b3489..adcb716 100644 --- a/src/pluto/reader/blocks.cljc +++ b/src/pluto/reader/blocks.cljc @@ -30,8 +30,14 @@ (assoc m o resolved-value) (merge m o)))) -(defn let-block [{:keys [env ctx ext]} children] - (walk/prewalk-replace (reduce-kv assoc-binding {} env) children)) +(defn replace-atom [values o] + (cond (contains? values o) (get values o) + (symbol? o) nil + :else o)) + +(defn let-block [{:keys [env]} children] + (let [values (reduce-kv assoc-binding {} env)] ; + (walk/prewalk #(replace-atom values %) children))) (defn properties? [o] (= 'properties o))