Nodes reference tools.analyzer.js AST Quickref Common AST fields :op The node op :form The clojure form from which the node originated :env The environment map :children optional A vector of keywords, representing the children nodes of this node, in order of evaluation:raw-forms optional If this node's :form
has been macroexpanded, a sequence of all the intermediate forms from the original form to the macroexpanded form:top-level optional true
if this is the root node:tag The tag of the expression :ignore-tag optional true
if this node returns a statement rather than an expressionNodes reference # bindingNode for a binding symbol :op :binding
:form The binding symbol :name The binding symbol :local One of :arg
, :catch
, :fn
, :let
, :letfn
, :loop
or :field
:arg-id optional When :local
is :arg
, the parameter index:variadic? optional When :local
is :arg
, a boolean indicating whether this parameter binds to a variable number of arguments:init optional When :local
is :let
, :letfn
or :loop
, an AST node representing the bound value:children []
, [:init]
# caseNode for a case* special-form expression :op :case
:form (case* expr [test*] [then*] default)
:test The AST node for the expression to test against :nodes A vector of :case-node
AST nodes representing the test/then clauses of the case* expression :default An AST node representing the default value of the case expression :children [:test :nodes :default]
# case-nodeGrouping node for tests/then expressions in a case* expression :op :case-node
:tests A vector of :case-test
AST nodes representing the test values :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 :children [:tests :then]
# case-testNode for a test value in a case* expression :op :case-test
:test A :const
AST node representing the test value :children [:test]
# case-thenNode for a then expression in a case* expression :op :case-then
:then An AST node representing the expression the case will evaluate to when the :test
expression matches this node's corresponding :case-test
value :children [:then]
# catchNode for a catch expression :op :catch
:form (catch class local body*)
:class An AST node representing the type of exception to catch :local The :binding
AST node for the caught exception :body Synthetic :do
AST node (with :body?
true
) representing the body of the catch clause :children [:class :local :body]
# constNode for a constant literal or a quoted collection literal :op :const
:form A constant literal or a quoted collection literal :literal? true
:type one of :nil
, :bool
, :keyword
, :symbol
, :string
, :number
, :seq
, :char
, :regex
or :unknown
:val The value of the constant node :meta optional A :map
AST node representing the metadata of the constant value, if present.:children []
, [:meta]
# defNode for a def special-form expression :op :def
:form (def name docstring? init?)
:name The var symbol to define in the current namespace :var The var object created (or found, if it already existed) named by the symbol :name
in the current namespace :meta optional 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
:init optional An AST node representing the initial value of the var:doc optional The docstring for this var:children []
, [:init]
, [:meta]
, [:meta :init]
# deftypeNode for a deftype* special-form expression :op :deftype
:form `(deftype name [field*] pmask body) :name The symbol name of the deftype :fields A vector of :binding
AST nodes with :local
:field
representing the deftype fields :pmask The protocol mask of the deftype :body A :do
AST node representing the inline protocols extensions of the deftype :children [:fields :body]
# defrecordNode for a defrecord* special-form expression :op :defrecord
:form `(defrecord name [field*] pmask body) :name The symbol name of the defrecord :fields A vector of :binding
AST nodes with :local
:field
representing the defrecord fields :pmask The protocol mask of the defrecord :body A :do
AST node representing the inline protocols extensions of the defrecord :children [:fields :body]
Node for a do special-form expression or for another special-form's body :op :do
:form (do statement* ret)
:statements A vector of AST nodes representing all but the last expression in the do body :ret An AST node representing the last expression in the do body (the block's return value) :body? optional true
if this node is a synthetic body:children [:statements :ret]
Node for a fn* special-form expression :op :fn
:form (fn* name? [arg*] body*)
or (fn* name? method*)
:variadic? true
if this function contains a variadic arity method:max-fixed-arity The number of arguments taken by the fixed-arity method taking the most arguments :local optional A :binding
AST node with :local
:fn
representing the function's local name, if one is supplied:methods A vector of :fn-method
AST nodes representing the fn method arities :once true
if the fn is marked as ^:once
fn*
, meaning it will only be executed once and thus allowing for the clearing of closed-over locals:children [:methods]
, [:local :methods]
# fn-methodNode for an arity method in a fn* expression :op :fn-method
:form ([arg*] body*)
:loop-id Unique symbol identifying this method as a target for recursion :variadic? true
if this fn-method takes a variable number of arguments:params A vector of :binding
AST nodes with :local
:arg
representing this fn-method args :fixed-arity The number of non-variadic args this fn-method takes :body Synthetic :do
node (with :body?
true
) representing the body of this fn-method :children [:params :body]
# host-callNode for a host interop call :op :host-call
:form (.method target arg*)
:method Symbol naming the method to call :target An AST node representing the target object :args A vector of AST nodes representing the args passed to the method call :children [:target :args]
# host-fieldNode for a host interop field access :op :host-field
:form (.-field target)
:field Symbol naming the field to access :target An AST node representing the target object :assignable? true
:children [:target]
Node for an if special-form expression :op :if
:form (if test then else?)
:test An AST node representing the test expression :then An AST node representing the expression's return value if :test
evaluated to a truthy value :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 :children [:test :then :else]
# invokeNode for an invoke expression :op :invoke
:form (f arg*)
:fn An AST node representing the function to invoke :args A vector of AST nodes representing the args to the function :meta optional Map of metadata attached to the invoke :form
:children [:fn :args]
Node for a js* special-form expression :op :js
:form `(js* js-string arg*) :segs A vector of js strings that delimit the compiled args :args A vector of AST nodes representing the cljs expressions that will be interposed with the strings in segs :children [:args]
# js-arrayNode for a js array literal :op :js-array
:form #js [item*]
:items A vector of AST nodes representing the items of the js array :children [:items]
# js-objectNode for a js object literal :op :js-object
:form #js {[key value]*}
:keys A vector of AST nodes representing the keys of the js object :vals A vector of AST nodes representing the vals of the js object :children [:keys :vals]
# js-varNode for a js-var symbol :op :js-var
:form A symbol naming the js-var in the form:
js/foo
, js-ns/foo
or js-var
:var The js-var object this symbol refers to, if :form
is in the form js/foo
, :ns
will be nil :assignable? true
# letNode for a let* special-form expression :op :let
:form (let* [binding*] body*)
:bindings A vector of :binding
AST nodes with :local
:let
:body Synthetic :do
node (with :body?
true
) representing the body of the let expression :children [:bindings :body]
# letfnNode for a letfn* special-form expression :op :letfn
:form (letfn* [binding*] body*)
:bindings A vector of :binding
AST nodes with :local
:letfn
:body Synthetic :do
node (with :body?
true
) representing the body of the letfn expression :children [:bindings :body]
# localNode for a local symbol :op :local
:form The local symbol :name The local symbol :local One of :arg
, :catch
, :fn
, :let
, :letfn
, :loop
or :field
:arg-id optional When :local
is :arg
, the parameter index:variadic? optional When :local
is :arg
, a boolean indicating whether this parameter binds to a variable number of arguments# loopNode a loop* special-form expression :op :loop
:form (loop* [binding*] body*)
:bindings A vector of :binding
AST nodes with :local
:loop
:body Synthetic :do
node (with :body?
true
) representing the body of the loop expression :loop-id Unique symbol identifying this loop as a target for recursion :children [:bindings :body]
# mapNode for a map literal :op :map
:form {[key val]*}
:keys A vector of AST nodes representing the keys of the map :vals A vector of AST nodes representing the vals of the map :children [:keys :vals]
# newNode for a new special-form expression :op :new
:form (new Class arg*)
:class An AST node :class
representing the class to instantiate :args A vector of AST nodes representing the arguments passed to the class constructor :children [:class :args]
# quoteNode for a quote special-form expression :op :quote
:form (quote expr)
:expr A :const
AST node representing the quoted value :literal? true
:children [:expr]
# recurNode for a recur special-form expression :op :recur
:form (recur expr*)
:exprs A vector of AST nodes representing the new bound values for the loop binding on the next loop iteration :children [:exprs]
# setNode for a set literal :op :set
:form #{item*}
:items A vector of AST nodes representing the items of the set :children [:items]
# set!Node for a set! special-form expression :op :set!
:form (set! target val)
:target An AST node representing the target of the set! expression, must be :assignable?
:val An AST node representing the new value for the target :children [:target]
# throwNode for a throw special-form statement :op :throw
:form (throw exception)
:exception An AST node representing the exception to throw :children [:exception]
# tryNode for a try special-form expression :op :try
:form (try body* catch* finally?)
:catches A vector of :catch
AST nodes representing the catch clauses of this try expression :finally optional Synthetic :do
AST node (with :body?
true
) representing the final clause of this try expression:children [:catches]
, [:catches :finally]
# varNode for a var symbol :op :var
:form A symbol naming the var :var The var object this symbol refers to :assignable? optional true
if the Var is :dynamic
# vectorNode for a vector literal with attached metadata and/or non literal elements :op :vector
:form [item*]
:items A vector of AST nodes representing the items of the vector :children [:items]
# with-metaNode for a non quoted collection literal or a fn expression with attached metadata :op :with-meta
:form Non quoted collection literal or fn expression with attached metadata :meta A :map
AST node representing the metadata of expression. :expr The expression this metadata is attached to, :op
is one of :vector
, :map
, :set
or :fn
:children [:meta :expr]