File tree Expand file tree Collapse file tree 3 files changed +26
-6
lines changed Expand file tree Collapse file tree 3 files changed +26
-6
lines changed Original file line number Diff line number Diff line change 2828 (let [child (get ast child-k)]
2929 (if (vector? child)
3030 (into [] (map #(walk % passes opts)) child)
31- (walk child passes)))))
31+ (walk child passes opts )))))
3232 (some-> ast (apply-passes passes opts)) (:children ast))))
Original file line number Diff line number Diff line change 22192219 :init fexpr
22202220 :variadic? (:variadic? fexpr)
22212221 :max-fixed-arity (:max-fixed-arity fexpr)
2222- :method-params (map :params (:methods fexpr)))]
2222+ :method-params (map :params (:methods fexpr))
2223+ :children [:init ])]
22232224 [(assoc-in env [:locals name] be')
22242225 (conj bes be')]))
22252226 [meth-env []] bes)
22962297 :env {:line line :column col}
22972298 :info {:name name
22982299 :shadow shadow}
2299- :binding-form? true }
2300+ :binding-form? true
2301+ :children [:init ]}
23002302 be (if (= :fn (:op init-expr))
23012303 ; ; TODO: can we simplify - David
23022304 (merge be
Original file line number Diff line number Diff line change 2424 (analyze expr-env))
2525 ast' (passes/walk ast [(fn [_ ast _] (dissoc ast :env ))])]
2626 (is (not (contains? ast' :env )))
27- (is (not (some #(contains? % :env ) (:args ast')))))))
27+ (is (not (some #(contains? % :env ) (:args ast')))))
28+ (let [expr-env (assoc (ana/empty-env ) :context :expr )
29+ ast (->> `(let [x# 1
30+ y# (fn [] x#)
31+ z# (fn [] y#)]
32+ 'x)
33+ (analyze expr-env))
34+ ast' (passes/walk ast [(fn [_ ast _] (dissoc ast :env ))])]
35+ (is (not (contains? ast' :env )))
36+ (is (= 3 (count (:bindings ast'))))
37+ (is (not (some #(contains? % :env ) (:bindings ast')))))))
2838
2939(deftest remove-local
3040 (testing " and/or remove local pass"
156166 (for [e s :when (and (sequential? e) (every? (fn [x] x) e))]
157167 e))
158168 [[]])]))))]
159- (is (empty? (re-seq #"and_" code))))))
169+ (is (empty? (re-seq #"and_" code))))
170+ (let [code (env/with-compiler-env (env/default-compiler-env )
171+ (comp/with-core-cljs {}
172+ (fn []
173+ (compile-form-seq
174+ '[(or false
175+ (boolean
176+ (for [s (range 1 )]
177+ (map (fn [x] x) s))))]))))]
178+ (is (empty? (re-seq #"or_" code))))))
160179
161180(comment
162181 (test/run-tests )
163182
164183 (require '[clojure.pprint :refer [pprint]])
165-
166184 )
You can’t perform that action at this time.
0 commit comments