UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

28 lines (27 loc) 1.98 kB
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 PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call'; import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol'; import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id'; import { type REnvironmentInformation } from '../../../../../environments/environment'; /** * Processes `new.env()` and `rlang::new_environment()`. * * The resulting function-call vertex carries the {@link BuiltInProcName.NewEnv} origin so that * `processAssignment` can detect it and attach an `envState` to the assigned variable. * * When the `parent` argument can be statically resolved (a tracked env variable or an * `emptyenv()`-family call), the resolved parent is stored in the vertex's `newEnvParent` * field so that {@link createFreshEnvState} can use it. */ export declare function processNewEnv<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation; /** * Creates the initial (empty) environment state for a freshly created `new.env()`. * * When called from `processAssignmentToSymbol`, pass `sourceInfo` so that a * statically-resolved `parent` argument (stored in the vertex's `newEnvParent` field) * is honoured. Without `sourceInfo` (or when no `newEnvParent` is present), falls back * to the current execution environment as parent. */ export declare function createFreshEnvState(data: Pick<DataflowProcessorInformation<never>, 'environment'>, sourceInfo?: DataflowInformation): REnvironmentInformation;