Juggernaut.Mutator.Tails (Juggernaut v0.4.0)

Copy Markdown View Source

Return paths of a function body, for the return_value family.

The tail of a block is its last expression; the tail of if, unless, case, cond, receive, with and try is the tail of each branch (a try's after is not a return path; an if without else returns nil; an else-less with returns its unmatched value, which is no literal). A function is unit-returning when every return path of every clause is literally :ok or nil, or raises.

Summary

Functions

Whether node is a control form whose branches are the return paths.

The return paths of body.

Whether every return path of bodies is :ok, nil or a raise.

The values of key in a do-block keyword list.

Functions

control?(arg1)

@spec control?(Macro.t()) :: boolean()

Whether node is a control form whose branches are the return paths.

tails(node)

@spec tails(Macro.t()) :: [Macro.t()]

The return paths of body.

unit?(bodies)

@spec unit?([Macro.t()]) :: boolean()

Whether every return path of bodies is :ok, nil or a raise.

values(opts, key)

@spec values(term(), atom()) :: [Macro.t()]

The values of key in a do-block keyword list.