expug v0.7.3 Expug.Transformer

Transforms a node after compilation.

Summary

Functions

Finds out what clauses can follow a given clause

Closes all a given next clause in the given children

Closes all possible clauses in the given children

Get the prelude of a given node

Transforms a node

Functions

clause_after(arg1)

Finds out what clauses can follow a given clause.

iex> Expug.Transformer.clause_after("if")
["else"]

iex> Expug.Transformer.clause_after("try")
["catch", "rescue", "after"]

iex> Expug.Transformer.clause_after("cond")
[] # nothing can follow cond
close_clause(children, next)

Closes all a given next clause in the given children.

Returns a tuple of {status, children} where :status depicts what happened on the first node given to it. :multi means it was matched for a multi-clause, :single means it was matched for a single clause, :ok otherwise.

close_clauses(children)

Closes all possible clauses in the given children.

prelude(arg1)

Get the prelude of a given node

iex> Expug.Transformer.prelude(%{value: "if foo"})
"if"

iex> Expug.Transformer.prelude(%{value: "case derp"})
"case"

iex> Expug.Transformer.prelude(%{value: "1 + 2"})
nil
transform(node)

Transforms a node.