@eagleoutice/flowr 2.6.3 → 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 +22 -22
- 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 +4 -7
- package/abstract-interpretation/data-frame/dataframe-domain.js +26 -16
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +6 -4
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +11 -14
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +10 -9
- package/abstract-interpretation/data-frame/mappers/arguments.js +8 -5
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +18 -18
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +53 -58
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +7 -5
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +26 -29
- package/abstract-interpretation/data-frame/semantics.js +48 -44
- 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/abstract-domain.d.ts +1 -0
- package/abstract-interpretation/domains/abstract-domain.js +3 -2
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +2 -2
- package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
- package/abstract-interpretation/domains/interval-domain.d.ts +4 -4
- package/abstract-interpretation/domains/interval-domain.js +3 -6
- package/abstract-interpretation/domains/lattice.d.ts +2 -0
- package/abstract-interpretation/domains/lattice.js +3 -1
- package/abstract-interpretation/domains/positive-interval-domain.d.ts +1 -1
- package/abstract-interpretation/domains/positive-interval-domain.js +1 -1
- package/abstract-interpretation/domains/satisfiable-domain.d.ts +2 -2
- package/abstract-interpretation/domains/satisfiable-domain.js +2 -2
- package/abstract-interpretation/domains/set-range-domain.d.ts +104 -0
- package/abstract-interpretation/domains/set-range-domain.js +406 -0
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +2 -2
- package/abstract-interpretation/domains/set-upper-bound-domain.js +2 -2
- package/abstract-interpretation/domains/singleton-domain.d.ts +2 -2
- package/abstract-interpretation/domains/singleton-domain.js +2 -2
- package/benchmark/slicer.d.ts +2 -1
- package/benchmark/slicer.js +50 -29
- package/benchmark/stats/print.js +8 -5
- package/benchmark/stats/stats.d.ts +3 -2
- package/benchmark/summarizer/data.d.ts +11 -8
- package/benchmark/summarizer/first-phase/process.js +11 -8
- package/benchmark/summarizer/second-phase/process.js +24 -18
- 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/cfg-dead-code.js +3 -2
- 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/control-flow/useless-loop.js +4 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +3 -0
- package/core/steps/all/static-slicing/00-slice.js +2 -1
- package/core/steps/pipeline/default-pipelines.d.ts +42 -42
- package/dataflow/cluster.js +2 -2
- package/dataflow/environments/append.d.ts +5 -0
- package/dataflow/environments/append.js +6 -20
- package/dataflow/environments/built-in.d.ts +2 -1
- package/dataflow/environments/clone.d.ts +1 -1
- package/dataflow/environments/clone.js +3 -27
- package/dataflow/environments/define.d.ts +7 -3
- package/dataflow/environments/define.js +9 -56
- package/dataflow/environments/diff.js +1 -1
- package/dataflow/environments/environment.d.ts +48 -28
- package/dataflow/environments/environment.js +187 -62
- package/dataflow/environments/overwrite.js +2 -45
- package/dataflow/environments/reference-to-maybe.d.ts +13 -0
- package/dataflow/environments/reference-to-maybe.js +54 -0
- package/dataflow/environments/resolve-by-name.d.ts +6 -1
- package/dataflow/environments/resolve-by-name.js +56 -4
- package/dataflow/environments/scoping.d.ts +2 -2
- package/dataflow/environments/scoping.js +7 -7
- package/dataflow/eval/resolve/alias-tracking.d.ts +10 -4
- package/dataflow/eval/resolve/alias-tracking.js +16 -14
- package/dataflow/eval/resolve/resolve-argument.d.ts +2 -1
- package/dataflow/eval/resolve/resolve-argument.js +8 -8
- package/dataflow/eval/resolve/resolve.d.ts +13 -11
- package/dataflow/eval/resolve/resolve.js +16 -15
- package/dataflow/extractor.js +1 -7
- package/dataflow/fn/higher-order-function.d.ts +2 -1
- package/dataflow/fn/higher-order-function.js +4 -4
- package/dataflow/graph/dataflowgraph-builder.d.ts +9 -5
- package/dataflow/graph/dataflowgraph-builder.js +21 -11
- package/dataflow/graph/diff-dataflow-graph.js +2 -2
- package/dataflow/graph/graph.d.ts +10 -2
- package/dataflow/graph/graph.js +41 -12
- package/dataflow/graph/invert-dfg.d.ts +3 -2
- package/dataflow/graph/invert-dfg.js +3 -3
- package/dataflow/graph/resolve-graph.d.ts +2 -1
- package/dataflow/graph/resolve-graph.js +2 -2
- package/dataflow/graph/vertex.d.ts +3 -3
- package/dataflow/graph/vertex.js +3 -3
- package/dataflow/info.d.ts +1 -1
- package/dataflow/internal/linker.d.ts +2 -0
- package/dataflow/internal/linker.js +13 -19
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +7 -1
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +12 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +9 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +9 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +8 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +5 -5
- package/dataflow/internal/process/functions/call/common.js +2 -3
- package/dataflow/internal/process/functions/call/known-call-handling.js +1 -1
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +1 -1
- package/dataflow/internal/process/functions/process-argument.js +1 -1
- package/dataflow/internal/process/process-symbol.js +1 -1
- package/dataflow/internal/process/process-value.d.ts +1 -1
- package/dataflow/internal/process/process-value.js +7 -7
- package/dataflow/processor.d.ts +1 -5
- 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-dfg.js +3 -2
- 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 +5 -4
- package/documentation/doc-util/doc-types.d.ts +1 -1
- package/documentation/doc-util/doc-types.js +2 -2
- package/documentation/issue-linting-rule.d.ts +1 -1
- package/documentation/wiki-analyzer.d.ts +1 -1
- package/documentation/wiki-analyzer.js +14 -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 +10 -11
- 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-faq.js +0 -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-linter.js +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 +5 -2
- 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/linter-rules.d.ts +2 -2
- package/linter/rules/absolute-path.js +4 -4
- package/linter/rules/dataframe-access-validation.d.ts +2 -2
- package/linter/rules/dataframe-access-validation.js +9 -11
- package/linter/rules/function-finder-util.d.ts +2 -2
- package/linter/rules/function-finder-util.js +1 -1
- package/linter/rules/network-functions.js +1 -1
- package/linter/rules/seeded-randomness.d.ts +1 -1
- package/linter/rules/seeded-randomness.js +5 -5
- package/linter/rules/unused-definition.js +1 -1
- package/package.json +1 -2
- package/project/context/flowr-analyzer-context.d.ts +11 -0
- package/project/context/flowr-analyzer-context.js +3 -0
- package/project/context/flowr-analyzer-environment-context.d.ts +47 -0
- package/project/context/flowr-analyzer-environment-context.js +50 -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/call-context-query/call-context-query-executor.js +1 -4
- package/queries/catalog/control-flow-query/control-flow-query-format.js +3 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +4 -4
- package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +5 -3
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +4 -4
- package/queries/catalog/df-shape-query/df-shape-query-format.js +2 -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/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -3
- package/queries/catalog/linter-query/linter-query-format.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.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/slicing/static/slice-call.d.ts +3 -2
- package/slicing/static/slice-call.js +4 -4
- package/slicing/static/static-slicer.d.ts +3 -1
- package/slicing/static/static-slicer.js +6 -7
- package/statistics/features/supported/control-flow/control-flow.js +1 -1
- package/statistics/features/supported/data-access/data-access.js +1 -1
- package/statistics/features/supported/used-functions/used-functions.js +1 -1
- package/statistics/features/supported/variables/variables.js +2 -1
- package/util/containers.js +2 -2
- 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 +2 -7
- package/util/mermaid/dfg.js +10 -6
- 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/simple-df/dfg-view.d.ts +2 -1
- package/util/simple-df/dfg-view.js +2 -2
- 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 -19
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.js +0 -33
- package/dataflow/environments/remove.d.ts +0 -12
- package/dataflow/environments/remove.js +0 -52
- 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
|
@@ -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
|
-
const resolveInfo = { graph: dfg, idMap: dfg.idMap, full: true, resolve: config_1.VariableResolve.Alias };
|
|
532
|
-
let operations;
|
|
530
|
+
const resolveInfo = { graph: dfg, idMap: dfg.idMap, full: true, resolve: config_1.VariableResolve.Alias, ctx };
|
|
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',
|
|
@@ -946,29 +941,29 @@ function mapDataFrameMutate(args, params, info) {
|
|
|
946
941
|
columns: accessedNames
|
|
947
942
|
});
|
|
948
943
|
}
|
|
949
|
-
if (
|
|
944
|
+
if (mutatedCols === undefined || mutatedCols.length > 0 || deletedCols?.length === 0) {
|
|
950
945
|
result.push({
|
|
951
|
-
operation: '
|
|
946
|
+
operation: 'mutateCols',
|
|
952
947
|
operand: operand?.info.id,
|
|
953
|
-
colnames:
|
|
954
|
-
options: { maybe: true }
|
|
948
|
+
colnames: mutatedCols
|
|
955
949
|
});
|
|
956
950
|
operand = undefined;
|
|
957
951
|
}
|
|
958
|
-
if (
|
|
952
|
+
if (deletedCols === undefined || deletedCols.length > 0) {
|
|
959
953
|
result.push({
|
|
960
|
-
operation: '
|
|
954
|
+
operation: 'removeCols',
|
|
961
955
|
operand: operand?.info.id,
|
|
962
|
-
colnames:
|
|
956
|
+
colnames: deletedCols,
|
|
957
|
+
options: { maybe: true }
|
|
963
958
|
});
|
|
964
959
|
operand = undefined;
|
|
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) {
|
|
@@ -1,11 +1,13 @@
|
|
|
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 { ParentInformation } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
|
-
import type {
|
|
5
|
+
import type { DataFrameOperations, DataFrameShapeInferenceVisitor } from '../shape-inference';
|
|
5
6
|
/**
|
|
6
|
-
* Maps a concrete data frame replacement function to abstract data frame operations.
|
|
7
|
-
* @param node - The R node of the replacement function
|
|
7
|
+
* Maps a concrete data frame replacement function call to abstract data frame operations.
|
|
8
|
+
* @param node - The R node of the replacement function call
|
|
8
9
|
* @param dfg - The data flow graph for resolving the arguments
|
|
9
|
-
* @
|
|
10
|
+
* @param ctx - The current flowR analysis context
|
|
11
|
+
* @returns The mapped abstract data frame operations for the replacement function call, or `undefined` if the node does not represent a data frame replacement function call
|
|
10
12
|
*/
|
|
11
|
-
export declare function mapDataFrameReplacementFunction(node: RNode<ParentInformation>, expression: RNode<ParentInformation>, dfg: DataflowGraph):
|
|
13
|
+
export declare function mapDataFrameReplacementFunction(node: RNode<ParentInformation>, expression: RNode<ParentInformation>, inference: DataFrameShapeInferenceVisitor, dfg: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext): DataFrameOperations;
|
|
@@ -18,39 +18,36 @@ const DataFrameReplacementFunctionMapper = {
|
|
|
18
18
|
'dimnames': mapDataFrameDimNamesAssignment
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
-
* Maps a concrete data frame replacement function to abstract data frame operations.
|
|
22
|
-
* @param node - The R node of the replacement function
|
|
21
|
+
* Maps a concrete data frame replacement function call to abstract data frame operations.
|
|
22
|
+
* @param node - The R node of the replacement function call
|
|
23
23
|
* @param dfg - The data flow graph for resolving the arguments
|
|
24
|
-
* @
|
|
24
|
+
* @param ctx - The current flowR analysis context
|
|
25
|
+
* @returns The mapped abstract data frame operations for the replacement function call, or `undefined` if the node does not represent a data frame replacement function call
|
|
25
26
|
*/
|
|
26
|
-
function mapDataFrameReplacementFunction(node, expression, dfg) {
|
|
27
|
+
function mapDataFrameReplacementFunction(node, expression, inference, dfg, ctx) {
|
|
27
28
|
const parent = hasParentReplacement(node, dfg) ? dfg.idMap?.get(node.info.parent) : undefined;
|
|
28
|
-
const resolveInfo = { graph: dfg, idMap: dfg.idMap, full: true, resolve: config_1.VariableResolve.Alias };
|
|
29
|
-
let operations;
|
|
29
|
+
const resolveInfo = { graph: dfg, idMap: dfg.idMap, full: true, resolve: config_1.VariableResolve.Alias, ctx };
|
|
30
30
|
if (node.type === type_1.RType.Access) {
|
|
31
31
|
if (node.access.every(arg => arg === r_function_call_1.EmptyArgument)) {
|
|
32
|
-
|
|
32
|
+
return mapDataFrameContentAssignment(node, expression, inference);
|
|
33
33
|
}
|
|
34
34
|
else if ((0, access_mapper_1.isStringBasedAccess)(node)) {
|
|
35
|
-
|
|
35
|
+
return mapDataFrameNamedColumnAssignment(node, expression, inference, resolveInfo);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
|
|
38
|
+
return mapDataFrameIndexColRowAssignment(node, expression, inference, resolveInfo);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
else if (node.type === type_1.RType.FunctionCall && node.named && node.arguments.length === 1 && node.arguments[0] !== r_function_call_1.EmptyArgument) {
|
|
42
42
|
if (isDataFrameReplacement(node.functionName.content)) {
|
|
43
43
|
const functionName = node.functionName.content;
|
|
44
|
-
const
|
|
45
|
-
|
|
44
|
+
const mapper = DataFrameReplacementFunctionMapper[functionName];
|
|
45
|
+
return mapper(node.arguments[0], expression, inference, resolveInfo, parent);
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
|
-
|
|
48
|
+
return mapDataFrameUnknownAssignment(node.arguments[0], expression, inference);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
if (operations !== undefined) {
|
|
52
|
-
return { type: 'expression', operations: operations };
|
|
53
|
-
}
|
|
54
51
|
}
|
|
55
52
|
function isDataFrameReplacement(functionName) {
|
|
56
53
|
// a check with `functionName in DataFrameReplacementFunctionMapper` would return true for "toString"
|
|
@@ -60,9 +57,9 @@ function hasParentReplacement(node, dfg) {
|
|
|
60
57
|
const parentVertex = node.info.parent ? dfg.getVertex(node.info.parent) : undefined;
|
|
61
58
|
return (0, vertex_1.isFunctionCallVertex)(parentVertex) && parentVertex.origin.includes('builtin:replacement');
|
|
62
59
|
}
|
|
63
|
-
function mapDataFrameContentAssignment(access, expression,
|
|
60
|
+
function mapDataFrameContentAssignment(access, expression, inference) {
|
|
64
61
|
const dataFrame = access.accessed;
|
|
65
|
-
if (!(0, arguments_1.isDataFrameArgument)(dataFrame,
|
|
62
|
+
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
|
|
66
63
|
return;
|
|
67
64
|
}
|
|
68
65
|
if ((0, arguments_1.isRNull)(expression)) {
|
|
@@ -81,9 +78,9 @@ function mapDataFrameContentAssignment(access, expression, info) {
|
|
|
81
78
|
}];
|
|
82
79
|
}
|
|
83
80
|
}
|
|
84
|
-
function mapDataFrameNamedColumnAssignment(access, expression, info) {
|
|
81
|
+
function mapDataFrameNamedColumnAssignment(access, expression, inference, info) {
|
|
85
82
|
const dataFrame = access.accessed;
|
|
86
|
-
if (!(0, arguments_1.isDataFrameArgument)(dataFrame,
|
|
83
|
+
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
|
|
87
84
|
return;
|
|
88
85
|
}
|
|
89
86
|
const colname = (0, resolve_args_1.resolveIdToArgValueSymbolName)(access.access[0], info);
|
|
@@ -104,10 +101,10 @@ function mapDataFrameNamedColumnAssignment(access, expression, info) {
|
|
|
104
101
|
}];
|
|
105
102
|
}
|
|
106
103
|
}
|
|
107
|
-
function mapDataFrameIndexColRowAssignment(access, expression, info) {
|
|
104
|
+
function mapDataFrameIndexColRowAssignment(access, expression, inference, info) {
|
|
108
105
|
const dataFrame = access.accessed;
|
|
109
106
|
const args = access.access;
|
|
110
|
-
if (!(0, arguments_1.isDataFrameArgument)(dataFrame,
|
|
107
|
+
if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference) || args.every(arg => arg === r_function_call_1.EmptyArgument)) {
|
|
111
108
|
return;
|
|
112
109
|
}
|
|
113
110
|
const result = [];
|
|
@@ -159,8 +156,8 @@ function mapDataFrameIndexColRowAssignment(access, expression, info) {
|
|
|
159
156
|
}
|
|
160
157
|
return result;
|
|
161
158
|
}
|
|
162
|
-
function mapDataFrameColNamesAssignment(operand, expression, info, parent) {
|
|
163
|
-
if (!(0, arguments_1.isDataFrameArgument)(operand,
|
|
159
|
+
function mapDataFrameColNamesAssignment(operand, expression, inference, info, parent) {
|
|
160
|
+
if (!(0, arguments_1.isDataFrameArgument)(operand, inference)) {
|
|
164
161
|
return;
|
|
165
162
|
}
|
|
166
163
|
const argument = info.idMap !== undefined ? (0, make_argument_1.toUnnamedArgument)(expression, info.idMap) : r_function_call_1.EmptyArgument;
|
|
@@ -172,8 +169,8 @@ function mapDataFrameColNamesAssignment(operand, expression, info, parent) {
|
|
|
172
169
|
...(parent !== undefined ? { options: { partial: true } } : {})
|
|
173
170
|
}];
|
|
174
171
|
}
|
|
175
|
-
function mapDataFrameRowNamesAssignment(operand, expression,
|
|
176
|
-
if (!(0, arguments_1.isDataFrameArgument)(operand,
|
|
172
|
+
function mapDataFrameRowNamesAssignment(operand, expression, inference) {
|
|
173
|
+
if (!(0, arguments_1.isDataFrameArgument)(operand, inference)) {
|
|
177
174
|
return;
|
|
178
175
|
}
|
|
179
176
|
return [{
|
|
@@ -182,8 +179,8 @@ function mapDataFrameRowNamesAssignment(operand, expression, info) {
|
|
|
182
179
|
type: semantics_1.ConstraintType.OperandModification
|
|
183
180
|
}];
|
|
184
181
|
}
|
|
185
|
-
function mapDataFrameDimNamesAssignment(operand, expression,
|
|
186
|
-
if (!(0, arguments_1.isDataFrameArgument)(operand,
|
|
182
|
+
function mapDataFrameDimNamesAssignment(operand, expression, inference) {
|
|
183
|
+
if (!(0, arguments_1.isDataFrameArgument)(operand, inference)) {
|
|
187
184
|
return;
|
|
188
185
|
}
|
|
189
186
|
return [{
|
|
@@ -192,8 +189,8 @@ function mapDataFrameDimNamesAssignment(operand, expression, info) {
|
|
|
192
189
|
colnames: undefined
|
|
193
190
|
}];
|
|
194
191
|
}
|
|
195
|
-
function mapDataFrameUnknownAssignment(operand, expression,
|
|
196
|
-
if (!(0, arguments_1.isDataFrameArgument)(operand,
|
|
192
|
+
function mapDataFrameUnknownAssignment(operand, expression, inference) {
|
|
193
|
+
if (!(0, arguments_1.isDataFrameArgument)(operand, inference)) {
|
|
197
194
|
return;
|
|
198
195
|
}
|
|
199
196
|
return [{
|