View Source Spark.CodeHelpers (spark v2.2.37)

Helpers for meta programming around code and code snippets

Summary

Functions

Given a section of Elixir AST, generate a hash of the code to help with generating unique names.

Lift anonymous and captured functions.

Copy of Macro.prewalk/2 w/ a branch accumulator

Copy of Macro.prewalk/3 w/ a branch accumulator

A copy of the corresponding Macro.traverse function that has a separate accumulator that only goes down each branch, only for pre

Functions

@spec code_identifier(Macro.t()) :: binary()

Given a section of Elixir AST, generate a hash of the code to help with generating unique names.

Link to this function

lift_functions(value, key, caller)

View Source
@spec lift_functions(Macro.t(), atom(), Macro.Env.t()) :: Macro.t()

Lift anonymous and captured functions.

Acts as an AST transformer to allow these kinds of functions to be added in the AST:

In the case of captured functions, it ensures they are all captured remote functions (ie calls with both the module and function name present) - this often requires the definition of a new public function on the target module.

In the case of anonymous functions, it converts them into a new public function on the module and returns a (remote) function capture much like that of above.

Copy of Macro.prewalk/2 w/ a branch accumulator

Link to this function

prewalk(ast, acc, branch_acc, fun)

View Source

Copy of Macro.prewalk/3 w/ a branch accumulator

Link to this function

traverse(ast, acc, branch_acc, pre, post)

View Source

A copy of the corresponding Macro.traverse function that has a separate accumulator that only goes down each branch, only for pre