File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
src/main/cljs/cljs/analyzer/passes Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ ; ; Copyright (c) Rich Hickey. All rights reserved.
2
+ ; ; The use and distribution terms for this software are covered by the
3
+ ; ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4
+ ; ; which can be found in the file epl-v10.html at the root of this distribution.
5
+ ; ; By using this software in any fashion, you are agreeing to be bound by
6
+ ; ; the terms of this license.
7
+ ; ; You must not remove this notice, or any other, from this software.
8
+
9
+ (ns cljs.analyzer.passes.lite )
10
+
11
+ (defn var? [ast]
12
+ (= :var (:op ast)))
13
+
14
+ (def replace
15
+ '{cljs.core/vector cljs.core/simple-vector
16
+ cljs.core/vec cljs.core/simple-vec})
17
+
18
+ (defn update-var [{:keys [name] :as ast}]
19
+ (update-in ast :name (get replace name)))
20
+
21
+ (defn replace-var? [ast]
22
+ (and (var? ast)
23
+ (contains? replace (:name ast))))
24
+
25
+ (defn use-lite-types
26
+ [env ast _]
27
+ (cond-> ast
28
+ (replace-var? ast) update-var))
You can’t perform that action at this time.
0 commit comments