@eagleoutice/flowr 2.7.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -20
- package/abstract-interpretation/absint-visitor.d.ts +160 -0
- package/abstract-interpretation/absint-visitor.js +279 -0
- package/abstract-interpretation/data-frame/dataframe-domain.d.ts +2 -2
- package/abstract-interpretation/data-frame/dataframe-domain.js +23 -7
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +6 -6
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +10 -14
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +10 -9
- package/abstract-interpretation/data-frame/mappers/arguments.js +7 -4
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +17 -17
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +45 -50
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +7 -7
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +25 -29
- package/abstract-interpretation/data-frame/semantics.js +2 -3
- package/abstract-interpretation/data-frame/shape-inference.d.ts +52 -28
- package/abstract-interpretation/data-frame/shape-inference.js +67 -90
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +2 -2
- package/abstract-interpretation/domains/interval-domain.d.ts +2 -2
- package/abstract-interpretation/domains/set-range-domain.d.ts +10 -4
- package/abstract-interpretation/domains/set-range-domain.js +7 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +2 -2
- package/abstract-interpretation/domains/singleton-domain.d.ts +2 -2
- package/benchmark/slicer.js +13 -14
- package/cli/common/options.d.ts +431 -8
- package/cli/common/options.js +1 -1
- package/cli/common/scripts-info.d.ts +431 -7
- package/cli/flowr-main-options.d.ts +102 -2
- package/cli/flowr.d.ts +102 -2
- package/cli/repl/commands/repl-commands.d.ts +25 -0
- package/cli/repl/commands/repl-query.js +17 -5
- package/cli/wiki.d.ts +13 -0
- package/cli/wiki.js +7 -2
- package/config.d.ts +4 -4
- package/config.js +1 -1
- package/control-flow/basic-cfg-guided-visitor.js +7 -8
- package/control-flow/control-flow-graph.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +1 -1
- package/dataflow/eval/resolve/alias-tracking.js +1 -1
- package/dataflow/internal/linker.d.ts +2 -0
- package/dataflow/internal/linker.js +10 -12
- package/documentation/doc-capabilities.d.ts +1 -1
- package/documentation/doc-readme.d.ts +1 -1
- package/documentation/doc-util/doc-cfg.js +1 -1
- package/documentation/doc-util/doc-cli-option.d.ts +6 -6
- package/documentation/doc-util/doc-cli-option.js +3 -3
- package/documentation/doc-util/doc-dfg.d.ts +1 -1
- package/documentation/doc-util/doc-files.d.ts +3 -0
- package/documentation/doc-util/doc-files.js +4 -1
- package/documentation/doc-util/doc-normalized-ast.js +2 -2
- package/documentation/issue-linting-rule.d.ts +1 -1
- package/documentation/wiki-analyzer.d.ts +1 -1
- package/documentation/wiki-cfg.d.ts +1 -1
- package/documentation/wiki-core.d.ts +1 -1
- package/documentation/wiki-dataflow-graph.d.ts +1 -1
- package/documentation/wiki-dataflow-graph.js +6 -6
- package/documentation/wiki-engine.d.ts +1 -1
- package/documentation/wiki-engine.js +9 -10
- package/documentation/wiki-faq.d.ts +1 -1
- package/documentation/wiki-interface.d.ts +1 -1
- package/documentation/wiki-interface.js +12 -13
- package/documentation/wiki-linter.d.ts +1 -1
- package/documentation/wiki-linting-and-testing.d.ts +1 -1
- package/documentation/wiki-mk/doc-context.d.ts +54 -1
- package/documentation/wiki-mk/doc-context.js +17 -0
- package/documentation/wiki-mk/doc-maker.d.ts +5 -5
- package/documentation/wiki-mk/doc-maker.js +3 -1
- package/documentation/wiki-normalized-ast.d.ts +1 -1
- package/documentation/wiki-onboarding.d.ts +1 -1
- package/documentation/wiki-overview.d.ts +9 -0
- package/documentation/wiki-overview.js +248 -0
- package/documentation/wiki-query.d.ts +1 -1
- package/documentation/wiki-query.js +17 -1
- package/documentation/wiki-search.d.ts +1 -1
- package/documentation/wiki-setup.d.ts +9 -0
- package/documentation/wiki-setup.js +122 -0
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +8 -10
- package/linter/rules/unused-definition.js +1 -1
- package/package.json +1 -1
- package/project/context/flowr-analyzer-context.d.ts +4 -0
- package/project/context/flowr-analyzer-files-context.d.ts +9 -1
- package/project/context/flowr-analyzer-files-context.js +4 -0
- package/project/context/flowr-file.d.ts +2 -0
- package/project/context/flowr-file.js +2 -0
- package/project/plugins/file-plugins/{flowr-description-file.d.ts → files/flowr-description-file.d.ts} +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.js +75 -0
- package/project/plugins/file-plugins/files/flowr-news-file.d.ts +27 -0
- package/project/plugins/file-plugins/files/flowr-news-file.js +152 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +23 -0
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +35 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +1 -1
- package/project/plugins/flowr-analyzer-plugin-defaults.js +2 -0
- package/project/plugins/plugin-registry.d.ts +2 -1
- package/project/plugins/plugin-registry.js +2 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +7 -1
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +4 -2
- package/queries/catalog/files-query/files-query-executor.d.ts +6 -0
- package/queries/catalog/files-query/files-query-executor.js +49 -0
- package/queries/catalog/files-query/files-query-format.d.ts +36 -0
- package/queries/catalog/files-query/files-query-format.js +114 -0
- package/queries/catalog/linter-query/linter-query-format.js +1 -1
- package/queries/query.d.ts +10 -1
- package/queries/query.js +3 -1
- package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +8 -8
- package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +8 -8
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +0 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +0 -1
- package/statistics/features/supported/data-access/data-access.js +1 -1
- package/util/containers.js +1 -1
- package/util/files.d.ts +0 -7
- package/util/files.js +0 -41
- package/util/mermaid/ast.d.ts +3 -2
- package/util/mermaid/ast.js +13 -7
- package/util/mermaid/cfg.d.ts +3 -2
- package/util/mermaid/cfg.js +26 -6
- package/util/mermaid/dfg.d.ts +1 -7
- package/util/mermaid/dfg.js +7 -3
- package/util/mermaid/info.d.ts +17 -0
- package/util/mermaid/info.js +5 -0
- package/util/prefix.d.ts +9 -5
- package/util/prefix.js +14 -6
- package/util/r-regex.d.ts +21 -0
- package/util/r-regex.js +25 -0
- package/util/text/args.js +12 -3
- package/util/version.js +1 -1
- package/abstract-interpretation/data-frame/absint-info.d.ts +0 -109
- package/abstract-interpretation/data-frame/absint-info.js +0 -31
- package/abstract-interpretation/data-frame/absint-visitor.d.ts +0 -57
- package/abstract-interpretation/data-frame/absint-visitor.js +0 -176
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.d.ts +0 -21
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.js +0 -34
- package/documentation/doc-util/doc-print.d.ts +0 -5
- package/documentation/doc-util/doc-print.js +0 -36
- package/project/plugins/file-plugins/flowr-description-file.js +0 -37
- package/project/plugins/file-plugins/notebooks/notebook.d.ts +0 -0
- package/project/plugins/file-plugins/notebooks/notebook.js +0 -2
- /package/project/plugins/file-plugins/{notebooks → files}/flowr-jupyter-file.d.ts +0 -0
- /package/project/plugins/file-plugins/{notebooks → files}/flowr-jupyter-file.js +0 -0
- /package/project/plugins/file-plugins/{notebooks → files}/flowr-rmarkdown-file.d.ts +0 -0
- /package/project/plugins/file-plugins/{notebooks → files}/flowr-rmarkdown-file.js +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DataFrameStateDomain = exports.DataFrameDomain = void 0;
|
|
4
|
+
const lattice_1 = require("../domains/lattice");
|
|
4
5
|
const positive_interval_domain_1 = require("../domains/positive-interval-domain");
|
|
5
6
|
const product_domain_1 = require("../domains/product-domain");
|
|
6
7
|
const set_range_domain_1 = require("../domains/set-range-domain");
|
|
@@ -9,15 +10,15 @@ const state_abstract_domain_1 = require("../domains/state-abstract-domain");
|
|
|
9
10
|
* The data frame abstract domain as product domain of a column names domain, column count domain, and row count domain.
|
|
10
11
|
*/
|
|
11
12
|
class DataFrameDomain extends product_domain_1.ProductDomain {
|
|
12
|
-
constructor(value
|
|
13
|
-
super({
|
|
14
|
-
colnames:
|
|
15
|
-
cols:
|
|
16
|
-
rows:
|
|
17
|
-
});
|
|
13
|
+
constructor(value) {
|
|
14
|
+
super(DataFrameDomain.refine({
|
|
15
|
+
colnames: value.colnames.create(value.colnames.value),
|
|
16
|
+
cols: value.cols.create(value.cols.value),
|
|
17
|
+
rows: value.rows.create(value.rows.value)
|
|
18
|
+
}));
|
|
18
19
|
}
|
|
19
20
|
create(value) {
|
|
20
|
-
return new DataFrameDomain(value
|
|
21
|
+
return new DataFrameDomain(value);
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* The current abstract value of the column names domain.
|
|
@@ -51,6 +52,21 @@ class DataFrameDomain extends product_domain_1.ProductDomain {
|
|
|
51
52
|
rows: positive_interval_domain_1.PosIntervalDomain.top()
|
|
52
53
|
});
|
|
53
54
|
}
|
|
55
|
+
static refine(value) {
|
|
56
|
+
if (value.colnames.isValue() && value.cols.isValue()) {
|
|
57
|
+
if (value.colnames.value.range === lattice_1.Top && value.colnames.value.min.size >= value.cols.value[1]) {
|
|
58
|
+
value.colnames = value.colnames.meet({ min: new Set(), range: value.colnames.value.min });
|
|
59
|
+
}
|
|
60
|
+
if (value.colnames.isValue()) {
|
|
61
|
+
const minColNames = value.colnames.value.min.size;
|
|
62
|
+
const maxColNames = value.colnames.isFinite() ? value.colnames.value.min.size + value.colnames.value.range.size : Infinity;
|
|
63
|
+
if (minColNames > value.cols.value[0] || maxColNames < value.cols.value[1]) {
|
|
64
|
+
value.cols = value.cols.meet([minColNames, maxColNames]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
54
70
|
}
|
|
55
71
|
exports.DataFrameDomain = DataFrameDomain;
|
|
56
72
|
/**
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { DataflowGraph } from '../../../dataflow/graph/graph';
|
|
2
|
+
import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flowr-analyzer-context';
|
|
2
3
|
import type { RNode } from '../../../r-bridge/lang-4.x/ast/model/model';
|
|
3
4
|
import type { RAccess, RNamedAccess } from '../../../r-bridge/lang-4.x/ast/model/nodes/r-access';
|
|
4
5
|
import type { ParentInformation } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
5
|
-
import type {
|
|
6
|
-
import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flowr-analyzer-context';
|
|
6
|
+
import type { DataFrameOperations, DataFrameShapeInferenceVisitor } from '../shape-inference';
|
|
7
7
|
/**
|
|
8
|
-
* Maps a concrete data frame access to abstract data frame operations.
|
|
8
|
+
* Maps a concrete data frame access operation to abstract data frame operations.
|
|
9
9
|
* @param node - The R node of the access
|
|
10
10
|
* @param dfg - The data flow graph for resolving the arguments
|
|
11
|
-
* @param ctx - The
|
|
12
|
-
* @returns
|
|
11
|
+
* @param ctx - The current flowR analyzer context
|
|
12
|
+
* @returns The mapped abstract data frame operations for the access operation, or `undefined` if the node does not represent a data frame access operation
|
|
13
13
|
*/
|
|
14
|
-
export declare function mapDataFrameAccess(node: RNode<ParentInformation>, dfg: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext):
|
|
14
|
+
export declare function mapDataFrameAccess(node: RNode<ParentInformation>, inference: DataFrameShapeInferenceVisitor, dfg: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext): DataFrameOperations;
|
|
15
15
|
/**
|
|
16
16
|
* Checks whether an access node represents a string-based access (`$` or `@`), and no index-based access (`[` or `[[`).
|
|
17
17
|
*/
|
|
@@ -15,31 +15,27 @@ const SpecialAccessArgumentsMapper = {
|
|
|
15
15
|
'[[': ['exact']
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
|
-
* Maps a concrete data frame access to abstract data frame operations.
|
|
18
|
+
* Maps a concrete data frame access operation to abstract data frame operations.
|
|
19
19
|
* @param node - The R node of the access
|
|
20
20
|
* @param dfg - The data flow graph for resolving the arguments
|
|
21
|
-
* @param ctx - The
|
|
22
|
-
* @returns
|
|
21
|
+
* @param ctx - The current flowR analyzer context
|
|
22
|
+
* @returns The mapped abstract data frame operations for the access operation, or `undefined` if the node does not represent a data frame access operation
|
|
23
23
|
*/
|
|
24
|
-
function mapDataFrameAccess(node, dfg, ctx) {
|
|
24
|
+
function mapDataFrameAccess(node, inference, dfg, ctx) {
|
|
25
25
|
if (node.type !== type_1.RType.Access) {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
const resolveInfo = { graph: dfg, idMap: dfg.idMap, full: true, resolve: config_1.VariableResolve.Alias, ctx };
|
|
29
|
-
let operations;
|
|
30
29
|
if (isStringBasedAccess(node)) {
|
|
31
|
-
|
|
30
|
+
return mapDataFrameNamedColumnAccess(node, inference, resolveInfo);
|
|
32
31
|
}
|
|
33
32
|
else {
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
if (operations !== undefined) {
|
|
37
|
-
return { type: 'expression', operations: operations };
|
|
33
|
+
return mapDataFrameIndexColRowAccess(node, inference, resolveInfo);
|
|
38
34
|
}
|
|
39
35
|
}
|
|
40
|
-
function mapDataFrameNamedColumnAccess(access, info) {
|
|
36
|
+
function mapDataFrameNamedColumnAccess(access, inference, info) {
|
|
41
37
|
const dataFrame = access.accessed;
|
|
42
|
-
if (!(0, arguments_1.isDataFrameArgument)(dataFrame,
|
|
38
|
+
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
|
|
43
39
|
return;
|
|
44
40
|
}
|
|
45
41
|
const colname = (0, resolve_args_1.resolveIdToArgValueSymbolName)(access.access[0], info);
|
|
@@ -49,12 +45,12 @@ function mapDataFrameNamedColumnAccess(access, info) {
|
|
|
49
45
|
columns: colname ? [colname] : undefined
|
|
50
46
|
}];
|
|
51
47
|
}
|
|
52
|
-
function mapDataFrameIndexColRowAccess(access, info) {
|
|
48
|
+
function mapDataFrameIndexColRowAccess(access, inference, info) {
|
|
53
49
|
const dataFrame = access.accessed;
|
|
54
50
|
const drop = (0, arguments_1.getArgumentValue)(access.access, 'drop', info);
|
|
55
51
|
const exact = (0, arguments_1.getArgumentValue)(access.access, 'exact', info);
|
|
56
52
|
const args = getAccessArgs(access.operator, access.access);
|
|
57
|
-
if (!(0, arguments_1.isDataFrameArgument)(dataFrame,
|
|
53
|
+
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
|
|
58
54
|
return;
|
|
59
55
|
}
|
|
60
56
|
else if (args.every(arg => arg === r_function_call_1.EmptyArgument)) {
|
|
@@ -6,7 +6,7 @@ import { type RFunctionArgument, type RFunctionCall, EmptyArgument } from '../..
|
|
|
6
6
|
import type { RSymbol } from '../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
7
7
|
import type { ParentInformation } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
8
8
|
import { RNull } from '../../../r-bridge/lang-4.x/convert-values';
|
|
9
|
-
import type {
|
|
9
|
+
import type { DataFrameShapeInferenceVisitor } from '../shape-inference';
|
|
10
10
|
/**
|
|
11
11
|
* The location of a function parameter for mapping function call arguments to function parameters.
|
|
12
12
|
* - `pos` contains the position of the function parameter (use `-1` for non-existent or non-positional arguments)
|
|
@@ -31,9 +31,10 @@ export declare function escapeRegExp(text: string, allowTokens?: boolean): strin
|
|
|
31
31
|
* @param checkNames - Whether to map all invalid column names to top (`undefined`)
|
|
32
32
|
* @param noDupNames - Whether to map all duplicate column names to top (`undefined`)
|
|
33
33
|
* @param noEmptyNames - Whether to map all empty column names to top (`undefined`)
|
|
34
|
+
* @param collapseDups - Whether duplicate columns should be collapsed to single occurrences afterward (excluding `undefined` values)
|
|
34
35
|
* @returns The filtered column names
|
|
35
36
|
*/
|
|
36
|
-
export declare function filterValidNames(colnames: (string | undefined)[] | undefined, checkNames?: boolean, noDupNames?: boolean, noEmptyNames?: boolean): (string | undefined)[] | undefined;
|
|
37
|
+
export declare function filterValidNames(colnames: (string | undefined)[] | undefined, checkNames?: boolean, noDupNames?: boolean, noEmptyNames?: boolean, collapseDups?: boolean): (string | undefined)[] | undefined;
|
|
37
38
|
/**
|
|
38
39
|
* Gets the value of an argument that specified as {@link FunctionParameterLocation}.
|
|
39
40
|
* @param args - The arguments to get the requested argument from
|
|
@@ -80,14 +81,14 @@ export declare function getUnresolvedSymbolsInExpression(expression: RNode<Paren
|
|
|
80
81
|
*/
|
|
81
82
|
export declare function hasCriticalArgument(args: readonly RFunctionArgument<ParentInformation>[], critical: (FunctionParameterLocation<unknown> | string)[] | undefined, info: ResolveInfo): boolean;
|
|
82
83
|
/**
|
|
83
|
-
* Checks if a given argument has
|
|
84
|
-
* @param arg
|
|
85
|
-
* @param
|
|
86
|
-
* @returns Whether the argument
|
|
84
|
+
* Checks if a given argument has an inferred data frame shape and therefore represents a data frame
|
|
85
|
+
* @param arg - The argument to check
|
|
86
|
+
* @param inference - The data frame shape inference visitor to use
|
|
87
|
+
* @returns Whether the argument represents a data frame
|
|
87
88
|
*/
|
|
88
|
-
export declare function isDataFrameArgument(arg: RNode<ParentInformation> | undefined,
|
|
89
|
-
export declare function isDataFrameArgument(arg: RFunctionArgument<ParentInformation> | undefined,
|
|
90
|
-
value: RNode<ParentInformation
|
|
89
|
+
export declare function isDataFrameArgument(arg: RNode<ParentInformation> | undefined, inference: DataFrameShapeInferenceVisitor): arg is RNode<ParentInformation>;
|
|
90
|
+
export declare function isDataFrameArgument(arg: RFunctionArgument<ParentInformation> | undefined, inference: DataFrameShapeInferenceVisitor): arg is RArgument<ParentInformation> & {
|
|
91
|
+
value: RNode<ParentInformation>;
|
|
91
92
|
};
|
|
92
93
|
/**
|
|
93
94
|
* Checks whether a function argument is a names argument.
|
|
@@ -19,7 +19,6 @@ const visitor_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/visit
|
|
|
19
19
|
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
20
20
|
const convert_values_1 = require("../../../r-bridge/lang-4.x/convert-values");
|
|
21
21
|
const resolve_args_1 = require("../resolve-args");
|
|
22
|
-
const shape_inference_1 = require("../shape-inference");
|
|
23
22
|
/** Regular expression representing valid columns names, e.g. for `data.frame` */
|
|
24
23
|
const ColNamesRegex = /^[A-Za-z.][A-Za-z0-9_.]*$/;
|
|
25
24
|
/**
|
|
@@ -42,9 +41,10 @@ function escapeRegExp(text, allowTokens = false) {
|
|
|
42
41
|
* @param checkNames - Whether to map all invalid column names to top (`undefined`)
|
|
43
42
|
* @param noDupNames - Whether to map all duplicate column names to top (`undefined`)
|
|
44
43
|
* @param noEmptyNames - Whether to map all empty column names to top (`undefined`)
|
|
44
|
+
* @param collapseDups - Whether duplicate columns should be collapsed to single occurrences afterward (excluding `undefined` values)
|
|
45
45
|
* @returns The filtered column names
|
|
46
46
|
*/
|
|
47
|
-
function filterValidNames(colnames, checkNames, noDupNames, noEmptyNames) {
|
|
47
|
+
function filterValidNames(colnames, checkNames, noDupNames, noEmptyNames, collapseDups = false) {
|
|
48
48
|
if (checkNames) { // map all invalid column names to top
|
|
49
49
|
colnames = colnames?.map(entry => isValidColName(entry) ? entry : undefined);
|
|
50
50
|
}
|
|
@@ -54,6 +54,9 @@ function filterValidNames(colnames, checkNames, noDupNames, noEmptyNames) {
|
|
|
54
54
|
if (noEmptyNames) { // map all empty column names to top
|
|
55
55
|
colnames = colnames?.map(entry => entry?.length === 0 ? undefined : entry);
|
|
56
56
|
}
|
|
57
|
+
if (collapseDups) {
|
|
58
|
+
colnames = colnames?.filter((value, index, array) => value === undefined || array.indexOf(value) === index);
|
|
59
|
+
}
|
|
57
60
|
return colnames;
|
|
58
61
|
}
|
|
59
62
|
/**
|
|
@@ -157,8 +160,8 @@ function hasCriticalArgument(args, critical, info) {
|
|
|
157
160
|
}
|
|
158
161
|
return false;
|
|
159
162
|
}
|
|
160
|
-
function isDataFrameArgument(arg,
|
|
161
|
-
return arg !== r_function_call_1.EmptyArgument &&
|
|
163
|
+
function isDataFrameArgument(arg, inference) {
|
|
164
|
+
return arg !== r_function_call_1.EmptyArgument && inference.getAbstractValue(arg) !== undefined;
|
|
162
165
|
}
|
|
163
166
|
/**
|
|
164
167
|
* Checks whether a function argument is a names argument.
|
|
@@ -4,7 +4,7 @@ import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flow
|
|
|
4
4
|
import type { RNode } from '../../../r-bridge/lang-4.x/ast/model/model';
|
|
5
5
|
import { type RFunctionArgument } from '../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
6
6
|
import type { ParentInformation } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
7
|
-
import type {
|
|
7
|
+
import type { DataFrameOperations, DataFrameShapeInferenceVisitor } from '../shape-inference';
|
|
8
8
|
import { type FunctionParameterLocation } from './arguments';
|
|
9
9
|
/**
|
|
10
10
|
* Represents the different types of data frames in R
|
|
@@ -182,17 +182,17 @@ type DataFrameFunction = keyof typeof DataFrameFunctionMapper;
|
|
|
182
182
|
* @param node - The R node of the function call
|
|
183
183
|
* @param dfg - The data flow graph for resolving the arguments
|
|
184
184
|
* @param ctx - The current flowR analyzer context
|
|
185
|
-
* @returns
|
|
185
|
+
* @returns The mapped abstract data frame operations for the function call, or `undefined` if the node does not represent a data frame function call
|
|
186
186
|
*/
|
|
187
|
-
export declare function mapDataFrameFunctionCall<Name extends DataFrameFunction>(node: RNode<ParentInformation>, dfg: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext):
|
|
187
|
+
export declare function mapDataFrameFunctionCall<Name extends DataFrameFunction>(node: RNode<ParentInformation>, inference: DataFrameShapeInferenceVisitor, dfg: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext): DataFrameOperations;
|
|
188
188
|
declare function mapDataFrameCreate(args: readonly RFunctionArgument<ParentInformation>[], params: {
|
|
189
189
|
checkNames: FunctionParameterLocation<boolean>;
|
|
190
190
|
noDupNames: FunctionParameterLocation<boolean>;
|
|
191
191
|
special: string[];
|
|
192
|
-
}, info: ResolveInfo):
|
|
192
|
+
}, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
|
|
193
193
|
declare function mapDataFrameConvert(args: readonly RFunctionArgument<ParentInformation>[], params: {
|
|
194
194
|
dataFrame: FunctionParameterLocation;
|
|
195
|
-
}, info: ResolveInfo):
|
|
195
|
+
}, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
|
|
196
196
|
declare function mapDataFrameRead(args: readonly RFunctionArgument<ParentInformation>[], params: {
|
|
197
197
|
fileName: FunctionParameterLocation;
|
|
198
198
|
text?: FunctionParameterLocation;
|
|
@@ -204,46 +204,46 @@ declare function mapDataFrameRead(args: readonly RFunctionArgument<ParentInforma
|
|
|
204
204
|
checkNames: FunctionParameterLocation<boolean>;
|
|
205
205
|
noDupNames: FunctionParameterLocation<boolean>;
|
|
206
206
|
noEmptyNames?: boolean;
|
|
207
|
-
},
|
|
207
|
+
}, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
|
|
208
208
|
declare function mapDataFrameColBind(args: readonly RFunctionArgument<ParentInformation>[], params: {
|
|
209
209
|
special: string[];
|
|
210
|
-
}, info: ResolveInfo):
|
|
210
|
+
}, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
|
|
211
211
|
declare function mapDataFrameRowBind(args: readonly RFunctionArgument<ParentInformation>[], params: {
|
|
212
212
|
special: string[];
|
|
213
|
-
}, info: ResolveInfo):
|
|
213
|
+
}, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
|
|
214
214
|
declare function mapDataFrameHeadTail(args: readonly RFunctionArgument<ParentInformation>[], params: {
|
|
215
215
|
dataFrame: FunctionParameterLocation;
|
|
216
216
|
amount: FunctionParameterLocation<number>;
|
|
217
|
-
}, info: ResolveInfo):
|
|
217
|
+
}, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
|
|
218
218
|
declare function mapDataFrameSubset(args: readonly RFunctionArgument<ParentInformation>[], params: {
|
|
219
219
|
dataFrame: FunctionParameterLocation;
|
|
220
220
|
subset: FunctionParameterLocation;
|
|
221
221
|
select: FunctionParameterLocation;
|
|
222
222
|
drop: FunctionParameterLocation<boolean>;
|
|
223
|
-
}, info: ResolveInfo):
|
|
223
|
+
}, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
|
|
224
224
|
declare function mapDataFrameFilter(args: readonly RFunctionArgument<ParentInformation>[], params: {
|
|
225
225
|
dataFrame: FunctionParameterLocation;
|
|
226
226
|
special: string[];
|
|
227
|
-
}, info: ResolveInfo):
|
|
227
|
+
}, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
|
|
228
228
|
declare function mapDataFrameSelect(args: readonly RFunctionArgument<ParentInformation>[], params: {
|
|
229
229
|
dataFrame: FunctionParameterLocation;
|
|
230
230
|
special: string[];
|
|
231
|
-
}, info: ResolveInfo):
|
|
231
|
+
}, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
|
|
232
232
|
declare function mapDataFrameMutate(args: readonly RFunctionArgument<ParentInformation>[], params: {
|
|
233
233
|
dataFrame: FunctionParameterLocation;
|
|
234
234
|
special: string[];
|
|
235
235
|
checkNames?: boolean;
|
|
236
236
|
noDupNames?: boolean;
|
|
237
|
-
}, info: ResolveInfo):
|
|
237
|
+
}, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
|
|
238
238
|
declare function mapDataFrameGroupBy(args: readonly RFunctionArgument<ParentInformation>[], params: {
|
|
239
239
|
dataFrame: FunctionParameterLocation;
|
|
240
240
|
by: FunctionParameterLocation;
|
|
241
241
|
special: string[];
|
|
242
|
-
}, info: ResolveInfo):
|
|
242
|
+
}, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
|
|
243
243
|
declare function mapDataFrameSummarize(args: readonly RFunctionArgument<ParentInformation>[], params: {
|
|
244
244
|
dataFrame: FunctionParameterLocation;
|
|
245
245
|
special: string[];
|
|
246
|
-
}, info: ResolveInfo):
|
|
246
|
+
}, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
|
|
247
247
|
declare function mapDataFrameJoin(args: readonly RFunctionArgument<ParentInformation>[], params: {
|
|
248
248
|
dataFrame: FunctionParameterLocation;
|
|
249
249
|
otherDataFrame: FunctionParameterLocation;
|
|
@@ -251,10 +251,10 @@ declare function mapDataFrameJoin(args: readonly RFunctionArgument<ParentInforma
|
|
|
251
251
|
joinAll: FunctionParameterLocation<boolean>;
|
|
252
252
|
joinLeft: FunctionParameterLocation<boolean>;
|
|
253
253
|
joinRight: FunctionParameterLocation<boolean>;
|
|
254
|
-
},
|
|
254
|
+
}, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
|
|
255
255
|
declare function mapDataFrameIdentity(args: readonly RFunctionArgument<ParentInformation>[], params: {
|
|
256
256
|
dataFrame: FunctionParameterLocation;
|
|
257
257
|
special: string[];
|
|
258
258
|
disallowNamedArgs?: boolean;
|
|
259
|
-
}, info: ResolveInfo):
|
|
259
|
+
}, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
|
|
260
260
|
export {};
|
|
@@ -11,7 +11,6 @@ const assert_1 = require("../../../util/assert");
|
|
|
11
11
|
const files_1 = require("../../../util/files");
|
|
12
12
|
const dataframe_domain_1 = require("../dataframe-domain");
|
|
13
13
|
const resolve_args_1 = require("../resolve-args");
|
|
14
|
-
const shape_inference_1 = require("../shape-inference");
|
|
15
14
|
const arguments_1 = require("./arguments");
|
|
16
15
|
/**
|
|
17
16
|
* Represents the different types of data frames in R
|
|
@@ -522,24 +521,23 @@ const DataFrameFunctionParamsMapper = {
|
|
|
522
521
|
* @param node - The R node of the function call
|
|
523
522
|
* @param dfg - The data flow graph for resolving the arguments
|
|
524
523
|
* @param ctx - The current flowR analyzer context
|
|
525
|
-
* @returns
|
|
524
|
+
* @returns The mapped abstract data frame operations for the function call, or `undefined` if the node does not represent a data frame function call
|
|
526
525
|
*/
|
|
527
|
-
function mapDataFrameFunctionCall(node, dfg, ctx) {
|
|
526
|
+
function mapDataFrameFunctionCall(node, inference, dfg, ctx) {
|
|
528
527
|
if (node.type !== type_1.RType.FunctionCall || !node.named) {
|
|
529
528
|
return;
|
|
530
529
|
}
|
|
531
530
|
const resolveInfo = { graph: dfg, idMap: dfg.idMap, full: true, resolve: config_1.VariableResolve.Alias, ctx };
|
|
532
|
-
let operations;
|
|
533
531
|
if (isDataFrameFunction(node.functionName.content)) {
|
|
534
532
|
const functionName = node.functionName.content;
|
|
535
533
|
const mapper = DataFrameFunctionMapper[functionName].mapper;
|
|
536
534
|
const params = DataFrameFunctionParamsMapper[functionName];
|
|
537
535
|
const args = (0, arguments_1.getFunctionArguments)(node, dfg);
|
|
538
536
|
if ((0, arguments_1.hasCriticalArgument)(args, params.critical, resolveInfo)) {
|
|
539
|
-
|
|
537
|
+
return [{ operation: 'unknown', operand: undefined }];
|
|
540
538
|
}
|
|
541
539
|
else {
|
|
542
|
-
|
|
540
|
+
return mapper(args, params, inference, resolveInfo);
|
|
543
541
|
}
|
|
544
542
|
}
|
|
545
543
|
else {
|
|
@@ -548,19 +546,16 @@ function mapDataFrameFunctionCall(node, dfg, ctx) {
|
|
|
548
546
|
return;
|
|
549
547
|
}
|
|
550
548
|
else if (mapping.type === 'entry_point') {
|
|
551
|
-
|
|
549
|
+
return [{ operation: 'unknown', operand: undefined }];
|
|
552
550
|
}
|
|
553
551
|
else if (mapping.type === 'transformation' || mapping.type === 'modification') {
|
|
554
552
|
const args = (0, arguments_1.getFunctionArguments)(node, dfg);
|
|
555
|
-
|
|
553
|
+
return mapDataFrameUnknown(args, mapping, inference, resolveInfo);
|
|
556
554
|
}
|
|
557
555
|
else {
|
|
558
556
|
(0, assert_1.assertUnreachable)(mapping);
|
|
559
557
|
}
|
|
560
558
|
}
|
|
561
|
-
if (operations !== undefined) {
|
|
562
|
-
return { type: 'expression', operations };
|
|
563
|
-
}
|
|
564
559
|
}
|
|
565
560
|
function isDataFrameFunction(functionName) {
|
|
566
561
|
// a check with `functionName in DataFrameFunctionMapper` would return true for "toString"
|
|
@@ -569,7 +564,7 @@ function isDataFrameFunction(functionName) {
|
|
|
569
564
|
function getOtherDataFrameFunction(functionName) {
|
|
570
565
|
return OtherDataFrameFunctions.find(entry => entry.names.includes(functionName));
|
|
571
566
|
}
|
|
572
|
-
function mapDataFrameCreate(args, params, info) {
|
|
567
|
+
function mapDataFrameCreate(args, params, inference, info) {
|
|
573
568
|
const checkNames = (0, arguments_1.getArgumentValue)(args, params.checkNames, info);
|
|
574
569
|
const noDupNames = (0, arguments_1.getArgumentValue)(args, params.noDupNames, info);
|
|
575
570
|
args = (0, arguments_1.getEffectiveArgs)(args, params.special);
|
|
@@ -595,7 +590,7 @@ function mapDataFrameCreate(args, params, info) {
|
|
|
595
590
|
rows
|
|
596
591
|
}];
|
|
597
592
|
}
|
|
598
|
-
function mapDataFrameConvert(args, params, info) {
|
|
593
|
+
function mapDataFrameConvert(args, params, inference, info) {
|
|
599
594
|
const dataFrame = (0, arguments_1.getFunctionArgument)(args, params.dataFrame, info);
|
|
600
595
|
if (dataFrame === r_function_call_1.EmptyArgument || dataFrame?.value === undefined) {
|
|
601
596
|
return [{ operation: 'unknown', operand: undefined }];
|
|
@@ -605,10 +600,10 @@ function mapDataFrameConvert(args, params, info) {
|
|
|
605
600
|
operand: dataFrame.value.info.id
|
|
606
601
|
}];
|
|
607
602
|
}
|
|
608
|
-
function mapDataFrameRead(args, params,
|
|
603
|
+
function mapDataFrameRead(args, params, inference, info) {
|
|
609
604
|
const fileNameArg = (0, arguments_1.getFunctionArgument)(args, params.fileName, info);
|
|
610
605
|
const textArg = params.text ? (0, arguments_1.getFunctionArgument)(args, params.text, info) : undefined;
|
|
611
|
-
const { source, request } = getRequestFromRead(fileNameArg, textArg, params, info
|
|
606
|
+
const { source, request } = getRequestFromRead(fileNameArg, textArg, params, info);
|
|
612
607
|
const header = (0, arguments_1.getArgumentValue)(args, params.header, info);
|
|
613
608
|
const separator = (0, arguments_1.getArgumentValue)(args, params.separator, info);
|
|
614
609
|
const quote = (0, arguments_1.getArgumentValue)(args, params.quote, info);
|
|
@@ -618,7 +613,7 @@ function mapDataFrameRead(args, params, info, ctx) {
|
|
|
618
613
|
const noDupNames = (0, arguments_1.getArgumentValue)(args, params.noDupNames, info);
|
|
619
614
|
const validArguments = typeof header === 'boolean' && typeof separator === 'string' && typeof quote === 'string' && typeof comment === 'string' &&
|
|
620
615
|
typeof skipLines === 'number' && typeof checkNames === 'boolean' && typeof noDupNames === 'boolean';
|
|
621
|
-
if (request === undefined || !ctx.config.abstractInterpretation.dataFrame.readLoadedData.readExternalFiles || !validArguments) {
|
|
616
|
+
if (request === undefined || !info.ctx.config.abstractInterpretation.dataFrame.readLoadedData.readExternalFiles || !validArguments) {
|
|
622
617
|
return [{
|
|
623
618
|
operation: 'read',
|
|
624
619
|
operand: undefined,
|
|
@@ -643,7 +638,7 @@ function mapDataFrameRead(args, params, info, ctx) {
|
|
|
643
638
|
}
|
|
644
639
|
}
|
|
645
640
|
};
|
|
646
|
-
const allLines = parseRequestContent(request, parseLine, ctx.config.abstractInterpretation.dataFrame.readLoadedData.maxReadLines);
|
|
641
|
+
const allLines = parseRequestContent(request, parseLine, info.ctx.config.abstractInterpretation.dataFrame.readLoadedData.maxReadLines);
|
|
647
642
|
let colnames;
|
|
648
643
|
if (header) {
|
|
649
644
|
colnames = (0, arguments_1.filterValidNames)(firstLine, checkNames, noDupNames, params.noEmptyNames);
|
|
@@ -659,9 +654,9 @@ function mapDataFrameRead(args, params, info, ctx) {
|
|
|
659
654
|
rows: allLines ? rowCount : [rowCount, Infinity]
|
|
660
655
|
}];
|
|
661
656
|
}
|
|
662
|
-
function mapDataFrameColBind(args, params, info) {
|
|
657
|
+
function mapDataFrameColBind(args, params, inference, info) {
|
|
663
658
|
args = (0, arguments_1.getEffectiveArgs)(args, params.special);
|
|
664
|
-
const dataFrame = args.find(arg => (0, arguments_1.isDataFrameArgument)(arg,
|
|
659
|
+
const dataFrame = args.find(arg => (0, arguments_1.isDataFrameArgument)(arg, inference));
|
|
665
660
|
if (dataFrame === undefined) {
|
|
666
661
|
return;
|
|
667
662
|
}
|
|
@@ -673,7 +668,7 @@ function mapDataFrameColBind(args, params, info) {
|
|
|
673
668
|
let colnames = [];
|
|
674
669
|
for (const arg of args) {
|
|
675
670
|
if (arg !== dataFrame && arg !== r_function_call_1.EmptyArgument) {
|
|
676
|
-
const otherDataFrame =
|
|
671
|
+
const otherDataFrame = inference.getAbstractValue(arg.value);
|
|
677
672
|
if (otherDataFrame !== undefined) {
|
|
678
673
|
result.push({
|
|
679
674
|
operation: 'concatCols',
|
|
@@ -701,9 +696,9 @@ function mapDataFrameColBind(args, params, info) {
|
|
|
701
696
|
}
|
|
702
697
|
return result;
|
|
703
698
|
}
|
|
704
|
-
function mapDataFrameRowBind(args, params, info) {
|
|
699
|
+
function mapDataFrameRowBind(args, params, inference, info) {
|
|
705
700
|
args = (0, arguments_1.getEffectiveArgs)(args, params.special);
|
|
706
|
-
const dataFrame = args.find(arg => (0, arguments_1.isDataFrameArgument)(arg,
|
|
701
|
+
const dataFrame = args.find(arg => (0, arguments_1.isDataFrameArgument)(arg, inference));
|
|
707
702
|
if (dataFrame === undefined) {
|
|
708
703
|
return;
|
|
709
704
|
}
|
|
@@ -715,7 +710,7 @@ function mapDataFrameRowBind(args, params, info) {
|
|
|
715
710
|
let rows = 0;
|
|
716
711
|
for (const arg of args) {
|
|
717
712
|
if (arg !== dataFrame && arg !== r_function_call_1.EmptyArgument) {
|
|
718
|
-
const otherDataFrame =
|
|
713
|
+
const otherDataFrame = inference.getAbstractValue(arg.value);
|
|
719
714
|
if (otherDataFrame !== undefined) {
|
|
720
715
|
result.push({
|
|
721
716
|
operation: 'concatRows',
|
|
@@ -742,9 +737,9 @@ function mapDataFrameRowBind(args, params, info) {
|
|
|
742
737
|
}
|
|
743
738
|
return result;
|
|
744
739
|
}
|
|
745
|
-
function mapDataFrameHeadTail(args, params, info) {
|
|
740
|
+
function mapDataFrameHeadTail(args, params, inference, info) {
|
|
746
741
|
const dataFrame = (0, arguments_1.getFunctionArgument)(args, params.dataFrame, info);
|
|
747
|
-
if (!(0, arguments_1.isDataFrameArgument)(dataFrame,
|
|
742
|
+
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
|
|
748
743
|
return;
|
|
749
744
|
}
|
|
750
745
|
const result = [];
|
|
@@ -772,9 +767,9 @@ function mapDataFrameHeadTail(args, params, info) {
|
|
|
772
767
|
}
|
|
773
768
|
return result;
|
|
774
769
|
}
|
|
775
|
-
function mapDataFrameSubset(args, params, info) {
|
|
770
|
+
function mapDataFrameSubset(args, params, inference, info) {
|
|
776
771
|
const dataFrame = (0, arguments_1.getFunctionArgument)(args, params.dataFrame, info);
|
|
777
|
-
if (!(0, arguments_1.isDataFrameArgument)(dataFrame,
|
|
772
|
+
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
|
|
778
773
|
return;
|
|
779
774
|
}
|
|
780
775
|
else if (args.length === 1) {
|
|
@@ -835,10 +830,10 @@ function mapDataFrameSubset(args, params, info) {
|
|
|
835
830
|
}
|
|
836
831
|
return result;
|
|
837
832
|
}
|
|
838
|
-
function mapDataFrameFilter(args, params, info) {
|
|
833
|
+
function mapDataFrameFilter(args, params, inference, info) {
|
|
839
834
|
args = (0, arguments_1.getEffectiveArgs)(args, params.special);
|
|
840
835
|
const dataFrame = (0, arguments_1.getFunctionArgument)(args, params.dataFrame, info);
|
|
841
|
-
if (!(0, arguments_1.isDataFrameArgument)(dataFrame,
|
|
836
|
+
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
|
|
842
837
|
return;
|
|
843
838
|
}
|
|
844
839
|
else if (args.length === 1) {
|
|
@@ -863,10 +858,10 @@ function mapDataFrameFilter(args, params, info) {
|
|
|
863
858
|
});
|
|
864
859
|
return result;
|
|
865
860
|
}
|
|
866
|
-
function mapDataFrameSelect(args, params, info) {
|
|
861
|
+
function mapDataFrameSelect(args, params, inference, info) {
|
|
867
862
|
args = (0, arguments_1.getEffectiveArgs)(args, params.special);
|
|
868
863
|
const dataFrame = (0, arguments_1.getFunctionArgument)(args, params.dataFrame, info);
|
|
869
|
-
if (!(0, arguments_1.isDataFrameArgument)(dataFrame,
|
|
864
|
+
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
|
|
870
865
|
return;
|
|
871
866
|
}
|
|
872
867
|
const result = [];
|
|
@@ -915,10 +910,10 @@ function mapDataFrameSelect(args, params, info) {
|
|
|
915
910
|
}
|
|
916
911
|
return result;
|
|
917
912
|
}
|
|
918
|
-
function mapDataFrameMutate(args, params, info) {
|
|
913
|
+
function mapDataFrameMutate(args, params, inference, info) {
|
|
919
914
|
args = (0, arguments_1.getEffectiveArgs)(args, params.special);
|
|
920
915
|
const dataFrame = (0, arguments_1.getFunctionArgument)(args, params.dataFrame, info);
|
|
921
|
-
if (!(0, arguments_1.isDataFrameArgument)(dataFrame,
|
|
916
|
+
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
|
|
922
917
|
return;
|
|
923
918
|
}
|
|
924
919
|
else if (args.length === 1) {
|
|
@@ -937,8 +932,8 @@ function mapDataFrameMutate(args, params, info) {
|
|
|
937
932
|
const accessedNames = mutateArgs
|
|
938
933
|
.flatMap(arg => (0, arguments_1.getUnresolvedSymbolsInExpression)(arg, info.graph))
|
|
939
934
|
.filter(arg => !mutatedCols?.includes(arg));
|
|
940
|
-
deletedCols = (0, arguments_1.filterValidNames)(deletedCols, params.checkNames, params.noDupNames);
|
|
941
|
-
mutatedCols = (0, arguments_1.filterValidNames)(mutatedCols, params.checkNames, params.noDupNames);
|
|
935
|
+
deletedCols = (0, arguments_1.filterValidNames)(deletedCols, params.checkNames, params.noDupNames, undefined, true);
|
|
936
|
+
mutatedCols = (0, arguments_1.filterValidNames)(mutatedCols, params.checkNames, params.noDupNames, undefined, true);
|
|
942
937
|
if (accessedNames.length > 0) {
|
|
943
938
|
result.push({
|
|
944
939
|
operation: 'accessCols',
|
|
@@ -965,10 +960,10 @@ function mapDataFrameMutate(args, params, info) {
|
|
|
965
960
|
}
|
|
966
961
|
return result;
|
|
967
962
|
}
|
|
968
|
-
function mapDataFrameGroupBy(args, params, info) {
|
|
963
|
+
function mapDataFrameGroupBy(args, params, inference, info) {
|
|
969
964
|
args = (0, arguments_1.getEffectiveArgs)(args, params.special);
|
|
970
965
|
const dataFrame = (0, arguments_1.getFunctionArgument)(args, params.dataFrame, info);
|
|
971
|
-
if (!(0, arguments_1.isDataFrameArgument)(dataFrame,
|
|
966
|
+
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
|
|
972
967
|
return;
|
|
973
968
|
}
|
|
974
969
|
else if (args.length === 1) {
|
|
@@ -994,10 +989,10 @@ function mapDataFrameGroupBy(args, params, info) {
|
|
|
994
989
|
});
|
|
995
990
|
return result;
|
|
996
991
|
}
|
|
997
|
-
function mapDataFrameSummarize(args, params, info) {
|
|
992
|
+
function mapDataFrameSummarize(args, params, inference, info) {
|
|
998
993
|
args = (0, arguments_1.getEffectiveArgs)(args, params.special);
|
|
999
994
|
const dataFrame = (0, arguments_1.getFunctionArgument)(args, params.dataFrame, info);
|
|
1000
|
-
if (!(0, arguments_1.isDataFrameArgument)(dataFrame,
|
|
995
|
+
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
|
|
1001
996
|
return;
|
|
1002
997
|
}
|
|
1003
998
|
const result = [];
|
|
@@ -1021,12 +1016,12 @@ function mapDataFrameSummarize(args, params, info) {
|
|
|
1021
1016
|
});
|
|
1022
1017
|
return result;
|
|
1023
1018
|
}
|
|
1024
|
-
function mapDataFrameJoin(args, params,
|
|
1019
|
+
function mapDataFrameJoin(args, params, inference, info) {
|
|
1025
1020
|
const dataFrame = (0, arguments_1.getFunctionArgument)(args, params.dataFrame, info);
|
|
1026
1021
|
const joinAll = (0, arguments_1.getArgumentValue)(args, params.joinAll, info);
|
|
1027
1022
|
const joinLeft = (0, arguments_1.getArgumentValue)(args, params.joinLeft, info);
|
|
1028
1023
|
const joinRight = (0, arguments_1.getArgumentValue)(args, params.joinRight, info);
|
|
1029
|
-
if (!(0, arguments_1.isDataFrameArgument)(dataFrame,
|
|
1024
|
+
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
|
|
1030
1025
|
return;
|
|
1031
1026
|
}
|
|
1032
1027
|
else if (args.length === 1) {
|
|
@@ -1038,7 +1033,7 @@ function mapDataFrameJoin(args, params, info, ctx) {
|
|
|
1038
1033
|
const result = [];
|
|
1039
1034
|
const otherArg = (0, arguments_1.getFunctionArgument)(args, params.otherDataFrame, info);
|
|
1040
1035
|
const byArg = (0, arguments_1.getFunctionArgument)(args, params.by, info);
|
|
1041
|
-
const otherDataFrame =
|
|
1036
|
+
const otherDataFrame = inference.getAbstractValue(otherArg) ?? dataframe_domain_1.DataFrameDomain.top(info.ctx.config.abstractInterpretation.dataFrame.maxColNames);
|
|
1042
1037
|
let byCols;
|
|
1043
1038
|
const joinType = getJoinType(joinAll, joinLeft, joinRight);
|
|
1044
1039
|
if (byArg !== undefined) {
|
|
@@ -1073,10 +1068,10 @@ function mapDataFrameJoin(args, params, info, ctx) {
|
|
|
1073
1068
|
});
|
|
1074
1069
|
return result;
|
|
1075
1070
|
}
|
|
1076
|
-
function mapDataFrameIdentity(args, params, info) {
|
|
1071
|
+
function mapDataFrameIdentity(args, params, inference, info) {
|
|
1077
1072
|
args = (0, arguments_1.getEffectiveArgs)(args, params.special);
|
|
1078
1073
|
const dataFrame = (0, arguments_1.getFunctionArgument)(args, params.dataFrame, info);
|
|
1079
|
-
if (!(0, arguments_1.isDataFrameArgument)(dataFrame,
|
|
1074
|
+
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
|
|
1080
1075
|
return;
|
|
1081
1076
|
}
|
|
1082
1077
|
else if (params.disallowNamedArgs && args.some(arguments_1.isNamedArgument)) {
|
|
@@ -1087,15 +1082,15 @@ function mapDataFrameIdentity(args, params, info) {
|
|
|
1087
1082
|
operand: dataFrame.value.info.id
|
|
1088
1083
|
}];
|
|
1089
1084
|
}
|
|
1090
|
-
function mapDataFrameUnknown(args, params, info) {
|
|
1085
|
+
function mapDataFrameUnknown(args, params, inference, info) {
|
|
1091
1086
|
let dataFrame;
|
|
1092
1087
|
if (params.dataFrame !== undefined) {
|
|
1093
1088
|
dataFrame = (0, arguments_1.getFunctionArgument)(args, params.dataFrame, info);
|
|
1094
1089
|
}
|
|
1095
1090
|
else {
|
|
1096
|
-
dataFrame = args.find(arg => (0, arguments_1.isDataFrameArgument)(arg,
|
|
1091
|
+
dataFrame = args.find(arg => (0, arguments_1.isDataFrameArgument)(arg, inference));
|
|
1097
1092
|
}
|
|
1098
|
-
if (!(0, arguments_1.isDataFrameArgument)(dataFrame,
|
|
1093
|
+
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
|
|
1099
1094
|
return;
|
|
1100
1095
|
}
|
|
1101
1096
|
return [{
|
|
@@ -1104,7 +1099,7 @@ function mapDataFrameUnknown(args, params, info) {
|
|
|
1104
1099
|
...(params.constraintType !== undefined ? { type: params.constraintType } : {})
|
|
1105
1100
|
}];
|
|
1106
1101
|
}
|
|
1107
|
-
function getRequestFromRead(fileNameArg, textArg, params, info
|
|
1102
|
+
function getRequestFromRead(fileNameArg, textArg, params, info) {
|
|
1108
1103
|
let source;
|
|
1109
1104
|
let request;
|
|
1110
1105
|
if (fileNameArg !== undefined && fileNameArg !== r_function_call_1.EmptyArgument) {
|
|
@@ -1112,7 +1107,7 @@ function getRequestFromRead(fileNameArg, textArg, params, info, ctx) {
|
|
|
1112
1107
|
if (typeof fileName === 'string') {
|
|
1113
1108
|
source = fileName;
|
|
1114
1109
|
const referenceChain = fileNameArg.info.file ? [fileNameArg.info.file] : [];
|
|
1115
|
-
const sources = (0, built_in_source_1.findSource)(ctx.config.solver.resolveSource, fileName, { referenceChain, ctx });
|
|
1110
|
+
const sources = (0, built_in_source_1.findSource)(info.ctx.config.solver.resolveSource, fileName, { referenceChain, ctx: info.ctx });
|
|
1116
1111
|
if (sources?.length === 1) {
|
|
1117
1112
|
source = sources[0];
|
|
1118
1113
|
// create request from resolved source file path
|
|
@@ -1131,7 +1126,7 @@ function getRequestFromRead(fileNameArg, textArg, params, info, ctx) {
|
|
|
1131
1126
|
request = (0, retriever_1.requestFromInput)((0, resolve_args_1.unescapeSpecialChars)(text));
|
|
1132
1127
|
}
|
|
1133
1128
|
}
|
|
1134
|
-
request = request ? ctx.files.resolveRequest(request).r : undefined;
|
|
1129
|
+
request = request ? info.ctx.files.resolveRequest(request).r : undefined;
|
|
1135
1130
|
return { source, request };
|
|
1136
1131
|
}
|
|
1137
1132
|
function parseRequestContent(request, parser, maxLines) {
|