View Source Hologram.Compiler.Normalizer (hologram v0.2.0)

Summary

Functions

Normalizes Elixir AST by ensuring that

Functions

normalize(ast)

Normalizes Elixir AST by ensuring that:

  • single expression blocks are wrapped in block tuple
  • alias atoms are wrapped in aliases tuple
  • unquote fragments are expanded

Examples

iex> ast = Code.string_to_quoted!("cond do true -> 123 end")
{:cond, [line: 1], [[do: [{:->, [line: 1], [[true], 987]}]]]}
iex> normalize(ast)
{:cond, [line: 1], [[do: [{:->, [line: 1], [[true], {:__block__, [], [987]}]}]]]}