API for jvm
-
Full namespace name:
clojure.tools.analyzer.jvm
Overview
Analyzer for clojure code, extends tools.analyzer with JVM specific passes/forms
Types
type
Fields:
[e ast]
Protocols:
Interfaces:
Public Variables and Functions
function
Usage: (->ExceptionThrown e ast)
Positional factory function for class clojure.tools.analyzer.jvm.ExceptionThrown.
Source
function
Usage: (analyze form)
(analyze form env)
(analyze form env opts)
Analyzes a clojure form using tools.analyzer augmented with the JVM specific special ops
and returns its AST, after running #'run-passes on it.
If no configuration option is provides, analyze will setup tools.analyzer using the extension
points declared in this namespace.
If provided, opts should be a map of options to analyze, currently the only valid
options are :bindings and :passes-opts (if not provided, :passes-opts defaults to the
value of `default-passes-opts`).
If provided, :bindings should be a map of Var->value pairs that will be merged into the
default bindings for tools.analyzer, useful to provide custom extension points.
If provided, :passes-opts should be a map of pass-name-kw->pass-config-map pairs that
can be used to configure the behaviour of each pass.
E.g.
(analyze form env {:bindings {#'ana/macroexpand-1 my-mexpand-1}})
Source
function
Usage: (analyze+eval form)
(analyze+eval form env)
(analyze+eval form env {:keys [handle-evaluation-exception], :or {handle-evaluation-exception throw!}, :as opts})
Like analyze but evals the form after the analysis and attaches the
returned value in the :result field of the AST node.
If evaluating the form will cause an exception to be thrown, the exception
will be caught and wrapped in an ExceptionThrown object, containing the
exception in the `e` field and the AST in the `ast` field.
The ExceptionThrown object is then passed to `handle-evaluation-exception`,
which by defaults throws the original exception, but can be used to provide
a replacement return value for the evaluation of the AST.
Unrolls `do` forms to handle the Gilardi scenario.
Useful when analyzing whole files/namespaces.
Source
function
Usage: (analyze-ns ns)
(analyze-ns ns env)
(analyze-ns ns env opts)
Analyzes a whole namespace, returns a vector of the ASTs for all the
top-level ASTs of that namespace.
Evaluates all the forms.
Source
function
Usage: (create-var sym {:keys [ns]})
Creates a Var for sym and returns it.
The Var gets interned in the env namespace.
Source
var
Set of passes that will be run by default on the AST by #'run-passes
Source
var
Default :passes-opts for `analyze`
Source
function
Usage: (empty-env)
Returns an empty env map
Source
function
Usage: (macroexpand-1 form)
(macroexpand-1 form env)
If form represents a macro form or an inlineable function,returns its expansion,
else returns form.
Source
function
Usage: (macroexpand-all form)
(macroexpand-all form env)
(macroexpand-all form env opts)
Like clojure.walk/macroexpand-all but correctly handles lexical scope
Source
var
Clojure macros that are known to not alter namespaces
Source
function
Usage: (parse form env)
Extension to tools.analyzer/-parse for JVM special forms
Source
dynamic function
Usage: (run-passes ast)
Function that will be invoked on the AST tree immediately after it has been constructed,
by default runs the passes declared in #'default-passes, should be rebound if a different
set of passes is required.
Use #'clojure.tools.analyzer.passes/schedule to get a function from a set of passes that
run-passes can be bound to.
Source
var
Set of the special forms for clojure in the JVM
Source
jvm.utils
Public Variables and Functions
function
Usage: (box c)
If the argument is a primitive Class, returns its boxed equivalent,
otherwise returns the argument
Source
function
Usage: (convertible? c1 c2)
Returns true if it's possible to convert from c1 to c2
Source
multimethod
No usage documentation available
Takes a Symbol, String or Class and tires to resolve to a matching Class
Source
function
Usage: (numeric? c)
Returns true if the given class is numeric
Source
function
Usage: (prim-or-obj tag)
If the given Class is a primitive, returns that Class, otherwise returns Object
Source
var
Returns non-nil if the argument represents a primitive Class other than Void
Source
function
Usage: (subsumes? c1 c2)
Returns true if c2 is subsumed by c1
Source
function
Usage: (try-best-match tags methods)
Given a vector of arg tags and a collection of methods, tries to return the
subset of methods that match best the given tags
Source
function
Usage: (unbox c)
If the argument is a Class with a primitive equivalent, returns that,
otherwise returns the argument
Source
function
Usage: (wider-primitive from to)
Given two numeric primitive Classes, returns the wider one
Source
function
Usage: (wider-tag tags)
Given a collection of Classes returns the wider one
Source
function
Usage: (wider-tag* from to)
Given two Classes returns the wider one
Source
var
If the argument is a numeric primitive Class, returns a set of primitive Classes
that are narrower than the given one
Source