ExDNA.AST.ClauseGrouper (ExDNA v1.5.0)

Copy Markdown View Source

Groups consecutive function clauses with the same name/arity into synthetic compound nodes so the fingerprinter can detect duplicated multi-clause functions.

Also groups delegation wrappers with their target clause. A delegation is when a lower-arity clause simply calls the same function with extra default arguments:

def fetch(id), do: fetch(id, [])
def fetch(id, opts) do ... end

These are grouped into a single __ex_dna_grouped_def__ block so the fingerprinter can detect duplicated wrapper+body patterns across modules.

Summary

Functions

Walk the AST and group consecutive function clauses inside module bodies.

Functions

group(ast)

@spec group(Macro.t()) :: Macro.t()

Walk the AST and group consecutive function clauses inside module bodies.