Macro.to_string

You're seeing just the function to_string, go back to Macro module for more information.
Link to this function

to_string(tree, fun \\ fn _ast, string -> string end)

View Source

Specs

to_string(t(), (t(), String.t() -> String.t())) :: String.t()

Converts the given expression AST to a string.

The given fun is called for every node in the AST with two arguments: the AST of the node being printed and the string representation of that same node. The return value of this function is used as the final string representation for that AST node.

This function discards all formatting of the original code.

Examples

iex> Macro.to_string(quote(do: foo.bar(1, 2, 3)))
"foo.bar(1, 2, 3)"

iex> Macro.to_string(quote(do: 1 + 2), fn
...>   1, _string -> "one"
...>   2, _string -> "two"
...>   _ast, string -> string
...> end)
"one + two"