Liking cljdoc? Tell your friends :D

eastwood.copieddeps.dep1.clojure.tools.analyzer.passes

Utilities for pass scheduling

Utilities for pass scheduling
raw docstring

calculate-depsclj

(calculate-deps passes)

Takes a map of pass-name -> pass-info and adds to each pass-info :dependencies and :dependants info, which also contain the transitive dependencies

Takes a map of pass-name -> pass-info and adds to each pass-info :dependencies and
:dependants info, which also contain the transitive dependencies
raw docstring

collapseclj

(collapse state)

compile-passesclj

(compile-passes passes walk info)

desugar-depsclj

(desugar-deps passes)

Takes a map of pass-name -> pass deps and puts the :after :affects and :before passes in the appropriate pass :depends

Takes a map of pass-name -> pass deps and puts the :after :affects and :before passes
in the appropriate pass :depends
raw docstring

groupclj

(group state)

Takes a scheduler state and returns a vector of three elements (or nil):

  • the :walk of the current group
  • a vector of consecutive passes that can be collapsed in a single pass (the current group)
  • the remaining scheduler state

E.g. given: [{:walk :any .. } {:walk :pre ..} {:walk :post ..} {:walk :pre ..}] it will return: [:pre [{:walk :any ..} {:walk :pre ..}] [{:walk :post ..} {:walk :pre ..}]]

Takes a scheduler state and returns a vector of three elements (or nil):
* the :walk of the current group
* a vector of consecutive passes that can be collapsed in a single pass (the current group)
* the remaining scheduler state

E.g. given:
[{:walk :any .. } {:walk :pre ..} {:walk :post ..} {:walk :pre ..}]
it will return:
[:pre [{:walk :any ..} {:walk :pre ..}] [{:walk :post ..} {:walk :pre ..}]]
raw docstring

maybe-looping-passclj

(maybe-looping-pass free passes)

satisfies-affected?clj

(satisfies-affected? {:keys [affects walk]} passes)

scheduleclj

(schedule passes & [opts])

Takes a set of Vars that represent tools.analyzer passes and returns a function that takes an AST and applies all the passes and their dependencies to the AST, trying to compose together as many passes as possible to reduce the number of full tree traversals.

Each pass must have a :pass-info element in its Var's metadata and it must point to a map with the following parameters (:before, :after, :affects and :state are optional):

  • :after a set of Vars, the passes that must be run before this pass
  • :before a set of Vars, the passes that must be run after this pass
  • :depends a set of Vars, the passes this pass depends on, implies :after
  • :walk a keyword, one of: - :none if the pass does its own tree walking and cannot be composed with other passes - :post if the pass requires a postwalk and can be composed with other passes - :pre if the pass requires a prewalk and can be composed with other passes - :any if the pass can be composed with other passes in both a prewalk or a postwalk
  • :affects a set of Vars, this pass must be the last in the same tree traversal that all the specified passes must partecipate in This pass must take a function as argument and return the actual pass, the argument represents the reified tree traversal which the pass can use to control a recursive traversal, implies :depends
  • :state a no-arg function that should return an atom holding an init value that will be passed as the first argument to the pass (the pass will thus take the ast as the second parameter), the atom will be the same for the whole tree traversal and thus can be used to preserve state across the traversal An opts map might be provided, valid parameters:
  • :debug? if true, returns a vector of the scheduled passes rather than the concrete function
Takes a set of Vars that represent tools.analyzer passes and returns a function
that takes an AST and applies all the passes and their dependencies to the AST,
trying to compose together as many passes as possible to reduce the number of
full tree traversals.

Each pass must have a :pass-info element in its Var's metadata and it must point
to a map with the following parameters (:before, :after, :affects and :state are
optional):
* :after    a set of Vars, the passes that must be run before this pass
* :before   a set of Vars, the passes that must be run after this pass
* :depends  a set of Vars, the passes this pass depends on, implies :after
* :walk     a keyword, one of:
              - :none if the pass does its own tree walking and cannot be composed
                      with other passes
              - :post if the pass requires a postwalk and can be composed with other
                      passes
              - :pre  if the pass requires a prewalk and can be composed with other
                      passes
              - :any  if the pass can be composed with other passes in both a prewalk
                      or a postwalk
* :affects  a set of Vars, this pass must be the last in the same tree traversal that all
            the specified passes must partecipate in
            This pass must take a function as argument and return the actual pass, the
            argument represents the reified tree traversal which the pass can use to
            control a recursive traversal, implies :depends
* :state    a no-arg function that should return an atom holding an init value that will be
            passed as the first argument to the pass (the pass will thus take the ast
            as the second parameter), the atom will be the same for the whole tree traversal
            and thus can be used to preserve state across the traversal
An opts map might be provided, valid parameters:
* :debug?   if true, returns a vector of the scheduled passes rather than the concrete
            function
raw docstring

schedule*clj

(schedule* state passes)

schedule-passesclj

(schedule-passes passes)

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close