import ControlFlowNode from "@specs-feup/flow/flow/ControlFlowNode"; import BaseNode from "@specs-feup/flow/graph/BaseNode"; import Node from "@specs-feup/flow/graph/Node"; import { NodeCollection } from "@specs-feup/flow/graph/NodeCollection"; /** * A node that represents a function. A CFG subgraph may be associated * with it. * * Each FunctionNode must have a name that is unique in the graph. * You should mangle names in case of overloading or when you wish * to have multiple contexts of the same function as different nodes. */ declare namespace FunctionNode { const TAG = "__lara_flow__function_node"; const VERSION = "1"; class Class extends BaseNode.Class { #private; /** * @returns The name of the function. This name must be unique in the graph, * so it should be mangled if the use case permits overloading. */ get functionName(): string; /** * Changes the function name. This name must be unique in the graph, * so it should be mangled if the use case permits overloading. * * The graph's function map will be updated. * * @param name The new name of the function. * @returns Itself, for chaining. * @throws {} {@link LaraFlowError} if the new function name already * exists in the graph. This should be seen as a logic error and * should not be catched. Instead, ensure that no existing function * shares the same name by renaming or removing. */ renameFunction(name: string): this; /** * @returns The control flow nodes that belong to this function. */ get controlFlowNodes(): NodeCollection; /** * @returns The initial node of the function's CFG. This is the entry point * of the function. */ get cfgEntryNode(): ControlFlowNode.Class | undefined; /** * Sets the initial node of the function's CFG. This is the entry point * of the function. * * @param node The new entry node. */ set cfgEntryNode(node: ControlFlowNode.Class | undefined); /** * Registers the function in the graph, so that its name points * to this node. * * @throws {} {@link LaraFlowError} if the node is not part of a * {@link FlowGraph} or if another function with the same name is * already registered in the graph. */ register(): void; /** * Unregisters the function from the graph, removing its name from * the function map. * * @throws {} {@link LaraFlowError} if the node is not part of a * {@link FlowGraph}. */ unregister(): void; /** * @returns Whether this function is registered in the graph. * * @throws {} {@link LaraFlowError} if the node is not part of a * {@link FlowGraph}. */ isRegistered(): boolean; } class Builder implements Node.Builder { #private; /** * Initializing an existing node to be a FunctionNode will not * update the graph's function map. As such, use of * {@link FlowGraph.Class.addFunction} is strongly encouraged * instead. * * @param functionName The name of the function. This name must be * unique in the graph, so it should be mangled if the use case * permits overloading. */ constructor(functionName: string); buildData(data: BaseNode.Data): Data; buildScratchData(scratchData: BaseNode.ScratchData): ScratchData; } const TypeGuard: Node.TypeGuard; interface Data extends BaseNode.Data { [TAG]: { version: typeof VERSION; /** * The name of the function. This name must be unique in the graph, * so it should be mangled if the use case permits overloading. * * The field {@link BaseNode.Data.parent} is not used so as to give * the developer more flexibility in the decision of what constitutes * a parent-child relationship. If desired that the {@link ControlFlowNode} * is a direct child of its {@link FunctionNode}, one may iterate * over the graph's {@link ControlFlowNode | ControlFlowNodes} and * set {@link BaseNode.Data.parent} to the value of this field. */ functionName: string; /** * The initial node of the function's CFG. This is the entry point * of the function. */ cfgEntryNode: string | undefined; }; } interface ScratchData extends BaseNode.ScratchData { } } export default FunctionNode; //# sourceMappingURL=FunctionNode.d.ts.map