@eagleoutice/flowr 2.2.11 → 2.2.13
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 +82 -20
- package/benchmark/slicer.d.ts +49 -22
- package/benchmark/slicer.js +89 -29
- package/benchmark/stats/print.js +16 -10
- package/benchmark/stats/size-of.js +18 -1
- package/benchmark/stats/stats.d.ts +3 -0
- package/benchmark/summarizer/first-phase/input.js +1 -1
- package/benchmark/summarizer/first-phase/process.js +3 -3
- package/benchmark/summarizer/second-phase/process.js +9 -3
- package/benchmark/summarizer/summarizer.js +1 -1
- package/cli/benchmark-app.d.ts +5 -0
- package/cli/benchmark-app.js +49 -6
- package/cli/benchmark-helper-app.d.ts +4 -0
- package/cli/benchmark-helper-app.js +20 -4
- package/cli/common/options.js +15 -6
- package/cli/common/script.js +1 -1
- package/cli/flowr.js +1 -1
- package/cli/repl/commands/repl-cfg.d.ts +2 -0
- package/cli/repl/commands/repl-cfg.js +38 -24
- package/cli/repl/commands/repl-commands.js +6 -2
- package/cli/repl/commands/repl-dataflow.d.ts +2 -0
- package/cli/repl/commands/repl-dataflow.js +37 -3
- package/cli/repl/commands/repl-execute.js +1 -1
- package/cli/repl/commands/repl-main.d.ts +1 -1
- package/cli/repl/commands/repl-main.js +1 -1
- package/cli/repl/commands/repl-normalize.js +1 -1
- package/cli/repl/commands/repl-query.js +2 -2
- package/cli/repl/core.js +1 -1
- package/cli/repl/prompt.js +1 -1
- package/cli/repl/server/connection.js +4 -4
- package/cli/repl/server/messages/message-analysis.d.ts +1 -1
- package/cli/script-core/statistics-core.js +1 -1
- package/cli/script-core/statistics-helper-core.js +4 -4
- package/config.d.ts +60 -21
- package/config.js +24 -4
- package/control-flow/basic-cfg-guided-visitor.d.ts +39 -0
- package/control-flow/basic-cfg-guided-visitor.js +114 -0
- package/control-flow/cfg-properties.d.ts +26 -0
- package/control-flow/cfg-properties.js +100 -0
- package/control-flow/cfg-simplification.d.ts +18 -0
- package/control-flow/cfg-simplification.js +55 -0
- package/control-flow/cfg-to-basic-blocks.d.ts +5 -0
- package/control-flow/cfg-to-basic-blocks.js +81 -0
- package/control-flow/control-flow-graph.d.ts +247 -0
- package/control-flow/control-flow-graph.js +290 -0
- package/control-flow/dfg-cfg-guided-visitor.d.ts +32 -0
- package/control-flow/dfg-cfg-guided-visitor.js +71 -0
- package/control-flow/diff-cfg.d.ts +11 -0
- package/control-flow/diff-cfg.js +161 -0
- package/control-flow/extract-cfg.d.ts +30 -0
- package/control-flow/extract-cfg.js +475 -0
- package/control-flow/happens-before.d.ts +7 -0
- package/{util/cfg → control-flow}/happens-before.js +3 -3
- package/control-flow/semantic-cfg-guided-visitor.d.ts +452 -0
- package/control-flow/semantic-cfg-guided-visitor.js +492 -0
- package/control-flow/simple-visitor.d.ts +25 -0
- package/control-flow/simple-visitor.js +80 -0
- package/control-flow/syntax-cfg-guided-visitor.d.ts +128 -0
- package/control-flow/syntax-cfg-guided-visitor.js +166 -0
- package/core/print/print.d.ts +1 -1
- package/core/print/slice-diff-ansi.js +1 -1
- package/core/steps/pipeline/create-pipeline.js +1 -1
- package/dataflow/environments/built-in-config.d.ts +5 -2
- package/dataflow/environments/built-in-config.js +17 -8
- package/dataflow/environments/built-in.d.ts +16 -5
- package/dataflow/environments/built-in.js +55 -6
- package/dataflow/environments/clone.d.ts +5 -0
- package/dataflow/environments/clone.js +5 -0
- package/dataflow/environments/default-builtin-config.d.ts +2 -0
- package/dataflow/environments/default-builtin-config.js +164 -13
- package/dataflow/environments/define.d.ts +5 -1
- package/dataflow/environments/define.js +36 -10
- package/dataflow/environments/overwrite.js +4 -0
- package/dataflow/environments/remove.d.ts +6 -0
- package/dataflow/environments/remove.js +24 -0
- package/dataflow/environments/resolve-by-name.js +16 -5
- package/dataflow/extractor.js +2 -2
- package/dataflow/graph/dataflowgraph-builder.d.ts +79 -7
- package/dataflow/graph/dataflowgraph-builder.js +106 -8
- package/dataflow/graph/diff-dataflow-graph.d.ts +16 -0
- package/dataflow/graph/{diff.js → diff-dataflow-graph.js} +30 -56
- package/dataflow/graph/graph.d.ts +17 -4
- package/dataflow/graph/graph.js +51 -12
- package/dataflow/graph/vertex.d.ts +59 -4
- package/dataflow/graph/vertex.js +32 -0
- package/dataflow/internal/linker.d.ts +3 -2
- package/dataflow/internal/linker.js +36 -25
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +67 -54
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +108 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +54 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +10 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +140 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +15 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +51 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +100 -31
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +41 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +35 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +15 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +75 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +3 -3
- package/dataflow/internal/process/functions/call/common.d.ts +5 -2
- package/dataflow/internal/process/functions/call/common.js +9 -5
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +2 -0
- package/dataflow/internal/process/functions/call/named-call-handling.js +10 -6
- package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +1 -0
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +6 -4
- package/dataflow/internal/process/process-named-call.d.ts +4 -1
- package/dataflow/internal/process/process-named-call.js +8 -5
- package/dataflow/origin/dfg-get-origin.d.ts +82 -0
- package/dataflow/origin/dfg-get-origin.js +116 -0
- package/documentation/doc-util/doc-cfg.d.ts +20 -4
- package/documentation/doc-util/doc-cfg.js +41 -7
- package/documentation/doc-util/doc-cli-option.js +4 -2
- package/documentation/doc-util/doc-code.js +10 -2
- package/documentation/doc-util/doc-dfg.js +3 -3
- package/documentation/doc-util/doc-escape.d.ts +7 -0
- package/documentation/doc-util/doc-escape.js +19 -0
- package/documentation/doc-util/doc-files.d.ts +1 -0
- package/documentation/doc-util/doc-files.js +2 -1
- package/documentation/doc-util/doc-normalized-ast.js +3 -3
- package/documentation/doc-util/doc-query.js +2 -2
- package/documentation/doc-util/doc-repl.js +1 -1
- package/documentation/doc-util/doc-search.js +1 -1
- package/documentation/doc-util/doc-server-message.js +2 -2
- package/documentation/doc-util/doc-structure.d.ts +1 -0
- package/documentation/doc-util/doc-structure.js +5 -0
- package/documentation/doc-util/doc-types.d.ts +7 -1
- package/documentation/doc-util/doc-types.js +13 -2
- package/documentation/print-capabilities-markdown.js +28 -2
- package/documentation/print-cfg-wiki.d.ts +1 -0
- package/documentation/print-cfg-wiki.js +572 -0
- package/documentation/print-core-wiki.js +2 -2
- package/documentation/print-dataflow-graph-wiki.js +180 -25
- package/documentation/print-engines-wiki.js +1 -1
- package/documentation/print-faq-wiki.d.ts +1 -0
- package/documentation/print-faq-wiki.js +75 -0
- package/documentation/print-interface-wiki.js +2 -1
- package/documentation/print-linting-and-testing-wiki.js +52 -36
- package/documentation/print-normalized-ast-wiki.js +1 -1
- package/documentation/print-onboarding-wiki.d.ts +1 -0
- package/documentation/print-onboarding-wiki.js +42 -0
- package/documentation/print-query-wiki.js +23 -3
- package/documentation/print-readme.js +10 -3
- package/package.json +10 -6
- package/queries/catalog/call-context-query/call-context-query-executor.js +5 -5
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +2 -2
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +24 -21
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
- package/queries/catalog/cluster-query/cluster-query-format.js +1 -1
- package/queries/catalog/config-query/config-query-format.d.ts +1 -1
- package/queries/catalog/config-query/config-query-format.js +2 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +17 -7
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -26
- package/queries/catalog/dependencies-query/dependencies-query-format.js +4 -147
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +24 -0
- package/queries/catalog/dependencies-query/function-info/function-info.js +10 -0
- package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/library-functions.js +18 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +101 -0
- package/queries/catalog/dependencies-query/function-info/source-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/source-functions.js +11 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.js +87 -0
- package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +4 -4
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -2
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
- package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -1
- package/queries/catalog/lineage-query/lineage-query-format.js +2 -2
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +2 -2
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -2
- package/queries/catalog/origin-query/origin-query-executor.d.ts +5 -0
- package/queries/catalog/origin-query/origin-query-executor.js +33 -0
- package/queries/catalog/origin-query/origin-query-format.d.ts +71 -0
- package/queries/catalog/origin-query/origin-query-format.js +27 -0
- package/queries/catalog/project-query/project-query-format.d.ts +1 -1
- package/queries/catalog/project-query/project-query-format.js +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -2
- package/queries/catalog/search-query/search-query-format.d.ts +1 -1
- package/queries/catalog/search-query/search-query-format.js +2 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.js +2 -2
- package/queries/query-print.d.ts +1 -1
- package/queries/query-print.js +4 -4
- package/queries/query.d.ts +61 -2
- package/queries/query.js +3 -1
- package/r-bridge/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +5 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +5 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/fold.js +3 -1
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +4 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +26 -8
- package/r-bridge/retriever.js +1 -1
- package/search/search-executor/search-generators.d.ts +1 -1
- package/search/search-executor/search-transformer.d.ts +1 -1
- package/slicing/criterion/collect-all.js +1 -1
- package/slicing/static/slice-call.js +13 -3
- package/statistics/features/supported/assignments/post-process.js +1 -1
- package/statistics/features/supported/defined-functions/post-process.js +2 -2
- package/statistics/features/supported/used-functions/post-process.js +1 -1
- package/statistics/features/supported/used-packages/post-process.js +2 -2
- package/statistics/features/supported/values/post-process.js +2 -2
- package/statistics/output/print-stats.js +2 -2
- package/statistics/summarizer/post-process/clusterer.d.ts +1 -1
- package/statistics/summarizer/post-process/clusterer.js +1 -1
- package/statistics/summarizer/post-process/histogram.js +3 -3
- package/statistics/summarizer/post-process/post-process-output.js +3 -3
- package/statistics/summarizer/second-phase/process.js +2 -2
- package/statistics/summarizer/summarizer.js +2 -2
- package/util/assert.js +36 -1
- package/util/cfg/cfg.d.ts +0 -80
- package/util/cfg/cfg.js +0 -549
- package/util/{arrays.d.ts → collections/arrays.d.ts} +24 -1
- package/util/{arrays.js → collections/arrays.js} +44 -3
- package/util/collections/set.js +17 -0
- package/util/{list-access.d.ts → containers.d.ts} +24 -4
- package/util/{list-access.js → containers.js} +42 -12
- package/util/diff-graph.d.ts +47 -0
- package/util/diff-graph.js +61 -0
- package/util/diff.d.ts +6 -6
- package/util/diff.js +1 -1
- package/util/mermaid/ast.js +12 -1
- package/util/mermaid/cfg.d.ts +9 -2
- package/util/mermaid/cfg.js +65 -13
- package/util/mermaid/dfg.d.ts +2 -1
- package/util/mermaid/dfg.js +26 -10
- package/util/mermaid/mermaid.d.ts +2 -0
- package/util/mermaid/mermaid.js +6 -0
- package/util/parallel.d.ts +2 -1
- package/util/parallel.js +11 -2
- package/util/prefix.d.ts +13 -0
- package/util/prefix.js +34 -0
- package/util/quads.js +1 -1
- package/util/schema.d.ts +1 -1
- package/util/schema.js +1 -1
- package/util/summarizer.js +1 -1
- package/util/{text.js → text/text.js} +1 -1
- package/util/{time.js → text/time.js} +1 -1
- package/util/version.js +1 -1
- package/dataflow/graph/diff.d.ts +0 -36
- package/util/cfg/happens-before.d.ts +0 -7
- package/util/cfg/visitor.d.ts +0 -9
- package/util/cfg/visitor.js +0 -30
- package/util/set.js +0 -31
- /package/util/{bimap.d.ts → collections/bimap.d.ts} +0 -0
- /package/util/{bimap.js → collections/bimap.js} +0 -0
- /package/util/{defaultmap.d.ts → collections/defaultmap.d.ts} +0 -0
- /package/util/{defaultmap.js → collections/defaultmap.js} +0 -0
- /package/util/{set.d.ts → collections/set.d.ts} +0 -0
- /package/util/{ansi.d.ts → text/ansi.d.ts} +0 -0
- /package/util/{ansi.js → text/ansi.js} +0 -0
- /package/util/{args.d.ts → text/args.d.ts} +0 -0
- /package/util/{args.js → text/args.js} +0 -0
- /package/util/{strings.d.ts → text/strings.d.ts} +0 -0
- /package/util/{strings.js → text/strings.js} +0 -0
- /package/util/{text.d.ts → text/text.d.ts} +0 -0
- /package/util/{time.d.ts → text/time.d.ts} +0 -0
|
@@ -3,9 +3,12 @@ import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/deco
|
|
|
3
3
|
import type { DataflowFunctionFlowInformation, FunctionArgument } from './graph';
|
|
4
4
|
import { DataflowGraph } from './graph';
|
|
5
5
|
import type { REnvironmentInformation } from '../environments/environment';
|
|
6
|
-
import type { DataflowGraphVertexUse } from './vertex';
|
|
6
|
+
import type { DataflowGraphVertexAstLink, DataflowGraphVertexUse, FunctionOriginInformation } from './vertex';
|
|
7
7
|
import type { ControlDependency } from '../info';
|
|
8
8
|
import type { LinkTo } from '../../queries/catalog/call-context-query/call-context-query-format';
|
|
9
|
+
import type { FlowrSearchLike } from '../../search/flowr-search-builder';
|
|
10
|
+
import type { Pipeline } from '../../core/steps/pipeline/pipeline';
|
|
11
|
+
import type { FlowrSearchInput } from '../../search/flowr-search';
|
|
9
12
|
export declare function emptyGraph(idMap?: AstIdMap): DataflowGraphBuilder;
|
|
10
13
|
export type DataflowGraphEdgeTarget = NodeId | (readonly NodeId[]);
|
|
11
14
|
/**
|
|
@@ -44,6 +47,8 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
44
47
|
onlyBuiltIn?: boolean;
|
|
45
48
|
environment?: REnvironmentInformation;
|
|
46
49
|
controlDependencies?: ControlDependency[];
|
|
50
|
+
origin?: FunctionOriginInformation[];
|
|
51
|
+
link?: DataflowGraphVertexAstLink;
|
|
47
52
|
}, asRoot?: boolean): this;
|
|
48
53
|
/** automatically adds argument links if they do not already exist */
|
|
49
54
|
private addArgumentLinks;
|
|
@@ -82,8 +87,9 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
82
87
|
controlDependencies?: ControlDependency[];
|
|
83
88
|
}, asRoot?: boolean): this;
|
|
84
89
|
private edgeHelper;
|
|
90
|
+
private queryHelper;
|
|
85
91
|
/**
|
|
86
|
-
* Adds a **read edge
|
|
92
|
+
* Adds a **read edge**.
|
|
87
93
|
*
|
|
88
94
|
* @param from - NodeId of the source vertex
|
|
89
95
|
* @param to - Either a single or multiple target ids.
|
|
@@ -91,30 +97,62 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
91
97
|
*/
|
|
92
98
|
reads(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
93
99
|
/**
|
|
94
|
-
* Adds a **
|
|
100
|
+
* Adds a **read edge** with a query for the from and/or to vertices.
|
|
101
|
+
*
|
|
102
|
+
* @param from - Either a node id or a query to find the node id.
|
|
103
|
+
* @param to - Either a node id or a query to find the node id.
|
|
104
|
+
* @param data - The data to search in i.e. the dataflow graph.
|
|
105
|
+
*/
|
|
106
|
+
readsQuery<P extends Pipeline>(from: FromQueryParam, to: ToQueryParam, data: FlowrSearchInput<P>): this;
|
|
107
|
+
/**
|
|
108
|
+
* Adds a **defined-by edge** with from as defined variable, and to
|
|
95
109
|
* as a variable/function contributing to its definition.
|
|
96
110
|
*
|
|
97
111
|
* @see {@link DataflowGraphBuilder#reads|reads} for parameters.
|
|
98
112
|
*/
|
|
99
113
|
definedBy(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
100
114
|
/**
|
|
101
|
-
* Adds a **
|
|
115
|
+
* Adds a **defined-by edge** with a query for the from and/or to vertices.
|
|
116
|
+
*
|
|
117
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
118
|
+
*/
|
|
119
|
+
definedByQuery<P extends Pipeline>(from: FromQueryParam, to: ToQueryParam, data: FlowrSearchInput<P>): this;
|
|
120
|
+
/**
|
|
121
|
+
* Adds a **call edge** with from as caller, and to as callee.
|
|
102
122
|
*
|
|
103
123
|
* @see {@link DataflowGraphBuilder#reads|reads} for parameters.
|
|
104
124
|
*/
|
|
105
125
|
calls(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
106
126
|
/**
|
|
107
|
-
* Adds a **
|
|
127
|
+
* Adds a **call edge** with a query for the from and/or to vertices.
|
|
128
|
+
*
|
|
129
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
130
|
+
*/
|
|
131
|
+
callsQuery<P extends Pipeline>(from: FromQueryParam, to: ToQueryParam, data: FlowrSearchInput<P>): this;
|
|
132
|
+
/**
|
|
133
|
+
* Adds a **return edge** with from as function, and to as exit point.
|
|
108
134
|
*
|
|
109
135
|
* @see {@link DataflowGraphBuilder#reads|reads} for parameters.
|
|
110
136
|
*/
|
|
111
137
|
returns(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
112
138
|
/**
|
|
113
|
-
* Adds a **
|
|
139
|
+
* Adds a **return edge** with a query for the from and/or to vertices.
|
|
140
|
+
*
|
|
141
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
142
|
+
*/
|
|
143
|
+
returnsQuery<P extends Pipeline>(from: FromQueryParam, to: ToQueryParam, data: FlowrSearchInput<P>): this;
|
|
144
|
+
/**
|
|
145
|
+
* Adds a **defines-on-call edge** with from as variable, and to as its definition
|
|
114
146
|
*
|
|
115
147
|
* @see {@link DataflowGraphBuilder#reads|reads} for parameters.
|
|
116
148
|
*/
|
|
117
149
|
definesOnCall(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
150
|
+
/**
|
|
151
|
+
* Adds a **defines-on-call edge** with a query for the from and/or to vertices.
|
|
152
|
+
*
|
|
153
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
154
|
+
*/
|
|
155
|
+
definesOnCallQuery<P extends Pipeline>(from: FromQueryParam, to: ToQueryParam, data: FlowrSearchInput<P>): this;
|
|
118
156
|
/**
|
|
119
157
|
* Adds a **defined-by-on-call edge** with from as definition, and to as variable.
|
|
120
158
|
*
|
|
@@ -122,23 +160,47 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
122
160
|
*/
|
|
123
161
|
definedByOnCall(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
124
162
|
/**
|
|
125
|
-
* Adds
|
|
163
|
+
* Adds a **defined-by-on-call edge** with a query for the from and/or to vertices.
|
|
164
|
+
*
|
|
165
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
166
|
+
*/
|
|
167
|
+
definedByOnCallQuery<P extends Pipeline>(from: FromQueryParam, to: ToQueryParam, data: FlowrSearchInput<P>): this;
|
|
168
|
+
/**
|
|
169
|
+
* Adds an **argument edge** with from as function call, and to as argument.
|
|
126
170
|
*
|
|
127
171
|
* @see {@link DataflowGraphBuilder#reads|reads} for parameters.
|
|
128
172
|
*/
|
|
129
173
|
argument(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
174
|
+
/**
|
|
175
|
+
* Adds a **argument edge** with a query for the from and/or to vertices.
|
|
176
|
+
*
|
|
177
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
178
|
+
*/
|
|
179
|
+
argumentQuery<P extends Pipeline>(from: FromQueryParam, to: ToQueryParam, data: FlowrSearchInput<P>): this;
|
|
130
180
|
/**
|
|
131
181
|
* Adds a **non-standard evaluation edge** with from as vertex, and to as vertex.
|
|
132
182
|
*
|
|
133
183
|
* @see {@link DataflowGraphBuilder#reads|reads} for parameters.
|
|
134
184
|
*/
|
|
135
185
|
nse(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
186
|
+
/**
|
|
187
|
+
* Adds a **non-standard evaluation edge** with a query for the from and/or to vertices.
|
|
188
|
+
*
|
|
189
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
190
|
+
*/
|
|
191
|
+
nseQuery<P extends Pipeline>(from: FromQueryParam, to: ToQueryParam, data: FlowrSearchInput<P>): this;
|
|
136
192
|
/**
|
|
137
193
|
* Adds a **side-effect-on-call edge** with from as vertex, and to as vertex.
|
|
138
194
|
*
|
|
139
195
|
* @see {@link DataflowGraphBuilder#reads|reads} for parameters.
|
|
140
196
|
*/
|
|
141
197
|
sideEffectOnCall(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
198
|
+
/**
|
|
199
|
+
* Adds a **side-effect-on-call edge** with a query for the from and/or to vertices.
|
|
200
|
+
*
|
|
201
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
202
|
+
*/
|
|
203
|
+
sideEffectOnCallQuery<P extends Pipeline>(from: FromQueryParam, to: ToQueryParam, data: FlowrSearchInput<P>): this;
|
|
142
204
|
/**
|
|
143
205
|
* explicitly overwrite the root ids of the graph,
|
|
144
206
|
* this is just an easier variant in case you working with a lot of functions this saves you a lot of `false` flags.
|
|
@@ -146,3 +208,13 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
146
208
|
overwriteRootIds(ids: readonly NodeId[]): this;
|
|
147
209
|
}
|
|
148
210
|
export declare function getBuiltInSideEffect(name: string): LinkTo<RegExp> | undefined;
|
|
211
|
+
interface Query {
|
|
212
|
+
query: FlowrSearchLike;
|
|
213
|
+
}
|
|
214
|
+
type FromQueryParam = {
|
|
215
|
+
nodeId: NodeId;
|
|
216
|
+
} | Query;
|
|
217
|
+
type ToQueryParam = {
|
|
218
|
+
target: DataflowGraphEdgeTarget;
|
|
219
|
+
} | Query;
|
|
220
|
+
export {};
|
|
@@ -12,6 +12,8 @@ const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-fun
|
|
|
12
12
|
const built_in_1 = require("../environments/built-in");
|
|
13
13
|
const edge_1 = require("./edge");
|
|
14
14
|
const default_builtin_config_1 = require("../environments/default-builtin-config");
|
|
15
|
+
const flowr_search_executor_1 = require("../../search/flowr-search-executor");
|
|
16
|
+
const assert_1 = require("../../util/assert");
|
|
15
17
|
function emptyGraph(idMap) {
|
|
16
18
|
return new DataflowGraphBuilder(idMap);
|
|
17
19
|
}
|
|
@@ -59,7 +61,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
59
61
|
* (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
|
|
60
62
|
*/
|
|
61
63
|
call(id, name, args, info, asRoot = true) {
|
|
62
|
-
const onlyBuiltInAuto = info?.reads?.length === 1 && info?.reads[0]
|
|
64
|
+
const onlyBuiltInAuto = info?.reads?.length === 1 && (0, built_in_1.isBuiltIn)(info?.reads[0]);
|
|
63
65
|
this.addVertex({
|
|
64
66
|
tag: vertex_1.VertexType.FunctionCall,
|
|
65
67
|
id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
|
|
@@ -67,7 +69,9 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
67
69
|
args: args.map(a => a === r_function_call_1.EmptyArgument ? r_function_call_1.EmptyArgument : { ...a, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(a.nodeId), controlDependencies: undefined }),
|
|
68
70
|
environment: (info?.onlyBuiltIn || onlyBuiltInAuto) ? undefined : info?.environment ?? (0, environment_1.initializeCleanEnvironments)(),
|
|
69
71
|
cds: info?.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
|
|
70
|
-
onlyBuiltin: info?.onlyBuiltIn ?? onlyBuiltInAuto ?? false
|
|
72
|
+
onlyBuiltin: info?.onlyBuiltIn ?? onlyBuiltInAuto ?? false,
|
|
73
|
+
origin: info?.origin ?? [(0, default_builtin_config_1.getDefaultProcessor)(name) ?? 'function'],
|
|
74
|
+
link: info?.link
|
|
71
75
|
}, asRoot);
|
|
72
76
|
this.addArgumentLinks(id, args);
|
|
73
77
|
if (info?.returns) {
|
|
@@ -170,8 +174,28 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
170
174
|
}
|
|
171
175
|
return this.addEdge((0, node_id_1.normalizeIdToNumberIfPossible)(from), (0, node_id_1.normalizeIdToNumberIfPossible)(to), type);
|
|
172
176
|
}
|
|
177
|
+
queryHelper(from, to, data, type) {
|
|
178
|
+
let fromId;
|
|
179
|
+
if ('nodeId' in from) {
|
|
180
|
+
fromId = from.nodeId;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
const result = (0, flowr_search_executor_1.runSearch)(from.query, data);
|
|
184
|
+
(0, assert_1.guard)(result.length === 1, `from query result should yield exactly one node, but yielded ${result.length}`);
|
|
185
|
+
fromId = result[0].node.info.id;
|
|
186
|
+
}
|
|
187
|
+
let toIds;
|
|
188
|
+
if ('target' in to) {
|
|
189
|
+
toIds = to.target;
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
const result = (0, flowr_search_executor_1.runSearch)(to.query, data);
|
|
193
|
+
toIds = result.map(r => r.node.info.id);
|
|
194
|
+
}
|
|
195
|
+
return this.edgeHelper(fromId, toIds, type);
|
|
196
|
+
}
|
|
173
197
|
/**
|
|
174
|
-
* Adds a **read edge
|
|
198
|
+
* Adds a **read edge**.
|
|
175
199
|
*
|
|
176
200
|
* @param from - NodeId of the source vertex
|
|
177
201
|
* @param to - Either a single or multiple target ids.
|
|
@@ -181,7 +205,17 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
181
205
|
return this.edgeHelper(from, to, edge_1.EdgeType.Reads);
|
|
182
206
|
}
|
|
183
207
|
/**
|
|
184
|
-
* Adds a **
|
|
208
|
+
* Adds a **read edge** with a query for the from and/or to vertices.
|
|
209
|
+
*
|
|
210
|
+
* @param from - Either a node id or a query to find the node id.
|
|
211
|
+
* @param to - Either a node id or a query to find the node id.
|
|
212
|
+
* @param data - The data to search in i.e. the dataflow graph.
|
|
213
|
+
*/
|
|
214
|
+
readsQuery(from, to, data) {
|
|
215
|
+
return this.queryHelper(from, to, data, edge_1.EdgeType.Reads);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Adds a **defined-by edge** with from as defined variable, and to
|
|
185
219
|
* as a variable/function contributing to its definition.
|
|
186
220
|
*
|
|
187
221
|
* @see {@link DataflowGraphBuilder#reads|reads} for parameters.
|
|
@@ -190,7 +224,15 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
190
224
|
return this.edgeHelper(from, to, edge_1.EdgeType.DefinedBy);
|
|
191
225
|
}
|
|
192
226
|
/**
|
|
193
|
-
* Adds a **
|
|
227
|
+
* Adds a **defined-by edge** with a query for the from and/or to vertices.
|
|
228
|
+
*
|
|
229
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
230
|
+
*/
|
|
231
|
+
definedByQuery(from, to, data) {
|
|
232
|
+
return this.queryHelper(from, to, data, edge_1.EdgeType.DefinedBy);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Adds a **call edge** with from as caller, and to as callee.
|
|
194
236
|
*
|
|
195
237
|
* @see {@link DataflowGraphBuilder#reads|reads} for parameters.
|
|
196
238
|
*/
|
|
@@ -198,7 +240,15 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
198
240
|
return this.edgeHelper(from, to, edge_1.EdgeType.Calls);
|
|
199
241
|
}
|
|
200
242
|
/**
|
|
201
|
-
* Adds a **
|
|
243
|
+
* Adds a **call edge** with a query for the from and/or to vertices.
|
|
244
|
+
*
|
|
245
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
246
|
+
*/
|
|
247
|
+
callsQuery(from, to, data) {
|
|
248
|
+
return this.queryHelper(from, to, data, edge_1.EdgeType.Calls);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Adds a **return edge** with from as function, and to as exit point.
|
|
202
252
|
*
|
|
203
253
|
* @see {@link DataflowGraphBuilder#reads|reads} for parameters.
|
|
204
254
|
*/
|
|
@@ -206,13 +256,29 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
206
256
|
return this.edgeHelper(from, to, edge_1.EdgeType.Returns);
|
|
207
257
|
}
|
|
208
258
|
/**
|
|
209
|
-
* Adds a **
|
|
259
|
+
* Adds a **return edge** with a query for the from and/or to vertices.
|
|
260
|
+
*
|
|
261
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
262
|
+
*/
|
|
263
|
+
returnsQuery(from, to, data) {
|
|
264
|
+
return this.queryHelper(from, to, data, edge_1.EdgeType.Returns);
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Adds a **defines-on-call edge** with from as variable, and to as its definition
|
|
210
268
|
*
|
|
211
269
|
* @see {@link DataflowGraphBuilder#reads|reads} for parameters.
|
|
212
270
|
*/
|
|
213
271
|
definesOnCall(from, to) {
|
|
214
272
|
return this.edgeHelper(from, to, edge_1.EdgeType.DefinesOnCall);
|
|
215
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Adds a **defines-on-call edge** with a query for the from and/or to vertices.
|
|
276
|
+
*
|
|
277
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
278
|
+
*/
|
|
279
|
+
definesOnCallQuery(from, to, data) {
|
|
280
|
+
return this.queryHelper(from, to, data, edge_1.EdgeType.DefinesOnCall);
|
|
281
|
+
}
|
|
216
282
|
/**
|
|
217
283
|
* Adds a **defined-by-on-call edge** with from as definition, and to as variable.
|
|
218
284
|
*
|
|
@@ -222,13 +288,29 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
222
288
|
return this.edgeHelper(from, to, edge_1.EdgeType.DefinedByOnCall);
|
|
223
289
|
}
|
|
224
290
|
/**
|
|
225
|
-
* Adds
|
|
291
|
+
* Adds a **defined-by-on-call edge** with a query for the from and/or to vertices.
|
|
292
|
+
*
|
|
293
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
294
|
+
*/
|
|
295
|
+
definedByOnCallQuery(from, to, data) {
|
|
296
|
+
return this.queryHelper(from, to, data, edge_1.EdgeType.DefinedByOnCall);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Adds an **argument edge** with from as function call, and to as argument.
|
|
226
300
|
*
|
|
227
301
|
* @see {@link DataflowGraphBuilder#reads|reads} for parameters.
|
|
228
302
|
*/
|
|
229
303
|
argument(from, to) {
|
|
230
304
|
return this.edgeHelper(from, to, edge_1.EdgeType.Argument);
|
|
231
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
* Adds a **argument edge** with a query for the from and/or to vertices.
|
|
308
|
+
*
|
|
309
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
310
|
+
*/
|
|
311
|
+
argumentQuery(from, to, data) {
|
|
312
|
+
return this.queryHelper(from, to, data, edge_1.EdgeType.Argument);
|
|
313
|
+
}
|
|
232
314
|
/**
|
|
233
315
|
* Adds a **non-standard evaluation edge** with from as vertex, and to as vertex.
|
|
234
316
|
*
|
|
@@ -237,6 +319,14 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
237
319
|
nse(from, to) {
|
|
238
320
|
return this.edgeHelper(from, to, edge_1.EdgeType.NonStandardEvaluation);
|
|
239
321
|
}
|
|
322
|
+
/**
|
|
323
|
+
* Adds a **non-standard evaluation edge** with a query for the from and/or to vertices.
|
|
324
|
+
*
|
|
325
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
326
|
+
*/
|
|
327
|
+
nseQuery(from, to, data) {
|
|
328
|
+
return this.queryHelper(from, to, data, edge_1.EdgeType.NonStandardEvaluation);
|
|
329
|
+
}
|
|
240
330
|
/**
|
|
241
331
|
* Adds a **side-effect-on-call edge** with from as vertex, and to as vertex.
|
|
242
332
|
*
|
|
@@ -245,6 +335,14 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
245
335
|
sideEffectOnCall(from, to) {
|
|
246
336
|
return this.edgeHelper(from, to, edge_1.EdgeType.SideEffectOnCall);
|
|
247
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* Adds a **side-effect-on-call edge** with a query for the from and/or to vertices.
|
|
340
|
+
*
|
|
341
|
+
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
342
|
+
*/
|
|
343
|
+
sideEffectOnCallQuery(from, to, data) {
|
|
344
|
+
return this.queryHelper(from, to, data, edge_1.EdgeType.SideEffectOnCall);
|
|
345
|
+
}
|
|
248
346
|
/**
|
|
249
347
|
* explicitly overwrite the root ids of the graph,
|
|
250
348
|
* this is just an easier variant in case you working with a lot of functions this saves you a lot of `false` flags.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FunctionArgument, OutgoingEdges } from './graph';
|
|
2
|
+
import type { GenericDiffConfiguration, GenericDifferenceInformation } from '../../util/diff';
|
|
3
|
+
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
|
+
import type { GraphDiffContext, NamedGraph } from '../../util/diff-graph';
|
|
5
|
+
import { GraphDifferenceReport } from '../../util/diff-graph';
|
|
6
|
+
/**
|
|
7
|
+
* Compare two dataflow graphs and return a report on the differences.
|
|
8
|
+
* If you simply want to check whether they equal, use {@link GraphDifferenceReport#isEqual|`<result>.isEqual()`}.
|
|
9
|
+
*
|
|
10
|
+
* @see {@link diffOfControlFlowGraphs} - for control flow graphs
|
|
11
|
+
*/
|
|
12
|
+
export declare function diffOfDataflowGraphs(left: NamedGraph, right: NamedGraph, config?: Partial<GenericDiffConfiguration>): GraphDifferenceReport;
|
|
13
|
+
export declare function equalFunctionArguments(fn: NodeId, a: false | readonly FunctionArgument[], b: false | readonly FunctionArgument[]): boolean;
|
|
14
|
+
export declare function diffFunctionArguments(fn: NodeId, a: false | readonly FunctionArgument[], b: false | readonly FunctionArgument[], ctx: GenericDifferenceInformation<GraphDifferenceReport>): void;
|
|
15
|
+
export declare function diffVertices(ctx: GraphDiffContext): void;
|
|
16
|
+
export declare function diffEdges(ctx: GraphDiffContext, id: NodeId, lEdges: OutgoingEdges | undefined, rEdges: OutgoingEdges | undefined): void;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DataflowDifferenceReport = void 0;
|
|
4
3
|
exports.diffOfDataflowGraphs = diffOfDataflowGraphs;
|
|
5
4
|
exports.equalFunctionArguments = equalFunctionArguments;
|
|
6
5
|
exports.diffFunctionArguments = diffFunctionArguments;
|
|
@@ -9,59 +8,29 @@ exports.diffEdges = diffEdges;
|
|
|
9
8
|
const graph_1 = require("./graph");
|
|
10
9
|
const diff_1 = require("../../util/diff");
|
|
11
10
|
const json_1 = require("../../util/json");
|
|
12
|
-
const arrays_1 = require("../../util/arrays");
|
|
11
|
+
const arrays_1 = require("../../util/collections/arrays");
|
|
13
12
|
const vertex_1 = require("./vertex");
|
|
14
13
|
const edge_1 = require("./edge");
|
|
15
14
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
16
15
|
const diff_2 = require("../environments/diff");
|
|
17
16
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
18
17
|
const info_1 = require("../info");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (related.length > 0) {
|
|
30
|
-
if (this._problematic === undefined) {
|
|
31
|
-
this._problematic = [...related];
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
this._problematic.push(...related);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
comments() {
|
|
39
|
-
return this._comments;
|
|
40
|
-
}
|
|
41
|
-
problematic() {
|
|
42
|
-
return this._problematic;
|
|
43
|
-
}
|
|
44
|
-
isEqual() {
|
|
45
|
-
return this._comments === undefined;
|
|
18
|
+
const diff_graph_1 = require("../../util/diff-graph");
|
|
19
|
+
/**
|
|
20
|
+
* Compare two dataflow graphs and return a report on the differences.
|
|
21
|
+
* If you simply want to check whether they equal, use {@link GraphDifferenceReport#isEqual|`<result>.isEqual()`}.
|
|
22
|
+
*
|
|
23
|
+
* @see {@link diffOfControlFlowGraphs} - for control flow graphs
|
|
24
|
+
*/
|
|
25
|
+
function diffOfDataflowGraphs(left, right, config) {
|
|
26
|
+
if (left.graph === right.graph) {
|
|
27
|
+
return new diff_graph_1.GraphDifferenceReport();
|
|
46
28
|
}
|
|
29
|
+
const ctx = (0, diff_graph_1.initDiffContext)(left, right, config);
|
|
30
|
+
diffDataflowGraph(ctx);
|
|
31
|
+
return ctx.report;
|
|
47
32
|
}
|
|
48
|
-
|
|
49
|
-
function initDiffContext(left, right, config) {
|
|
50
|
-
return {
|
|
51
|
-
left: left.graph,
|
|
52
|
-
leftname: left.name,
|
|
53
|
-
right: right.graph,
|
|
54
|
-
rightname: right.name,
|
|
55
|
-
report: new DataflowDifferenceReport(),
|
|
56
|
-
position: '',
|
|
57
|
-
config: {
|
|
58
|
-
rightIsSubgraph: false,
|
|
59
|
-
leftIsSubgraph: false,
|
|
60
|
-
...config
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function diff(ctx) {
|
|
33
|
+
function diffDataflowGraph(ctx) {
|
|
65
34
|
diffRootVertices(ctx);
|
|
66
35
|
diffVertices(ctx);
|
|
67
36
|
diffOutgoingEdges(ctx);
|
|
@@ -102,14 +71,6 @@ function diffRootVertices(ctx) {
|
|
|
102
71
|
(0, diff_1.setDifference)(ctx.left.rootIds(), ctx.right.rootIds(), { ...ctx, position: `${ctx.position}Root vertices differ in graphs. ` });
|
|
103
72
|
(0, diff_1.setDifference)(new Set([...ctx.left.unknownSideEffects].map(n => typeof n === 'object' ? n.id : n)), new Set([...ctx.right.unknownSideEffects].map(n => typeof n === 'object' ? n.id : n)), { ...ctx, position: `${ctx.position}Unknown side effects differ in graphs. ` });
|
|
104
73
|
}
|
|
105
|
-
function diffOfDataflowGraphs(left, right, config) {
|
|
106
|
-
if (left.graph === right.graph) {
|
|
107
|
-
return new DataflowDifferenceReport();
|
|
108
|
-
}
|
|
109
|
-
const ctx = initDiffContext(left, right, config);
|
|
110
|
-
diff(ctx);
|
|
111
|
-
return ctx.report;
|
|
112
|
-
}
|
|
113
74
|
function diffFunctionArgumentsReferences(fn, a, b, ctx) {
|
|
114
75
|
if (a === '<value>' || b === '<value>') {
|
|
115
76
|
if (a !== b) {
|
|
@@ -121,7 +82,7 @@ function diffFunctionArgumentsReferences(fn, a, b, ctx) {
|
|
|
121
82
|
}
|
|
122
83
|
function equalFunctionArguments(fn, a, b) {
|
|
123
84
|
const ctx = {
|
|
124
|
-
report: new
|
|
85
|
+
report: new diff_graph_1.GraphDifferenceReport(),
|
|
125
86
|
leftname: 'left',
|
|
126
87
|
rightname: 'right',
|
|
127
88
|
position: '',
|
|
@@ -200,6 +161,19 @@ function diffVertices(ctx) {
|
|
|
200
161
|
}
|
|
201
162
|
}
|
|
202
163
|
(0, info_1.diffControlDependencies)(lInfo.cds, rInfo.cds, { ...ctx, position: `Vertex ${id} differs in controlDependencies. ` });
|
|
164
|
+
if (lInfo.origin !== undefined || rInfo.origin !== undefined) {
|
|
165
|
+
// compare arrays
|
|
166
|
+
const equalArrays = lInfo.origin && rInfo.origin && (0, arrays_1.arrayEqual)(lInfo.origin, rInfo.origin);
|
|
167
|
+
if (!equalArrays) {
|
|
168
|
+
ctx.report.addComment(`Vertex ${id} differs in origin. ${ctx.leftname}: ${JSON.stringify(lInfo.origin, json_1.jsonReplacer)} vs ${ctx.rightname}: ${JSON.stringify(rInfo.origin, json_1.jsonReplacer)}`, { tag: 'vertex', id });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (lInfo.link !== undefined || rInfo.link !== undefined) {
|
|
172
|
+
const equal = lInfo.link && rInfo.link && (0, arrays_1.arrayEqual)(lInfo.link.origin, rInfo.link.origin);
|
|
173
|
+
if (!equal) {
|
|
174
|
+
ctx.report.addComment(`Vertex ${id} differs in link. ${ctx.leftname}: ${JSON.stringify(lInfo.link, json_1.jsonReplacer)} vs ${ctx.rightname}: ${JSON.stringify(rInfo.link, json_1.jsonReplacer)}`, { tag: 'vertex', id });
|
|
175
|
+
}
|
|
176
|
+
}
|
|
203
177
|
if ((lInfo.environment === undefined && rInfo.environment !== undefined && !ctx.config.leftIsSubgraph)
|
|
204
178
|
|| (lInfo.environment !== undefined && rInfo.environment === undefined && !ctx.config.rightIsSubgraph)) {
|
|
205
179
|
/* only diff them if specified at all */
|
|
@@ -282,4 +256,4 @@ function diffEdges(ctx, id, lEdges, rEdges) {
|
|
|
282
256
|
diffEdge(edge, otherEdge, ctx, id, target);
|
|
283
257
|
}
|
|
284
258
|
}
|
|
285
|
-
//# sourceMappingURL=diff.js.map
|
|
259
|
+
//# sourceMappingURL=diff-dataflow-graph.js.map
|
|
@@ -2,7 +2,7 @@ import type { DataflowGraphEdge, EdgeType } from './edge';
|
|
|
2
2
|
import type { DataflowInformation } from '../info';
|
|
3
3
|
import type { DataflowGraphVertexArgument, DataflowGraphVertexFunctionCall, DataflowGraphVertexInfo } from './vertex';
|
|
4
4
|
import { EmptyArgument } from '../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
5
|
-
import type { IdentifierDefinition, IdentifierReference } from '../environments/identifier';
|
|
5
|
+
import type { Identifier, IdentifierDefinition, IdentifierReference } from '../environments/identifier';
|
|
6
6
|
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
7
|
import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
8
8
|
import type { LinkTo } from '../../queries/catalog/call-context-query/call-context-query-format';
|
|
@@ -99,7 +99,7 @@ export type UnknownSidEffect = NodeId | {
|
|
|
99
99
|
* @see {@link DataflowGraph#addEdge|`addEdge`} - to add an edge to the graph
|
|
100
100
|
* @see {@link DataflowGraph#addVertex|`addVertex`} - to add a vertex to the graph
|
|
101
101
|
* @see {@link DataflowGraph#fromJson|`fromJson`} - to construct a dataflow graph object from a deserialized JSON object.
|
|
102
|
-
* @see {@link emptyGraph} - to create an empty graph (useful in tests)
|
|
102
|
+
* @see {@link emptyGraph|`emptyGraph`} - to create an empty graph (useful in tests)
|
|
103
103
|
*/
|
|
104
104
|
export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = DataflowGraphVertexInfo, Edge extends DataflowGraphEdge = DataflowGraphEdge> {
|
|
105
105
|
private static DEFAULT_ENVIRONMENT;
|
|
@@ -136,6 +136,13 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
|
|
|
136
136
|
getVertex(id: NodeId, includeDefinedFunctions?: boolean): Vertex | undefined;
|
|
137
137
|
outgoingEdges(id: NodeId): OutgoingEdges | undefined;
|
|
138
138
|
ingoingEdges(id: NodeId): IngoingEdges | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Given a node in the normalized AST this either:
|
|
141
|
+
* * returns the id if the node directly exists in the DFG
|
|
142
|
+
* * returns the ids of all vertices in the DFG that are linked to this
|
|
143
|
+
* * returns undefined if the node is not part of the DFG and not linked to any node
|
|
144
|
+
*/
|
|
145
|
+
getLinked(nodeId: NodeId): NodeId[] | undefined;
|
|
139
146
|
/** Retrieves the id-map to the normalized AST attached to the dataflow graph */
|
|
140
147
|
get idMap(): AstIdMap | undefined;
|
|
141
148
|
get sourced(): (string | '<inline>')[];
|
|
@@ -178,11 +185,12 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
|
|
|
178
185
|
* @param vertex - The vertex to add
|
|
179
186
|
* @param asRoot - If false, this will only add the vertex but do not add it to the {@link rootIds|root vertices} of the graph.
|
|
180
187
|
* This is probably only of use, when you construct dataflow graphs for tests.
|
|
188
|
+
* @param overwrite - If true, this will overwrite the vertex if it already exists in the graph (based on the id).
|
|
181
189
|
*
|
|
182
190
|
* @see DataflowGraphVertexInfo
|
|
183
191
|
* @see DataflowGraphVertexArgument
|
|
184
192
|
*/
|
|
185
|
-
addVertex(vertex: DataflowGraphVertexArgument & Omit<Vertex, keyof DataflowGraphVertexArgument>, asRoot?: boolean): this;
|
|
193
|
+
addVertex(vertex: DataflowGraphVertexArgument & Omit<Vertex, keyof DataflowGraphVertexArgument>, asRoot?: boolean, overwrite?: boolean): this;
|
|
186
194
|
/** {@inheritDoc} */
|
|
187
195
|
addEdge(from: NodeId, to: NodeId, type: EdgeType | number): this;
|
|
188
196
|
/** {@inheritDoc} */
|
|
@@ -211,7 +219,7 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
|
|
|
211
219
|
/** If you do not pass the `to` node, this will just mark the node as maybe */
|
|
212
220
|
addControlDependency(from: NodeId, to?: NodeId, when?: boolean): this;
|
|
213
221
|
/** Marks the given node as having unknown side effects */
|
|
214
|
-
markIdForUnknownSideEffects(id: NodeId, target?: LinkTo
|
|
222
|
+
markIdForUnknownSideEffects(id: NodeId, target?: LinkTo): this;
|
|
215
223
|
/**
|
|
216
224
|
* Constructs a dataflow graph instance from the given JSON data and returns the result.
|
|
217
225
|
* This can be useful for data sent by the flowR server when analyzing it further.
|
|
@@ -219,4 +227,9 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
|
|
|
219
227
|
*/
|
|
220
228
|
static fromJson(data: DataflowGraphJson): DataflowGraph;
|
|
221
229
|
}
|
|
230
|
+
export interface IEnvironmentJson {
|
|
231
|
+
readonly id: number;
|
|
232
|
+
parent: IEnvironmentJson;
|
|
233
|
+
memory: Record<Identifier, IdentifierDefinition[]>;
|
|
234
|
+
}
|
|
222
235
|
export {};
|