@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
57 lines (56 loc) • 4.16 kB
TypeScript
import type { RAstNodeBase, Location, NoInfo } from '../model';
import { RNode } from '../model';
import { RType } from '../type';
import type { RParameter } from './r-parameter';
import type { AstIdMap, ParentInformation } from '../processing/decorate';
/**
* ```r
* function(<parameters>) <body>
* ```
* or:
* ```r
* \(<parameters>) <body>
* ```
*/
export interface RFunctionDefinition<Info = NoInfo> extends RAstNodeBase<Info>, Location {
readonly type: RType.FunctionDefinition;
/** the R formals, to our knowledge, they must be unique */
parameters: RParameter<Info>[];
body: RNode<Info>;
}
/**
* Helper for working with {@link RFunctionDefinition} AST nodes.
*/
export declare const RFunctionDefinition: {
readonly name: "RFunctionDefinition";
/**
* Type guard for {@link RFunctionDefinition} nodes.
*/
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RFunctionDefinition<Info>;
/**
* Checks whether the given id is part of a function definition, and if so, this returns the id of the
* inner-most function definition.
* @see {@link RFunctionDefinition.rootFunctionDefinition} - for the outer-most function definition
*/
readonly wrappingFunctionDefinition: <Info = object>(this: void, n: RNode<ParentInformation & Info> | undefined, idMap: AstIdMap<ParentInformation & Info>) => RFunctionDefinition<ParentInformation & Info> | undefined;
/**
* Checks whether the given id is part of a function definition, and if so, this returns the id of the
* outer-most function definition.
* @see {@link RFunctionDefinition.wrappingFunctionDefinition} - for the inner-most function definition
*/
readonly rootFunctionDefinition: <Info = object>(this: void, n: RNode<ParentInformation & Info> | undefined, idMap: AstIdMap<ParentInformation & Info>) => RFunctionDefinition<ParentInformation & Info> | undefined;
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
readonly getId: (this: void, node: RNode<ParentInformation>) => import("../processing/node-id").NodeId;
readonly getType: (this: void, node: RNode) => RType;
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo & ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
readonly directChildren: <OtherInfo>(this: void, node: RNode<OtherInfo>) => readonly (RNode<OtherInfo> | typeof import("./r-function-call").EmptyArgument)[];
readonly directParent: <OtherInfo>(this: void, node: RNode<OtherInfo & ParentInformation>, idMap: Map<import("../processing/node-id").NodeId, RNode<OtherInfo & ParentInformation>>) => RNode<OtherInfo & ParentInformation> | undefined;
readonly iterateParents: <OtherInfo>(this: void, node: RNode<OtherInfo & ParentInformation> | undefined, idMap: Map<import("../processing/node-id").NodeId, RNode<OtherInfo & ParentInformation>>) => Generator<RNode<OtherInfo & ParentInformation>>;
readonly depth: (this: void, node: RNode<ParentInformation>, idMap: Map<import("../processing/node-id").NodeId, RNode<ParentInformation>>) => number;
readonly collectAllIdsWithStop: <OtherInfo>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo & ParentInformation>>, stop: (node: RNode<OtherInfo & ParentInformation>) => boolean) => Set<import("../processing/node-id").NodeId>;
readonly lexeme: <R extends RNode<ParentInformation>>(this: void, node: R | undefined) => R extends {
lexeme: string;
} ? string : string | undefined;
readonly documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf;
};