File tree
Expand file treeCollapse file tree3 files changed
+26
-6
lines changed Expand file treeCollapse file tree3 files changed
+26
-6
lines changed Original file line number | Diff line number | Diff line change |
---|
|
28 | 28 | (let [child (get ast child-k)]
|
29 | 29 | (if (vector? child)
|
30 | 30 | (into [] (map #(walk % passes opts)) child)
|
31 |
| -(walk child passes))))) |
| 31 | +(walk child passes opts))))) |
32 | 32 | (some-> ast (apply-passes passes opts)) (:children ast))))
|
Original file line number | Diff line number | Diff line change |
---|
|
2219 | 2219 | :init fexpr
|
2220 | 2220 | :variadic? (:variadic? fexpr)
|
2221 | 2221 | :max-fixed-arity (:max-fixed-arity fexpr)
|
2222 |
| -:method-params (map :params (:methods fexpr)))] |
| 2222 | +:method-params (map :params (:methods fexpr)) |
| 2223 | +:children [:init])] |
2223 | 2224 | [(assoc-in env [:locals name] be')
|
2224 | 2225 | (conj bes be')]))
|
2225 | 2226 | [meth-env []] bes)
|
|
2296 | 2297 | :env {:line line :column col}
|
2297 | 2298 | :info {:name name
|
2298 | 2299 | :shadow shadow}
|
2299 |
| -:binding-form? true} |
| 2300 | +:binding-form? true |
| 2301 | +:children [:init]} |
2300 | 2302 | be (if (= :fn (:op init-expr))
|
2301 | 2303 | ;; TODO: can we simplify - David
|
2302 | 2304 | (merge be
|
|
Original file line number | Diff line number | Diff line change |
---|
|
24 | 24 | (analyze expr-env))
|
25 | 25 | ast' (passes/walk ast [(fn [_ ast _] (dissoc ast :env))])]
|
26 | 26 | (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'))))))) |
28 | 38 |
|
29 | 39 | (deftest remove-local
|
30 | 40 | (testing "and/or remove local pass"
|
|
156 | 166 | (for [e s :when (and (sequential? e) (every? (fn [x] x) e))]
|
157 | 167 | e))
|
158 | 168 | [[]])]))))]
|
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)))))) |
160 | 179 |
|
161 | 180 | (comment
|
162 | 181 | (test/run-tests)
|
163 | 182 |
|
164 | 183 | (require '[clojure.pprint :refer [pprint]])
|
165 |
| - |
166 | 184 | )
|
You can’t perform that action at this time.
0 commit comments