|
| 1 | +{:all-keys |
| 2 | + |
| 3 | + [[:op "The node op"] |
| 4 | + [:form "The ClojureScript form from which the node originated"] |
| 5 | + [:env "The environment map"] |
| 6 | + [:context "Either :expr, :return or :statement."] |
| 7 | + ^:optional |
| 8 | + [:children "A vector of keywords, representing the children nodes of this node, in order of evaluation"] |
| 9 | +; ^:optional |
| 10 | +; [:raw-forms "If this node's :form has been macroexpanded, a sequence of all the intermediate forms from the original form to the macroexpanded form"] |
| 11 | + ;^:optional |
| 12 | + ;[:top-level "`true` if this is the root node"] |
| 13 | + [:tag "The tag this expression is required to have"] |
| 14 | +; [:o-tag "The tag of this expression, based on the node's children"] |
| 15 | +; ^:optional |
| 16 | +; [:ignore-tag "`true` if this node returns a statement rather than an expression"] |
| 17 | + ; ^:optional |
| 18 | + ; [:loops "A set of the loop-ids that might cause this node to recur"] |
| 19 | + ] |
| 20 | + |
| 21 | + :node-keys |
| 22 | + [{:op :binding |
| 23 | + :doc "Node for a binding symbol" |
| 24 | + :keys [[:form "The binding symbol"] |
| 25 | + [:name "The binding symbol"] |
| 26 | + [:local "One of :arg, :catch, :fn, :let, :letfn, :loop or :field"] |
| 27 | + ^:optional |
| 28 | + [:variadic? "When :local is :arg, a boolean indicating whether this parameter binds to a variable number of arguments"] |
| 29 | + ^:optional ^:children |
| 30 | + [:init "When :local is :let, :letfn or :loop, an AST node representing the bound value"] |
| 31 | + ^:optional ;^:children |
| 32 | + [:shadow "When this binding shadows another local binding, an AST node representing the shadowed local"] |
| 33 | + ]} |
| 34 | + {:op :case |
| 35 | + :doc "Node for a case* special-form expression" |
| 36 | + :keys [[:form "`(case* expr shift maks default case-map switch-type test-type skip-check?)`"] |
| 37 | + ^:children |
| 38 | + [:test "The AST node for the expression to test against"] |
| 39 | + ^:children |
| 40 | + [:nodes "A vector of :case-node AST nodes representing the test/then clauses of the case* expression"] |
| 41 | + ^:children |
| 42 | + [:default "An AST node representing the default value of the case expression"] |
| 43 | + ]} |
| 44 | + {:op :case-node |
| 45 | + :doc "Grouping node for tests/then expressions in a case* expression" |
| 46 | + :keys [^:children |
| 47 | + [:tests "A vector of :case-test AST nodes representing the test values"] |
| 48 | + ^:children |
| 49 | + [:then "A :case-then AST node representing the value the case expression will evaluate to when one of the :tests expressions matches the :case :test value"]]} |
| 50 | + {:op :case-test |
| 51 | + :doc "Node for a test value in a case* expression" |
| 52 | + :keys [^:children |
| 53 | + [:test "A :const AST node representing the test value"] |
| 54 | + #_[:hash]]} |
| 55 | + {:op :case-then |
| 56 | + :doc "Node for a then expression in a case* expression" |
| 57 | + :keys [^:children |
| 58 | + [:then "An AST node representing the expression the case will evaluate to when the :test expression matches this node's corresponding :case-test value"] |
| 59 | + #_[:hash]]} |
| 60 | + {:op :const |
| 61 | + :doc "Node for a constant literal or a quoted collection literal" |
| 62 | + :keys [[:form "A constant literal or a quoted collection literal"] |
| 63 | + [:literal? "`true`"] |
| 64 | + [:type "one of :nil, :bool, :keyword, :symbol, :string, :number, :type, :record, :map, :vector, :set, :seq, :char, :regex, :class, :var, or :unknown"] |
| 65 | + [:val "The value of the constant node"] |
| 66 | + ;^:optional ^:children |
| 67 | + ;; FIXME |
| 68 | + ;[:meta "An AST node representing the metadata of the constant value, if present. The node will be either a :map node or a :const node with :type :map"] |
| 69 | + ; |
| 70 | + ;^:optional |
| 71 | + ;[:id "A numeric id for the constant value, will be the same for every instance of this constant inside the same compilation unit, not present if :type is :nil or :bool"] |
| 72 | + ]} |
| 73 | + {:op :def |
| 74 | + :doc "Node for a def special-form expression" |
| 75 | + :keys [[:form "`(def name docstring? init?)`"] |
| 76 | + [:name "The var symbol to define in the current namespace"] |
| 77 | + ;[:var "The Var object created (or found, if it already existed) named by the symbol :name in the current namespace"] |
| 78 | + ;^:optional ^:children |
| 79 | + ;[:meta "An AST node representing the metadata attached to :name, if present. The node will be either a :map node or a :const node with :type :map"] |
| 80 | + ^:optional ^:children |
| 81 | + [:init "An AST node representing the initial value of the var"] |
| 82 | + ^:children |
| 83 | + [:the-var "A :the-var AST node representing the return of this :def."] |
| 84 | + ;^:optional |
| 85 | + ;[:doc "The docstring for this var"] |
| 86 | + ]} |
| 87 | + {:op :defrecord |
| 88 | + :doc "Node for a defrecord* special-form expression" |
| 89 | + :keys [[:form "`(deftype* name class.name [arg*] :implements [interface*] method*)`"] |
| 90 | + ;[:interfaces "A set of the interfaces implemented by the type"] |
| 91 | + [:t "The symbol name of the defrecord."] |
| 92 | + ^:children |
| 93 | + [:body "An AST node containing method implementations for this record."] |
| 94 | + ;^:children |
| 95 | + ;[:fields "A vector of :binding AST nodes with :local :field representing the deftype fields"] |
| 96 | + ]} |
| 97 | + {:op :deftype |
| 98 | + :doc "Node for a deftype* special-form expression" |
| 99 | + :keys [[:form "`(deftype* name class.name [arg*] :implements [interface*] method*)`"] |
| 100 | + ;[:interfaces "A set of the interfaces implemented by the type"] |
| 101 | + [:t "The symbol name of the deftype"] |
| 102 | + ;[:class-name "A class for the deftype, should *never* be instantiated or used on instance? checks as this will not be the same class the deftype will evaluate to after compilation"] |
| 103 | + ^:children |
| 104 | + [:body "An AST node containing method implemented for this type."] |
| 105 | + ;^:children |
| 106 | + ;[:fields "A vector of :binding AST nodes with :local :field representing the deftype fields"] |
| 107 | + ]} |
| 108 | + {:op :do |
| 109 | + :doc "Node for a do special-form expression or for another special-form's body" |
| 110 | + :keys [[:form "`(do statement* ret)`"] |
| 111 | + ^:children |
| 112 | + [:statements "A vector of AST nodes representing all but the last expression in the do body"] |
| 113 | + ^:children |
| 114 | + [:ret "An AST node representing the last expression in the do body (the block's return value)"] |
| 115 | + ^:optional |
| 116 | + [:body? "`true` if this node is a synthetic body"]]} |
| 117 | + {:op :fn |
| 118 | + :doc "Node for a fn* special-form expression" |
| 119 | + :keys [[:form "`(fn* name? [arg*] body*)` or `(fn* name? method*)`"] |
| 120 | + [:variadic? "`true` if this function contains a variadic arity method"] |
| 121 | + [:max-fixed-arity "The number of arguments taken by the fixed-arity method taking the most arguments"] |
| 122 | + ^:optional ^:children |
| 123 | + [:local "A :binding AST node with :local :fn representing the function's local name, if one is supplied"] |
| 124 | + ^:children |
| 125 | + [:methods "A vector of :fn-method AST nodes representing the fn method arities"] |
| 126 | + ]} |
| 127 | + {:op :fn-method |
| 128 | + :doc "Node for an arity method in a fn* expression" |
| 129 | + :keys [[:form "`([arg*] body*)`"] |
| 130 | + [:variadic? "`true` if this fn-method takes a variable number of arguments"] |
| 131 | + ^:children |
| 132 | + [:params "A vector of :binding AST nodes with :local :arg representing this fn-method args"] |
| 133 | + [:fixed-arity "The number of non-variadic args this fn-method takes"] |
| 134 | + ^:children |
| 135 | + [:body "Synthetic :do node (with :body? `true`) representing the body of this fn-method"]]} |
| 136 | + {:op :host-call |
| 137 | + :doc "Node for a host interop call" |
| 138 | + :keys [[:form "`(.method target arg*)`"] |
| 139 | + [:method "Symbol naming the method to call"] |
| 140 | + ^:children |
| 141 | + [:target "An AST node representing the target object"] |
| 142 | + ^:children |
| 143 | + [:args "A vector of AST nodes representing the args passed to the method call"]]} |
| 144 | + {:op :host-field |
| 145 | + :doc "Node for a host interop field access" |
| 146 | + :keys [[:form "`(.-field target)`"] |
| 147 | + [:field "Symbol naming the field to access"] |
| 148 | + ^:children |
| 149 | + [:target "An AST node representing the target object"]]} |
| 150 | + {:op :if |
| 151 | + :doc "Node for an if special-form expression" |
| 152 | + :keys [[:form "`(if test then else?)`"] |
| 153 | + ^:children |
| 154 | + [:test "An AST node representing the test expression"] |
| 155 | + ^:children |
| 156 | + [:then "An AST node representing the expression's return value if :test evaluated to a truthy value"] |
| 157 | + ^:children |
| 158 | + [:else "An AST node representing the expression's return value if :test evaluated to a falsey value, if not supplied it will default to a :const node representing nil"]]} |
| 159 | + {:op :invoke |
| 160 | + :doc "Node for an invoke expression" |
| 161 | + :keys [[:form "`(f arg*)`"] |
| 162 | + ^:children |
| 163 | + [:fn "An AST node representing the function to invoke"] |
| 164 | + ^:children |
| 165 | + [:args "A vector of AST nodes representing the args to the function"] |
| 166 | + ;FIXME |
| 167 | + ;^:optional |
| 168 | + ;[:meta "Map of metadata attached to the invoke :form"] |
| 169 | + ]} |
| 170 | + {:op :js |
| 171 | + :doc "Node for a js* special-form expression" |
| 172 | + :keys [[:form "`(js* js-string arg*)`"] |
| 173 | + [:segs "A vector of js strings that delimit the compiled args"] |
| 174 | + ^:children |
| 175 | + [:args "A vector of AST nodes representing the cljs expressions that will be interposed with the strings in segs"]]} |
| 176 | + {:op :js-array |
| 177 | + :doc "Node for a js array literal" |
| 178 | + :keys [[:form "`#js [item*]`"] |
| 179 | + ^:children |
| 180 | + [:items "A vector of AST nodes representing the items of the js array"]]} |
| 181 | + {:op :js-object |
| 182 | + :doc "Node for a js object literal" |
| 183 | + :keys [[:form "`#js {[key value]*}`"] |
| 184 | + [:keys "A vector of values representing the keys of the js object"] |
| 185 | + ^:children |
| 186 | + [:vals "A vector of AST nodes representing the vals of the js object"]]} |
| 187 | + {:op :js-var |
| 188 | + :doc "Node for a js-var symbol" |
| 189 | + :keys [[:form "A symbol naming the js-var in the form: `js/foo`, `js-ns/foo` or `js-var`"] |
| 190 | + [:ns "The namespace symbol for this js-var."] |
| 191 | + [:name "The fully qualified symbol naming this js-var."] |
| 192 | + ]} |
| 193 | + {:op :let |
| 194 | + :doc "Node for a let* special-form expression" |
| 195 | + :keys [[:form "`(let* [binding*] body*)`"] |
| 196 | + ^:children |
| 197 | + [:bindings "A vector of :binding AST nodes with :local :let"] |
| 198 | + ^:children |
| 199 | + [:body "Synthetic :do node (with :body? `true`) representing the body of the let expression"]]} |
| 200 | + {:op :letfn |
| 201 | + :doc "Node for a letfn* special-form expression" |
| 202 | + :keys [[:form "`(letfn* [binding*] body*)`"] |
| 203 | + ^:children |
| 204 | + [:bindings "A vector of :binding AST nodes with :local :letfn"] |
| 205 | + ^:children |
| 206 | + [:body "Synthetic :do node (with :body? `true`) representing the body of the letfn expression"]]} |
| 207 | + {:op :local |
| 208 | + :doc "Node for a local symbol" |
| 209 | + :keys [[:form "The local symbol"] |
| 210 | + [:name "The uniquified local symbol"] |
| 211 | + [:local "One of :arg, :catch, :fn, :let, :letfn, :loop, :field or :this"] |
| 212 | + ]} |
| 213 | + {:op :loop |
| 214 | + :doc "Node a loop* special-form expression" |
| 215 | + :keys [[:form "`(loop* [binding*] body*)`"] |
| 216 | + ^:children |
| 217 | + [:bindings "A vector of :binding AST nodes with :local :loop"] |
| 218 | + ^:children |
| 219 | + [:body "Synthetic :do node (with :body? `true`) representing the body of the loop expression"]]} |
| 220 | + {:op :map |
| 221 | + :doc "Node for a map literal with attached metadata and/or non literal elements" |
| 222 | + :keys [[:form "`{[key val]*}`"] |
| 223 | + ^:children |
| 224 | + [:keys "A vector of AST nodes representing the keys of the map"] |
| 225 | + ^:children |
| 226 | + [:vals "A vector of AST nodes representing the vals of the map"]]} |
| 227 | + {:op :new |
| 228 | + :doc "Node for a new special-form expression" |
| 229 | + :keys [[:form "`(new Class arg*)`"] |
| 230 | + ^:children |
| 231 | + [:class "A :const AST node with :type :class representing the Class to instantiate"] |
| 232 | + ^:children |
| 233 | + [:args "A vector of AST nodes representing the arguments passed to the Class constructor"] |
| 234 | + ]} |
| 235 | + {:op :no-op |
| 236 | + :doc "Node for a no-op" |
| 237 | + :keys [ |
| 238 | + ]} |
| 239 | + {:op :ns |
| 240 | + :doc "Node for a clojure.core/ns form." |
| 241 | + :keys [ |
| 242 | + ]} |
| 243 | + {:op :ns* |
| 244 | + :doc "Node for a special file-loading form." |
| 245 | + :keys [ |
| 246 | + ]} |
| 247 | + {:op :quote |
| 248 | + :doc "Node for a quote special-form expression" |
| 249 | + :keys [[:form "`(quote expr)`"] |
| 250 | + ^:children |
| 251 | + [:expr "A :const AST node representing the quoted value"] |
| 252 | + [:literal? "`true`"]]} |
| 253 | + {:op :recur |
| 254 | + :doc "Node for a recur special-form expression" |
| 255 | + :keys [[:form "`(recur expr*)`"] |
| 256 | + ^:children |
| 257 | + [:exprs "A vector of AST nodes representing the new bound values for the loop binding on the next loop iteration"]]} |
| 258 | + {:op :set |
| 259 | + :doc "Node for a set literal with attached metadata and/or non literal elements" |
| 260 | + :keys [[:form "`#{item*}`"] |
| 261 | + ^:children |
| 262 | + [:items "A vector of AST nodes representing the items of the set"]]} |
| 263 | + {:op :set! |
| 264 | + :doc "Node for a set! special-form expression" |
| 265 | + :keys [[:form "`(set! target val)`"] |
| 266 | + ^:children |
| 267 | + [:target "An AST node representing the target of the set! expression, must be :assignable?"] |
| 268 | + ^:children |
| 269 | + [:val "An AST node representing the new value for the target"]]} |
| 270 | + {:op :the-var |
| 271 | + :doc "Node for a var special-form expression" |
| 272 | + :keys [[:form "`(var var-name)`"] |
| 273 | + ^:children |
| 274 | + [:var "A :var AST node that this expression refers to"] |
| 275 | + ^:children |
| 276 | + [:sym "An AST node for the quoted fully qualified name of this var."] |
| 277 | + ^:children |
| 278 | + [:meta "A :map AST node of this var's metadata."] |
| 279 | + ]} |
| 280 | + {:op :throw |
| 281 | + :doc "Node for a throw special-form statement" |
| 282 | + :keys [[:form "`(throw exception)`"] |
| 283 | + ^:children |
| 284 | + [:exception "An AST node representing the exception to throw"]]} |
| 285 | + {:op :try |
| 286 | + :doc "Node for a try special-form expression" |
| 287 | + :keys [[:form "`(try body* catch* finally?)`"] |
| 288 | + ^:children |
| 289 | + [:body "Synthetic :do AST node (with :body? `true`) representing the body of this try expression"] |
| 290 | + ^:optional |
| 291 | + [:name "A binding in scope in :catch. (symbol)"] |
| 292 | + ^:optional ^:children |
| 293 | + [:catch "An AST node representing an unconditional JavaScript catch."] |
| 294 | + ^:optional ^:children |
| 295 | + [:finally "Synthetic :do AST node (with :body? `true`) representing the final clause of this try expression"]]} |
| 296 | + {:op :var |
| 297 | + :doc "Node for a var symbol" |
| 298 | + :keys [[:form "A symbol naming the var"] |
| 299 | + [:ns "The namespace symbol this var is defined in."] |
| 300 | + [:name "The fully qualified symbol naming this var."] |
| 301 | + ]} |
| 302 | + {:op :vector |
| 303 | + :doc "Node for a vector literal with attached metadata and/or non literal elements" |
| 304 | + :keys [[:form "`[item*]`"] |
| 305 | + ^:children |
| 306 | + [:items "A vector of AST nodes representing the items of the vector"]]} |
| 307 | + {:op :with-meta |
| 308 | + :doc "Node for a non quoted collection literal or fn/reify expression with attached metadata" |
| 309 | + :keys [[:form "Non quoted collection literal or fn/reify expression with attached metadata"] |
| 310 | + ^:children |
| 311 | + [:meta "An AST node representing the metadata of expression. The node will be either a :map node or a :const node with :type :map"] |
| 312 | + ^:children |
| 313 | + [:expr "The expression this metadata is attached to, :op is one of :vector, :map, :set, :fn or :reify"]]}]} |
0 commit comments