@eagleoutice/flowr 2.0.25 → 2.1.0
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/benchmark/slicer.js +2 -1
- package/benchmark/stats/print.js +3 -4
- package/benchmark/stats/size-of.js +9 -7
- package/benchmark/summarizer/first-phase/input.d.ts +0 -1
- package/benchmark/summarizer/first-phase/input.js +2 -3
- package/benchmark/summarizer/first-phase/process.js +7 -7
- package/benchmark/summarizer/second-phase/graph.js +1 -2
- package/benchmark/summarizer/second-phase/process.d.ts +0 -1
- package/benchmark/summarizer/second-phase/process.js +4 -5
- package/benchmark/summarizer/summarizer.js +7 -1
- package/cli/benchmark-app.js +6 -1
- package/cli/common/features.js +2 -3
- package/cli/common/script.js +2 -3
- package/cli/common/scripts-info.d.ts +69 -1
- package/cli/common/scripts-info.js +6 -6
- package/cli/flowr-main-options.d.ts +4 -0
- package/cli/flowr-main-options.js +88 -0
- package/cli/flowr.d.ts +3 -3
- package/cli/flowr.js +22 -31
- package/cli/repl/commands/{cfg.d.ts → repl-cfg.d.ts} +1 -1
- package/cli/repl/commands/{cfg.js → repl-cfg.js} +3 -3
- package/cli/repl/commands/{commands.d.ts → repl-commands.d.ts} +3 -1
- package/cli/repl/commands/{commands.js → repl-commands.js} +56 -35
- package/cli/repl/commands/{dataflow.d.ts → repl-dataflow.d.ts} +1 -1
- package/cli/repl/commands/{dataflow.js → repl-dataflow.js} +2 -2
- package/cli/repl/commands/{execute.d.ts → repl-execute.d.ts} +1 -1
- package/cli/repl/commands/{execute.js → repl-execute.js} +3 -3
- package/cli/repl/commands/repl-lineage.d.ts +15 -0
- package/cli/repl/commands/{lineage.js → repl-lineage.js} +14 -12
- package/cli/repl/commands/{main.js → repl-main.js} +1 -1
- package/cli/repl/commands/{normalize.d.ts → repl-normalize.d.ts} +1 -1
- package/cli/repl/commands/{normalize.js → repl-normalize.js} +3 -3
- package/cli/repl/commands/{parse.d.ts → repl-parse.d.ts} +1 -1
- package/cli/repl/commands/{parse.js → repl-parse.js} +3 -2
- package/cli/repl/commands/repl-query.d.ts +8 -0
- package/cli/repl/commands/repl-query.js +155 -0
- package/cli/repl/commands/repl-quit.d.ts +2 -0
- package/cli/repl/commands/{quit.js → repl-quit.js} +1 -1
- package/cli/repl/commands/{version.d.ts → repl-version.d.ts} +1 -1
- package/cli/repl/commands/{version.js → repl-version.js} +4 -4
- package/cli/repl/core.d.ts +1 -2
- package/cli/repl/core.js +13 -13
- package/cli/repl/execute.d.ts +1 -2
- package/cli/repl/execute.js +2 -3
- package/cli/repl/print-version.js +3 -4
- package/cli/repl/server/connection.d.ts +1 -0
- package/cli/repl/server/connection.js +45 -12
- package/cli/repl/server/messages/{messages.d.ts → all-messages.d.ts} +8 -7
- package/cli/repl/server/messages/{messages.js → all-messages.js} +1 -1
- package/cli/repl/server/messages/{analysis.d.ts → message-analysis.d.ts} +2 -1
- package/cli/repl/server/messages/message-analysis.js +39 -0
- package/cli/repl/server/messages/{error.d.ts → message-error.d.ts} +1 -1
- package/cli/repl/server/messages/{error.js → message-error.js} +1 -1
- package/cli/repl/server/messages/{hello.d.ts → message-hello.d.ts} +4 -3
- package/cli/repl/server/messages/message-hello.js +20 -0
- package/cli/repl/server/messages/{lineage.d.ts → message-lineage.d.ts} +2 -1
- package/cli/repl/server/messages/message-lineage.js +25 -0
- package/cli/repl/server/messages/message-query.d.ts +16 -0
- package/cli/repl/server/messages/message-query.js +26 -0
- package/cli/repl/server/messages/{repl.d.ts → message-repl.d.ts} +3 -1
- package/cli/repl/server/messages/message-repl.js +53 -0
- package/cli/repl/server/messages/{slice.d.ts → message-slice.d.ts} +2 -1
- package/cli/repl/server/messages/{slice.js → message-slice.js} +14 -6
- package/cli/repl/server/net.d.ts +0 -1
- package/cli/repl/server/send.d.ts +1 -1
- package/cli/repl/server/send.js +2 -3
- package/cli/repl/server/server.js +2 -2
- package/cli/repl/server/validate.d.ts +1 -1
- package/cli/repl/server/validate.js +5 -6
- package/cli/run-script.d.ts +8 -0
- package/cli/run-script.js +18 -0
- package/cli/script-core/statistics-core.d.ts +2 -0
- package/cli/script-core/statistics-core.js +100 -0
- package/cli/script-core/statistics-helper-core.d.ts +2 -0
- package/cli/script-core/statistics-helper-core.js +81 -0
- package/cli/script-core/summarizer-core.d.ts +2 -0
- package/cli/script-core/summarizer-core.js +51 -0
- package/cli/statistics-app.js +3 -87
- package/cli/statistics-helper-app.js +3 -77
- package/cli/summarizer-app.js +2 -48
- package/config.d.ts +20 -4
- package/config.js +62 -36
- package/core/pipeline-executor.js +11 -1
- package/core/print/dataflow-printer.js +4 -5
- package/core/print/normalize-printer.js +4 -5
- package/core/print/parse-printer.js +1 -2
- package/core/print/print.js +2 -3
- package/core/print/slice-diff-ansi.js +1 -2
- package/core/steps/pipeline/create-pipeline.js +1 -2
- package/core/steps/pipeline/default-pipelines.d.ts +18 -18
- package/core/steps/pipeline/pipeline.js +1 -2
- package/dataflow/environments/append.js +1 -2
- package/dataflow/environments/built-in-config.d.ts +47 -0
- package/dataflow/environments/built-in-config.js +83 -0
- package/dataflow/environments/built-in.d.ts +49 -6
- package/dataflow/environments/built-in.js +29 -97
- package/dataflow/environments/clone.js +2 -2
- package/dataflow/environments/default-builtin-config.d.ts +5 -0
- package/dataflow/environments/default-builtin-config.js +83 -0
- package/dataflow/environments/define.js +1 -2
- package/dataflow/environments/diff.js +5 -6
- package/dataflow/environments/environment.js +8 -7
- package/dataflow/environments/identifier.d.ts +39 -8
- package/dataflow/environments/identifier.js +33 -0
- package/dataflow/environments/overwrite.d.ts +6 -5
- package/dataflow/environments/overwrite.js +16 -9
- package/dataflow/environments/resolve-by-name.d.ts +3 -1
- package/dataflow/environments/resolve-by-name.js +40 -8
- package/dataflow/environments/scoping.js +2 -3
- package/dataflow/extractor.js +25 -24
- package/dataflow/graph/dataflowgraph-builder.d.ts +139 -0
- package/dataflow/graph/dataflowgraph-builder.js +247 -0
- package/dataflow/graph/diff.js +12 -11
- package/dataflow/graph/edge.d.ts +2 -2
- package/dataflow/graph/edge.js +46 -20
- package/dataflow/graph/graph.d.ts +14 -6
- package/dataflow/graph/graph.js +25 -21
- package/dataflow/graph/quads.js +1 -2
- package/dataflow/graph/resolve-graph.d.ts +7 -0
- package/dataflow/graph/resolve-graph.js +51 -0
- package/dataflow/graph/vertex.d.ts +12 -4
- package/dataflow/graph/vertex.js +19 -11
- package/dataflow/info.d.ts +3 -7
- package/dataflow/info.js +7 -8
- package/dataflow/internal/linker.d.ts +3 -1
- package/dataflow/internal/linker.js +77 -32
- package/dataflow/internal/process/functions/call/argument/make-argument.js +5 -5
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +10 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +27 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +40 -26
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +30 -20
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +10 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +12 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +10 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +7 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +6 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +6 -5
- package/dataflow/internal/process/functions/call/common.js +30 -19
- package/dataflow/internal/process/functions/call/default-call-handling.js +1 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +8 -6
- package/dataflow/internal/process/functions/call/named-call-handling.js +7 -6
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +11 -7
- package/dataflow/internal/process/functions/process-argument.js +10 -8
- package/dataflow/internal/process/functions/process-parameter.js +8 -6
- package/dataflow/internal/process/process-named-call.js +3 -3
- package/dataflow/internal/process/process-symbol.js +5 -4
- package/dataflow/internal/process/process-uninteresting-leaf.js +1 -2
- package/dataflow/internal/process/process-value.js +5 -4
- package/dataflow/processor.js +1 -2
- package/documentation/data/dfg/doc-data-dfg-util.d.ts +20 -0
- package/documentation/data/dfg/doc-data-dfg-util.js +13 -0
- package/documentation/data/query/example-query-code.d.ts +1 -0
- package/documentation/data/query/example-query-code.js +25 -0
- package/documentation/data/server/doc-data-server-messages.d.ts +1 -0
- package/documentation/data/server/doc-data-server-messages.js +508 -0
- package/documentation/doc-util/doc-auto-gen.d.ts +7 -0
- package/documentation/doc-util/doc-auto-gen.js +9 -0
- package/documentation/doc-util/doc-cfg.d.ts +7 -0
- package/documentation/doc-util/doc-cfg.js +18 -0
- package/documentation/doc-util/doc-cli-option.d.ts +8 -0
- package/documentation/doc-util/doc-cli-option.js +36 -0
- package/documentation/doc-util/doc-code.d.ts +1 -0
- package/documentation/doc-util/doc-code.js +7 -0
- package/documentation/doc-util/doc-dfg.d.ts +21 -0
- package/documentation/doc-util/doc-dfg.js +93 -0
- package/documentation/doc-util/doc-docker.d.ts +1 -0
- package/documentation/doc-util/doc-docker.js +5 -0
- package/documentation/doc-util/doc-env.d.ts +2 -0
- package/documentation/doc-util/doc-env.js +20 -0
- package/documentation/doc-util/doc-files.d.ts +6 -0
- package/documentation/doc-util/doc-files.js +25 -0
- package/documentation/doc-util/doc-general.d.ts +2 -0
- package/documentation/doc-util/doc-general.js +16 -0
- package/documentation/doc-util/doc-hover-over.d.ts +1 -0
- package/documentation/doc-util/doc-hover-over.js +7 -0
- package/documentation/doc-util/doc-issue.d.ts +1 -0
- package/documentation/doc-util/doc-issue.js +6 -0
- package/documentation/doc-util/doc-ms.d.ts +1 -0
- package/documentation/doc-util/doc-ms.js +8 -0
- package/documentation/doc-util/doc-normalized-ast.d.ts +11 -0
- package/documentation/doc-util/doc-normalized-ast.js +71 -0
- package/documentation/doc-util/doc-query.d.ts +24 -0
- package/documentation/doc-util/doc-query.js +113 -0
- package/documentation/doc-util/doc-repl.d.ts +13 -0
- package/documentation/doc-util/doc-repl.js +79 -0
- package/documentation/doc-util/doc-server-message.d.ts +37 -0
- package/documentation/doc-util/doc-server-message.js +153 -0
- package/documentation/doc-util/doc-structure.d.ts +12 -0
- package/documentation/doc-util/doc-structure.js +21 -0
- package/documentation/doc-util/doc-types.d.ts +38 -0
- package/documentation/doc-util/doc-types.js +276 -0
- package/{r-bridge/data/print.js → documentation/print-capabilities-markdown.js} +8 -4
- package/documentation/print-dataflow-graph-wiki.d.ts +1 -0
- package/documentation/print-dataflow-graph-wiki.js +849 -0
- package/documentation/print-interface-wiki.d.ts +1 -0
- package/documentation/print-interface-wiki.js +401 -0
- package/documentation/print-normalized-ast-wiki.d.ts +1 -0
- package/documentation/print-normalized-ast-wiki.js +98 -0
- package/documentation/print-query-wiki.d.ts +1 -0
- package/documentation/print-query-wiki.js +215 -0
- package/package.json +29 -33
- package/queries/base-query-format.d.ts +11 -0
- package/{cli/repl/server/messages/hello.js → queries/base-query-format.js} +1 -1
- package/queries/call-context-query/call-context-query-executor.d.ts +11 -0
- package/queries/call-context-query/call-context-query-executor.js +255 -0
- package/queries/call-context-query/call-context-query-format.d.ts +72 -0
- package/queries/call-context-query/call-context-query-format.js +17 -0
- package/queries/query-schema.d.ts +7 -0
- package/queries/query-schema.js +31 -0
- package/queries/query.d.ts +35 -0
- package/queries/query.js +57 -0
- package/queries/two-layer-collector.d.ts +8 -0
- package/queries/two-layer-collector.js +31 -0
- package/queries/virtual-query/compound-query.d.ts +24 -0
- package/queries/virtual-query/compound-query.js +18 -0
- package/queries/virtual-query/virtual-queries.d.ts +15 -0
- package/queries/virtual-query/virtual-queries.js +8 -0
- package/r-bridge/data/data.d.ts +5 -0
- package/r-bridge/data/data.js +6 -0
- package/r-bridge/data/get.js +2 -3
- package/r-bridge/init.js +2 -2
- package/r-bridge/lang-4.x/ast/model/collect.js +1 -2
- package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +10 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/operators.js +27 -26
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +9 -9
- package/r-bridge/lang-4.x/ast/model/processing/fold.js +1 -2
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +26 -3
- package/r-bridge/lang-4.x/ast/model/processing/role.js +1 -2
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +23 -23
- package/r-bridge/lang-4.x/ast/model/processing/visitor.js +23 -23
- package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/type.js +221 -12
- package/r-bridge/lang-4.x/ast/parser/json/format.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +6 -5
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then-else.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then.js +7 -7
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/normalize-expression.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-argument.js +10 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-call.js +18 -18
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-definition.js +8 -8
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-parameter.js +9 -9
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-break.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-for.js +10 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-next.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-repeat.js +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-while.js +7 -7
- package/r-bridge/lang-4.x/ast/parser/xml/internal/normalize-access.js +12 -12
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/normalize-binary.js +14 -14
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/normalize-unary.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/normalize-comment.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/normalize-line-directive.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-delimiter.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-expressions.js +13 -13
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-root.js +6 -6
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-single-node.js +19 -19
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-number.js +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-string.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-symbol.js +2 -3
- package/r-bridge/lang-4.x/ast/parser/xml/normalize-meta.js +12 -12
- package/r-bridge/lang-4.x/convert-values.js +7 -7
- package/r-bridge/retriever.js +12 -11
- package/r-bridge/shell.d.ts +0 -1
- package/r-bridge/shell.js +6 -1
- package/reconstruct/auto-select/auto-select-defaults.js +1 -2
- package/reconstruct/auto-select/magic-comments.js +3 -3
- package/reconstruct/reconstruct.js +4 -3
- package/slicing/criterion/collect-all.js +1 -2
- package/slicing/criterion/parse.d.ts +1 -1
- package/slicing/criterion/parse.js +6 -5
- package/slicing/static/fingerprint.js +2 -3
- package/slicing/static/slice-call.js +9 -9
- package/slicing/static/static-slicer.js +5 -4
- package/statistics/features/common-syntax-probability.js +13 -13
- package/statistics/features/feature.d.ts +5 -9
- package/statistics/features/feature.js +2 -2
- package/statistics/features/post-processing.js +2 -3
- package/statistics/features/supported/assignments/assignments.js +3 -2
- package/statistics/features/supported/assignments/post-process.js +1 -2
- package/statistics/features/supported/comments/post-process.js +1 -2
- package/statistics/features/supported/control-flow/control-flow.js +4 -3
- package/statistics/features/supported/control-flow/post-process.js +1 -2
- package/statistics/features/supported/data-access/data-access.d.ts +2 -2
- package/statistics/features/supported/data-access/data-access.js +3 -2
- package/statistics/features/supported/data-access/post-process.js +1 -2
- package/statistics/features/supported/defined-functions/defined-functions.js +9 -7
- package/statistics/features/supported/defined-functions/post-process.d.ts +1 -1
- package/statistics/features/supported/defined-functions/post-process.js +2 -3
- package/statistics/features/supported/expression-list/post-process.js +1 -2
- package/statistics/features/supported/expression-list/{expression-list.js → statistics-expression-list.js} +4 -3
- package/statistics/features/supported/loops/loops.js +8 -7
- package/statistics/features/supported/loops/post-process.js +1 -2
- package/statistics/features/supported/used-functions/post-process.js +2 -3
- package/statistics/features/supported/used-functions/used-functions.d.ts +1 -1
- package/statistics/features/supported/used-functions/used-functions.js +4 -3
- package/statistics/features/supported/used-packages/post-process.js +1 -2
- package/statistics/features/supported/values/post-process.js +1 -2
- package/statistics/features/supported/variables/post-process.js +2 -3
- package/statistics/features/supported/variables/variables.js +2 -1
- package/statistics/meta-statistics.js +1 -2
- package/statistics/output/print-stats.js +4 -5
- package/statistics/output/statistics-file.js +5 -5
- package/statistics/statistics.js +2 -3
- package/statistics/summarizer/auto-detect.js +1 -2
- package/statistics/summarizer/post-process/clusterer.js +1 -2
- package/statistics/summarizer/post-process/file-based-count.js +2 -3
- package/statistics/summarizer/post-process/histogram.js +3 -4
- package/statistics/summarizer/post-process/post-process-output.js +2 -3
- package/statistics/summarizer/second-phase/process.d.ts +2 -0
- package/statistics/summarizer/second-phase/process.js +2 -2
- package/statistics/summarizer/summarizer.js +8 -1
- package/util/ansi.d.ts +1 -0
- package/util/ansi.js +27 -4
- package/util/args.js +2 -3
- package/util/arrays.js +8 -9
- package/util/assert.js +5 -6
- package/util/bimap.d.ts +4 -4
- package/util/cfg/cfg.d.ts +1 -0
- package/util/cfg/cfg.js +8 -5
- package/util/cfg/visitor.d.ts +8 -13
- package/util/cfg/visitor.js +22 -56
- package/util/diff.js +1 -2
- package/util/files.d.ts +0 -1
- package/util/files.js +11 -8
- package/util/json.js +2 -3
- package/util/mermaid/ast.js +7 -7
- package/util/mermaid/cfg.js +2 -3
- package/util/mermaid/dfg.d.ts +12 -4
- package/util/mermaid/dfg.js +28 -16
- package/util/mermaid/mermaid.js +5 -4
- package/util/numbers.js +1 -2
- package/util/objects.d.ts +7 -0
- package/util/objects.js +13 -3
- package/util/os.js +1 -2
- package/util/quads.js +5 -5
- package/util/random.js +2 -2
- package/util/range.js +8 -9
- package/util/schema.d.ts +11 -0
- package/util/schema.js +75 -0
- package/util/set.js +2 -3
- package/util/strings.js +3 -4
- package/util/summarizer.js +4 -4
- package/util/text.d.ts +1 -0
- package/util/text.js +20 -0
- package/util/time.js +1 -2
- package/util/version.js +2 -3
- package/cli/repl/commands/lineage.d.ts +0 -15
- package/cli/repl/commands/quit.d.ts +0 -2
- package/cli/repl/server/messages/analysis.js +0 -21
- package/cli/repl/server/messages/lineage.js +0 -17
- package/cli/repl/server/messages/repl.js +0 -37
- /package/cli/repl/commands/{main.d.ts → repl-main.d.ts} +0 -0
- /package/{r-bridge/data/print.d.ts → documentation/print-capabilities-markdown.d.ts} +0 -0
- /package/statistics/features/supported/expression-list/{expression-list.d.ts → statistics-expression-list.d.ts} +0 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
|
+
import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
|
+
import type { DataflowFunctionFlowInformation, FunctionArgument } from './graph';
|
|
4
|
+
import { DataflowGraph } from './graph';
|
|
5
|
+
import type { REnvironmentInformation } from '../environments/environment';
|
|
6
|
+
import type { DataflowGraphVertexUse } from './vertex';
|
|
7
|
+
import type { ControlDependency } from '../info';
|
|
8
|
+
export declare function emptyGraph(idMap?: AstIdMap): DataflowGraphBuilder;
|
|
9
|
+
export type DataflowGraphEdgeTarget = NodeId | (readonly NodeId[]);
|
|
10
|
+
/**
|
|
11
|
+
* This DataflowGraphBuilder extends {@link DataflowGraph} with builder methods to
|
|
12
|
+
* easily and compactly add vertices and edges to a dataflow graph. Its usage thus
|
|
13
|
+
* simplifies writing tests for dataflow graphs.
|
|
14
|
+
*/
|
|
15
|
+
export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
16
|
+
/**
|
|
17
|
+
* Adds a **vertex** for a **function definition** (V1).
|
|
18
|
+
*
|
|
19
|
+
* @param id - AST node ID
|
|
20
|
+
* @param subflow - Subflow data graph for the defined function.
|
|
21
|
+
* @param exitPoints - Node IDs for exit point vertices.
|
|
22
|
+
* @param info - Additional/optional properties.
|
|
23
|
+
* @param asRoot - should the vertex be part of the root vertex set of the graph
|
|
24
|
+
* (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
|
|
25
|
+
*/
|
|
26
|
+
defineFunction(id: NodeId, exitPoints: readonly NodeId[], subflow: DataflowFunctionFlowInformation, info?: {
|
|
27
|
+
environment?: REnvironmentInformation;
|
|
28
|
+
controlDependencies?: ControlDependency[];
|
|
29
|
+
}, asRoot?: boolean): this;
|
|
30
|
+
/**
|
|
31
|
+
* Adds a **vertex** for a **function call** (V2).
|
|
32
|
+
*
|
|
33
|
+
* @param id - AST node ID
|
|
34
|
+
* @param name - Function name
|
|
35
|
+
* @param args - Function arguments; may be empty
|
|
36
|
+
* @param info - Additional/optional properties.
|
|
37
|
+
* @param asRoot - should the vertex be part of the root vertex set of the graph
|
|
38
|
+
* (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
|
|
39
|
+
*/
|
|
40
|
+
call(id: NodeId, name: string, args: FunctionArgument[], info?: {
|
|
41
|
+
returns?: readonly NodeId[];
|
|
42
|
+
reads?: readonly NodeId[];
|
|
43
|
+
onlyBuiltIn?: boolean;
|
|
44
|
+
environment?: REnvironmentInformation;
|
|
45
|
+
controlDependencies?: ControlDependency[];
|
|
46
|
+
}, asRoot?: boolean): this;
|
|
47
|
+
/** automatically adds argument links if they do not already exist */
|
|
48
|
+
private addArgumentLinks;
|
|
49
|
+
/**
|
|
50
|
+
* Adds a **vertex** for a **variable definition** (V4).
|
|
51
|
+
*
|
|
52
|
+
* @param id - AST node ID
|
|
53
|
+
* @param name - Variable name
|
|
54
|
+
* @param info - Additional/optional properties.
|
|
55
|
+
* @param asRoot - Should the vertex be part of the root vertex set of the graph
|
|
56
|
+
* (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
|
|
57
|
+
*/
|
|
58
|
+
defineVariable(id: NodeId, name?: string, info?: {
|
|
59
|
+
controlDependencies?: ControlDependency[];
|
|
60
|
+
definedBy?: NodeId[];
|
|
61
|
+
}, asRoot?: boolean): this;
|
|
62
|
+
/**
|
|
63
|
+
* Adds a **vertex** for **variable use** (V5). Intended for creating dataflow graphs as part of function tests.
|
|
64
|
+
*
|
|
65
|
+
* @param id - AST node id
|
|
66
|
+
* @param name - Variable name
|
|
67
|
+
* @param info - Additional/optional properties; i.e., scope, when, or environment.
|
|
68
|
+
* @param asRoot - should the vertex be part of the root vertex set of the graph
|
|
69
|
+
* (i.e., be a valid entry point) or is it nested (e.g., as part of a function definition)
|
|
70
|
+
*/
|
|
71
|
+
use(id: NodeId, name?: string, info?: Partial<DataflowGraphVertexUse>, asRoot?: boolean): this;
|
|
72
|
+
/**
|
|
73
|
+
* Adds a **vertex** for a **constant value** (V6).
|
|
74
|
+
*
|
|
75
|
+
* @param id - AST node ID
|
|
76
|
+
* @param options - Additional/optional properties;
|
|
77
|
+
* @param asRoot - should the vertex be part of the root vertex set of the graph
|
|
78
|
+
* (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
|
|
79
|
+
*/
|
|
80
|
+
constant(id: NodeId, options?: {
|
|
81
|
+
controlDependencies?: ControlDependency[];
|
|
82
|
+
}, asRoot?: boolean): this;
|
|
83
|
+
private edgeHelper;
|
|
84
|
+
/**
|
|
85
|
+
* Adds a **read edge** (E1).
|
|
86
|
+
*
|
|
87
|
+
* @param from - Vertex/NodeId
|
|
88
|
+
* @param to - see from
|
|
89
|
+
*/
|
|
90
|
+
reads(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
91
|
+
/**
|
|
92
|
+
* Adds a **defined-by edge** (E2), with from as defined variable, and to
|
|
93
|
+
* as a variable/function contributing to its definition.
|
|
94
|
+
*
|
|
95
|
+
* @see reads for parameters.
|
|
96
|
+
*/
|
|
97
|
+
definedBy(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
98
|
+
/**
|
|
99
|
+
* Adds a **call edge** (E5) with from as caller, and to as callee.
|
|
100
|
+
*
|
|
101
|
+
* @see reads for parameters.
|
|
102
|
+
*/
|
|
103
|
+
calls(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
104
|
+
/**
|
|
105
|
+
* Adds a **return edge** (E6) with from as function, and to as exit point.
|
|
106
|
+
*
|
|
107
|
+
* @see reads for parameters.
|
|
108
|
+
*/
|
|
109
|
+
returns(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
110
|
+
/**
|
|
111
|
+
* Adds a **defines-on-call edge** (E7) with from as variable, and to as its definition
|
|
112
|
+
*
|
|
113
|
+
* @see reads for parameters.
|
|
114
|
+
*/
|
|
115
|
+
definesOnCall(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
116
|
+
/**
|
|
117
|
+
* Adds an **argument edge** (E9) with from as function call, and to as argument.
|
|
118
|
+
*
|
|
119
|
+
* @see reads for parameters.
|
|
120
|
+
*/
|
|
121
|
+
argument(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
122
|
+
/**
|
|
123
|
+
* Adds a **non-standard evaluation edge** with from as vertex, and to as vertex.
|
|
124
|
+
*
|
|
125
|
+
* @see reads for parameters.
|
|
126
|
+
*/
|
|
127
|
+
nse(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
128
|
+
/**
|
|
129
|
+
* Adds a **side-effect-on-call edge** with from as vertex, and to as vertex.
|
|
130
|
+
*
|
|
131
|
+
* @see reads for parameters.
|
|
132
|
+
*/
|
|
133
|
+
sideEffectOnCall(from: NodeId, to: DataflowGraphEdgeTarget): this;
|
|
134
|
+
/**
|
|
135
|
+
* explicitly overwrite the root ids of the graph,
|
|
136
|
+
* this is just an easier variant in case you working with a lot of functions this saves you a lot of `false` flags.
|
|
137
|
+
*/
|
|
138
|
+
overwriteRootIds(ids: readonly NodeId[]): this;
|
|
139
|
+
}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataflowGraphBuilder = void 0;
|
|
4
|
+
exports.emptyGraph = emptyGraph;
|
|
5
|
+
const objects_1 = require("../../util/objects");
|
|
6
|
+
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
7
|
+
const graph_1 = require("./graph");
|
|
8
|
+
const environment_1 = require("../environments/environment");
|
|
9
|
+
const vertex_1 = require("./vertex");
|
|
10
|
+
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
11
|
+
const built_in_1 = require("../environments/built-in");
|
|
12
|
+
const edge_1 = require("./edge");
|
|
13
|
+
function emptyGraph(idMap) {
|
|
14
|
+
return new DataflowGraphBuilder(idMap);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* This DataflowGraphBuilder extends {@link DataflowGraph} with builder methods to
|
|
18
|
+
* easily and compactly add vertices and edges to a dataflow graph. Its usage thus
|
|
19
|
+
* simplifies writing tests for dataflow graphs.
|
|
20
|
+
*/
|
|
21
|
+
class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
22
|
+
/**
|
|
23
|
+
* Adds a **vertex** for a **function definition** (V1).
|
|
24
|
+
*
|
|
25
|
+
* @param id - AST node ID
|
|
26
|
+
* @param subflow - Subflow data graph for the defined function.
|
|
27
|
+
* @param exitPoints - Node IDs for exit point vertices.
|
|
28
|
+
* @param info - Additional/optional properties.
|
|
29
|
+
* @param asRoot - should the vertex be part of the root vertex set of the graph
|
|
30
|
+
* (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
|
|
31
|
+
*/
|
|
32
|
+
defineFunction(id, exitPoints, subflow, info, asRoot = true) {
|
|
33
|
+
return this.addVertex({
|
|
34
|
+
tag: vertex_1.VertexType.FunctionDefinition,
|
|
35
|
+
id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
|
|
36
|
+
subflow: {
|
|
37
|
+
...subflow,
|
|
38
|
+
entryPoint: (0, node_id_1.normalizeIdToNumberIfPossible)(subflow.entryPoint),
|
|
39
|
+
graph: new Set([...subflow.graph].map(node_id_1.normalizeIdToNumberIfPossible)),
|
|
40
|
+
out: subflow.out.map(o => ({ ...o, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(o.nodeId), controlDependencies: o.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })) })),
|
|
41
|
+
in: subflow.in.map(o => ({ ...o, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(o.nodeId), controlDependencies: o.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })) })),
|
|
42
|
+
unknownReferences: subflow.unknownReferences.map(o => ({ ...o, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(o.nodeId), controlDependencies: o.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })) }))
|
|
43
|
+
},
|
|
44
|
+
exitPoints: exitPoints.map(node_id_1.normalizeIdToNumberIfPossible),
|
|
45
|
+
controlDependencies: info?.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
|
|
46
|
+
environment: info?.environment
|
|
47
|
+
}, asRoot);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Adds a **vertex** for a **function call** (V2).
|
|
51
|
+
*
|
|
52
|
+
* @param id - AST node ID
|
|
53
|
+
* @param name - Function name
|
|
54
|
+
* @param args - Function arguments; may be empty
|
|
55
|
+
* @param info - Additional/optional properties.
|
|
56
|
+
* @param asRoot - should the vertex be part of the root vertex set of the graph
|
|
57
|
+
* (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
|
|
58
|
+
*/
|
|
59
|
+
call(id, name, args, info, asRoot = true) {
|
|
60
|
+
const onlyBuiltInAuto = info?.reads?.length === 1 && info?.reads[0] === built_in_1.BuiltIn;
|
|
61
|
+
this.addVertex({
|
|
62
|
+
tag: vertex_1.VertexType.FunctionCall,
|
|
63
|
+
id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
|
|
64
|
+
name,
|
|
65
|
+
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 }),
|
|
66
|
+
environment: (info?.onlyBuiltIn || onlyBuiltInAuto) ? undefined : info?.environment ?? (0, environment_1.initializeCleanEnvironments)(),
|
|
67
|
+
controlDependencies: info?.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
|
|
68
|
+
onlyBuiltin: info?.onlyBuiltIn ?? onlyBuiltInAuto ?? false
|
|
69
|
+
}, asRoot);
|
|
70
|
+
this.addArgumentLinks(id, args);
|
|
71
|
+
if (info?.returns) {
|
|
72
|
+
for (const ret of info.returns) {
|
|
73
|
+
this.returns(id, ret);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (info?.reads) {
|
|
77
|
+
for (const call of info.reads) {
|
|
78
|
+
this.reads(id, call);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
/** automatically adds argument links if they do not already exist */
|
|
84
|
+
addArgumentLinks(id, args) {
|
|
85
|
+
for (const arg of args) {
|
|
86
|
+
if (arg === r_function_call_1.EmptyArgument) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if ((0, graph_1.isPositionalArgument)(arg)) {
|
|
90
|
+
this.argument(id, arg.nodeId);
|
|
91
|
+
if (typeof arg.nodeId === 'string' && arg.nodeId.endsWith('-arg')) {
|
|
92
|
+
const withoutSuffix = arg.nodeId.slice(0, -4);
|
|
93
|
+
this.reads(arg.nodeId, withoutSuffix);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else if (!this.hasVertex(arg.nodeId, true)) {
|
|
97
|
+
this.use(arg.nodeId, arg.name, { controlDependencies: arg.controlDependencies });
|
|
98
|
+
this.argument(id, arg.nodeId);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Adds a **vertex** for a **variable definition** (V4).
|
|
104
|
+
*
|
|
105
|
+
* @param id - AST node ID
|
|
106
|
+
* @param name - Variable name
|
|
107
|
+
* @param info - Additional/optional properties.
|
|
108
|
+
* @param asRoot - Should the vertex be part of the root vertex set of the graph
|
|
109
|
+
* (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
|
|
110
|
+
*/
|
|
111
|
+
defineVariable(id, name, info, asRoot = true) {
|
|
112
|
+
this.addVertex({
|
|
113
|
+
tag: vertex_1.VertexType.VariableDefinition,
|
|
114
|
+
id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
|
|
115
|
+
name,
|
|
116
|
+
controlDependencies: info?.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
|
|
117
|
+
}, asRoot);
|
|
118
|
+
if (info?.definedBy) {
|
|
119
|
+
for (const def of info.definedBy) {
|
|
120
|
+
this.definedBy(id, def);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return this;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Adds a **vertex** for **variable use** (V5). Intended for creating dataflow graphs as part of function tests.
|
|
127
|
+
*
|
|
128
|
+
* @param id - AST node id
|
|
129
|
+
* @param name - Variable name
|
|
130
|
+
* @param info - Additional/optional properties; i.e., scope, when, or environment.
|
|
131
|
+
* @param asRoot - should the vertex be part of the root vertex set of the graph
|
|
132
|
+
* (i.e., be a valid entry point) or is it nested (e.g., as part of a function definition)
|
|
133
|
+
*/
|
|
134
|
+
use(id, name, info, asRoot = true) {
|
|
135
|
+
return this.addVertex((0, objects_1.deepMergeObject)({
|
|
136
|
+
tag: vertex_1.VertexType.Use,
|
|
137
|
+
id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
|
|
138
|
+
name,
|
|
139
|
+
controlDependencies: undefined,
|
|
140
|
+
environment: undefined
|
|
141
|
+
}, {
|
|
142
|
+
...info,
|
|
143
|
+
controlDependencies: info?.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) }))
|
|
144
|
+
}), asRoot);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Adds a **vertex** for a **constant value** (V6).
|
|
148
|
+
*
|
|
149
|
+
* @param id - AST node ID
|
|
150
|
+
* @param options - Additional/optional properties;
|
|
151
|
+
* @param asRoot - should the vertex be part of the root vertex set of the graph
|
|
152
|
+
* (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
|
|
153
|
+
*/
|
|
154
|
+
constant(id, options, asRoot = true) {
|
|
155
|
+
return this.addVertex({
|
|
156
|
+
tag: vertex_1.VertexType.Value,
|
|
157
|
+
id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
|
|
158
|
+
controlDependencies: options?.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
|
|
159
|
+
environment: undefined
|
|
160
|
+
}, asRoot);
|
|
161
|
+
}
|
|
162
|
+
edgeHelper(from, to, type) {
|
|
163
|
+
if (Array.isArray(to)) {
|
|
164
|
+
for (const t of to) {
|
|
165
|
+
this.edgeHelper(from, t, type);
|
|
166
|
+
}
|
|
167
|
+
return this;
|
|
168
|
+
}
|
|
169
|
+
return this.addEdge((0, node_id_1.normalizeIdToNumberIfPossible)(from), (0, node_id_1.normalizeIdToNumberIfPossible)(to), type);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Adds a **read edge** (E1).
|
|
173
|
+
*
|
|
174
|
+
* @param from - Vertex/NodeId
|
|
175
|
+
* @param to - see from
|
|
176
|
+
*/
|
|
177
|
+
reads(from, to) {
|
|
178
|
+
return this.edgeHelper(from, to, edge_1.EdgeType.Reads);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Adds a **defined-by edge** (E2), with from as defined variable, and to
|
|
182
|
+
* as a variable/function contributing to its definition.
|
|
183
|
+
*
|
|
184
|
+
* @see reads for parameters.
|
|
185
|
+
*/
|
|
186
|
+
definedBy(from, to) {
|
|
187
|
+
return this.edgeHelper(from, to, edge_1.EdgeType.DefinedBy);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Adds a **call edge** (E5) with from as caller, and to as callee.
|
|
191
|
+
*
|
|
192
|
+
* @see reads for parameters.
|
|
193
|
+
*/
|
|
194
|
+
calls(from, to) {
|
|
195
|
+
return this.edgeHelper(from, to, edge_1.EdgeType.Calls);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Adds a **return edge** (E6) with from as function, and to as exit point.
|
|
199
|
+
*
|
|
200
|
+
* @see reads for parameters.
|
|
201
|
+
*/
|
|
202
|
+
returns(from, to) {
|
|
203
|
+
return this.edgeHelper(from, to, edge_1.EdgeType.Returns);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Adds a **defines-on-call edge** (E7) with from as variable, and to as its definition
|
|
207
|
+
*
|
|
208
|
+
* @see reads for parameters.
|
|
209
|
+
*/
|
|
210
|
+
definesOnCall(from, to) {
|
|
211
|
+
return this.edgeHelper(from, to, edge_1.EdgeType.DefinesOnCall);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Adds an **argument edge** (E9) with from as function call, and to as argument.
|
|
215
|
+
*
|
|
216
|
+
* @see reads for parameters.
|
|
217
|
+
*/
|
|
218
|
+
argument(from, to) {
|
|
219
|
+
return this.edgeHelper(from, to, edge_1.EdgeType.Argument);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Adds a **non-standard evaluation edge** with from as vertex, and to as vertex.
|
|
223
|
+
*
|
|
224
|
+
* @see reads for parameters.
|
|
225
|
+
*/
|
|
226
|
+
nse(from, to) {
|
|
227
|
+
return this.edgeHelper(from, to, edge_1.EdgeType.NonStandardEvaluation);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Adds a **side-effect-on-call edge** with from as vertex, and to as vertex.
|
|
231
|
+
*
|
|
232
|
+
* @see reads for parameters.
|
|
233
|
+
*/
|
|
234
|
+
sideEffectOnCall(from, to) {
|
|
235
|
+
return this.edgeHelper(from, to, edge_1.EdgeType.SideEffectOnCall);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* explicitly overwrite the root ids of the graph,
|
|
239
|
+
* this is just an easier variant in case you working with a lot of functions this saves you a lot of `false` flags.
|
|
240
|
+
*/
|
|
241
|
+
overwriteRootIds(ids) {
|
|
242
|
+
this.rootVertices = new Set(ids.map(node_id_1.normalizeIdToNumberIfPossible));
|
|
243
|
+
return this;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
exports.DataflowGraphBuilder = DataflowGraphBuilder;
|
|
247
|
+
//# sourceMappingURL=dataflowgraph-builder.js.map
|
package/dataflow/graph/diff.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DataflowDifferenceReport = void 0;
|
|
4
|
+
exports.diffOfDataflowGraphs = diffOfDataflowGraphs;
|
|
5
|
+
exports.equalFunctionArguments = equalFunctionArguments;
|
|
6
|
+
exports.diffFunctionArguments = diffFunctionArguments;
|
|
7
|
+
exports.diffVertices = diffVertices;
|
|
8
|
+
exports.diffEdges = diffEdges;
|
|
4
9
|
const graph_1 = require("./graph");
|
|
5
10
|
const diff_1 = require("../../util/diff");
|
|
6
11
|
const json_1 = require("../../util/json");
|
|
7
12
|
const arrays_1 = require("../../util/arrays");
|
|
13
|
+
const vertex_1 = require("./vertex");
|
|
8
14
|
const edge_1 = require("./edge");
|
|
9
15
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
10
16
|
const diff_2 = require("../environments/diff");
|
|
@@ -73,8 +79,8 @@ function diffOutgoingEdges(ctx) {
|
|
|
73
79
|
if (!ctx.left.hasVertex(id)) {
|
|
74
80
|
if (!ctx.config.leftIsSubgraph) {
|
|
75
81
|
ctx.report.addComment(`The source ${id} of edges ${JSON.stringify(edge, json_1.jsonReplacer)} is not present in ${ctx.leftname}. This means that the graph contains an edge but not the corresponding vertex.`);
|
|
82
|
+
continue;
|
|
76
83
|
}
|
|
77
|
-
continue;
|
|
78
84
|
}
|
|
79
85
|
diffEdges(ctx, id, edge, rEdges.get(id));
|
|
80
86
|
}
|
|
@@ -83,8 +89,8 @@ function diffOutgoingEdges(ctx) {
|
|
|
83
89
|
if (!ctx.right.hasVertex(id)) {
|
|
84
90
|
if (!ctx.config.rightIsSubgraph) {
|
|
85
91
|
ctx.report.addComment(`The source ${id} of edges ${JSON.stringify(edge, json_1.jsonReplacer)} is not present in ${ctx.rightname}. This means that the graph contains an edge but not the corresponding vertex.`);
|
|
92
|
+
continue;
|
|
86
93
|
}
|
|
87
|
-
continue;
|
|
88
94
|
}
|
|
89
95
|
if (!ctx.config.leftIsSubgraph && !lEdges.has(id)) {
|
|
90
96
|
diffEdges(ctx, id, undefined, edge);
|
|
@@ -104,7 +110,6 @@ function diffOfDataflowGraphs(left, right, config) {
|
|
|
104
110
|
diff(ctx);
|
|
105
111
|
return ctx.report;
|
|
106
112
|
}
|
|
107
|
-
exports.diffOfDataflowGraphs = diffOfDataflowGraphs;
|
|
108
113
|
function diffFunctionArgumentsReferences(fn, a, b, ctx) {
|
|
109
114
|
if (a === '<value>' || b === '<value>') {
|
|
110
115
|
if (a !== b) {
|
|
@@ -125,7 +130,6 @@ function equalFunctionArguments(fn, a, b) {
|
|
|
125
130
|
diffFunctionArguments(fn, a, b, ctx);
|
|
126
131
|
return ctx.report.isEqual();
|
|
127
132
|
}
|
|
128
|
-
exports.equalFunctionArguments = equalFunctionArguments;
|
|
129
133
|
function diffFunctionArguments(fn, a, b, ctx) {
|
|
130
134
|
if (a === false || b === false) {
|
|
131
135
|
if (a !== b) {
|
|
@@ -164,7 +168,6 @@ function diffFunctionArguments(fn, a, b, ctx) {
|
|
|
164
168
|
}
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
|
-
exports.diffFunctionArguments = diffFunctionArguments;
|
|
168
171
|
function diffVertices(ctx) {
|
|
169
172
|
// collect vertices from both sides
|
|
170
173
|
const lVert = [...ctx.left.vertices(true)].map(([id, info]) => [id, info]);
|
|
@@ -205,8 +208,8 @@ function diffVertices(ctx) {
|
|
|
205
208
|
position: `${ctx.position}Vertex ${id} differs in environment. `
|
|
206
209
|
});
|
|
207
210
|
}
|
|
208
|
-
if (lInfo.tag ===
|
|
209
|
-
if (rInfo.tag !==
|
|
211
|
+
if (lInfo.tag === vertex_1.VertexType.FunctionCall) {
|
|
212
|
+
if (rInfo.tag !== vertex_1.VertexType.FunctionCall) {
|
|
210
213
|
ctx.report.addComment(`Vertex ${id} differs in tags. ${ctx.leftname}: ${lInfo.tag} vs. ${ctx.rightname}: ${rInfo.tag}`);
|
|
211
214
|
}
|
|
212
215
|
else {
|
|
@@ -245,11 +248,10 @@ function diffVertices(ctx) {
|
|
|
245
248
|
}
|
|
246
249
|
}
|
|
247
250
|
}
|
|
248
|
-
exports.diffVertices = diffVertices;
|
|
249
251
|
function diffEdge(edge, otherEdge, ctx, id, target) {
|
|
250
252
|
const edgeTypes = (0, edge_1.splitEdgeTypes)(edge.types);
|
|
251
253
|
const otherEdgeTypes = (0, edge_1.splitEdgeTypes)(otherEdge.types);
|
|
252
|
-
if (edgeTypes.length
|
|
254
|
+
if ((edgeTypes.length < otherEdgeTypes.length && !ctx.config.leftIsSubgraph) || (edgeTypes.length > otherEdgeTypes.length && !ctx.config.rightIsSubgraph)) {
|
|
253
255
|
ctx.report.addComment(`Target of ${id}->${target} in ${ctx.leftname} differs in number of edge types: ${JSON.stringify([...edgeTypes])} vs ${JSON.stringify([...otherEdgeTypes])}`, { tag: 'edge', from: id, to: target });
|
|
254
256
|
}
|
|
255
257
|
if (edge.types !== otherEdge.types) {
|
|
@@ -280,5 +282,4 @@ function diffEdges(ctx, id, lEdges, rEdges) {
|
|
|
280
282
|
diffEdge(edge, otherEdge, ctx, id, target);
|
|
281
283
|
}
|
|
282
284
|
}
|
|
283
|
-
exports.diffEdges = diffEdges;
|
|
284
285
|
//# sourceMappingURL=diff.js.map
|
package/dataflow/graph/edge.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface DataflowGraphEdge {
|
|
|
11
11
|
* The actual value is represented as a bitmask so use {@link edgeTypesToNames} to get something more human-readable.
|
|
12
12
|
* Similarly, you can access {@link EdgeTypeName} to access the name counterpart.
|
|
13
13
|
*/
|
|
14
|
-
export declare
|
|
14
|
+
export declare enum EdgeType {
|
|
15
15
|
/** The edge determines that source reads target */
|
|
16
16
|
Reads = 1,
|
|
17
17
|
/** The edge determines that source is defined by target */
|
|
@@ -68,7 +68,7 @@ export declare const enum TraverseEdge {
|
|
|
68
68
|
* @example
|
|
69
69
|
*
|
|
70
70
|
* ```typescript
|
|
71
|
-
*
|
|
71
|
+
* edgeIncludesType(EdgeType.Reads, EdgeType.Reads | EdgeType.DefinedBy) // true
|
|
72
72
|
*```
|
|
73
73
|
*
|
|
74
74
|
* Counterpart of {@link edgeDoesNotIncludeType}.
|
package/dataflow/graph/edge.js
CHANGED
|
@@ -1,16 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.EdgeType = void 0;
|
|
4
|
+
exports.edgeTypeToName = edgeTypeToName;
|
|
5
|
+
exports.splitEdgeTypes = splitEdgeTypes;
|
|
6
|
+
exports.edgeTypesToNames = edgeTypesToNames;
|
|
7
|
+
exports.edgeIncludesType = edgeIncludesType;
|
|
8
|
+
exports.edgeDoesNotIncludeType = edgeDoesNotIncludeType;
|
|
9
|
+
exports.shouldTraverseEdge = shouldTraverseEdge;
|
|
10
|
+
/**
|
|
11
|
+
* Represents the relationship between the source and the target vertex in the dataflow graph.
|
|
12
|
+
* The actual value is represented as a bitmask so use {@link edgeTypesToNames} to get something more human-readable.
|
|
13
|
+
* Similarly, you can access {@link EdgeTypeName} to access the name counterpart.
|
|
14
|
+
*/
|
|
15
|
+
var EdgeType;
|
|
16
|
+
(function (EdgeType) {
|
|
17
|
+
/** The edge determines that source reads target */
|
|
18
|
+
EdgeType[EdgeType["Reads"] = 1] = "Reads";
|
|
19
|
+
/** The edge determines that source is defined by target */
|
|
20
|
+
EdgeType[EdgeType["DefinedBy"] = 2] = "DefinedBy";
|
|
21
|
+
/** The edge determines that the source calls the target */
|
|
22
|
+
EdgeType[EdgeType["Calls"] = 4] = "Calls";
|
|
23
|
+
/** The source returns target on call */
|
|
24
|
+
EdgeType[EdgeType["Returns"] = 8] = "Returns";
|
|
25
|
+
/** The edge determines that source (probably argument) defines the target (probably parameter), currently automatically created by `addEdge` */
|
|
26
|
+
EdgeType[EdgeType["DefinesOnCall"] = 16] = "DefinesOnCall";
|
|
27
|
+
/** Inverse of `defines-on-call` currently only needed to get better results when slicing complex function calls */
|
|
28
|
+
EdgeType[EdgeType["DefinedByOnCall"] = 32] = "DefinedByOnCall";
|
|
29
|
+
/** Formal used as argument to a function call */
|
|
30
|
+
EdgeType[EdgeType["Argument"] = 64] = "Argument";
|
|
31
|
+
/** The edge determines that the source is a side effect that happens when the target is called */
|
|
32
|
+
EdgeType[EdgeType["SideEffectOnCall"] = 128] = "SideEffectOnCall";
|
|
33
|
+
/** The Edge determines that the reference is affected by a non-standard evaluation (e.g., a for-loop body or a quotation) */
|
|
34
|
+
EdgeType[EdgeType["NonStandardEvaluation"] = 256] = "NonStandardEvaluation";
|
|
35
|
+
})(EdgeType || (exports.EdgeType = EdgeType = {}));
|
|
4
36
|
const edgeTypeToHumanReadableName = new Map([
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
37
|
+
[EdgeType.Reads, "reads" /* EdgeTypeName.Reads */],
|
|
38
|
+
[EdgeType.DefinedBy, "defined-by" /* EdgeTypeName.DefinedBy */],
|
|
39
|
+
[EdgeType.Calls, "calls" /* EdgeTypeName.Calls */],
|
|
40
|
+
[EdgeType.Returns, "returns" /* EdgeTypeName.Returns */],
|
|
41
|
+
[EdgeType.DefinesOnCall, "defines-on-call" /* EdgeTypeName.DefinesOnCall */],
|
|
42
|
+
[EdgeType.DefinedByOnCall, "defined-by-on-call" /* EdgeTypeName.DefinedByOnCall */],
|
|
43
|
+
[EdgeType.Argument, "argument" /* EdgeTypeName.Argument */],
|
|
44
|
+
[EdgeType.SideEffectOnCall, "side-effect-on-call" /* EdgeTypeName.SideEffectOnCall */],
|
|
45
|
+
[EdgeType.NonStandardEvaluation, "non-standard-evaluation" /* EdgeTypeName.NonStandardEvaluation */]
|
|
14
46
|
]);
|
|
15
47
|
/**
|
|
16
48
|
* Only use this function to retrieve a human-readable name if you know that it is a single bitmask.
|
|
@@ -19,7 +51,6 @@ const edgeTypeToHumanReadableName = new Map([
|
|
|
19
51
|
function edgeTypeToName(type) {
|
|
20
52
|
return edgeTypeToHumanReadableName.get(type);
|
|
21
53
|
}
|
|
22
|
-
exports.edgeTypeToName = edgeTypeToName;
|
|
23
54
|
function splitEdgeTypes(types) {
|
|
24
55
|
const split = [];
|
|
25
56
|
for (const bit of edgeTypeToHumanReadableName.keys()) {
|
|
@@ -29,7 +60,6 @@ function splitEdgeTypes(types) {
|
|
|
29
60
|
}
|
|
30
61
|
return split;
|
|
31
62
|
}
|
|
32
|
-
exports.splitEdgeTypes = splitEdgeTypes;
|
|
33
63
|
function edgeTypesToNames(bits) {
|
|
34
64
|
const types = new Set();
|
|
35
65
|
for (const [bit, name] of edgeTypeToHumanReadableName.entries()) {
|
|
@@ -39,13 +69,12 @@ function edgeTypesToNames(bits) {
|
|
|
39
69
|
}
|
|
40
70
|
return types;
|
|
41
71
|
}
|
|
42
|
-
exports.edgeTypesToNames = edgeTypesToNames;
|
|
43
72
|
/**
|
|
44
73
|
* Check if the given-edge type has any of the given types.
|
|
45
74
|
* @example
|
|
46
75
|
*
|
|
47
76
|
* ```typescript
|
|
48
|
-
*
|
|
77
|
+
* edgeIncludesType(EdgeType.Reads, EdgeType.Reads | EdgeType.DefinedBy) // true
|
|
49
78
|
*```
|
|
50
79
|
*
|
|
51
80
|
* Counterpart of {@link edgeDoesNotIncludeType}.
|
|
@@ -53,7 +82,6 @@ exports.edgeTypesToNames = edgeTypesToNames;
|
|
|
53
82
|
function edgeIncludesType(type, types) {
|
|
54
83
|
return (types & type) !== 0;
|
|
55
84
|
}
|
|
56
|
-
exports.edgeIncludesType = edgeIncludesType;
|
|
57
85
|
/**
|
|
58
86
|
* Check if the given-edge type does not include the given type.
|
|
59
87
|
* Counterpart of {@link edgeIncludesType}.
|
|
@@ -61,19 +89,17 @@ exports.edgeIncludesType = edgeIncludesType;
|
|
|
61
89
|
function edgeDoesNotIncludeType(type, types) {
|
|
62
90
|
return (types & type) === 0;
|
|
63
91
|
}
|
|
64
|
-
|
|
65
|
-
const alwaysTraverseEdgeTypes = 1 /* EdgeType.Reads */ | 2 /* EdgeType.DefinedBy */ | 64 /* EdgeType.Argument */ | 4 /* EdgeType.Calls */ | 16 /* EdgeType.DefinesOnCall */;
|
|
92
|
+
const alwaysTraverseEdgeTypes = EdgeType.Reads | EdgeType.DefinedBy | EdgeType.Argument | EdgeType.Calls | EdgeType.DefinesOnCall;
|
|
66
93
|
function shouldTraverseEdge(types) {
|
|
67
94
|
if (edgeIncludesType(types, alwaysTraverseEdgeTypes)) {
|
|
68
95
|
return 3 /* TraverseEdge.Always */;
|
|
69
96
|
}
|
|
70
|
-
else if (edgeIncludesType(types,
|
|
97
|
+
else if (edgeIncludesType(types, EdgeType.DefinedByOnCall)) {
|
|
71
98
|
return 2 /* TraverseEdge.DefinedByOnCall */;
|
|
72
99
|
}
|
|
73
|
-
else if (edgeIncludesType(types,
|
|
100
|
+
else if (edgeIncludesType(types, EdgeType.SideEffectOnCall)) {
|
|
74
101
|
return 1 /* TraverseEdge.SideEffect */;
|
|
75
102
|
}
|
|
76
103
|
return 0 /* TraverseEdge.Never */;
|
|
77
104
|
}
|
|
78
|
-
exports.shouldTraverseEdge = shouldTraverseEdge;
|
|
79
105
|
//# sourceMappingURL=edge.js.map
|
|
@@ -9,12 +9,23 @@ import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/deco
|
|
|
9
9
|
export type DataflowFunctionFlowInformation = Omit<DataflowInformation, 'graph' | 'exitPoints'> & {
|
|
10
10
|
graph: Set<NodeId>;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* ```r
|
|
14
|
+
* foo(a = 3, b = 2)
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
12
17
|
export interface NamedFunctionArgument extends IdentifierReference {
|
|
13
18
|
readonly name: string;
|
|
14
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* ```r
|
|
22
|
+
* foo(3, 2)
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
15
25
|
export interface PositionalFunctionArgument extends Omit<IdentifierReference, 'name'> {
|
|
16
26
|
readonly name?: undefined;
|
|
17
27
|
}
|
|
28
|
+
/** Summarizes either named (`foo(a = 3, b = 2)`), unnamed (`foo(3, 2)`), or empty (`foo(,)`) arguments within a function. */
|
|
18
29
|
export type FunctionArgument = NamedFunctionArgument | PositionalFunctionArgument | typeof EmptyArgument;
|
|
19
30
|
export declare function isPositionalArgument(arg: FunctionArgument): arg is PositionalFunctionArgument;
|
|
20
31
|
export declare function isNamedArgument(arg: FunctionArgument): arg is NamedFunctionArgument;
|
|
@@ -29,9 +40,6 @@ export type OutgoingEdges<Edge extends DataflowGraphEdge = DataflowGraphEdge> =
|
|
|
29
40
|
* In other words, it maps the source to the edge information.
|
|
30
41
|
*/
|
|
31
42
|
export type IngoingEdges<Edge extends DataflowGraphEdge = DataflowGraphEdge> = Map<NodeId, Edge>;
|
|
32
|
-
type EdgeData<Edge extends DataflowGraphEdge> = Omit<Edge, 'from' | 'to' | 'types' | 'attribute'> & {
|
|
33
|
-
type: EdgeType;
|
|
34
|
-
};
|
|
35
43
|
export interface DataflowGraphJson {
|
|
36
44
|
readonly rootVertices: NodeId[];
|
|
37
45
|
readonly vertexInformation: [NodeId, DataflowGraphVertexInfo][];
|
|
@@ -126,11 +134,11 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
|
|
|
126
134
|
*/
|
|
127
135
|
addVertex(vertex: DataflowGraphVertexArgument & Omit<Vertex, keyof DataflowGraphVertexArgument>, asRoot?: boolean): this;
|
|
128
136
|
/** {@inheritDoc} */
|
|
129
|
-
addEdge(from: NodeId, to: NodeId,
|
|
137
|
+
addEdge(from: NodeId, to: NodeId, type: EdgeType): this;
|
|
130
138
|
/** {@inheritDoc} */
|
|
131
|
-
addEdge(from: ReferenceForEdge, to: ReferenceForEdge,
|
|
139
|
+
addEdge(from: ReferenceForEdge, to: ReferenceForEdge, type: EdgeType): this;
|
|
132
140
|
/** {@inheritDoc} */
|
|
133
|
-
addEdge(from: NodeId | ReferenceForEdge, to: NodeId | ReferenceForEdge,
|
|
141
|
+
addEdge(from: NodeId | ReferenceForEdge, to: NodeId | ReferenceForEdge, type: EdgeType): this;
|
|
134
142
|
private installEdge;
|
|
135
143
|
/**
|
|
136
144
|
* Merges the other graph into *this* one (in-place). The return value is only for convenience.
|