• Recursively iterates over each statement in an ASTNode and applies a callback to each statement.

    Type Parameters

    • T

    Parameters

    • node: AstNode

      The node to traverse.

    • callback: ((acc: T, stmt: AstStatement) => T)

      The callback function to apply to each statement, also passes the accumulator.

    • acc: T

      The initial value of the accumulator.

    • flatStmts: Partial<{
          flatStmts: boolean;
      }> = {}

      If true, only traverse statements at the current level without going into nested statements.

    Returns T

    The final value of the accumulator after processing all statements.