Juggernaut.Operators.ReturnValue (Juggernaut v0.4.0)

Copy Markdown View Source

Replaces each return path of a def, defp or fn clause with a constant of its shape (Mutare return_value):

tailemptysentinel
numeric (a + b, div(a, b), -n)01
string concatenation (a <> b)"""juggernaut"
list expression (a ++ b, a -- b)[][:juggernaut]
anything elsenil:juggernaut

Not a return path: literals (their families own them; bare atoms are eligible), nil, boolean expressions (conditional), control forms (each branch is one), raising calls, and every tail of a unit-returning function (all paths :ok or nil, no @impl). A replacement equal to the original is omitted, and one another family already makes at the same node is dropped by the mutator.