Function Graph Overview
    Preparing search index...

    Interface BasicBlock

    The BasicBlock is used in the process of building a CFG. It is meant to represent a "statement" or "block" of source-code.

    It allows us to abstract over individual CFG nodes and work with something that's closer to the source code.

    BasicBlockss can be nested, just like code structures. If we have a BasicBlock representing an if statement, it will have BasicBlocks for the individual statements nested within it.

    Each BasicBlock can span many CFG nodes.

    interface BasicBlock {
        entry: string;
        exit: null | string;
        continues?: ExitStatement[];
        breaks?: ExitStatement[];
        labels?: Map<string, string>;
        gotos?: Goto[];
        functionExits?: string[];
    }
    Index

    Properties

    entry

    entry: string

    The ID of the entry node.

    exit: null | string

    Normal exit node, if exists.

    This would be the next statement after the current one in the source code. For control-flow statements (like return, break, etc.) we won't have an exit, as the control-flow doesn't reach it. Similarly, blocks ending with a flow-altering statement won't have an exit.

    continues?: ExitStatement[]

    The active continue nodes within this block.

    A continue is active if it's target is outside the current block.

    breaks?: ExitStatement[]

    The active break nodes within this block.

    labels?: Map<string, string>

    All the labels within this block.

    The mapping is from the label's name to the labeled node.

    gotos?: Goto[]

    All the active gotos within this block.

    Active gotos are one that were not yet resolved.

    functionExits?: string[]

    All the function-exit statements within the block. As the CFG is a single-function graph, function-exit statements are never resolved within it. This includes things like return and throw and raise.