Pathex.Builder.Code (Pathex v1.3.0) View Source

Structure for working with closures as ASTs

Fields

  • vars - list of variables/arguments
  • code - body of a closure

Link to this section Summary

Functions

Converts code structures to quoted fn-statement with multiple clauses

Simply creates new Code structure

Converts quoted code with list of quoted vars to piped %Code{} with first arg piping into quoted code

Converts code structure to quoted def-statement

Converts code structure to quoted fn-closure

Link to this section Types

Specs

code_type() :: :one_arg_pipe

Specs

t() :: %Pathex.Builder.Code{
  code: Macro.t(),
  vars: [{atom(), list(), atom() | nil}] | []
}

Link to this section Functions

Specs

multiple_to_fn([{atom(), t()}] | %{required(atom()) => t()}) :: Macro.t()

Converts code structures to quoted fn-statement with multiple clauses

Specs

new(Macro.t(), [Macro.t()]) :: t()

Simply creates new Code structure

Link to this function

new_arg_pipe(code, args)

View Source

Specs

new_arg_pipe(Macro.t(), [Macro.t()]) :: t()

Converts quoted code with list of quoted vars to piped %Code{} with first arg piping into quoted code

Specs

to_def(t(), atom()) :: Macro.t()

Converts code structure to quoted def-statement

Specs

to_fn(t()) :: Macro.t()

Converts code structure to quoted fn-closure