View Source FreeVarAnalysis (Chorex v0.8.4)
Free variable analysis for Elixir expressions
Summary
Functions
Collect all variables mentioned in some syntax, free or otherwise.
Return all variables that are free in an expression.
Types
@type ast() :: any()
Functions
Collect all variables mentioned in some syntax, free or otherwise.
iex> all_vars(quote do: x) |> Enum.map(&elem(&1, 0)) [:x] iex> all_vars(quote do: fn x -> x + 1 end) |> Enum.map(&elem(&1, 0)) [:x] iex> all_vars(quote do: fn x -> x + y end) |> Enum.map(&elem(&1, 0)) [:x, :y]
Return all variables that are free in an expression.
iex> freevars(quote do: fn x -> {^x, ^y, } = {1, 2, 3} end) |> Enum.map(&elem(&1, 0)) [:y]