@eagleoutice/flowr - v2.16.3
    Preparing search index...
    ControlFlow: {
        alwaysExits(
            this: void,
            info: DataflowCfgInformation,
            context?: readonly ControlDependency[],
        ): boolean;
        branchesTo(
            this: void,
            graph: DataflowGraph,
            from: DataflowCfgInformation,
            target: NodeId,
            cd: ControlDependency,
        ): void;
        canComplete(this: void, info: DataflowCfgInformation): boolean;
        continuesWith(
            this: void,
            graph: DataflowGraph,
            from: DataflowCfgInformation,
            next: NodeId,
        ): void;
        entryOf(this: void, info: DataflowCfgInformation): NodeId;
        inSequence(
            this: void,
            graph: DataflowGraph,
            parts: readonly (DataflowCfgInformation | undefined)[],
            last?: NodeId,
        ): NodeId | undefined;
        isExpression(this: void, graph: DataflowGraph, id: NodeId): boolean;
        isStatement(this: void, graph: DataflowGraph, id: NodeId): boolean;
        jumpsTo(
            this: void,
            graph: DataflowGraph,
            from: DataflowCfgInformation,
            kind: ExitPointType,
            target: NodeId,
        ): void;
        name: "ControlFlow";
        outsidePromises<Data extends { cds?: readonly ControlDependency[] }>(
            this: void,
            data: Data,
        ): Data;
        picksOneOf(
            this: void,
            graph: DataflowGraph,
            parts: readonly (DataflowCfgInformation | undefined)[],
            from: number,
            joinsAt: NodeId,
            hasDefault: boolean,
        ): NodeId | undefined;
        promise(
            this: void,
            graph: DataflowGraph,
            promise: DataflowCfgInformation | undefined,
            forcing: Ternary,
            holder: NodeId,
        ): ExitPoint[];
        withinPromise<Data extends { cds?: readonly ControlDependency[] }>(
            this: void,
            data: Data,
            holder: NodeId,
        ): Data;
    } = ...

    Records the control flow of a program in the DataflowGraph while the dataflow analysis walks it. The ControlFlowGraph is a view on what is recorded here.

    The control flow is modeled in post-order: everything a construct is made of runs before the construct itself, so its own vertex is where its parts join again and where it is left.

    Type Declaration

    • alwaysExits: function
      • Whether the subtree always jumps away instead of being left normally, i.e. whether a non-default exit point happens in every branch. The control dependencies in context (like a promise's) hold for the whole subtree.

        Parameters

        Returns boolean

        ControlFlow#canComplete|canComplete() - for whether it can be left normally at all

        { break }            # always exits
        { if(u) break } # only maybe
    • branchesTo: function
    • canComplete: function
    • continuesWith: function
    • entryOf: function
    • inSequence: function
    • isExpression: function
      • Whether the node runs as part of a larger expression instead of as a statement of its own.

        Parameters

        Returns boolean

        ControlFlow#isStatement|isStatement() - for the other kind

        print(x + 1) # `x + 1` and `x` are expressions, the call is a statement
        
    • isStatement: function
      • Whether the node runs as a statement of the program instead of as part of a larger expression. Assignments count as statements wherever they stand.

        Parameters

        Returns boolean

        ControlFlow#isExpression|isExpression() - for the other kind

        print(x + 1) # the call is a statement, `x + 1` and `x` are expressions
        
    • jumpsTo: function
    • Readonlyname: "ControlFlow"
    • outsidePromises: function
      • A function defined within a promise: forcing the promise only creates it, its body runs once it is called, so neither the definition nor its body depend on the call holding the promise.

        Type Parameters

        Parameters

        • this: void
        • data: Data

        Returns Data

        f(function() print(1)) # the print runs when `f` calls its argument, which `f(...)` itself does not decide
        
    • picksOneOf: function
      • The parts before from run in sequence, the ones after it are alternatives of which at most one runs. Whichever one it is, control joins on joinsAt.

        Parameters

        • this: void
        • graph: DataflowGraph

          the graph to record in

        • parts: readonly (DataflowCfgInformation | undefined)[]

          the arguments of the call, in the order they run

        • from: number

          the index the alternatives start at

        • joinsAt: NodeId

          the call the alternatives belong to

        • hasDefault: boolean

          whether one alternative runs when none of the others matched

        Returns NodeId | undefined

        the node control flow enters the call at

        switch(k, a = 1, b = 2) # `k`, then one arm, then the switch
        
    • promise: function
      • The jumps within a promise, an argument or default R evaluates only if holder forces it. A jump

        • never runs if the promise is Ternary#Never|never forced, so control resumes at holder,
        • leaves whenever reached if it is Ternary#Always|always forced,
        • otherwise stays an exit under a byPromise dependency on holder, and control may resume at holder as well, until FunctionSemantics.settleJumpsInPromises settles it.

        Parameters

        Returns ExitPoint[]

        the exit points the holder takes over from the promise

        g(return(1))           # whether this returns is up to `g`
        function(x = break) x # the `break` runs where `x` is first used
    • withinPromise: function
      • What is handed to holder runs only once holder forces it, so it is analyzed under that control dependency: a definition within a promise may not happen, and what it would overwrite stays visible.

        Type Parameters

        Parameters

        Returns Data

        ControlFlow#promise|promise() - for the jumps within a promise

        g(x <- 2) # `x` is 2 afterwards only if `g` forces its argument
        

    control-flow