Nodes reference
tools.analyzer.jvm 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 this expression is required to have :o-tag The tag of this expression, based on the node's children :ignore-tag optional true if this node returns a statement rather than an expression:loops optional A set of the loop-ids that might cause this node to recur
Nodes reference
# bindingNode for a binding symbol :op :binding :form The binding symbol :name The uniquified binding symbol :local One of :arg, :catch, :fn, :let, :letfn, :loop, :field or :this :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:atom An atom shared by this :binding node and all the :local nodes that refer to this binding :children [], [:init]
# caseNode for a case* special-form expression :op :case :form (case* expr shift maks default case-map switch-type test-type skip-check?):test The AST node for the expression to test against :tests A vector of :case-test AST nodes, each node has a corresponding :case-then node in the :thens field :thens A vector of :case-then AST nodes, each node has a corresponding :case-test node in the :tests field :default An AST node representing the default value of the case expression :shift :mask :low :high :switch-type One of :sparse or :compact :test-type One of :int, :hash-equiv or :hash-identity :skip-check? A set of case ints for which equivalence checking should not be done :children [:test :tests :thens :default]
# case-testNode for a test value in a case* expression :op :case-test :test A :const AST node representing the test value :hash :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 :hash :children [:then]
# catchNode for a catch expression :op :catch :form (catch class local body*):class A :const AST node with :type :class 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, :type, :record, :map, :vector, :set, :seq, :char, :regex, :class, :var, or :unknown :val The value of the constant node :meta optional 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 :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 class.name [arg*] :implements [interface*] method*):interfaces A set of the interfaces implemented by the type :name The symbol name of the deftype :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 :fields A vector of :binding AST nodes with :local :field representing the deftype fields :methods A vector :method AST nodes representing the deftype methods :children [:fields :methods]
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-interopNode for a no-arg instance-call or for an instance-field that couldn't be resolved at compile time :op :host-interop :form (. target m-or-f):target An AST node representing the target object :m-or-f Symbol naming the no-arg method or field to lookup in the target :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]
# importNode for a clojure.core/import* special-form expression :op :import :form (clojure.core/import* "qualified.class"):class String representing the qualified class to import
# instance-callNode for an instance method call :op :instance-call :form (.method instance arg*):method Symbol naming the invoked method :instance An AST node representing the instance to call the method on :args A vector of AST nodes representing the args passed to the method call :validated? optional true if the method call could be resolved at compile time:class optional If :validated? the class or interface the method belongs to :children [:instance :args]
# instance-fieldNode for an instance field access :op :instance-field :form (.-field instance):field Symbol naming the field to access :instance An AST node representing the instance to lookup the symbol on :assignable? true if the field is set!able:class The class the field belongs to :children [:instance]
# instance?Node for a clojure.core/instance? call where the Class is known at compile time :op :instance? :form (clojure.core/instance? Class x):class The Class to test the :target for instanceability :target An AST node representing the object to test for instanceability :children [:target]
# 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]
# keyword-invokeNode for an invoke expression where the fn is a not-namespaced keyword and thus a keyword callsite can be emitted :op :keyword-invoke :form (:k instance):keyword An AST node representing the keyword to lookup in the instance :target An AST node representing the instance to lookup the keyword in :children [:keyword :target]
# 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 :assignable? true if the corresponding :binding AST node is :local :field and is declared either ^:volatile-mutable or ^:unsynchronized-mutable:name The uniquified local symbol :local One of :arg, :catch, :fn, :let, :letfn, :loop, :field or :this :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:atom An atom shared by this :local node, the :binding node this local refers to and all the other :local nodes that refer to this same local
# 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 with attached metadata and/or non literal elements :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]
# methodNode for a method in a deftype* or reify* special-form expression :op :method :form (method [this arg*] body*):bridges A list of signature for bridge methods to emit :interface The interface (or Object) this method belongs to :this A :binding AST node with :local :this representing the "this" local :loop-id Unique symbol identifying this method as a target for recursion :name The symbol name of this method :params A vector of AST :binding nodes with :local :arg representing the arguments of the method :fixed-arity The number of args this method takes :body Synthetic :do node (with :body? true) representing the body of this method :children [:this :params :body]
# monitor-enterNode for a monitor-enter special-form statement :op :monitor-enter :form (monitor-enter target):target An AST node representing the monitor-enter sentinel :children [:target]
# monitor-exitNode for a monitor-exit special-form statement :op :monitor-exit :form (monitor-exit target):target An AST node representing the monitor-exit sentinel :children [:target]
# newNode for a new special-form expression :op :new :form (new Class arg*):class A :const AST node with :type :class representing the Class to instantiate :args A vector of AST nodes representing the arguments passed to the Class constructor :validated? optional true if the constructor call could be resolved at compile time :children [:class :args]
# prim-invokeNode for an invoke expression that can be optimized using one of the primitive interfaces in IFn :op :prim-invoke :form (prim-f arg*):fn An AST node representing the function to invoke :args A vector of AST nodes representing the args to the function :prim-interface The primitive interface in IFn that will be used :meta optional Map of metadata attached to the invoke :form :children [:fn :args]
# protocol-invokeNode for an invoke expression where the function is a protocol function var :op :protocol-invoke :form (proto-fn target arg*):protocol-fn An AST node representing the protocol function var to invoke :target An AST node representing the target of the protocol function call :args A vector of AST nodes representing the args to the protocol function :children [:protocol-fn :target :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 :loop-id Unique symbol identifying the enclosing loop target :children [:exprs]
# reifyNode for a reify* special-form expression :op :reify :form (reify* [interface*] method*):interfaces A set of the interfaces implemented by the generated type :class-name The generated class for the reify, should *never* be instantiated or used on instance? checks :methods A vector :method AST nodes representing the reify methods :children [:methods]
# setNode for a set literal with attached metadata and/or non literal elements :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 :val]
# static-callNode for a static method call :op :static-call :form (Class/method arg*):class The Class the static method belongs to :method The symbol name of the static method :args A vector of AST nodes representing the args to the method call :validated? optional true if the static method could be resolved at compile time :children [:args]
# static-fieldNode for a static field access :op :static-field :form Class/field:class The Class the static field belongs to :field The symbol name of the static field :assignable? optional true if the static field is set!able
# the-varNode for a var special-form expression :op :the-var :form (var var-name):var The Var object this expression refers to
# 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?):body Synthetic :do AST node (with :body? true) representing the body of this try expression :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 [:body :catches], [:body :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 fn/reify expression with attached metadata :op :with-meta :form Non quoted collection literal or fn/reify expression with attached metadata :meta An AST node representing the metadata of expression. The node will be either a :map node or a :const node with :type :map :expr The expression this metadata is attached to, :op is one of :vector, :map, :set, :fn or :reify :children [:meta :expr]