View Source Spark.CodeHelpers (spark v1.1.44)

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.

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.