UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

34 lines 1.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mapDataFrameVariableAssignment = mapDataFrameVariableAssignment; exports.isAssignmentTarget = isAssignmentTarget; const config_1 = require("../../../config"); const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type"); const arguments_1 = require("./arguments"); /** * Maps a concrete data frame assignment to data frame assignment info containing the ids of the identifier and assigned expression. * We currently do not support function assignments dealing with data frames. * * @param identifier - The R node of the variable identifier * @param expression - The R node of the assigned expression * @param dfg - The data flow graph for resolving the arguments * @returns Data frame assignment info containing the IDs of the identifier and expression, or `undefined` if the node does not represent a data frame assignment */ function mapDataFrameVariableAssignment(identifier, expression, dfg) { const resolveInfo = { graph: dfg, idMap: dfg.idMap, full: true, resolve: config_1.VariableResolve.Alias }; if (!(0, arguments_1.isDataFrameArgument)(expression, resolveInfo)) { return; } return { type: 'assignment', identifier: identifier.info.id, expression: expression.info.id }; } /** * Checks whether a R node represents an assignment target, i.e. is a `RSymbol` or `RString`. */ function isAssignmentTarget(node) { return node?.type === type_1.RType.Symbol || node?.type === type_1.RType.String; } //# sourceMappingURL=assignment-mapper.js.map