@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
52 lines (51 loc) • 3.09 kB
TypeScript
import type { DataflowProcessorInformation } from '../../../../../processor';
import type { DataflowInformation } from '../../../../../info';
import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
import type { RNode } from '../../../../../../r-bridge/lang-4.x/ast/model/model';
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
import type { RFunctionArgument } 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';
import type { InGraphIdentifierDefinition } from '../../../../../environments/identifier';
import type { ContainerIndicesCollection } from '../../../../../graph/vertex';
import type { ForceArguments } from '../common';
import type { REnvironmentInformation } from '../../../../../environments/environment';
import type { DataflowGraph } from '../../../../../graph/graph';
export interface AssignmentConfiguration extends ForceArguments {
readonly superAssignment?: boolean;
readonly swapSourceAndTarget?: boolean;
/** Make maybe if assigned to symbol */
readonly makeMaybe?: boolean;
readonly quoteSource?: boolean;
readonly canBeReplacement?: boolean;
/** is the target a variable pointing at the actual name? */
readonly targetVariable?: boolean;
readonly indicesCollection?: ContainerIndicesCollection;
readonly mayHaveMoreArgs?: boolean;
}
/**
* Processes an assignment, i.e., `<target> <- <source>`.
* Handling it as a function call \`<-\` `(<target>, <source>)`.
* This includes handling of replacement functions (e.g., `names(x) <- ...` as \`names<-\` `(x, ...)`).
*/
export declare function processAssignment<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: AssignmentConfiguration): DataflowInformation;
export interface AssignmentToSymbolParameters<OtherInfo> extends AssignmentConfiguration {
readonly nameOfAssignmentFunction: string;
readonly source: RNode<OtherInfo & ParentInformation>;
readonly args: [DataflowInformation, DataflowInformation];
readonly target: RSymbol<OtherInfo & ParentInformation>;
readonly rootId: NodeId;
readonly data: DataflowProcessorInformation<OtherInfo>;
readonly information: DataflowInformation;
}
/**
* Consider a call like `x <- v`
* @param information - the information to define the assignment within
* @param nodeToDefine - `x`
* @param sourceIds - `v`
* @param rootIdOfAssignment - `<-`
* @param config - configuration for the assignment processing
*/
export declare function markAsAssignment(information: {
environment: REnvironmentInformation;
graph: DataflowGraph;
}, nodeToDefine: InGraphIdentifierDefinition, sourceIds: readonly NodeId[], rootIdOfAssignment: NodeId, config?: AssignmentConfiguration): void;