@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
|
@@ -7,12 +7,12 @@ const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model
|
|
|
7
7
|
const logger_1 = require("../../../../../logger");
|
|
8
8
|
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
9
9
|
const edge_1 = require("../../../../../graph/edge");
|
|
10
|
-
const environment_1 = require("../../../../../environments/environment");
|
|
11
10
|
const built_in_1 = require("../../../../../environments/built-in");
|
|
12
11
|
const built_in_assignment_1 = require("./built-in-assignment");
|
|
13
12
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
14
13
|
const vertex_1 = require("../../../../../graph/vertex");
|
|
15
14
|
const containers_1 = require("../../../../../../util/containers");
|
|
15
|
+
const reference_to_maybe_1 = require("../../../../../environments/reference-to-maybe");
|
|
16
16
|
function tableAssignmentProcessor(name, args, rootId, data, outInfo) {
|
|
17
17
|
outInfo.definitionRootNodes.push(rootId);
|
|
18
18
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'table:assign' }).information;
|
|
@@ -71,12 +71,12 @@ function processAccess(name, args, rootId, data, config) {
|
|
|
71
71
|
* ```
|
|
72
72
|
* the read for a will use both accesses as potential definitions and not just the last one!
|
|
73
73
|
*/
|
|
74
|
-
unknownReferences: (0,
|
|
74
|
+
unknownReferences: (0, reference_to_maybe_1.makeAllMaybe)(info.unknownReferences, info.graph, info.environment, false),
|
|
75
75
|
entryPoint: rootId,
|
|
76
76
|
/** it is, to be precise, the accessed element we want to map to maybe */
|
|
77
77
|
in: head === r_function_call_1.EmptyArgument ? info.in : info.in.map(ref => {
|
|
78
78
|
if (ref.nodeId === head.value?.info.id) {
|
|
79
|
-
return (0,
|
|
79
|
+
return (0, reference_to_maybe_1.makeReferenceMaybe)(ref, info.graph, info.environment, false);
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
82
|
return ref;
|
|
@@ -60,7 +60,7 @@ function processApply(name, args, rootId, data, config) {
|
|
|
60
60
|
else if (val.type === type_1.RType.Symbol) {
|
|
61
61
|
functionId = val.info.id;
|
|
62
62
|
if (resolveValue) {
|
|
63
|
-
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(val.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables }));
|
|
63
|
+
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(val.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables, ctx: data.ctx }));
|
|
64
64
|
if (resolved?.elements.length === 1 && resolved.elements[0].type === 'string') {
|
|
65
65
|
functionName = (0, r_value_1.isValue)(resolved.elements[0].value) ? resolved.elements[0].value.str : undefined;
|
|
66
66
|
}
|
|
@@ -105,7 +105,7 @@ function processApply(name, args, rootId, data, config) {
|
|
|
105
105
|
cds: data.controlDependencies,
|
|
106
106
|
args: allOtherArguments, // same reference
|
|
107
107
|
origin: ['function']
|
|
108
|
-
});
|
|
108
|
+
}, data.ctx.env.makeCleanEnv());
|
|
109
109
|
information.graph.addEdge(rootId, rootFnId, edge_1.EdgeType.Calls | edge_1.EdgeType.Reads);
|
|
110
110
|
information.graph.addEdge(rootId, functionId, edge_1.EdgeType.Calls | edge_1.EdgeType.Argument);
|
|
111
111
|
information = {
|
|
@@ -51,4 +51,6 @@ export interface AssignmentToSymbolParameters<OtherInfo> extends AssignmentConfi
|
|
|
51
51
|
export declare function markAsAssignment<OtherInfo>(information: {
|
|
52
52
|
environment: REnvironmentInformation;
|
|
53
53
|
graph: DataflowGraph;
|
|
54
|
-
}, nodeToDefine: InGraphIdentifierDefinition
|
|
54
|
+
}, nodeToDefine: InGraphIdentifierDefinition & {
|
|
55
|
+
name: string;
|
|
56
|
+
}, sourceIds: readonly NodeId[], rootIdOfAssignment: NodeId, data: DataflowProcessorInformation<OtherInfo>, assignmentConfig?: AssignmentConfiguration): void;
|
|
@@ -112,7 +112,7 @@ args, rootId, data, config) {
|
|
|
112
112
|
}
|
|
113
113
|
else {
|
|
114
114
|
// try to resolve the variable first
|
|
115
|
-
const n = (0, alias_tracking_1.resolveIdToValue)(target.info.id, { environment: data.environment, resolve: data.ctx.config.solver.variables, idMap: data.completeAst.idMap, full: true });
|
|
115
|
+
const n = (0, alias_tracking_1.resolveIdToValue)(target.info.id, { environment: data.environment, resolve: data.ctx.config.solver.variables, idMap: data.completeAst.idMap, full: true, ctx: data.ctx });
|
|
116
116
|
if (n.type === 'set' && n.elements.length === 1 && n.elements[0].type === 'string') {
|
|
117
117
|
const val = n.elements[0].value;
|
|
118
118
|
if ((0, r_value_1.isValue)(val)) {
|
|
@@ -187,8 +187,8 @@ args, rootId, data, config) {
|
|
|
187
187
|
return info;
|
|
188
188
|
}
|
|
189
189
|
function extractSourceAndTarget(args) {
|
|
190
|
-
const source = (0, unpack_argument_1.
|
|
191
|
-
const target = (0, unpack_argument_1.
|
|
190
|
+
const source = (0, unpack_argument_1.unpackArg)(args[1]);
|
|
191
|
+
const target = (0, unpack_argument_1.unpackArg)(args[0]);
|
|
192
192
|
return { source, target };
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
@@ -38,7 +38,7 @@ function processEvalCall(name, args, rootId, data, config) {
|
|
|
38
38
|
(0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
|
|
39
39
|
return information;
|
|
40
40
|
}
|
|
41
|
-
const code = resolveEvalToCode(evalArgument.value, data.environment, data.completeAst.idMap, data.ctx
|
|
41
|
+
const code = resolveEvalToCode(evalArgument.value, data.environment, data.completeAst.idMap, data.ctx);
|
|
42
42
|
if (code) {
|
|
43
43
|
const idGenerator = (0, decorate_1.sourcedDeterministicCountingIdGenerator)(name.lexeme + '::' + rootId, name.location);
|
|
44
44
|
data = {
|
|
@@ -70,7 +70,7 @@ function processEvalCall(name, args, rootId, data, config) {
|
|
|
70
70
|
(0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
|
|
71
71
|
return information;
|
|
72
72
|
}
|
|
73
|
-
function resolveEvalToCode(evalArgument, env, idMap,
|
|
73
|
+
function resolveEvalToCode(evalArgument, env, idMap, ctx) {
|
|
74
74
|
const val = evalArgument;
|
|
75
75
|
if (val.type === type_1.RType.FunctionCall && val.named && val.functionName.content === 'parse') {
|
|
76
76
|
const arg = val.arguments.find(v => v !== r_function_call_1.EmptyArgument && v.name?.content === 'text');
|
|
@@ -82,13 +82,13 @@ function resolveEvalToCode(evalArgument, env, idMap, config) {
|
|
|
82
82
|
return [arg.value.content.str];
|
|
83
83
|
}
|
|
84
84
|
else if (arg.value?.type === type_1.RType.Symbol) {
|
|
85
|
-
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(arg.value.info.id, { environment: env, idMap: idMap, resolve: config.solver.variables }));
|
|
85
|
+
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(arg.value.info.id, { environment: env, idMap: idMap, resolve: ctx.config.solver.variables, ctx }));
|
|
86
86
|
if (resolved) {
|
|
87
87
|
return (0, string_constants_1.collectStrings)(resolved.elements);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
else if (arg.value?.type === type_1.RType.FunctionCall && arg.value.named && ['paste', 'paste0'].includes(arg.value.functionName.content)) {
|
|
91
|
-
return handlePaste(config, arg.value.arguments, env, idMap, arg.value.functionName.content === 'paste' ? [' '] : ['']);
|
|
91
|
+
return handlePaste(ctx.config, arg.value.arguments, env, idMap, arg.value.functionName.content === 'paste' ? [' '] : [''], ctx);
|
|
92
92
|
}
|
|
93
93
|
return undefined;
|
|
94
94
|
}
|
|
@@ -101,7 +101,7 @@ function resolveEvalToCode(evalArgument, env, idMap, config) {
|
|
|
101
101
|
return undefined;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
function getAsString(config, val, env, idMap) {
|
|
104
|
+
function getAsString(config, val, env, idMap, ctx) {
|
|
105
105
|
if (!val) {
|
|
106
106
|
return undefined;
|
|
107
107
|
}
|
|
@@ -109,17 +109,17 @@ function getAsString(config, val, env, idMap) {
|
|
|
109
109
|
return [val.content.str];
|
|
110
110
|
}
|
|
111
111
|
else if (val.type === type_1.RType.Symbol) {
|
|
112
|
-
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(val.info.id, { environment: env, idMap: idMap, resolve: config.solver.variables }));
|
|
112
|
+
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(val.info.id, { environment: env, idMap: idMap, resolve: config.solver.variables, ctx }));
|
|
113
113
|
if (resolved) {
|
|
114
114
|
return (0, string_constants_1.collectStrings)(resolved.elements);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
return undefined;
|
|
118
118
|
}
|
|
119
|
-
function handlePaste(config, args, env, idMap, sepDefault) {
|
|
119
|
+
function handlePaste(config, args, env, idMap, sepDefault, ctx) {
|
|
120
120
|
const sepArg = args.find(v => v !== r_function_call_1.EmptyArgument && v.name?.content === 'sep');
|
|
121
121
|
if (sepArg) {
|
|
122
|
-
const res = sepArg !== r_function_call_1.EmptyArgument && sepArg.value ? getAsString(config, sepArg.value, env, idMap) : undefined;
|
|
122
|
+
const res = sepArg !== r_function_call_1.EmptyArgument && sepArg.value ? getAsString(config, sepArg.value, env, idMap, ctx) : undefined;
|
|
123
123
|
if (!res) {
|
|
124
124
|
// sep not resolvable clearly / unknown
|
|
125
125
|
return undefined;
|
|
@@ -128,7 +128,7 @@ function handlePaste(config, args, env, idMap, sepDefault) {
|
|
|
128
128
|
}
|
|
129
129
|
const allArgs = args
|
|
130
130
|
.filter(v => v !== r_function_call_1.EmptyArgument && v.name?.content !== 'sep' && v.value)
|
|
131
|
-
.map(v => getAsString(config, v.value, env, idMap));
|
|
131
|
+
.map(v => getAsString(config, v.value, env, idMap, ctx));
|
|
132
132
|
if (allArgs.some(assert_1.isUndefined)) {
|
|
133
133
|
return undefined;
|
|
134
134
|
}
|
|
@@ -7,7 +7,6 @@ const linker_1 = require("../../../../linker");
|
|
|
7
7
|
const assert_1 = require("../../../../../../util/assert");
|
|
8
8
|
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
9
9
|
const common_1 = require("../common");
|
|
10
|
-
const environment_1 = require("../../../../../environments/environment");
|
|
11
10
|
const graph_1 = require("../../../../../graph/graph");
|
|
12
11
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
13
12
|
const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
|
|
@@ -18,7 +17,7 @@ const built_in_1 = require("../../../../../environments/built-in");
|
|
|
18
17
|
const overwrite_1 = require("../../../../../environments/overwrite");
|
|
19
18
|
const logger_1 = require("../../../../../logger");
|
|
20
19
|
const log_1 = require("../../../../../../util/log");
|
|
21
|
-
const
|
|
20
|
+
const reference_to_maybe_1 = require("../../../../../environments/reference-to-maybe");
|
|
22
21
|
const dotDotDotAccess = /^\.\.\d+$/;
|
|
23
22
|
function linkReadNameToWriteIfPossible(read, environments, listEnvironments, remainingRead, nextGraph) {
|
|
24
23
|
const readName = read.name && dotDotDotAccess.test(read.name) ? '...' : read.name;
|
|
@@ -82,7 +81,10 @@ function updateSideEffectsForCalledFunctions(calledEnvs, inputEnvironment, nextG
|
|
|
82
81
|
// we update all definitions to be linked with the corresponding function call
|
|
83
82
|
// we, however, have to ignore expression-local writes!
|
|
84
83
|
if (localDefs.length > 0) {
|
|
85
|
-
environment =
|
|
84
|
+
environment = {
|
|
85
|
+
current: environment.current.removeAll(localDefs.filter(d => (0, assert_1.isNotUndefined)(d.name))),
|
|
86
|
+
level: environment.level
|
|
87
|
+
};
|
|
86
88
|
}
|
|
87
89
|
if (callDependencies === null) {
|
|
88
90
|
callDependencies = nextGraph.getVertex(functionCall, true)?.cds;
|
|
@@ -97,7 +99,7 @@ function updateSideEffectsForCalledFunctions(calledEnvs, inputEnvironment, nextG
|
|
|
97
99
|
*
|
|
98
100
|
*/
|
|
99
101
|
function processExpressionList(name, args, rootId, data) {
|
|
100
|
-
const expressions = args.map(
|
|
102
|
+
const expressions = args.map(unpack_argument_1.unpackNonameArg);
|
|
101
103
|
(0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `[expr list] with ${expressions.length} expressions`);
|
|
102
104
|
let { environment } = data;
|
|
103
105
|
// used to detect if a "write" happens within the same expression list
|
|
@@ -124,9 +126,9 @@ function processExpressionList(name, args, rootId, data) {
|
|
|
124
126
|
// if the expression contained next or break anywhere before the next loop, the "overwrite" should be an "append", because we do not know if the rest is executed
|
|
125
127
|
// update the environments for the next iteration with the previous writes
|
|
126
128
|
if (exitPoints.length > 0) {
|
|
127
|
-
processed.out = (0,
|
|
128
|
-
processed.in = (0,
|
|
129
|
-
processed.unknownReferences = (0,
|
|
129
|
+
processed.out = (0, reference_to_maybe_1.makeAllMaybe)(processed.out, nextGraph, processed.environment, true);
|
|
130
|
+
processed.in = (0, reference_to_maybe_1.makeAllMaybe)(processed.in, nextGraph, processed.environment, false);
|
|
131
|
+
processed.unknownReferences = (0, reference_to_maybe_1.makeAllMaybe)(processed.unknownReferences, nextGraph, processed.environment, false);
|
|
130
132
|
}
|
|
131
133
|
(0, info_1.addNonDefaultExitPoints)(exitPoints, processed.exitPoints);
|
|
132
134
|
out = out.concat(processed.out);
|
|
@@ -12,9 +12,9 @@ const logger_1 = require("../../../../../logger");
|
|
|
12
12
|
const overwrite_1 = require("../../../../../environments/overwrite");
|
|
13
13
|
const define_1 = require("../../../../../environments/define");
|
|
14
14
|
const append_1 = require("../../../../../environments/append");
|
|
15
|
-
const environment_1 = require("../../../../../environments/environment");
|
|
16
15
|
const edge_1 = require("../../../../../graph/edge");
|
|
17
16
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
17
|
+
const reference_to_maybe_1 = require("../../../../../environments/reference-to-maybe");
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
@@ -23,7 +23,7 @@ function processForLoop(name, args, rootId, data) {
|
|
|
23
23
|
logger_1.dataflowLogger.warn(`For-Loop ${name.content} does not have three arguments, skipping`);
|
|
24
24
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
25
25
|
}
|
|
26
|
-
const [variableArg, vectorArg, bodyArg] = args.map(e => (0, unpack_argument_1.
|
|
26
|
+
const [variableArg, vectorArg, bodyArg] = args.map(e => (0, unpack_argument_1.unpackNonameArg)(e));
|
|
27
27
|
(0, assert_1.guard)(variableArg !== undefined && vectorArg !== undefined && bodyArg !== undefined, () => `For-Loop ${JSON.stringify(args)} has missing arguments! Bad!`);
|
|
28
28
|
const vector = (0, processor_1.processDataflowFor)(vectorArg, data);
|
|
29
29
|
if ((0, info_1.alwaysExits)(vector)) {
|
|
@@ -50,7 +50,7 @@ function processForLoop(name, args, rootId, data) {
|
|
|
50
50
|
nextGraph.addEdge(write.nodeId, vector.entryPoint, edge_1.EdgeType.DefinedBy);
|
|
51
51
|
nextGraph.setDefinitionOfVertex(write);
|
|
52
52
|
}
|
|
53
|
-
const outgoing = variable.out.concat(writtenVariable, (0,
|
|
53
|
+
const outgoing = variable.out.concat(writtenVariable, (0, reference_to_maybe_1.makeAllMaybe)(body.out, nextGraph, outEnvironment, true));
|
|
54
54
|
(0, linker_1.linkCircularRedefinitionsWithinALoop)(nextGraph, nameIdShares, body.out);
|
|
55
55
|
(0, linker_1.reapplyLoopExitPoints)(body.exitPoints, body.in.concat(body.out, body.unknownReferences));
|
|
56
56
|
(0, common_1.patchFunctionCall)({
|
|
@@ -6,6 +6,7 @@ import { type RFunctionArgument } from '../../../../../../r-bridge/lang-4.x/ast/
|
|
|
6
6
|
import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
7
|
import { DataflowGraph } from '../../../../../graph/graph';
|
|
8
8
|
import { type REnvironmentInformation } from '../../../../../environments/environment';
|
|
9
|
+
import type { ReadOnlyFlowrAnalyzerContext } from '../../../../../../project/context/flowr-analyzer-context';
|
|
9
10
|
/**
|
|
10
11
|
* Process a function definition, i.e., `function(a, b) { ... }`
|
|
11
12
|
*/
|
|
@@ -13,7 +14,7 @@ export declare function processFunctionDefinition<OtherInfo>(name: RSymbol<Other
|
|
|
13
14
|
/**
|
|
14
15
|
*
|
|
15
16
|
*/
|
|
16
|
-
export declare function retrieveActiveEnvironment(callerEnvironment: REnvironmentInformation | undefined, baseEnvironment: REnvironmentInformation): REnvironmentInformation;
|
|
17
|
+
export declare function retrieveActiveEnvironment(callerEnvironment: REnvironmentInformation | undefined, baseEnvironment: REnvironmentInformation, ctx: ReadOnlyFlowrAnalyzerContext): REnvironmentInformation;
|
|
17
18
|
/**
|
|
18
19
|
* Update the closure links of all nested function definitions
|
|
19
20
|
* @param graph - dataflow graph to collect the function definitions from and to update the closure links for
|
|
@@ -16,7 +16,6 @@ const identifier_1 = require("../../../../../environments/identifier");
|
|
|
16
16
|
const overwrite_1 = require("../../../../../environments/overwrite");
|
|
17
17
|
const vertex_1 = require("../../../../../graph/vertex");
|
|
18
18
|
const scoping_1 = require("../../../../../environments/scoping");
|
|
19
|
-
const environment_1 = require("../../../../../environments/environment");
|
|
20
19
|
const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
|
|
21
20
|
const edge_1 = require("../../../../../graph/edge");
|
|
22
21
|
const log_1 = require("../../../../../../util/log");
|
|
@@ -31,7 +30,7 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
31
30
|
}
|
|
32
31
|
/* we remove the last argument, as it is the body */
|
|
33
32
|
const parameters = args.slice(0, -1);
|
|
34
|
-
const bodyArg = (0, unpack_argument_1.
|
|
33
|
+
const bodyArg = (0, unpack_argument_1.unpackNonameArg)(args[args.length - 1]);
|
|
35
34
|
(0, assert_1.guard)(bodyArg !== undefined, () => `Function Definition ${JSON.stringify(args)} has missing body! This is bad!`);
|
|
36
35
|
const originalEnvironment = data.environment;
|
|
37
36
|
// within a function def we do not pass on the outer binds as they could be overwritten when called
|
|
@@ -74,7 +73,7 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
74
73
|
id: read.nodeId,
|
|
75
74
|
environment: undefined,
|
|
76
75
|
cds: undefined
|
|
77
|
-
});
|
|
76
|
+
}, data.ctx.env.makeCleanEnv());
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
const flow = {
|
|
@@ -95,7 +94,7 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
95
94
|
cds: data.controlDependencies,
|
|
96
95
|
subflow: flow,
|
|
97
96
|
exitPoints: exitPoints?.filter(e => e.type === 1 /* ExitPointType.Return */ || e.type === 0 /* ExitPointType.Default */).map(e => e.nodeId) ?? []
|
|
98
|
-
});
|
|
97
|
+
}, data.ctx.env.makeCleanEnv());
|
|
99
98
|
return {
|
|
100
99
|
/* nothing escapes a function definition, but the function itself, will be forced in assignment: { nodeId: functionDefinition.info.id, scope: data.activeScope, used: 'always', name: functionDefinition.info.id as string } */
|
|
101
100
|
unknownReferences: [],
|
|
@@ -112,8 +111,8 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
112
111
|
/**
|
|
113
112
|
*
|
|
114
113
|
*/
|
|
115
|
-
function retrieveActiveEnvironment(callerEnvironment, baseEnvironment) {
|
|
116
|
-
callerEnvironment ??=
|
|
114
|
+
function retrieveActiveEnvironment(callerEnvironment, baseEnvironment, ctx) {
|
|
115
|
+
callerEnvironment ??= ctx.env.makeCleanEnv();
|
|
117
116
|
let level = callerEnvironment.level ?? 0;
|
|
118
117
|
if (baseEnvironment.level !== level) {
|
|
119
118
|
while (baseEnvironment.level < level) {
|
|
@@ -135,10 +134,7 @@ function retrieveActiveEnvironment(callerEnvironment, baseEnvironment) {
|
|
|
135
134
|
function updateNestedFunctionClosures(graph, outEnvironment, fnId) {
|
|
136
135
|
// track *all* function definitions - including those nested within the current graph,
|
|
137
136
|
// try to resolve their 'in' by only using the lowest scope which will be popped after this definition
|
|
138
|
-
for (const [id, { subflow
|
|
139
|
-
if (tag !== vertex_1.VertexType.FunctionDefinition) {
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
137
|
+
for (const [id, { subflow }] of graph.verticesOfType(vertex_1.VertexType.FunctionDefinition)) {
|
|
142
138
|
const ingoingRefs = subflow.in;
|
|
143
139
|
const remainingIn = [];
|
|
144
140
|
for (const ingoing of ingoingRefs) {
|
|
@@ -171,8 +167,8 @@ function updateNestedFunctionClosures(graph, outEnvironment, fnId) {
|
|
|
171
167
|
function updateNestedFunctionCalls(graph, outEnvironment) {
|
|
172
168
|
// track *all* function definitions - including those nested within the current graph,
|
|
173
169
|
// try to resolve their 'in' by only using the lowest scope which will be popped after this definition
|
|
174
|
-
for (const [id, { onlyBuiltin,
|
|
175
|
-
if (
|
|
170
|
+
for (const [id, { onlyBuiltin, environment, name }] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
171
|
+
if (!name || onlyBuiltin) {
|
|
176
172
|
continue;
|
|
177
173
|
}
|
|
178
174
|
// only the call environment counts!
|
|
@@ -218,7 +214,7 @@ function updateNestedFunctionCalls(graph, outEnvironment) {
|
|
|
218
214
|
}
|
|
219
215
|
}
|
|
220
216
|
function prepareFunctionEnvironment(data) {
|
|
221
|
-
let env =
|
|
217
|
+
let env = data.ctx.env.makeCleanEnv();
|
|
222
218
|
for (let i = 0; i < data.environment.level + 1 /* add another env */; i++) {
|
|
223
219
|
env = (0, scoping_1.pushLocalEnvironment)(env);
|
|
224
220
|
}
|
|
@@ -16,7 +16,7 @@ function processGet(name, args, rootId, data) {
|
|
|
16
16
|
logger_1.dataflowLogger.warn(`symbol access with ${name.content} has not 1 argument, skipping`);
|
|
17
17
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
18
18
|
}
|
|
19
|
-
const retrieve = (0, unpack_argument_1.
|
|
19
|
+
const retrieve = (0, unpack_argument_1.unpackNonameArg)(args[0]);
|
|
20
20
|
if (retrieve === undefined || retrieve.type !== type_1.RType.String) {
|
|
21
21
|
logger_1.dataflowLogger.warn(`symbol access with ${name.content} has not 1 argument, skipping`);
|
|
22
22
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
@@ -5,6 +5,8 @@ import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/
|
|
|
5
5
|
import type { RFunctionArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
6
6
|
import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Processes an if-then-else built-in function call.
|
|
9
|
+
* For example, `if(cond) thenExpr else elseExpr` and `if(cond) thenExpr`.
|
|
10
|
+
* The arguments will be either `[cond, thenExpr]` or `[cond, thenExpr, elseExpr]`.
|
|
9
11
|
*/
|
|
10
12
|
export declare function processIfThenElse<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
|
|
@@ -10,18 +10,20 @@ const logger_1 = require("../../../../../logger");
|
|
|
10
10
|
const edge_1 = require("../../../../../graph/edge");
|
|
11
11
|
const append_1 = require("../../../../../environments/append");
|
|
12
12
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
13
|
-
const environment_1 = require("../../../../../environments/environment");
|
|
14
13
|
const general_1 = require("../../../../../eval/values/general");
|
|
15
14
|
const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
|
|
15
|
+
const reference_to_maybe_1 = require("../../../../../environments/reference-to-maybe");
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Processes an if-then-else built-in function call.
|
|
18
|
+
* For example, `if(cond) thenExpr else elseExpr` and `if(cond) thenExpr`.
|
|
19
|
+
* The arguments will be either `[cond, thenExpr]` or `[cond, thenExpr, elseExpr]`.
|
|
18
20
|
*/
|
|
19
21
|
function processIfThenElse(name, args, rootId, data) {
|
|
20
22
|
if (args.length !== 2 && args.length !== 3) {
|
|
21
23
|
logger_1.dataflowLogger.warn(`If-then-else ${name.content} has something different from 2 or 3 arguments, skipping`);
|
|
22
24
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
23
25
|
}
|
|
24
|
-
const [condArg, thenArg, otherwiseArg] = args.map(e => (0, unpack_argument_1.
|
|
26
|
+
const [condArg, thenArg, otherwiseArg] = args.map(e => (0, unpack_argument_1.unpackNonameArg)(e));
|
|
25
27
|
if (condArg === undefined || thenArg === undefined) {
|
|
26
28
|
logger_1.dataflowLogger.warn(`If-then-else ${name.content} has empty condition or then case in ${JSON.stringify(args)}, skipping`);
|
|
27
29
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
@@ -37,7 +39,7 @@ function processIfThenElse(name, args, rootId, data) {
|
|
|
37
39
|
let then;
|
|
38
40
|
let makeThenMaybe = false;
|
|
39
41
|
// we should defer this to the abstract interpretation
|
|
40
|
-
const values = (0, alias_tracking_1.resolveIdToValue)(condArg?.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables });
|
|
42
|
+
const values = (0, alias_tracking_1.resolveIdToValue)(condArg?.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables, ctx: data.ctx });
|
|
41
43
|
const conditionIsAlwaysFalse = (0, general_1.valueSetGuard)(values)?.elements.every(d => d.type === 'logical' && d.value === false) ?? false;
|
|
42
44
|
const conditionIsAlwaysTrue = (0, general_1.valueSetGuard)(values)?.elements.every(d => d.type === 'logical' && d.value === true) ?? false;
|
|
43
45
|
if (!conditionIsAlwaysFalse) {
|
|
@@ -77,10 +79,10 @@ function processIfThenElse(name, args, rootId, data) {
|
|
|
77
79
|
const cdTrue = { id: rootId, when: true };
|
|
78
80
|
const cdFalse = { id: rootId, when: false };
|
|
79
81
|
// again within an if-then-else we consider all actives to be read
|
|
80
|
-
const ingoing = cond.in.concat(makeThenMaybe ? (0,
|
|
82
|
+
const ingoing = cond.in.concat(makeThenMaybe ? (0, reference_to_maybe_1.makeAllMaybe)(then?.in, nextGraph, finalEnvironment, false, cdTrue) : then?.in ?? [], makeOtherwiseMaybe ? (0, reference_to_maybe_1.makeAllMaybe)(otherwise?.in, nextGraph, finalEnvironment, false, cdFalse) : otherwise?.in ?? [], cond.unknownReferences, makeThenMaybe ? (0, reference_to_maybe_1.makeAllMaybe)(then?.unknownReferences, nextGraph, finalEnvironment, false, cdTrue) : then?.unknownReferences ?? [], makeOtherwiseMaybe ? (0, reference_to_maybe_1.makeAllMaybe)(otherwise?.unknownReferences, nextGraph, finalEnvironment, false, cdFalse) : otherwise?.unknownReferences ?? []);
|
|
81
83
|
// we assign all with a maybe marker
|
|
82
84
|
// we do not merge even if they appear in both branches because the maybe links will refer to different ids
|
|
83
|
-
const outgoing = cond.out.concat((makeThenMaybe ? (0,
|
|
85
|
+
const outgoing = cond.out.concat((makeThenMaybe ? (0, reference_to_maybe_1.makeAllMaybe)(then?.out, nextGraph, finalEnvironment, true, cdTrue) : then?.out ?? []), (makeOtherwiseMaybe ? (0, reference_to_maybe_1.makeAllMaybe)(otherwise?.out, nextGraph, finalEnvironment, true, cdFalse) : otherwise?.out ?? []));
|
|
84
86
|
(0, common_1.patchFunctionCall)({
|
|
85
87
|
nextGraph,
|
|
86
88
|
rootId,
|
|
@@ -15,7 +15,7 @@ function processLibrary(name, args, rootId, data) {
|
|
|
15
15
|
logger_1.dataflowLogger.warn(`Currently only one-arg library-likes are allows (for ${name.content}), skipping`);
|
|
16
16
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, hasUnknownSideEffect: true, origin: 'default' }).information;
|
|
17
17
|
}
|
|
18
|
-
const nameToLoad = (0, unpack_argument_1.
|
|
18
|
+
const nameToLoad = (0, unpack_argument_1.unpackNonameArg)(args[0]);
|
|
19
19
|
if (nameToLoad === undefined || nameToLoad.type !== type_1.RType.Symbol) {
|
|
20
20
|
logger_1.dataflowLogger.warn('No library name provided, skipping');
|
|
21
21
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, hasUnknownSideEffect: true, origin: 'default' }).information;
|
|
@@ -18,7 +18,7 @@ function processPipe(name, args, rootId, data) {
|
|
|
18
18
|
logger_1.dataflowLogger.warn(`Pipe ${name.content} has something else than 2 arguments, skipping`);
|
|
19
19
|
return information;
|
|
20
20
|
}
|
|
21
|
-
const [lhs, rhs] = args.map(e => (0, unpack_argument_1.
|
|
21
|
+
const [lhs, rhs] = args.map(e => (0, unpack_argument_1.unpackNonameArg)(e));
|
|
22
22
|
(0, assert_1.guard)(lhs !== undefined && rhs !== undefined, () => `lhs and rhs must be present, but ${JSON.stringify(lhs)} and ${JSON.stringify(rhs)} were found instead.`);
|
|
23
23
|
if (rhs.type !== type_1.RType.FunctionCall) {
|
|
24
24
|
logger_1.dataflowLogger.warn(`Expected rhs of pipe to be a function call, but got ${rhs.type} instead.`);
|
|
@@ -21,7 +21,7 @@ function processRepeatLoop(name, args, rootId, data) {
|
|
|
21
21
|
logger_1.dataflowLogger.warn(`Repeat-Loop ${name.content} does not have 1 argument, skipping`);
|
|
22
22
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
23
23
|
}
|
|
24
|
-
const unpacked = (0, unpack_argument_1.
|
|
24
|
+
const unpacked = (0, unpack_argument_1.unpackNonameArg)(args[0]);
|
|
25
25
|
const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
26
26
|
name,
|
|
27
27
|
args: unpacked ? [unpacked] : args,
|
|
@@ -59,11 +59,11 @@ args, rootId, data, config) {
|
|
|
59
59
|
data,
|
|
60
60
|
rootId,
|
|
61
61
|
name,
|
|
62
|
-
argumentProcessResult: args.map(a => a === r_function_call_1.EmptyArgument ? undefined : { entryPoint: (0, unpack_argument_1.
|
|
62
|
+
argumentProcessResult: args.map(a => a === r_function_call_1.EmptyArgument ? undefined : { entryPoint: (0, unpack_argument_1.unpackNonameArg)(a)?.info.id }),
|
|
63
63
|
origin: 'builtin:replacement',
|
|
64
64
|
link: config.assignRootId ? { origin: [config.assignRootId] } : undefined
|
|
65
65
|
});
|
|
66
|
-
const firstArg = (0, unpack_argument_1.
|
|
66
|
+
const firstArg = (0, unpack_argument_1.unpackNonameArg)(args[0]);
|
|
67
67
|
(0, unknown_replacement_1.handleReplacementOperator)({
|
|
68
68
|
operator: name.content,
|
|
69
69
|
target: firstArg?.lexeme,
|
|
@@ -80,7 +80,7 @@ args, rootId, data, config) {
|
|
|
80
80
|
res.graph.addEdge(rootId, ref, edge_1.EdgeType.Reads);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
const fa = (0, unpack_argument_1.
|
|
83
|
+
const fa = (0, unpack_argument_1.unpackNonameArg)(args[0]);
|
|
84
84
|
if (!data.ctx.config.solver.pointerTracking && fa) {
|
|
85
85
|
res = {
|
|
86
86
|
...res,
|
|
@@ -4,7 +4,6 @@ exports.processRm = processRm;
|
|
|
4
4
|
const known_call_handling_1 = require("../known-call-handling");
|
|
5
5
|
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
6
6
|
const logger_1 = require("../../../../../logger");
|
|
7
|
-
const remove_1 = require("../../../../../environments/remove");
|
|
8
7
|
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
9
8
|
/**
|
|
10
9
|
*
|
|
@@ -32,13 +31,16 @@ function processRm(name, args, rootId, data) {
|
|
|
32
31
|
names.push(unpacked.content.str);
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
|
-
let env = res.environment;
|
|
34
|
+
let env = res.environment.current;
|
|
36
35
|
for (const name of names) {
|
|
37
|
-
env =
|
|
36
|
+
env = env.remove(name);
|
|
38
37
|
}
|
|
39
38
|
return {
|
|
40
39
|
...res,
|
|
41
|
-
environment:
|
|
40
|
+
environment: {
|
|
41
|
+
current: env,
|
|
42
|
+
level: res.environment.level
|
|
43
|
+
}
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
46
|
//# sourceMappingURL=built-in-rm.js.map
|
|
@@ -148,7 +148,7 @@ function processSourceCall(name, args, rootId, data, config) {
|
|
|
148
148
|
sourceFile = [(0, retriever_1.removeRQuotes)(sourceFileArgument.lexeme)];
|
|
149
149
|
}
|
|
150
150
|
else if (sourceFileArgument !== r_function_call_1.EmptyArgument) {
|
|
151
|
-
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(sourceFileArgument.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables }));
|
|
151
|
+
const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(sourceFileArgument.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables, ctx: data.ctx }));
|
|
152
152
|
sourceFile = resolved?.elements.map(r => r.type === 'string' && (0, r_value_1.isValue)(r.value) ? r.value.str : undefined).filter(assert_1.isNotUndefined);
|
|
153
153
|
}
|
|
154
154
|
if (sourceFile && sourceFile.length === 1) {
|
|
@@ -8,11 +8,11 @@ const assert_1 = require("../../../../../../util/assert");
|
|
|
8
8
|
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
9
9
|
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
10
10
|
const logger_1 = require("../../../../../logger");
|
|
11
|
-
const environment_1 = require("../../../../../environments/environment");
|
|
12
11
|
const edge_1 = require("../../../../../graph/edge");
|
|
13
12
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
14
13
|
const general_1 = require("../../../../../eval/values/general");
|
|
15
14
|
const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
|
|
15
|
+
const reference_to_maybe_1 = require("../../../../../environments/reference-to-maybe");
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
@@ -21,13 +21,13 @@ function processWhileLoop(name, args, rootId, data) {
|
|
|
21
21
|
logger_1.dataflowLogger.warn(`While-Loop ${name.content} does not have 2 arguments, skipping`);
|
|
22
22
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
23
23
|
}
|
|
24
|
-
const unpackedArgs = args.map(e => (0, unpack_argument_1.
|
|
24
|
+
const unpackedArgs = args.map(e => (0, unpack_argument_1.unpackNonameArg)(e));
|
|
25
25
|
if (unpackedArgs.some(assert_1.isUndefined)) {
|
|
26
26
|
logger_1.dataflowLogger.warn(`While-Loop ${name.content} has empty arguments in ${JSON.stringify(args)}, skipping`);
|
|
27
27
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
28
28
|
}
|
|
29
29
|
// we should defer this to the abstract interpretation
|
|
30
|
-
const values = (0, alias_tracking_1.resolveIdToValue)(unpackedArgs[0]?.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables });
|
|
30
|
+
const values = (0, alias_tracking_1.resolveIdToValue)(unpackedArgs[0]?.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables, ctx: data.ctx });
|
|
31
31
|
const conditionIsAlwaysFalse = (0, general_1.valueSetGuard)(values)?.elements.every(d => d.type === 'logical' && d.value === false) ?? false;
|
|
32
32
|
//We don't care about the body if it never executes
|
|
33
33
|
if (conditionIsAlwaysFalse) {
|
|
@@ -69,7 +69,7 @@ function processWhileLoop(name, args, rootId, data) {
|
|
|
69
69
|
return condition;
|
|
70
70
|
}
|
|
71
71
|
const cdTrue = { id: name.info.id, when: true };
|
|
72
|
-
const remainingInputs = (0, linker_1.linkInputs)((0,
|
|
72
|
+
const remainingInputs = (0, linker_1.linkInputs)((0, reference_to_maybe_1.makeAllMaybe)(body.unknownReferences, information.graph, information.environment, false, cdTrue).concat((0, reference_to_maybe_1.makeAllMaybe)(body.in, information.graph, information.environment, false, cdTrue)), information.environment, condition.in.concat(condition.unknownReferences), information.graph, true);
|
|
73
73
|
(0, linker_1.linkCircularRedefinitionsWithinALoop)(information.graph, (0, linker_1.produceNameSharedIdMap)((0, linker_1.findNonLocalReads)(information.graph, condition.in)), body.out);
|
|
74
74
|
(0, linker_1.reapplyLoopExitPoints)(body.exitPoints, body.in.concat(body.out, body.unknownReferences));
|
|
75
75
|
// as the while-loop always evaluates its condition
|
|
@@ -77,7 +77,7 @@ function processWhileLoop(name, args, rootId, data) {
|
|
|
77
77
|
return {
|
|
78
78
|
unknownReferences: [],
|
|
79
79
|
in: [{ nodeId: name.info.id, name: name.lexeme, controlDependencies: originalDependency, type: identifier_1.ReferenceType.Function }, ...remainingInputs],
|
|
80
|
-
out: condition.out.concat((0,
|
|
80
|
+
out: condition.out.concat((0, reference_to_maybe_1.makeAllMaybe)(body.out, information.graph, information.environment, true, cdTrue)),
|
|
81
81
|
entryPoint: name.info.id,
|
|
82
82
|
exitPoints: (0, info_1.filterOutLoopExitPoints)(body.exitPoints),
|
|
83
83
|
graph: information.graph,
|
|
@@ -29,8 +29,7 @@ function forceVertexArgumentValueReferences(rootId, value, graph, env) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
const containedSubflowIn = graph.
|
|
33
|
-
.filter(([, info]) => (0, vertex_1.isFunctionDefinitionVertex)(info))
|
|
32
|
+
const containedSubflowIn = graph.verticesOfType(vertex_1.VertexType.FunctionDefinition)
|
|
34
33
|
.flatMap(([, info]) => info.subflow.in)
|
|
35
34
|
.toArray();
|
|
36
35
|
// try to resolve them against the current environment
|
|
@@ -122,7 +121,7 @@ function patchFunctionCall({ nextGraph, rootId, name, data, argumentProcessResul
|
|
|
122
121
|
args: argumentProcessResult.map(arg => arg === undefined ? r_function_call_1.EmptyArgument : { nodeId: arg.entryPoint, controlDependencies: undefined, call: undefined, type: identifier_1.ReferenceType.Argument }),
|
|
123
122
|
origin: [origin],
|
|
124
123
|
link
|
|
125
|
-
}, !nextGraph.hasVertex(rootId) || nextGraph.isRoot(rootId), true);
|
|
124
|
+
}, data.ctx.env.makeCleanEnv(), !nextGraph.hasVertex(rootId) || nextGraph.isRoot(rootId), true);
|
|
126
125
|
for (const arg of argumentProcessResult) {
|
|
127
126
|
if (arg) {
|
|
128
127
|
nextGraph.addEdge(rootId, arg.entryPoint, edge_1.EdgeType.Argument);
|
|
@@ -52,7 +52,7 @@ function processKnownFunctionCall({ name, args, rootId, data, reverseOrder = fal
|
|
|
52
52
|
args: reverseOrder ? callArgs.reverse() : callArgs,
|
|
53
53
|
indicesCollection: indicesCollection,
|
|
54
54
|
origin: origin === 'default' ? ['function'] : [origin]
|
|
55
|
-
});
|
|
55
|
+
}, data.ctx.env.makeCleanEnv());
|
|
56
56
|
if (hasUnknownSideEffect) {
|
|
57
57
|
(0, unknown_side_effect_1.handleUnknownSideEffect)(finalGraph, data.environment, rootId);
|
|
58
58
|
}
|
|
@@ -45,7 +45,7 @@ function processUnnamedFunctionCall(functionCall, data) {
|
|
|
45
45
|
cds: data.controlDependencies,
|
|
46
46
|
args: callArgs, // same reference
|
|
47
47
|
origin: [exports.UnnamedFunctionCallOrigin]
|
|
48
|
-
});
|
|
48
|
+
}, data.ctx.env.makeCleanEnv());
|
|
49
49
|
let inIds = remainingReadInArgs;
|
|
50
50
|
inIds.push({ nodeId: functionRootId, name: functionCallName, controlDependencies: data.controlDependencies, type: identifier_1.ReferenceType.Function });
|
|
51
51
|
if (functionCall.calledFunction.type === type_1.RType.FunctionDefinition) {
|
|
@@ -34,7 +34,7 @@ function processFunctionArgument(argument, data) {
|
|
|
34
34
|
tag: vertex_1.VertexType.Use,
|
|
35
35
|
id: argument.info.id,
|
|
36
36
|
cds: data.controlDependencies
|
|
37
|
-
});
|
|
37
|
+
}, data.ctx.env.makeCleanEnv());
|
|
38
38
|
entryPoint = argument.info.id;
|
|
39
39
|
}
|
|
40
40
|
const ingoingRefs = [...value?.unknownReferences ?? [], ...value?.in ?? [], ...(name === undefined ? [] : [...name.in])];
|
|
@@ -22,7 +22,7 @@ function processSymbol(symbol, data) {
|
|
|
22
22
|
tag: vertex_1.VertexType.Use,
|
|
23
23
|
id: symbol.info.id,
|
|
24
24
|
cds: data.controlDependencies
|
|
25
|
-
}),
|
|
25
|
+
}, data.ctx.env.makeCleanEnv()),
|
|
26
26
|
entryPoint: symbol.info.id,
|
|
27
27
|
exitPoints: [{ nodeId: symbol.info.id, type: 0 /* ExitPointType.Default */, controlDependencies: data.controlDependencies }]
|
|
28
28
|
};
|
|
@@ -4,4 +4,4 @@ import type { RNodeWithParent } from '../../../r-bridge/lang-4.x/ast/model/proce
|
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
6
|
*/
|
|
7
|
-
export declare function processValue<OtherInfo>({ info: { id } }: RNodeWithParent,
|
|
7
|
+
export declare function processValue<OtherInfo>({ info: { id } }: RNodeWithParent, { controlDependencies, completeAst: { idMap }, ctx: { env }, environment }: DataflowProcessorInformation<OtherInfo>): DataflowInformation;
|