Reach.Smell.Helpers (Reach v2.8.1)

Copy Markdown View Source

Shared helpers for smell checks including loop detection, statement pairs, and callbacks.

Summary

Functions

Returns top-level statements from a function body.

Extracts the callback fn body nodes from an Enum call.

Returns true when an AST node is an identity anonymous function.

Returns true if node is inside an accumulator-carrying loop (reduce/scan).

Returns true if node is inside a loop body (reduce/map/for/recursion).

Returns true if the function contains a self-recursive call.

Returns a deterministic source-order key for an IR node.

Returns adjacent top-level statement pairs from a function body.

Functions

ast_modules_in_file(ast)

body_statements(function)

Returns top-level statements from a function body.

callback_body(arg1)

Extracts the callback fn body nodes from an Enum call.

function_defs(project)

identity_fn?(arg1)

Returns true when an AST node is an identity anonymous function.

inside_accumulator?(node, function)

Returns true if node is inside an accumulator-carrying loop (reduce/scan).

inside_loop?(node, function)

Returns true if node is inside a loop body (reduce/map/for/recursion).

location(node)

recursive?(function)

Returns true if the function contains a self-recursive call.

source_location(arg1)

source_sort_key(node)

Returns a deterministic source-order key for an IR node.

statement_pairs(function)

Returns adjacent top-level statement pairs from a function body.