API for clojure.tools.analyzer.jvm - JVM-specific passes for tools.analyzer 0.3.1 (in development)


Full namespace name: clojure.tools.analyzer.jvm

Overview

Analyzer for clojure code, extends tools.analyzer with JVM specific passes/forms

Types



ExceptionThrown

type

    Fields: [e]
Protocols:
Interfaces:

Public Variables and Functions



->ExceptionThrown

function
Usage: (->ExceptionThrown e)
Positional factory function for class clojure.tools.analyzer.jvm.ExceptionThrown.
Source


analyze

function
Usage: (analyze form)
       (analyze form env)
       (analyze form env opts)
Returns an AST for the form that's compatible with what tools.emitter.jvm requires.

Binds tools.analyzer/{macroexpand-1,create-var,parse} to
tools.analyzer.jvm/{macroexpand-1,create-var,parse} and calls
tools.analyzer/analyzer on form.

If provided, opts should be a map of options to analyze, currently the only valid option
is :bindings.
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.

E.g.
(analyze form env {:bindings  {#'ana/macroexpand-1 my-mexpand-1}})

Calls `run-passes` on the AST.
Source


analyze'

function
Usage: (analyze' form)
       (analyze' form env)
       (analyze' form env opts)
Like `analyze` but runs cleanup on the AST
Source


analyze+eval

function
Usage: (analyze+eval form)
       (analyze+eval form env)
       (analyze+eval form env 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 the :result field will hold an ExceptionThrown instance
with the exception in the "e" field.

Useful when analyzing whole files/namespaces.
Source


analyze+eval'

function
Usage: (analyze+eval' form)
       (analyze+eval' form env)
       (analyze+eval' form env opts)
Like `analyze+eval` but runs cleanup on the AST
Source


butlast+last

function
Usage: (butlast+last s)
Returns same value as (juxt butlast last), but slightly more
efficient since it only traverses the input sequence s once, not
twice.
Source


create-var

function
Usage: (create-var sym {:keys [ns]})
Creates a Var for sym and returns it.
The Var gets interned in the env namespace.
Source


empty-env

function
Usage: (empty-env)
Returns an empty env map
Source


macroexpand-1

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


parse

multimethod
No usage documentation available
Extension to tools.analyzer/-parse for JVM special forms
Source


run-passes

dynamic function
Usage: (run-passes ast)
Applies the following passes in the correct order to the AST:
* uniquify
* add-binding-atom
* cleanup
* source-info
* elide-meta
* warn-earmuff
* collect
* jvm.box
* jvm.constant-lifter
* jvm.annotate-branch
* jvm.annotate-loops
* jvm.annotate-class-id
* jvm.annotate-internal-name
* jvm.annotate-methods
* jvm.fix-case-test
* jvm.clear-locals
* jvm.classify-invoke
* jvm.validate
* jvm.infer-tag
* jvm.annotate-tag
* jvm.validate-loop-locals
* jvm.analyze-host-expr
Source


specials

var

    
Set of the special forms for clojure in the JVM
Source

clojure.tools.analyzer.jvm.utils





Public Variables and Functions



box

function
Usage: (box c)
If the argument is a primitive Class, returns its boxed equivalent,
otherwise returns the argument
Source


convertible?

function
Usage: (convertible? c1 c2)
Returns true if it's possible to convert from c1 to c2
Source


maybe-class

var

    
Takes a Symbol, String or Class and tires to resolve to a matching Class
Source


numeric?

function
Usage: (numeric? c)
Returns true if the given class is numeric
Source


prim-or-obj

function
Usage: (prim-or-obj tag)
If the given Class is a primitive, returns that Class, otherwise returns Object
Source


primitive?

var

    
Returns non-nil if the argument represents a primitive Class other than Void
Source


subsumes?

function
Usage: (subsumes? c1 c2)
Returns true if c2 is subsumed by c1
Source


try-best-match

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


unbox

function
Usage: (unbox c)
If the argument is a Class with a primitive equivalent, returns that,
otherwise returns the argument
Source


wider-primitive

function
Usage: (wider-primitive from to)
Given two numeric primitive Classes, returns the wider one
Source


wider-tag

function
Usage: (wider-tag tags)
Given a collection of Classes returns the wider one
Source


wider-tag*

function
Usage: (wider-tag* from to)
Given two Classes returns the wider one
Source


wider-than

var

    
If the argument is a numeric primitive Class, returns a set of primitive Classes
that are narrower than the given one
Source
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.