Represents a Compilation Unit, encapsulating the information necessary for analyzing a single Tact project.

Constructors

Properties

The AST of the project.

callGraph: CallGraph
contracts: Map<ContractIdx, Contract>

A mapping from unique IDs of contract entries to contracts.

functions: Map<CFGIdx, CFG>

A mapping from unique IDs of free functions to their CFGs.

imports: ImportGraph

A graph showing the connections between project files.

projectName: ProjectName

The name of the project this Compilation Unit belongs to.

Methods

  • Looks for a CFG with a specific index.

    Parameters

    Returns undefined | CFG

    Found CFG or undefined if not found.

  • Looks for a CFG for a function node with a specific name.

    Parameters

    Returns undefined | CFG

    Found CFG or undefined if not found.

  • Performs a fold operation over all CFGs in the Compilation Unit.

    Type Parameters

    • T

    Parameters

    • init: T

      The initial value of the accumulator.

    • callback: ((acc: T, cfg: CFG) => T)

      A function that takes the current accumulator and a CFG, and returns a new accumulator value.

        • (acc, cfg): T
        • Parameters

          Returns T

    Returns T

    The final accumulated value.

  • Iterates over all CFGs in a Compilation Unit, and applies a callback to each basic block in every CFG.

    Parameters

    • astStore: TactASTStore

      The store containing the AST nodes.

    • callback: ((cfg: CFG, node: BasicBlock, stmt: AstStatement) => void)

      The function to apply to each BB within each CFG.

        • (cfg, node, stmt): void
        • Parameters

          Returns void

    Returns void

  • Iterates over all CFGs in a Compilation Unit, and applies a callback to CFG.

    Parameters

    • callback: ((cfg: CFG) => void)

      The function to apply to each CFG.

        • (cfg): void
        • Parameters

          Returns void

    • __namedParameters: Partial<{
          includeStdlib: boolean;
      }> = {}

    Returns void