Skip to content
This repository
Browse code

Redesigned the emitter

The emitter should now be easier to comprehend. The trick is that parent
expressions adds a :db/id key to it's child expressions. As before, the
emitter returns transaction data, but now in the form of maps.

Another substantial change is that I now derive 'child' (again) instead
of explicitly recording it in the database as :ast/child
  • Loading branch information...
commit c6dc541cbee8c00218798d98c1a873113c2bce12 1 parent 1be7108
Jonas Enlund authored August 08, 2012
2  project.clj
@@ -7,4 +7,4 @@
7 7
   :dependencies [[org.clojure/clojure "1.4.0"]
8 8
                  [org.clojure/clojurescript "0.0-1443"]
9 9
                  [domina "1.0.0-SNAPSHOT"]
10  
-                 [com.datomic/datomic-free "0.8.3372"]])
  10
+                 [com.datomic/datomic-free "0.8.3397"]])
232  src/scape/core.clj
@@ -40,65 +40,46 @@
40 40
         (println "AST transaction complete.")
41 41
         (db conn)))))
42 42
 
43  
-  (def child-rule
44  
-    '[
45  
-      #_[[child ?parent ?child]
46  
-         [?parent :ast.if/test ?child]]
47  
-      #_[[child ?parent ?child]
48  
-         [?parent :ast.if/then ?child]]
49  
-      #_[[child ?parent ?child]
50  
-         [?parent :ast.if/else ?child]]
51  
-      
52  
-      #_[[child ?parent ?child]
53  
-         [?parent :ast.def/init ?child]]
54  
-
55  
-      #_[[child ?parent ?child]
56  
-         [?parent :ast.fn/method ?method]
57  
-         [?method :ast.fn.method/statement ?child]]
58  
-      #_[[child ?parent ?child]
59  
-         [?parent :ast.fn/method ?method]
60  
-         [?method :ast.fn.method/return ?child]]
61  
-      
62  
-      #_[[child ?parent ?child]
63  
-         [?parent :ast.do/statement ?child]]
64  
-      #_[[child ?parent ?child]
65  
-         [?parent :ast.do/return ?child]]
66  
-      
67  
-      #_[[child ?parent ?child]
68  
-         [?parent :ast.let/binding ?binding]
69  
-         [?binding :ast.let.binding/init ?child]]
70  
-      #_[[child ?parent ?child]
71  
-         [?parent :ast.let/statement ?child]]
72  
-      #_[[child ?parent ?child]
73  
-         [?parent :ast.let/return ?child]]
74  
-      
75  
-      #_[[child ?parent ?child]
76  
-         [?parent :ast.invoke/f ?child]
77  
-         [?parent :ast.invoke/arg ?child]]
78  
-      
79  
-      #_[[child ?parent ?child]
80  
-         [?parent :ast.recur/arg ?child]]
81  
-      
82  
-      [[child ?a ?d]
83  
-       [?a :ast.default/child ?d]]])
  43
+  ;; How many top-level forms?
  44
+  (count (q '[:find ?e
  45
+              :where
  46
+              [?e :ast/top-level true]]
  47
+            ast-db))
84 48
   
85  
-  (def ancestor
86  
-    '[[[ancestor ?ancestor ?descendant]
87  
-       [child ?ancestor ?descendant]]
88  
-      [[ancestor ?ancestor ?descendant]
89  
-       [?ancestor :ast.default/child ?middle-man]
90  
-       ;[child ?ancestor ?middle-man]
91  
-       [ancestor ?middle-man ?descendant]]])
  49
+  ;; How many ast nodes are there in core.cljs?
  50
+  (count (q '[:find ?e
  51
+              :where
  52
+              [?e :ast/ns :cljs.core]
  53
+              [?e :ast/op]]
  54
+            ast-db))
92 55
 
93  
-  (q '[:find ?descendant
94  
-       :in $ %
  56
+  ;; What namespaces have been analyzed?
  57
+  (q '[:find ?ns
95 58
        :where
96  
-       [?map :ast.def/name :cljs.core/map]
97  
-       [?map :ast.def/init ?init]
98  
-       [ancestor ?init ?descendant]]
99  
-     ast-db
100  
-     (concat ancestor child-rule))
  59
+       [_ :ast/ns ?ns]]
  60
+     ast-db)
  61
+
  62
+  ;; What ops are in use?
  63
+  (q '[:find ?op
  64
+       :where [_ :ast/op ?op]]
  65
+     ast-db)
  66
+
  67
+  ;; Where are no-ops?
  68
+  (q '[:find ?line
  69
+       :where
  70
+       [?e :ast/op :no-op]
  71
+       [?e :ast/line ?line]]
  72
+     ast-db)
101 73
   
  74
+  ;; What forms are on line 288?
  75
+  (q '[:find ?form
  76
+       :where
  77
+       [?op :ast/op]
  78
+       [?op :ast/line 288]
  79
+       [?op :ast/form ?form]
  80
+       [?op :ast/ns :domina]]
  81
+     ast-db)
  82
+
102 83
   ;; Find documentation and line number
103 84
   (q '[:find ?line ?doc
104 85
        :in $ ?name
@@ -112,18 +93,18 @@
112 93
   (q '[:find ?line
113 94
        :in $ ?sym
114 95
        :where
115  
-       [?var :ast/op :var]
116  
-       [?var :ast.var/local false]
117  
-       [?var :ast/name ?sym]
  96
+       [?var :ast.var/ns-qualified-name ?sym]
118 97
        [?var :ast/line ?line]
119 98
        [?var :ast/ns :domina]]
120 99
      ast-db :cljs.core/map)
121 100
   
122  
-  ;; What are the most used local/var names?
123  
-  (->>  (q '[:find ?var ?name
  101
+  ;; What are the most used var names?
  102
+  (->>  (q '[:find ?var ?sym
  103
+             :in $ ?local ?ns
124 104
              :where
125  
-             [?var :ast.var/name ?name]]
126  
-           ast-db)
  105
+             [?var :ast.var/name ?sym]
  106
+             [?var :ast/ns ?ns]]
  107
+           ast-db false :domina.events)
127 108
         (map second)
128 109
         frequencies
129 110
         (sort-by second)
@@ -162,14 +143,13 @@
162 143
        [?kw* :ast/form ?kw]]
163 144
      ast-db)
164 145
 
165  
-  ;; Any local functions used?
  146
+  ;; Any local functions invoked?
166 147
   (sort-by second
167 148
            (q '[:find ?name ?line
168 149
                 :where
169  
-                [?e :ast.invoke/f ?var]
170  
-                [?var :ast.var/local true]
171  
-                [?var :ast/line ?line]
172  
-                [?var :ast/name ?name]]
  150
+                [_ :ast.invoke/f ?local]
  151
+                [?local :ast/line ?line]
  152
+                [?local :ast.local/name ?name]]
173 153
               ast-db))
174 154
 
175 155
   ;;What op's are parents to recur?
@@ -209,10 +189,8 @@
209 189
   ;; What namespaces are used, and how many times?
210 190
   (->> (q '[:find ?ns ?var
211 191
             :where
212  
-            [?var :ast/op :var]
213  
-            [?var :ast/name ?name]
214  
-            [?var :ast.var/local false]
215  
-            [(namespace ?name) ?ns]]
  192
+            [?var :ast.var/name]
  193
+            [?var :ast.var/ns ?ns]]
216 194
           ast-db)
217 195
        (map first)
218 196
        frequencies
@@ -221,13 +199,12 @@
221 199
 
222 200
   ;; What vars from namespace x are used in namespace y?
223 201
   (q '[:find ?var-name
224  
-       :in $ % ?x ?y
  202
+       :in $ ?x ?y
225 203
        :where
226  
-       [?var :ast/op :var]
227  
-       [?var :ast/name ?var-name]
  204
+       [?var :ast.var/ns ?x]
228 205
        [?var :ast/ns ?y]
229  
-       [namespace ?var ?x]]
230  
-     ast-db rules/namespace :cljs.core :domina.events)
  206
+       [?var :ast.var/name ?var-name]]
  207
+     ast-db :cljs.core :domina.events)
231 208
   
232 209
   ;; Who's calling my namespace?
233 210
   (q '[:find ?ns
@@ -241,105 +218,72 @@
241 218
 
242 219
   ;; Who's using my fn (and on what line)?
243 220
   (q '[:find ?ns ?line
244  
-       :in $ % ?my-var
  221
+       :in $ ?my-var
245 222
        :where
246  
-       [?var :ast/name ?my-var]
  223
+       [?var :ast.var/ns-qualified-name ?my-var]
247 224
        [?var :ast/line ?line]
248 225
        [?var :ast/ns ?ns]
249  
-       [namespace ?var ?my-ns]
  226
+       [?var :ast.var/ns ?my-ns]
250 227
        [(not= ?ns ?my-ns)]]
251  
-     ast-db rules/namespace :cljs.core/filter)
  228
+     ast-db :cljs.core/filter)
252 229
 
253 230
   ;; What vars (from other namespaces) are used from my ns?
254 231
   (q '[:find ?var-name
255  
-       :in $ % ?my-ns
  232
+       :in $ ?my-ns
256 233
        :where
257  
-       [?var :ast/name ?var-name]
258 234
        [?var :ast/ns ?my-ns]
259  
-       [namespace ?var ?ns]
260  
-       [(not= ?ns ?my-ns)]
261  
-       [(not= ?ns nil)]]
262  
-     ast-db rules/namespace :domina.css)
  235
+       [?var :ast.var/name ?var-name]
  236
+       [?var :ast.var/ns ?ns]
  237
+       [(not= ?ns ?my-ns)]]
  238
+     ast-db :domina.css)
263 239
 
264 240
   ;; Which function in core is used most (outside core itself)
265 241
   (->> (q '[:find ?var ?var-name
266  
-            :in $ %
267 242
             :where
268  
-            [?var :ast/op :var]
269  
-            [?var :ast/name ?var-name]
  243
+            [?var :ast.var/ns :cljs.core]
  244
+            [?var :ast.var/name ?var-name]
270 245
             [?var :ast/ns ?var-ns]
271  
-            [namespace ?var :cljs.core]
272 246
             [(not= ?var-ns :cljs.core)]]
273  
-          ast-db
274  
-          rules/namespace)
  247
+          ast-db)
275 248
        (map second)
276 249
        frequencies
277 250
        (sort-by second)
278 251
        reverse)
279 252
 
280  
-  ;; What op's can we figure out the type of?
281  
-  (q '[:find ?op
282  
-       :in $ %
283  
-       :where
284  
-       [?e :ast/op ?op]
285  
-       [type ?e _]]
286  
-     ast-db rules/type)
287  
-
288  
-  ;; Enumerate type/op/line/ns of known types
289  
-  (seq (q '[:find ?type ?op ?line ?ns
290  
-            :in $ %
291  
-            :where
292  
-            [?e :ast/op ?op]
293  
-            [?e :ast/line ?line]
294  
-            [?e :ast/ns ?ns]
295  
-            [type ?e ?type]]
296  
-          ast-db rules/type))
297  
-       
298 253
   ;; What functions does ?my-fn invoke?
299 254
   (q '[:find ?fn-name
300 255
        :in $ % ?my-fn
301 256
        :where
302  
-       [?def :db/ident ?my-fn]
303  
-       [descendant ?def ?invoke]
304  
-       [?invoke :ast/op :invoke]
  257
+       [?def :ast.def/name ?my-fn]
  258
+       [ancestor ?def ?invoke]
305 259
        [?invoke :ast.invoke/f ?f]
306  
-       [?f :ast.var/local false]
307  
-       [?f :ast/name ?fn-name]]
308  
-     ast-db rules/descendant :cljs.core/map)
  260
+       [?f :ast.var/name ?fn-name]]
  261
+     ast-db
  262
+     (concat rules/ancestor rules/child)
  263
+     :cljs.core/map)
  264
+
  265
+  (def transitive-var
  266
+    '[[[transitive-var ?e ?v]
  267
+       [ancestor ?e ?v]
  268
+       [?v :ast.var/name]]
  269
+      [[transitive-var ?e ?v]
  270
+       [ancestor ?e ?v*]
  271
+       [?v* :ast.var/ns-qualified-name ?name]
  272
+       [?ve :ast.def/name ?name]
  273
+       [transitive-var ?ve ?v]]])
309 274
 
310 275
   ;; Transitive var dependency
311 276
   ;; Could be used for tree shaking?
312 277
   (q '[:find ?var-name
313  
-       :in $ % ?my-fn
  278
+       :in $ % ?my-def
314 279
        :where
315  
-       [?def :db/ident ?my-fn]
316  
-       [transitive-var-dep ?def ?var]
317  
-       [?var :ast/name ?var-name]
318  
-       ]
  280
+       [?def :ast.def/name ?my-def]
  281
+       [transitive-var ?def ?var]
  282
+       [?var :ast.var/name ?var-name]]
319 283
      ast-db
320  
-     (concat rules/descendant
321  
-             rules/transitive-var-dep)
  284
+     (concat transitive-var
  285
+             rules/ancestor
  286
+             rules/child)
322 287
      :cljs.core/map)
323 288
 
324  
-  ;;=>
325  
-  ;; #<HashSet [[:cljs.core/chunk-append],
326  
-  ;;            [:cljs.core/seq],
327  
-  ;;            [:cljs.core/rest],
328  
-  ;;            [:cljs.core/chunk],
329  
-  ;;            [:cljs.core/every?],
330  
-  ;;            [:cljs.core/conj],
331  
-  ;;            [:cljs.core/chunk-buffer],
332  
-  ;;            [:cljs.core/first],
333  
-  ;;            [:cljs.core/cons],
334  
-  ;;            [:cljs.core/chunk-cons],
335  
-  ;;            [:cljs.core/apply],
336  
-  ;;            [:cljs.core/count],
337  
-  ;;            [:cljs.core/-nth],
338  
-  ;;            [:cljs.core/chunk-rest],
339  
-  ;;            [:cljs.core/chunked-seq?],
340  
-  ;;            [:cljs.core/chunk-first],
341  
-  ;;            [:cljs.core/identity],
342  
-  ;;            [:cljs.core/LazySeq]]>
343  
-       
344  
-  
345 289
   )
50  src/scape/emitter.clj
@@ -6,15 +6,14 @@
6 6
 
7 7
 (defn emit-common [expr-obj]
8 8
   {:db/id (:db/id expr-obj)
9  
-   ;; :ast/op (:op expr-obj)               ;; Could be derived
10  
-   ;; :ast/ns (-> expr-obj :env :ns :name) ;; Could be derived from top level form
11  
-   ;; :ast/form (-> expr-obj :form pr-str) ;; Record forms only on constants?
  9
+   :ast/op (:op expr-obj)               ;; Could be derived
  10
+   :ast/ns (-> expr-obj :env :ns :name) ;; Could be derived from top level form
  11
+   :ast/form (-> expr-obj :form pr-str) ;; Record forms only on constants?
12 12
    :ast/line (-> expr-obj :env :line)}) ;; 
13 13
 
14 14
 (defmulti emit :op)
15 15
 
16  
-;; TODO: else could be nil?
17  
-#_(defmethod emit :if [expr-obj]
  16
+(defmethod emit :if [expr-obj]
18 17
   (let [test (assoc-id (:test expr-obj))
19 18
         then (assoc-id (:then expr-obj))
20 19
         else (assoc-id (:else expr-obj))]
@@ -26,11 +25,21 @@
26 25
             (emit then)
27 26
             (emit else))))
28 27
 
29  
-;; TODO: Differentiate between locals and vars?
30  
-#_(defmethod emit :var [expr-obj]
  28
+(defn emit-var [expr-obj]
31 29
   [(assoc (emit-common expr-obj)
32  
-     :ast.var/name (-> expr-obj :info :name keyword))])
  30
+     :ast.var/name (-> expr-obj :info :name name keyword)
  31
+     :ast.var/ns (-> expr-obj :info :name namespace keyword)
  32
+     :ast.var/ns-qualified-name (-> expr-obj :info :name keyword))])
33 33
 
  34
+(defn emit-local [expr-obj]
  35
+  [(assoc (emit-common expr-obj)
  36
+     :ast.local/name (-> expr-obj :info :name keyword))])
  37
+
  38
+(defmethod emit :var [expr-obj]
  39
+  (if (-> expr-obj :info :name namespace)
  40
+    (emit-var expr-obj)
  41
+    (emit-local expr-obj)))
  42
+  
34 43
 (defmethod emit :def [{:keys [name doc init] :as expr-obj}]
35 44
   (let [init (when init (assoc-id (:init expr-obj)))]
36 45
     (concat [(merge (emit-common expr-obj)
@@ -40,14 +49,14 @@
40 49
              (when init (emit init)))))
41 50
 
42 51
 ;; TODO: indexed statements?
43  
-#_(defn emit-block [statements return]
  52
+(defn emit-block [statements return]
44 53
   (let [statements-tx (mapcat emit statements)
45 54
         return-tx (emit return)]
46 55
     (concat statements-tx
47 56
             return-tx)))
48 57
 
49 58
 ;; TODO: arity etc.
50  
-#_(defn emit-fn-method [fn-method]
  59
+(defn emit-fn-method [fn-method]
51 60
   (let [statements (map assoc-id (:statements fn-method))
52 61
         return (assoc-id (:ret fn-method))]
53 62
     (concat [{:db/id (:db/id fn-method)
@@ -55,13 +64,13 @@
55 64
               :ast.fn.method/return (:db/id return)}]
56 65
             (emit-block statements return))))
57 66
 
58  
-#_(defmethod emit :fn [expr-obj]
  67
+(defmethod emit :fn [expr-obj]
59 68
   (let [methods (map assoc-id (:methods expr-obj))]
60 69
     (concat [(assoc (emit-common expr-obj)
61 70
                :ast.fn/method (map :db/id methods))]
62 71
             (mapcat emit-fn-method methods))))
63 72
 
64  
-#_(defmethod emit :do [expr-obj]
  73
+(defmethod emit :do [expr-obj]
65 74
   (let [statements (map assoc-id (:statements expr-obj))
66 75
         return (assoc-id (:ret expr-obj))]
67 76
     (concat [(assoc (emit-common expr-obj)
@@ -69,17 +78,17 @@
69 78
                :ast.do/return (:db/id return))]
70 79
             (emit-block statements return))))
71 80
 
72  
-#_(defmethod emit :constant [expr-obj]
  81
+(defmethod emit :constant [expr-obj]
73 82
   [(emit-common expr-obj)])
74 83
 
75  
-#_(defn emit-binding [binding]
  84
+(defn emit-binding [binding]
76 85
   (let [init (assoc-id (:init binding))]
77 86
     (concat [{:db/id (:db/id binding)
78 87
               :ast.let.binding/name (-> binding :name keyword)
79 88
               :ast.let.binding/init (:db/id init)}]
80 89
             (emit init))))
81 90
 
82  
-#_(defmethod emit :let [expr-obj]
  91
+(defmethod emit :let [expr-obj]
83 92
   (let [bindings (map assoc-id (:bindings expr-obj))
84 93
         statements (map assoc-id (:statements expr-obj))
85 94
         return (assoc-id (:ret expr-obj))]
@@ -91,7 +100,7 @@
91 100
             (mapcat emit-binding bindings)
92 101
             (emit-block statements return))))
93 102
 
94  
-#_(defmethod emit :invoke [expr-obj]
  103
+(defmethod emit :invoke [expr-obj]
95 104
   (let [f (assoc-id (:f expr-obj))
96 105
         args (map assoc-id (:args expr-obj))]
97 106
     (concat [(assoc (emit-common expr-obj)
@@ -100,7 +109,7 @@
100 109
             (emit f)
101 110
             (mapcat emit args))))
102 111
 
103  
-#_(defmethod emit :recur [expr-obj]
  112
+(defmethod emit :recur [expr-obj]
104 113
   (let [args (map assoc-id (:exprs expr-obj))]
105 114
     (concat [(assoc (emit-common expr-obj)
106 115
                :ast.recur/arg (map :db/id args))]
@@ -113,6 +122,9 @@
113 122
                :ast.default/child (map :db/id children))]
114 123
             (mapcat emit children))))
115 124
 
116  
-;; TODO :ast/top-level true
117 125
 (defn emit-transaction-data [expr-obj]
118  
-  (emit (assoc-id expr-obj)))
  126
+  (let [expr-obj (assoc-id expr-obj)]
  127
+    (cons
  128
+     {:db/id (:db/id expr-obj)
  129
+      :ast/top-level true}
  130
+     (emit expr-obj))))
96  src/scape/rules.clj
... ...
@@ -1,51 +1,51 @@
1  
-(ns scape.rules
2  
-  (:refer-clojure :exclude [namespace type]))
  1
+(ns scape.rules)
3 2
 
4  
-(def namespace
5  
-  '[[[namespace ?var ?ns]
6  
-     [?var :ast/name ?name]
7  
-     [(namespace ?name) ?ns-str]
8  
-     [(keyword ?ns-str) ?ns]]])
  3
+(def child
  4
+  '[[[child ?parent ?child]
  5
+     [?parent :ast.if/test ?child]]
  6
+    [[child ?parent ?child]
  7
+     [?parent :ast.if/then ?child]]
  8
+    [[child ?parent ?child]
  9
+     [?parent :ast.if/else ?child]]
  10
+    
  11
+    [[child ?parent ?child]
  12
+     [?parent :ast.def/init ?child]]
  13
+    
  14
+    [[child ?parent ?child]
  15
+     [?parent :ast.fn/method ?method]
  16
+     [?method :ast.fn.method/statement ?child]]
  17
+    [[child ?parent ?child]
  18
+     [?parent :ast.fn/method ?method]
  19
+     [?method :ast.fn.method/return ?child]]
  20
+    
  21
+    [[child ?parent ?child]
  22
+     [?parent :ast.do/statement ?child]]
  23
+    [[child ?parent ?child]
  24
+     [?parent :ast.do/return ?child]]
  25
+    
  26
+    [[child ?parent ?child]
  27
+     [?parent :ast.let/binding ?binding]
  28
+     [?binding :ast.let.binding/init ?child]]
  29
+    [[child ?parent ?child]
  30
+     [?parent :ast.let/statement ?child]]
  31
+    [[child ?parent ?child]
  32
+     [?parent :ast.let/return ?child]]
  33
+    
  34
+    [[child ?parent ?child]
  35
+     [?parent :ast.invoke/f ?child]]
  36
+    [[child ?parent ?child]
  37
+     [?parent :ast.invoke/arg ?child]]
  38
+    
  39
+    [[child ?parent ?child]
  40
+     [?parent :ast.recur/arg ?child]]
  41
+    
  42
+    [[child ?parent ?child]
  43
+     [?parent :ast.default/child ?child]]])
9 44
 
10  
-(def descendant 
11  
-  '[[[descendant ?r ?d]
12  
-     [?r :ast/child ?d]]
13  
-    [[descendant ?r ?d]
14  
-     [?r :ast/child ?x]
15  
-     [descendant ?x ?d]]])
  45
+(def ancestor
  46
+  '[[[ancestor ?a ?d]
  47
+     [child ?a ?d]]
  48
+    [[ancestor ?a ?d]
  49
+     [child ?a ?x]
  50
+     [ancestor ?x ?d]]])
16 51
 
17  
-(def top-level
18  
-  '[[[top-level ?tl ?e]
19  
-     [?t1 :ast/top-level true]
20  
-     [descendant ?t1 ?e]]])
21  
-
22  
-(def form
23  
-  '[[[form ?e ?f]
24  
-     [?e :ast/form ?fs]
25  
-     [(read-string ?fs) ?f]]])
26  
-
27  
-(def type
28  
-  '[[[type ?e ?t]
29  
-     [?e :ast.constant/type ?t]]
30  
-    [[type ?e ?t]
31  
-     ;[?e :ast/op]
32  
-     [?e :ast/ret ?r]
33  
-     [type ?r ?t]]
34  
-    [[type ?e ?t]
35  
-     [?e :ast.fn/method ?m]
36  
-     [?m :ast/ret ?r]
37  
-     [type ?r ?t]]])
38  
-
39  
-(def transitive-var-dep
40  
-  '[[[transitive-var-dep ?e ?v]
41  
-     [descendant ?e ?v]
42  
-     [?v :ast/op :var]
43  
-     [?v :ast.var/local false]]
44  
-    [[transititve-var-dep ?e ?v]
45  
-     [descendant ?e ?v*]
46  
-     [?v* :ast/op :var]
47  
-     [?v* :ast.var/local false]
48  
-     [?ve :db/ident ?v*]
49  
-     [transitive-var-dep ?ve ?v]]])
50  
-
51  
-    
17  src/scape/schema.clj
@@ -15,7 +15,13 @@
15 15
         {:db/doc doc}))))
16 16
 
17 17
 (def common
18  
-  [[:ast/line :long :one]])
  18
+  [[:ast/line :long :one]
  19
+   [:ast/op :keyword :one]
  20
+   [:ast/ns :keyword :one]
  21
+   [:ast/form :string :one]])
  22
+
  23
+(def top-level
  24
+  [[:ast/top-level :boolean :one]])
19 25
 
20 26
 (def op-if
21 27
   [[:ast.if/test :ref :one]
@@ -23,7 +29,12 @@
23 29
    [:ast.if/else :ref :one]])
24 30
 
25 31
 (def op-var
26  
-  [[:ast.var/name :keyword :one]])
  32
+  [[:ast.var/name :keyword :one]
  33
+   [:ast.var/ns :keyword :one]
  34
+   [:ast.var/ns-qualified-name :keyword :one]])
  35
+
  36
+(def op-local
  37
+  [[:ast.local/name :keyword :one]])
27 38
 
28 39
 (def op-def
29 40
   [[:ast.def/name :keyword :one]
@@ -64,8 +75,10 @@
64 75
 (def schema
65 76
   (map #(apply attribute %)
66 77
        (concat common
  78
+               top-level
67 79
                op-if
68 80
                op-var
  81
+               op-local
69 82
                op-def
70 83
                op-fn
71 84
                op-do

0 notes on commit c6dc541

Please sign in to comment.
Something went wrong with that request. Please try again.