@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
24 lines (23 loc) • 1.52 kB
TypeScript
import { type DataflowProcessorInformation } from '../../../../../processor';
import { type DataflowInformation } from '../../../../../info';
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
/** `if(<cond>) <then> else <else>` built-in function configuration, make sure to not reuse indices */
export interface IfThenElseConfig {
args?: {
/** the expression to treat as condition, defaults to index 0 */
cond: string;
/** argument to treat as yes/'then' case, defaults to index 1 */
yes: string;
/** argument to treat as no/'else' case, defaults to index 2 */
no: string;
};
}
/**
* Processes an if-then-else built-in function call.
* For example, `if(cond) thenExpr else elseExpr` and `if(cond) thenExpr`.
* The arguments will be either `[cond, thenExpr]` or `[cond, thenExpr, elseExpr]`.
*/
export declare function processIfThenElse<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config?: IfThenElseConfig): DataflowInformation;