@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
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.processAssignment = processAssignment;
|
|
4
|
+
exports.markAsAssignment = markAsAssignment;
|
|
4
5
|
const known_call_handling_1 = require("../known-call-handling");
|
|
5
6
|
const assert_1 = require("../../../../../../util/assert");
|
|
6
7
|
const log_1 = require("../../../../../../util/log");
|
|
7
8
|
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
8
9
|
const process_named_call_1 = require("../../../process-named-call");
|
|
9
10
|
const make_argument_1 = require("../argument/make-argument");
|
|
11
|
+
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
10
12
|
const logger_1 = require("../../../../../logger");
|
|
13
|
+
const identifier_1 = require("../../../../../environments/identifier");
|
|
11
14
|
const overwrite_1 = require("../../../../../environments/overwrite");
|
|
12
15
|
const retriever_1 = require("../../../../../../r-bridge/retriever");
|
|
16
|
+
const vertex_1 = require("../../../../../graph/vertex");
|
|
13
17
|
const define_1 = require("../../../../../environments/define");
|
|
18
|
+
const edge_1 = require("../../../../../graph/edge");
|
|
14
19
|
function toReplacementSymbol(target, prefix, superAssignment) {
|
|
15
20
|
return {
|
|
16
|
-
type:
|
|
21
|
+
type: type_1.RType.Symbol,
|
|
17
22
|
info: target.info,
|
|
18
23
|
/* they are all mapped to `<-` in R, but we mark super as well */
|
|
19
24
|
content: `${prefix}${superAssignment ? '<<-' : '<-'}`,
|
|
@@ -27,10 +32,10 @@ function getEffectiveOrder(config, args) {
|
|
|
27
32
|
}
|
|
28
33
|
function findRootAccess(node) {
|
|
29
34
|
let current = node;
|
|
30
|
-
while (current.type ===
|
|
35
|
+
while (current.type === type_1.RType.Access) {
|
|
31
36
|
current = current.accessed;
|
|
32
37
|
}
|
|
33
|
-
if (current.type ===
|
|
38
|
+
if (current.type === type_1.RType.Symbol) {
|
|
34
39
|
return current;
|
|
35
40
|
}
|
|
36
41
|
else {
|
|
@@ -52,7 +57,7 @@ args, rootId, data, config) {
|
|
|
52
57
|
const effectiveArgs = getEffectiveOrder(config, args);
|
|
53
58
|
const { target, source } = extractSourceAndTarget(effectiveArgs, name);
|
|
54
59
|
const { type, named } = target;
|
|
55
|
-
if (type ===
|
|
60
|
+
if (type === type_1.RType.Symbol) {
|
|
56
61
|
const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, reverseOrder: !config.swapSourceAndTarget, forceArgs: config.forceArgs });
|
|
57
62
|
return processAssignmentToSymbol({
|
|
58
63
|
...config,
|
|
@@ -65,18 +70,18 @@ args, rootId, data, config) {
|
|
|
65
70
|
information: res.information,
|
|
66
71
|
});
|
|
67
72
|
}
|
|
68
|
-
else if (config.canBeReplacement && type ===
|
|
73
|
+
else if (config.canBeReplacement && type === type_1.RType.FunctionCall && named) {
|
|
69
74
|
/* as replacement functions take precedence over the lhs fn-call (i.e., `names(x) <- ...` is independent from the definition of `names`), we do not have to process the call */
|
|
70
75
|
logger_1.dataflowLogger.debug(`Assignment ${name.content} has a function call as target => replacement function ${target.lexeme}`);
|
|
71
76
|
const replacement = toReplacementSymbol(target, target.functionName.content, config.superAssignment ?? false);
|
|
72
77
|
return (0, process_named_call_1.processAsNamedCall)(replacement, data, replacement.content, [...target.arguments, source]);
|
|
73
78
|
}
|
|
74
|
-
else if (config.canBeReplacement && type ===
|
|
79
|
+
else if (config.canBeReplacement && type === type_1.RType.Access) {
|
|
75
80
|
logger_1.dataflowLogger.debug(`Assignment ${name.content} has an access as target => replacement function ${target.lexeme}`);
|
|
76
81
|
const replacement = toReplacementSymbol(target, target.operator, config.superAssignment ?? false);
|
|
77
82
|
return (0, process_named_call_1.processAsNamedCall)(replacement, data, replacement.content, [(0, make_argument_1.toUnnamedArgument)(target.accessed, data.completeAst.idMap), ...target.access, source]);
|
|
78
83
|
}
|
|
79
|
-
else if (type ===
|
|
84
|
+
else if (type === type_1.RType.Access) {
|
|
80
85
|
const rootArg = findRootAccess(target);
|
|
81
86
|
if (rootArg) {
|
|
82
87
|
const res = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
@@ -99,13 +104,12 @@ args, rootId, data, config) {
|
|
|
99
104
|
});
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
|
-
else if (type ===
|
|
107
|
+
else if (type === type_1.RType.String) {
|
|
103
108
|
return processAssignmentToString(target, args, name, rootId, data, config, source);
|
|
104
109
|
}
|
|
105
110
|
logger_1.dataflowLogger.warn(`Assignment ${name.content} has an unknown target type ${target.type}, skipping`);
|
|
106
111
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args: effectiveArgs, rootId, data, forceArgs: config.forceArgs }).information;
|
|
107
112
|
}
|
|
108
|
-
exports.processAssignment = processAssignment;
|
|
109
113
|
function extractSourceAndTarget(args, name) {
|
|
110
114
|
const source = (0, unpack_argument_1.unpackArgument)(args[1]);
|
|
111
115
|
const target = (0, unpack_argument_1.unpackArgument)(args[0]);
|
|
@@ -113,17 +117,17 @@ function extractSourceAndTarget(args, name) {
|
|
|
113
117
|
(0, assert_1.guard)(target !== undefined, () => `Assignment ${name.content} has no target, impossible!`);
|
|
114
118
|
return { source, target };
|
|
115
119
|
}
|
|
116
|
-
function produceWrittenNodes(rootId, target,
|
|
120
|
+
function produceWrittenNodes(rootId, target, referenceType, data, makeMaybe) {
|
|
117
121
|
return [...target.in, ...target.unknownReferences].map(ref => ({
|
|
118
122
|
...ref,
|
|
119
|
-
|
|
123
|
+
type: referenceType,
|
|
120
124
|
definedAt: rootId,
|
|
121
125
|
controlDependencies: data.controlDependencies ?? (makeMaybe ? [] : undefined)
|
|
122
126
|
}));
|
|
123
127
|
}
|
|
124
128
|
function processAssignmentToString(target, args, name, rootId, data, config, source) {
|
|
125
129
|
const symbol = {
|
|
126
|
-
type:
|
|
130
|
+
type: type_1.RType.Symbol,
|
|
127
131
|
info: target.info,
|
|
128
132
|
content: (0, retriever_1.removeRQuotes)(target.lexeme),
|
|
129
133
|
lexeme: target.lexeme,
|
|
@@ -154,8 +158,17 @@ function processAssignmentToString(target, args, name, rootId, data, config, sou
|
|
|
154
158
|
information: res.information
|
|
155
159
|
});
|
|
156
160
|
}
|
|
157
|
-
function
|
|
158
|
-
|
|
161
|
+
function checkTargetReferenceType(source, sourceInfo) {
|
|
162
|
+
const vert = sourceInfo.graph.getVertex(source.info.id, true);
|
|
163
|
+
switch (vert?.tag) {
|
|
164
|
+
case vertex_1.VertexType.FunctionDefinition:
|
|
165
|
+
return identifier_1.ReferenceType.Function;
|
|
166
|
+
case vertex_1.VertexType.Use:
|
|
167
|
+
case vertex_1.VertexType.FunctionCall:
|
|
168
|
+
return identifier_1.ReferenceType.Unknown;
|
|
169
|
+
default:
|
|
170
|
+
return identifier_1.ReferenceType.Variable;
|
|
171
|
+
}
|
|
159
172
|
}
|
|
160
173
|
/**
|
|
161
174
|
* Consider a call like `x <- v`
|
|
@@ -171,48 +184,49 @@ function markAsAssignment(information, nodeToDefine, sourceIds, rootIdOfAssignme
|
|
|
171
184
|
information.graph.setDefinitionOfVertex(nodeToDefine);
|
|
172
185
|
if (!quoteSource) {
|
|
173
186
|
for (const sourceId of sourceIds) {
|
|
174
|
-
information.graph.addEdge(nodeToDefine, sourceId,
|
|
187
|
+
information.graph.addEdge(nodeToDefine, sourceId, edge_1.EdgeType.DefinedBy);
|
|
175
188
|
}
|
|
176
189
|
}
|
|
177
|
-
information.graph.addEdge(nodeToDefine, rootIdOfAssignment,
|
|
190
|
+
information.graph.addEdge(nodeToDefine, rootIdOfAssignment, edge_1.EdgeType.DefinedBy);
|
|
178
191
|
// kinda dirty, but we have to remove existing read edges for the symbol, added by the child
|
|
179
192
|
const out = information.graph.outgoingEdges(nodeToDefine.nodeId);
|
|
180
193
|
for (const [id, edge] of (out ?? [])) {
|
|
181
|
-
edge.types &= ~
|
|
194
|
+
edge.types &= ~edge_1.EdgeType.Reads;
|
|
182
195
|
if (edge.types == 0) {
|
|
183
196
|
out?.delete(id);
|
|
184
197
|
}
|
|
185
198
|
}
|
|
186
199
|
}
|
|
187
|
-
exports.markAsAssignment = markAsAssignment;
|
|
188
200
|
/**
|
|
189
201
|
* Helper function whenever it is known that the _target_ of an assignment is a (single) symbol (i.e. `x <- ...`, but not `names(x) <- ...`).
|
|
190
202
|
*/
|
|
191
203
|
function processAssignmentToSymbol({ nameOfAssignmentFunction, source, args: [targetArg, sourceArg], target, rootId, data, information, superAssignment, makeMaybe, quoteSource }) {
|
|
192
|
-
const
|
|
193
|
-
const writeNodes = produceWrittenNodes(rootId, targetArg,
|
|
204
|
+
const referenceType = checkTargetReferenceType(source, sourceArg);
|
|
205
|
+
const writeNodes = produceWrittenNodes(rootId, targetArg, referenceType, data, makeMaybe ?? false);
|
|
194
206
|
if (writeNodes.length !== 1 && log_1.log.settings.minLevel <= 4 /* LogLevel.Warn */) {
|
|
195
207
|
log_1.log.warn(`Unexpected write number in assignment: ${JSON.stringify(writeNodes)}`);
|
|
196
208
|
}
|
|
197
209
|
// we drop the first arg which we use to pass along arguments :D
|
|
198
210
|
const readFromSourceWritten = sourceArg.out.slice(1);
|
|
199
|
-
const readTargets = [
|
|
200
|
-
|
|
211
|
+
const readTargets = [
|
|
212
|
+
{ nodeId: rootId, name: nameOfAssignmentFunction, controlDependencies: data.controlDependencies, type: identifier_1.ReferenceType.Function },
|
|
213
|
+
...sourceArg.unknownReferences, ...sourceArg.in, ...targetArg.in.filter(i => i.nodeId !== target.info.id), ...readFromSourceWritten
|
|
214
|
+
];
|
|
201
215
|
information.environment = (0, overwrite_1.overwriteEnvironment)(targetArg.environment, sourceArg.environment);
|
|
202
216
|
// install assigned variables in environment
|
|
203
217
|
for (const write of writeNodes) {
|
|
204
218
|
markAsAssignment(information, write, [source.info.id], rootId, quoteSource, superAssignment);
|
|
205
219
|
}
|
|
206
|
-
information.graph.addEdge(rootId, targetArg.entryPoint,
|
|
220
|
+
information.graph.addEdge(rootId, targetArg.entryPoint, edge_1.EdgeType.Returns);
|
|
207
221
|
if (quoteSource) {
|
|
208
|
-
information.graph.addEdge(rootId, source.info.id,
|
|
222
|
+
information.graph.addEdge(rootId, source.info.id, edge_1.EdgeType.NonStandardEvaluation);
|
|
209
223
|
}
|
|
210
224
|
return {
|
|
211
225
|
...information,
|
|
212
226
|
unknownReferences: [],
|
|
213
227
|
entryPoint: rootId,
|
|
214
228
|
in: readTargets,
|
|
215
|
-
out:
|
|
229
|
+
out: [...writeNodes, ...readFromSourceWritten]
|
|
216
230
|
};
|
|
217
231
|
}
|
|
218
232
|
//# sourceMappingURL=built-in-assignment.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processExpressionList =
|
|
3
|
+
exports.processExpressionList = processExpressionList;
|
|
4
4
|
const info_1 = require("../../../../../info");
|
|
5
5
|
const processor_1 = require("../../../../../processor");
|
|
6
6
|
const linker_1 = require("../../../../linker");
|
|
@@ -9,19 +9,25 @@ const unpack_argument_1 = require("../argument/unpack-argument");
|
|
|
9
9
|
const common_1 = require("../common");
|
|
10
10
|
const environment_1 = require("../../../../../environments/environment");
|
|
11
11
|
const graph_1 = require("../../../../../graph/graph");
|
|
12
|
+
const identifier_1 = require("../../../../../environments/identifier");
|
|
12
13
|
const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
|
|
14
|
+
const edge_1 = require("../../../../../graph/edge");
|
|
15
|
+
const vertex_1 = require("../../../../../graph/vertex");
|
|
13
16
|
const scoping_1 = require("../../../../../environments/scoping");
|
|
14
17
|
const built_in_1 = require("../../../../../environments/built-in");
|
|
15
18
|
const overwrite_1 = require("../../../../../environments/overwrite");
|
|
16
19
|
const logger_1 = require("../../../../../logger");
|
|
17
|
-
const dotDotDotAccess =
|
|
20
|
+
const dotDotDotAccess = /^\.\.\d+$/;
|
|
18
21
|
function linkReadNameToWriteIfPossible(read, environments, listEnvironments, remainingRead, nextGraph) {
|
|
19
22
|
const readName = read.name && dotDotDotAccess.test(read.name) ? '...' : read.name;
|
|
20
|
-
const probableTarget = readName ? (0, resolve_by_name_1.resolveByName)(readName, environments) : undefined;
|
|
23
|
+
const probableTarget = readName ? (0, resolve_by_name_1.resolveByName)(readName, environments, read.type) : undefined;
|
|
21
24
|
// record if at least one has not been defined
|
|
22
|
-
if (probableTarget === undefined || probableTarget.some(t => !listEnvironments.has(t.nodeId))) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
if (probableTarget === undefined || probableTarget.some(t => !listEnvironments.has(t.nodeId) || !(0, info_1.happensInEveryBranch)(t.controlDependencies))) {
|
|
26
|
+
const has = remainingRead.get(readName);
|
|
27
|
+
if (has) {
|
|
28
|
+
if (!has?.some(h => h.nodeId === read.nodeId && h.name === read.name && h.controlDependencies === read.controlDependencies)) {
|
|
29
|
+
has.push(read);
|
|
30
|
+
}
|
|
25
31
|
}
|
|
26
32
|
else {
|
|
27
33
|
remainingRead.set(readName, [read]);
|
|
@@ -34,19 +40,20 @@ function linkReadNameToWriteIfPossible(read, environments, listEnvironments, rem
|
|
|
34
40
|
}
|
|
35
41
|
for (const target of probableTarget) {
|
|
36
42
|
// we can stick with maybe even if readId.attribute is always
|
|
37
|
-
nextGraph.addEdge(read, target,
|
|
43
|
+
nextGraph.addEdge(read, target, edge_1.EdgeType.Reads);
|
|
38
44
|
}
|
|
39
45
|
}
|
|
40
46
|
function processNextExpression(currentElement, environment, listEnvironments, remainingRead, nextGraph) {
|
|
41
|
-
// all inputs that have not been written until now
|
|
47
|
+
// all inputs that have not been written until now are read!
|
|
42
48
|
for (const read of [...currentElement.in, ...currentElement.unknownReferences]) {
|
|
43
49
|
linkReadNameToWriteIfPossible(read, environment, listEnvironments, remainingRead, nextGraph);
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
function updateSideEffectsForCalledFunctions(calledEnvs, inputEnvironment, nextGraph) {
|
|
47
53
|
for (const { functionCall, called } of calledEnvs) {
|
|
54
|
+
const callDependencies = nextGraph.getVertex(functionCall, true)?.controlDependencies;
|
|
48
55
|
for (const calledFn of called) {
|
|
49
|
-
(0, assert_1.guard)(calledFn.tag ===
|
|
56
|
+
(0, assert_1.guard)(calledFn.tag === vertex_1.VertexType.FunctionDefinition, 'called function must call a function definition');
|
|
50
57
|
// only merge the environments they have in common
|
|
51
58
|
let environment = calledFn.environment;
|
|
52
59
|
while (environment.level > inputEnvironment.level) {
|
|
@@ -54,26 +61,30 @@ function updateSideEffectsForCalledFunctions(calledEnvs, inputEnvironment, nextG
|
|
|
54
61
|
}
|
|
55
62
|
// update alle definitions to be defined at this function call
|
|
56
63
|
let current = environment.current;
|
|
57
|
-
|
|
64
|
+
let hasUpdate = false;
|
|
65
|
+
while (current !== undefined && current.id !== environment_1.BuiltInEnvironment.id) {
|
|
58
66
|
for (const definitions of current.memory.values()) {
|
|
59
67
|
for (const def of definitions) {
|
|
60
68
|
if (def.definedAt !== built_in_1.BuiltIn) {
|
|
61
|
-
|
|
69
|
+
hasUpdate = true;
|
|
70
|
+
nextGraph.addEdge(def.nodeId, functionCall, edge_1.EdgeType.SideEffectOnCall);
|
|
62
71
|
}
|
|
63
72
|
}
|
|
64
73
|
}
|
|
65
74
|
current = current.parent;
|
|
66
75
|
}
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
if (hasUpdate) {
|
|
77
|
+
// we update all definitions to be linked with the corresponding function call
|
|
78
|
+
inputEnvironment = (0, overwrite_1.overwriteEnvironment)(inputEnvironment, environment, callDependencies);
|
|
79
|
+
}
|
|
69
80
|
}
|
|
70
81
|
}
|
|
71
82
|
return inputEnvironment;
|
|
72
83
|
}
|
|
73
84
|
function processExpressionList(name, args, rootId, data) {
|
|
74
85
|
const expressions = args.map(unpack_argument_1.unpackArgument);
|
|
75
|
-
logger_1.dataflowLogger.trace(`
|
|
76
|
-
let environment = data
|
|
86
|
+
logger_1.dataflowLogger.trace(() => `[expr list] with ${expressions.length} expressions`);
|
|
87
|
+
let { environment } = data;
|
|
77
88
|
// used to detect if a "write" happens within the same expression list
|
|
78
89
|
const listEnvironments = new Set();
|
|
79
90
|
const remainingRead = new Map();
|
|
@@ -95,7 +106,7 @@ function processExpressionList(name, args, rootId, data) {
|
|
|
95
106
|
processedExpressions.push(processed);
|
|
96
107
|
nextGraph.mergeWith(processed.graph);
|
|
97
108
|
defaultReturnExpr = processed;
|
|
98
|
-
// if the expression contained next or break anywhere before the next loop, the overwrite should be an append because we do not know if the rest is executed
|
|
109
|
+
// if the expression contained next or break anywhere before the next loop, the "overwrite" should be an "append", because we do not know if the rest is executed
|
|
99
110
|
// update the environments for the next iteration with the previous writes
|
|
100
111
|
if (exitPoints.length > 0) {
|
|
101
112
|
processed.out = (0, environment_1.makeAllMaybe)(processed.out, nextGraph, processed.environment, true);
|
|
@@ -106,8 +117,8 @@ function processExpressionList(name, args, rootId, data) {
|
|
|
106
117
|
out.push(...processed.out);
|
|
107
118
|
logger_1.dataflowLogger.trace(`expression ${expressionCounter} of ${expressions.length} has ${processed.unknownReferences.length} unknown nodes`);
|
|
108
119
|
processNextExpression(processed, environment, listEnvironments, remainingRead, nextGraph);
|
|
109
|
-
const calledEnvs = (0, linker_1.linkFunctionCalls)(nextGraph, data.completeAst.idMap, processed.graph);
|
|
110
120
|
environment = exitPoints.length > 0 ? (0, overwrite_1.overwriteEnvironment)(environment, processed.environment) : processed.environment;
|
|
121
|
+
const calledEnvs = (0, linker_1.linkFunctionCalls)(nextGraph, data.completeAst.idMap, processed.graph);
|
|
111
122
|
// if the called function has global redefinitions, we have to keep them within our environment
|
|
112
123
|
environment = updateSideEffectsForCalledFunctions(calledEnvs, environment, nextGraph);
|
|
113
124
|
for (const { nodeId } of processed.out) {
|
|
@@ -132,7 +143,7 @@ function processExpressionList(name, args, rootId, data) {
|
|
|
132
143
|
const rootNode = data.completeAst.idMap.get(rootId);
|
|
133
144
|
const withGroup = rootNode?.grouping;
|
|
134
145
|
if (withGroup) {
|
|
135
|
-
ingoing.push({ nodeId: rootId, name: name.content, controlDependencies: data.controlDependencies });
|
|
146
|
+
ingoing.push({ nodeId: rootId, name: name.content, controlDependencies: data.controlDependencies, type: identifier_1.ReferenceType.Function });
|
|
136
147
|
(0, common_1.patchFunctionCall)({
|
|
137
148
|
nextGraph,
|
|
138
149
|
rootId,
|
|
@@ -143,7 +154,7 @@ function processExpressionList(name, args, rootId, data) {
|
|
|
143
154
|
// process all exit points as potential returns:
|
|
144
155
|
for (const exit of exitPoints) {
|
|
145
156
|
if (exit.type === 1 /* ExitPointType.Return */ || exit.type === 0 /* ExitPointType.Default */) {
|
|
146
|
-
nextGraph.addEdge(rootId, exit.nodeId,
|
|
157
|
+
nextGraph.addEdge(rootId, exit.nodeId, edge_1.EdgeType.Returns);
|
|
147
158
|
}
|
|
148
159
|
}
|
|
149
160
|
}
|
|
@@ -161,5 +172,4 @@ function processExpressionList(name, args, rootId, data) {
|
|
|
161
172
|
: exitPoints
|
|
162
173
|
};
|
|
163
174
|
}
|
|
164
|
-
exports.processExpressionList = processExpressionList;
|
|
165
175
|
//# sourceMappingURL=built-in-expression-list.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processForLoop =
|
|
3
|
+
exports.processForLoop = processForLoop;
|
|
4
4
|
const processor_1 = require("../../../../../processor");
|
|
5
5
|
const info_1 = require("../../../../../info");
|
|
6
6
|
const linker_1 = require("../../../../linker");
|
|
@@ -13,6 +13,8 @@ const overwrite_1 = require("../../../../../environments/overwrite");
|
|
|
13
13
|
const define_1 = require("../../../../../environments/define");
|
|
14
14
|
const append_1 = require("../../../../../environments/append");
|
|
15
15
|
const environment_1 = require("../../../../../environments/environment");
|
|
16
|
+
const edge_1 = require("../../../../../graph/edge");
|
|
17
|
+
const identifier_1 = require("../../../../../environments/identifier");
|
|
16
18
|
function processForLoop(name, args, rootId, data) {
|
|
17
19
|
if (args.length !== 3) {
|
|
18
20
|
logger_1.dataflowLogger.warn(`For-Loop ${name.content} does not have three arguments, skipping`);
|
|
@@ -33,7 +35,7 @@ function processForLoop(name, args, rootId, data) {
|
|
|
33
35
|
const headGraph = variable.graph.mergeWith(vector.graph);
|
|
34
36
|
const writtenVariable = [...variable.unknownReferences, ...variable.in];
|
|
35
37
|
for (const write of writtenVariable) {
|
|
36
|
-
headEnvironments = (0, define_1.define)({ ...write, definedAt: name.info.id,
|
|
38
|
+
headEnvironments = (0, define_1.define)({ ...write, definedAt: name.info.id, type: identifier_1.ReferenceType.Variable }, false, headEnvironments);
|
|
37
39
|
}
|
|
38
40
|
data = { ...data, environment: headEnvironments };
|
|
39
41
|
const body = (0, processor_1.processDataflowFor)(bodyArg, data);
|
|
@@ -41,9 +43,9 @@ function processForLoop(name, args, rootId, data) {
|
|
|
41
43
|
const outEnvironment = (0, append_1.appendEnvironment)(headEnvironments, body.environment);
|
|
42
44
|
// now we have to identify all reads that may be effected by a circular redefinition
|
|
43
45
|
// for this, we search for all reads with a non-local read resolve!
|
|
44
|
-
const nameIdShares = (0, linker_1.produceNameSharedIdMap)((0, linker_1.findNonLocalReads)(nextGraph));
|
|
46
|
+
const nameIdShares = (0, linker_1.produceNameSharedIdMap)((0, linker_1.findNonLocalReads)(nextGraph, writtenVariable));
|
|
45
47
|
for (const write of writtenVariable) {
|
|
46
|
-
nextGraph.addEdge(write.nodeId, vector.entryPoint,
|
|
48
|
+
nextGraph.addEdge(write.nodeId, vector.entryPoint, edge_1.EdgeType.DefinedBy);
|
|
47
49
|
nextGraph.setDefinitionOfVertex(write);
|
|
48
50
|
}
|
|
49
51
|
const outgoing = [...variable.out, ...writtenVariable, ...(0, environment_1.makeAllMaybe)(body.out, nextGraph, outEnvironment, true)];
|
|
@@ -56,14 +58,14 @@ function processForLoop(name, args, rootId, data) {
|
|
|
56
58
|
argumentProcessResult: [variable, vector, body]
|
|
57
59
|
});
|
|
58
60
|
/* mark the last argument as nse */
|
|
59
|
-
nextGraph.addEdge(rootId, body.entryPoint,
|
|
61
|
+
nextGraph.addEdge(rootId, body.entryPoint, edge_1.EdgeType.NonStandardEvaluation);
|
|
60
62
|
// as the for-loop always evaluates its variable and condition
|
|
61
|
-
nextGraph.addEdge(name.info.id, variable.entryPoint,
|
|
62
|
-
nextGraph.addEdge(name.info.id, vector.entryPoint,
|
|
63
|
+
nextGraph.addEdge(name.info.id, variable.entryPoint, edge_1.EdgeType.Reads);
|
|
64
|
+
nextGraph.addEdge(name.info.id, vector.entryPoint, edge_1.EdgeType.Reads);
|
|
63
65
|
return {
|
|
64
66
|
unknownReferences: [],
|
|
65
67
|
// we only want those not bound by a local variable
|
|
66
|
-
in: [{ nodeId: rootId, name: name.content, controlDependencies: originalDependency
|
|
68
|
+
in: [{ nodeId: rootId, name: name.content, controlDependencies: originalDependency, type: identifier_1.ReferenceType.Function }, ...vector.unknownReferences, ...[...nameIdShares.values()].flat()],
|
|
67
69
|
out: outgoing,
|
|
68
70
|
graph: nextGraph,
|
|
69
71
|
entryPoint: name.info.id,
|
|
@@ -71,5 +73,4 @@ function processForLoop(name, args, rootId, data) {
|
|
|
71
73
|
environment: outEnvironment
|
|
72
74
|
};
|
|
73
75
|
}
|
|
74
|
-
exports.processForLoop = processForLoop;
|
|
75
76
|
//# sourceMappingURL=built-in-for-loop.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processFunctionDefinition =
|
|
3
|
+
exports.processFunctionDefinition = processFunctionDefinition;
|
|
4
4
|
const processor_1 = require("../../../../../processor");
|
|
5
5
|
const linker_1 = require("../../../../linker");
|
|
6
6
|
const known_call_handling_1 = require("../known-call-handling");
|
|
@@ -10,9 +10,11 @@ const logger_1 = require("../../../../../logger");
|
|
|
10
10
|
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
11
11
|
const graph_1 = require("../../../../../graph/graph");
|
|
12
12
|
const overwrite_1 = require("../../../../../environments/overwrite");
|
|
13
|
+
const vertex_1 = require("../../../../../graph/vertex");
|
|
13
14
|
const scoping_1 = require("../../../../../environments/scoping");
|
|
14
15
|
const environment_1 = require("../../../../../environments/environment");
|
|
15
16
|
const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
|
|
17
|
+
const edge_1 = require("../../../../../graph/edge");
|
|
16
18
|
const log_1 = require("../../../../../../util/log");
|
|
17
19
|
function processFunctionDefinition(name, args, rootId, data) {
|
|
18
20
|
if (args.length < 1) {
|
|
@@ -60,7 +62,7 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
60
62
|
for (const read of remainingRead) {
|
|
61
63
|
if (read.name) {
|
|
62
64
|
subgraph.addVertex({
|
|
63
|
-
tag:
|
|
65
|
+
tag: vertex_1.VertexType.Use,
|
|
64
66
|
id: read.nodeId,
|
|
65
67
|
environment: undefined,
|
|
66
68
|
controlDependencies: undefined
|
|
@@ -79,7 +81,7 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
79
81
|
const exitPoints = body.exitPoints;
|
|
80
82
|
const graph = new graph_1.DataflowGraph(data.completeAst.idMap).mergeWith(subgraph, false);
|
|
81
83
|
graph.addVertex({
|
|
82
|
-
tag:
|
|
84
|
+
tag: vertex_1.VertexType.FunctionDefinition,
|
|
83
85
|
id: name.info.id,
|
|
84
86
|
environment: (0, scoping_1.popLocalEnvironment)(outEnvironment),
|
|
85
87
|
controlDependencies: data.controlDependencies,
|
|
@@ -97,25 +99,24 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
97
99
|
environment: originalEnvironment
|
|
98
100
|
};
|
|
99
101
|
}
|
|
100
|
-
exports.processFunctionDefinition = processFunctionDefinition;
|
|
101
102
|
function updateNestedFunctionClosures(subgraph, outEnvironment, name) {
|
|
102
103
|
// track *all* function definitions - including those nested within the current graph,
|
|
103
104
|
// try to resolve their 'in' by only using the lowest scope which will be popped after this definition
|
|
104
105
|
for (const [id, { subflow, tag }] of subgraph.vertices(true)) {
|
|
105
|
-
if (tag !==
|
|
106
|
+
if (tag !== vertex_1.VertexType.FunctionDefinition) {
|
|
106
107
|
continue;
|
|
107
108
|
}
|
|
108
109
|
const ingoingRefs = subflow.in;
|
|
109
110
|
const remainingIn = [];
|
|
110
111
|
for (const ingoing of ingoingRefs) {
|
|
111
|
-
const resolved = ingoing.name ? (0, resolve_by_name_1.resolveByName)(ingoing.name, outEnvironment) : undefined;
|
|
112
|
+
const resolved = ingoing.name ? (0, resolve_by_name_1.resolveByName)(ingoing.name, outEnvironment, ingoing.type) : undefined;
|
|
112
113
|
if (resolved === undefined) {
|
|
113
114
|
remainingIn.push(ingoing);
|
|
114
115
|
continue;
|
|
115
116
|
}
|
|
116
117
|
(0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Found ${resolved.length} references to open ref ${id} in closure of function definition ${name.info.id}`);
|
|
117
118
|
for (const ref of resolved) {
|
|
118
|
-
subgraph.addEdge(ingoing, ref,
|
|
119
|
+
subgraph.addEdge(ingoing, ref, edge_1.EdgeType.Reads);
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
(0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Keeping ${remainingIn.length} references to open ref ${id} in closure of function definition ${name.info.id}`);
|
|
@@ -142,10 +143,10 @@ function findPromiseLinkagesForParameters(parameters, readInParameters, paramete
|
|
|
142
143
|
// first, we try to bind again within parameters - if we have it, fine
|
|
143
144
|
const remainingRead = [];
|
|
144
145
|
for (const read of readInParameters) {
|
|
145
|
-
const resolved = read.name ? (0, resolve_by_name_1.resolveByName)(read.name, parameterEnvs) : undefined;
|
|
146
|
+
const resolved = read.name ? (0, resolve_by_name_1.resolveByName)(read.name, parameterEnvs, read.type) : undefined;
|
|
146
147
|
if (resolved !== undefined) {
|
|
147
148
|
for (const ref of resolved) {
|
|
148
|
-
parameters.addEdge(read, ref,
|
|
149
|
+
parameters.addEdge(read, ref, edge_1.EdgeType.Reads);
|
|
149
150
|
}
|
|
150
151
|
continue;
|
|
151
152
|
}
|
|
@@ -158,11 +159,11 @@ function findPromiseLinkagesForParameters(parameters, readInParameters, paramete
|
|
|
158
159
|
continue;
|
|
159
160
|
}
|
|
160
161
|
if (writingOuts[0].controlDependencies === undefined) {
|
|
161
|
-
parameters.addEdge(read, writingOuts[0],
|
|
162
|
+
parameters.addEdge(read, writingOuts[0], edge_1.EdgeType.Reads);
|
|
162
163
|
continue;
|
|
163
164
|
}
|
|
164
165
|
for (const out of writingOuts) {
|
|
165
|
-
parameters.addEdge(read, out,
|
|
166
|
+
parameters.addEdge(read, out, edge_1.EdgeType.Reads);
|
|
166
167
|
}
|
|
167
168
|
}
|
|
168
169
|
return remainingRead;
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processGet =
|
|
3
|
+
exports.processGet = processGet;
|
|
4
4
|
const known_call_handling_1 = require("../known-call-handling");
|
|
5
5
|
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
6
6
|
const make_argument_1 = require("../argument/make-argument");
|
|
7
7
|
const logger_1 = require("../../../../../logger");
|
|
8
8
|
const retriever_1 = require("../../../../../../r-bridge/retriever");
|
|
9
|
+
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
10
|
+
const edge_1 = require("../../../../../graph/edge");
|
|
9
11
|
function processGet(name, args, rootId, data) {
|
|
10
12
|
if (args.length !== 1) {
|
|
11
13
|
logger_1.dataflowLogger.warn(`symbol access with ${name.content} has not 1 argument, skipping`);
|
|
12
14
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data }).information;
|
|
13
15
|
}
|
|
14
16
|
const retrieve = (0, unpack_argument_1.unpackArgument)(args[0]);
|
|
15
|
-
if (retrieve === undefined || retrieve.type !==
|
|
17
|
+
if (retrieve === undefined || retrieve.type !== type_1.RType.String) {
|
|
16
18
|
logger_1.dataflowLogger.warn(`symbol access with ${name.content} has not 1 argument, skipping`);
|
|
17
19
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data }).information;
|
|
18
20
|
}
|
|
19
21
|
const treatTargetAsSymbol = {
|
|
20
|
-
type:
|
|
22
|
+
type: type_1.RType.Symbol,
|
|
21
23
|
info: retrieve.info,
|
|
22
24
|
content: (0, retriever_1.removeRQuotes)(retrieve.lexeme),
|
|
23
25
|
lexeme: retrieve.lexeme,
|
|
@@ -33,9 +35,8 @@ function processGet(name, args, rootId, data) {
|
|
|
33
35
|
const firstArg = processedArguments[0];
|
|
34
36
|
if (firstArg) {
|
|
35
37
|
// get 'reads' its first argument
|
|
36
|
-
information.graph.addEdge(rootId, firstArg.entryPoint,
|
|
38
|
+
information.graph.addEdge(rootId, firstArg.entryPoint, edge_1.EdgeType.Reads);
|
|
37
39
|
}
|
|
38
40
|
return information;
|
|
39
41
|
}
|
|
40
|
-
exports.processGet = processGet;
|
|
41
42
|
//# sourceMappingURL=built-in-get.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processIfThenElse =
|
|
3
|
+
exports.processIfThenElse = processIfThenElse;
|
|
4
4
|
const processor_1 = require("../../../../../processor");
|
|
5
5
|
const info_1 = require("../../../../../info");
|
|
6
6
|
const known_call_handling_1 = require("../known-call-handling");
|
|
@@ -8,7 +8,9 @@ const common_1 = require("../common");
|
|
|
8
8
|
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
9
9
|
const logger_1 = require("../../../../../logger");
|
|
10
10
|
const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
|
|
11
|
+
const edge_1 = require("../../../../../graph/edge");
|
|
11
12
|
const append_1 = require("../../../../../environments/append");
|
|
13
|
+
const identifier_1 = require("../../../../../environments/identifier");
|
|
12
14
|
const environment_1 = require("../../../../../environments/environment");
|
|
13
15
|
function processIfThenElse(name, args, rootId, data) {
|
|
14
16
|
if (args.length !== 2 && args.length !== 3) {
|
|
@@ -36,7 +38,7 @@ function processIfThenElse(name, args, rootId, data) {
|
|
|
36
38
|
if (conditionIsFalse !== 0 /* Ternary.Always */) {
|
|
37
39
|
then = (0, processor_1.processDataflowFor)(thenArg, data);
|
|
38
40
|
if (then.entryPoint) {
|
|
39
|
-
then.graph.addEdge(name.info.id, then.entryPoint,
|
|
41
|
+
then.graph.addEdge(name.info.id, then.entryPoint, edge_1.EdgeType.Returns);
|
|
40
42
|
}
|
|
41
43
|
if (conditionIsTrue !== 0 /* Ternary.Always */) {
|
|
42
44
|
makeThenMaybe = true;
|
|
@@ -47,7 +49,7 @@ function processIfThenElse(name, args, rootId, data) {
|
|
|
47
49
|
if (otherwiseArg !== undefined && conditionIsTrue !== 0 /* Ternary.Always */) {
|
|
48
50
|
otherwise = (0, processor_1.processDataflowFor)(otherwiseArg, data);
|
|
49
51
|
if (otherwise.entryPoint) {
|
|
50
|
-
otherwise.graph.addEdge(name.info.id, otherwise.entryPoint,
|
|
52
|
+
otherwise.graph.addEdge(name.info.id, otherwise.entryPoint, edge_1.EdgeType.Returns);
|
|
51
53
|
}
|
|
52
54
|
if (conditionIsFalse !== 0 /* Ternary.Always */) {
|
|
53
55
|
makeOtherwiseMaybe = true;
|
|
@@ -83,14 +85,14 @@ function processIfThenElse(name, args, rootId, data) {
|
|
|
83
85
|
argumentProcessResult: [cond, then, otherwise]
|
|
84
86
|
});
|
|
85
87
|
// as an if always evaluates its condition, we add a 'reads'-edge
|
|
86
|
-
nextGraph.addEdge(name.info.id, cond.entryPoint,
|
|
88
|
+
nextGraph.addEdge(name.info.id, cond.entryPoint, edge_1.EdgeType.Reads);
|
|
87
89
|
const exitPoints = [
|
|
88
90
|
...(then?.exitPoints ?? []).map(e => ({ ...e, controlDependencies: makeThenMaybe ? [...data.controlDependencies ?? [], { id: rootId, when: true }] : e.controlDependencies })),
|
|
89
91
|
...(otherwise?.exitPoints ?? []).map(e => ({ ...e, controlDependencies: makeOtherwiseMaybe ? [...data.controlDependencies ?? [], { id: rootId, when: false }] : e.controlDependencies }))
|
|
90
92
|
];
|
|
91
93
|
return {
|
|
92
94
|
unknownReferences: [],
|
|
93
|
-
in: [{ nodeId: rootId, name: name.content, controlDependencies: originalDependency }, ...ingoing],
|
|
95
|
+
in: [{ nodeId: rootId, name: name.content, controlDependencies: originalDependency, type: identifier_1.ReferenceType.Function }, ...ingoing],
|
|
94
96
|
out: outgoing,
|
|
95
97
|
exitPoints,
|
|
96
98
|
entryPoint: rootId,
|
|
@@ -98,5 +100,4 @@ function processIfThenElse(name, args, rootId, data) {
|
|
|
98
100
|
graph: nextGraph
|
|
99
101
|
};
|
|
100
102
|
}
|
|
101
|
-
exports.processIfThenElse = processIfThenElse;
|
|
102
103
|
//# sourceMappingURL=built-in-if-then-else.js.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processLibrary =
|
|
3
|
+
exports.processLibrary = processLibrary;
|
|
4
4
|
const known_call_handling_1 = require("../known-call-handling");
|
|
5
5
|
const logger_1 = require("../../../../../logger");
|
|
6
6
|
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
7
|
+
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
7
8
|
const make_argument_1 = require("../argument/make-argument");
|
|
8
9
|
function processLibrary(name, args, rootId, data) {
|
|
9
10
|
/* we do not really know what loading the library does and what side effects it causes, hence we mark it as an unknown side effect */
|
|
@@ -12,13 +13,13 @@ function processLibrary(name, args, rootId, data) {
|
|
|
12
13
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, hasUnknownSideEffect: true }).information;
|
|
13
14
|
}
|
|
14
15
|
const nameToLoad = (0, unpack_argument_1.unpackArgument)(args[0]);
|
|
15
|
-
if (nameToLoad === undefined || nameToLoad.type !==
|
|
16
|
+
if (nameToLoad === undefined || nameToLoad.type !== type_1.RType.Symbol) {
|
|
16
17
|
logger_1.dataflowLogger.warn('No library name provided, skipping');
|
|
17
18
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, hasUnknownSideEffect: true }).information;
|
|
18
19
|
}
|
|
19
20
|
// treat as a function call but convert the first argument to a string
|
|
20
21
|
const newArg = {
|
|
21
|
-
type:
|
|
22
|
+
type: type_1.RType.String,
|
|
22
23
|
info: nameToLoad.info,
|
|
23
24
|
lexeme: nameToLoad.lexeme,
|
|
24
25
|
location: nameToLoad.location,
|
|
@@ -32,5 +33,4 @@ function processLibrary(name, args, rootId, data) {
|
|
|
32
33
|
hasUnknownSideEffect: true
|
|
33
34
|
}).information;
|
|
34
35
|
}
|
|
35
|
-
exports.processLibrary = processLibrary;
|
|
36
36
|
//# sourceMappingURL=built-in-library.js.map
|