CfgVertex: {
    equal(this: void, a: CfgVertex, b: CfgVertex): boolean;
    fromExitId(this: void, exitId: NodeId): NodeId;
    getBasicBlockElements(
        this: void,
        vertex: CfgBasicBlockVertex,
    ): readonly (CfgStatementVertex | CfgExpressionVertex | CfgMarkerVertex)[];
    getCallTargets(
        this: void,
        vertex: undefined | CfgVertex,
    ): undefined | Set<NodeId>;
    getChildren(
        this: void,
        vertex: undefined | CfgVertex,
    ): undefined | NodeId[];
    getEnd(this: void, vertex: undefined | CfgVertex): undefined | NodeId[];
    getId<T extends undefined | CfgVertex>(
        this: void,
        vertex: T,
    ): T extends undefined ? undefined | NodeId : NodeId;
    getMid(this: void, vertex: CfgVertex): undefined | NodeId[];
    getRootId(this: void, vertex: CfgVertex): NodeId;
    getType(this: void, vertex: CfgVertex): CfgVertexType;
    isBlock(
        this: void,
        vertex: undefined | CfgVertex,
    ): vertex is CfgBasicBlockVertex;
    isExpression(
        this: void,
        vertex: undefined | CfgVertex,
    ): vertex is CfgExpressionVertex;
    isMarker(
        this: void,
        vertex: undefined | CfgVertex,
    ): vertex is CfgMarkerVertex;
    isStatement(
        this: void,
        vertex: undefined | CfgVertex,
    ): vertex is CfgStatementVertex;
    makeBlock(
        this: void,
        id: NodeId,
        elems: readonly (
            CfgStatementVertex
            | CfgExpressionVertex
            | CfgMarkerVertex
        )[],
    ): CfgBasicBlockVertex;
    makeExitMarker(this: void, id: NodeId): CfgMarkerVertex;
    makeExpression(
        this: void,
        id: NodeId,
        __namedParameters?: {
            callTargets?: Set<NodeId>;
            children?: NodeId[];
            end?: NodeId[];
            mid?: NodeId[];
        },
    ): CfgExpressionVertex;
    makeExpressionWithEnd(
        this: void,
        id: NodeId,
        __namedParameters?: {
            callTargets?: Set<NodeId>;
            children?: NodeId[];
            mid?: NodeId[];
        },
    ): CfgExpressionVertex;
    makeExprOrStm(
        this: void,
        id: NodeId,
        type: Statement | Expression,
        __namedParameters?: {
            callTargets?: Set<NodeId>;
            children?: NodeId[];
            end?: NodeId[];
            mid?: NodeId[];
        },
    ): CfgStatementVertex
    | CfgExpressionVertex;
    makeMarker(this: void, id: NodeId, rootId: NodeId): CfgMarkerVertex;
    makeStatement(
        this: void,
        id: NodeId,
        __namedParameters?: {
            callTargets?: Set<NodeId>;
            children?: NodeId[];
            end?: NodeId[];
            mid?: NodeId[];
        },
    ): CfgStatementVertex;
    makeStatementWithEnd(
        this: void,
        id: NodeId,
        __namedParameters?: {
            callTargets?: Set<NodeId>;
            children?: NodeId[];
            mid?: NodeId[];
        },
    ): CfgStatementVertex;
    mapCallTargets(
        this: void,
        vertex: CfgStatementVertex | CfgExpressionVertex,
        mapFn: (targets: undefined | Set<NodeId>) => Set<NodeId>,
    ): void;
    setBasicBlockElements(
        this: void,
        vertex: CfgBasicBlockVertex,
        elems: readonly (
            CfgStatementVertex
            | CfgExpressionVertex
            | CfgMarkerVertex
        )[],
    ): void;
    setCallTargets(
        this: void,
        vertex: CfgStatementVertex | CfgExpressionVertex,
        callTargets: Set<NodeId>,
    ): void;
    setEnd(
        this: void,
        vertex: CfgStatementVertex | CfgExpressionVertex,
        endMarkers: undefined | NodeId[],
    ): void;
    setMid(
        this: void,
        vertex: CfgStatementVertex | CfgExpressionVertex,
        midMarkers: undefined | NodeId[],
    ): void;
    toBasicBlockId<Id extends NodeId>(this: void, id: Id): `bb-${Id}`;
    toExitId<Id extends NodeId>(this: void, id: Id): `${Id}-e`;
    typeToString(this: void, type: CfgVertexType): string;
    unpackRootId(this: void, vertex: CfgMarkerVertex): NodeId;
}

Helper object for CfgVertex - a vertex in the ControlFlowGraph that may have markers attached to it (e.g., for function calls).

Type declaration

  • equal:function
  • fromExitId:function
    • Converts the given id from a canonical end marker lift to the original id (i.e., it removes '-end' as a suffix if it is present).

      Parameters

      Returns NodeId

      CfgVertex#toExitId|toExitId() - for a way to convert the given id to a canonical end marker lift (i.e., it adds '-end' as a suffix)

  • getBasicBlockElements:function
  • getCallTargets:function
  • getChildren:function
  • getEnd:function
    • Get the ids of the mid-markers attached to this vertex, which should directly relate to the AST nodes of the mid markers.

      Parameters

      Returns undefined | NodeId[]

      • CfgVertex#getMid|getMid() - for a way to get the ids of the mid-markers attached to this vertex
      • CfgVertex#setEnd|setEnd() - for a way to set the ids of the end-markers attached to this vertex
  • getId:function
    • Get the id of the given vertex, which should directly relate to the AST node.

      Type Parameters

      Parameters

      • this: void
      • vertex: T

      Returns T extends undefined ? undefined | NodeId : NodeId

      const vertex: CfgVertex = CfgVertex.makeExpr('node-1')
      console.log(CfgVertex.getId(vertex)); // Output: 'node-1'
      • CfgVertex#getType|getType() - for a way to get the type of a vertex
      • CfgVertex#getRootId|getRootId() - for a way to get the root id of a vertex
  • getMid:function
  • getRootId:function
    • Get the root id of a vertex, i.e., the id of the AST node it corresponds to. For normal vertices, this is the same as the id of the vertex itself, for end marker vertices, this is the root id stored in the vertex.

      Parameters

      Returns NodeId

      CfgVertex#unpackRoot|unpackRoot() - for a way to unpack the root id of a marker vertex

  • getType:function
    • Get the type of the given vertex.

      Parameters

      Returns CfgVertexType

      const vertex: CfgVertex = CfgVertex.makeExpr('node-1')
      console.log(CfgVertex.getType(vertex)); // Output: CfgVertexType.Expression
      • CfgVertex#isExpression|isExpression(), CfgVertex#isStatement|isStatement(), CfgVertex#isMarker|isMarker(), CfgVertex#isBlock|isBlock() - for ways to check the type of a vertex against a specific type instead of getting the type and checking it against a specific type
      • CfgVertex#getId|getId() - for a way to get the id of a vertex
      • CfgVertex#typeToString|typeToString() - for a way to convert the type of a vertex to a string for easier debugging and visualization
  • isBlock:function
  • isExpression:function
    • Check whether the given vertex is an expression vertex.

      Parameters

      Returns vertex is CfgExpressionVertex

      • CfgVertex#makeExpression|makeExpression() - for a way to create expression vertices
      • CfgVertex#getType|getType() - for a way to get the type of a vertex instead of checking against a given type
  • isMarker:function
    • Check whether the given vertex is an end marker vertex.

      Parameters

      Returns vertex is CfgMarkerVertex

      • CfgVertex#makeMarker|makeMarker() - for a way to create end marker vertices
      • CfgVertex#getType|getType() - for a way to get the type of a vertex instead of checking against a given type
  • isStatement:function
    • Check whether the given vertex is a statement vertex.

      Parameters

      Returns vertex is CfgStatementVertex

      • CfgVertex#makeStatement|makeStatement() - for a way to create statement vertices
      • CfgVertex#getType|getType() - for a way to get the type of a vertex instead of checking against a given type
  • makeBlock:function
  • makeExitMarker:function
  • makeExpression:function
    • Create a new expression vertex with the given id, children, call targets, and markers.

      Parameters

      • this: void
      • id: NodeId

        the id of the vertex, which should directly relate to the AST node

      • __namedParameters: {
            callTargets?: Set<NodeId>;
            children?: NodeId[];
            end?: NodeId[];
            mid?: NodeId[];
        } = {}

      Returns CfgExpressionVertex

      CfgVertex#isExpression|isExpression() - for a way to check whether a vertex is an expression vertex

  • makeExpressionWithEnd:function
    • A convenience function to create a new expression vertex with a canonical end marker (CfgVertex#toExitId|toExitId()) based on the given id and the given id as root id for the end marker.

      Parameters

      • this: void
      • id: NodeId

        the id of the vertex, which should directly relate to the AST node

      • __namedParameters: { callTargets?: Set<NodeId>; children?: NodeId[]; mid?: NodeId[] } = {}

      Returns CfgExpressionVertex

      • CfgVertex#makeExpression|makeExpression() - for a way to create expression vertices with a custom end marker
      • CfgVertex#makeExitMarker|makeExitMarker() - for a helper function to create end marker vertices with a canonical id#
      • CfgVertex#toExitId|toExitId() - for a way to convert the given id to a canonical end marker id
  • makeExprOrStm:function
  • makeMarker:function
    • Create a new marker vertex with the given id, root id, children, and call targets.

      Parameters

      • this: void
      • id: NodeId

        the id of the vertex, which should directly relate to the AST node

      • rootId: NodeId

        the id of the AST node this end marker corresponds to

      Returns CfgMarkerVertex

      • CfgVertex#isMarker|isMarker() - for a way to check whether a vertex is an end marker vertex
      • CfgVertex#getRootId|getRootId() - for a way to get the root id of an end marker vertex
      • CfgVertex#makeExitMarker|makeExitMarker() - for a helper function to create end marker vertices with a canonical id
  • makeStatement:function
    • Create a new statement vertex with the given id, children, call targets, and markers.

      Parameters

      • this: void
      • id: NodeId

        the id of the vertex, which should directly relate to the AST node

      • __namedParameters: {
            callTargets?: Set<NodeId>;
            children?: NodeId[];
            end?: NodeId[];
            mid?: NodeId[];
        } = {}

      Returns CfgStatementVertex

      CfgVertex#isStatement|isStatement() - for a way to check whether a vertex is a statement vertex

  • makeStatementWithEnd:function
    • A convenience function to create a new statement vertex with a canonical end marker (CfgVertex#toExitId|toExitId()) based on the given id and the given id as root id for the end marker.

      Parameters

      • this: void
      • id: NodeId

        the id of the vertex, which should directly relate to the AST node

      • __namedParameters: { callTargets?: Set<NodeId>; children?: NodeId[]; mid?: NodeId[] } = {}

      Returns CfgStatementVertex

      • CfgVertex#makeExpression|makeExpression() - for a way to create expression vertices with a custom end marker
      • CfgVertex#makeExitMarker|makeExitMarker() - for a helper function to create end marker vertices with a canonical id#
      • CfgVertex#toExitId|toExitId() - for a way to convert the given id to a canonical end marker id
  • mapCallTargets:function
    • Map the call targets of a statement or expression vertex, which links all targets of this call, to new call targets using the given mapping function.

      Parameters

      Returns void

      • CfgVertex#getCallTargets|getCallTargets() - for a way to get the call targets of a statement or expression vertex
      • CfgVertex#setCallTargets|setCallTargets() - for a way to set the call targets of a statement or expression vertex to new call targets
  • setBasicBlockElements:function
  • setCallTargets:function
    • Sets in-place Set the call targets of a statement or expression vertex, which links all targets of this call.

      Parameters

      Returns void

      • CfgVertex#getCallTargets|getCallTargets() - for a way to get the call targets of a statement or expression vertex
      • CfgVertex#mapCallTargets|mapCallTargets() - for a way to map the call targets of a statement or expression vertex to new call targets
  • setEnd:function
  • setMid:function
  • toBasicBlockId:function
  • toExitId:function
    • Converts the given id to a canonical, end marker lift (i.e., it adds '-end' as a suffix).

      Type Parameters

      Parameters

      • this: void
      • id: Id

      Returns `${Id}-e`

      CfgVertex#fromExitId|fromExitId() - for a way to convert the given id from a canonical end marker lift to the original id (i.e., it removes '-end' as a suffix if it is present)

  • typeToString:function
  • unpackRootId:function
    • Unpack the root id of a marker vertex, i.e., get the root id stored in the vertex or derive it from the canonical id if it is not explicitly stored.

      Parameters

      Returns NodeId

      CfgVertex#getRootId|getRootId() - for a way to get the root id of a vertex, which uses this function for marker vertices