@eagleoutice/flowr 2.14.4 → 2.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -64
- package/abstract-interpretation/absint-inference.d.ts +347 -0
- package/abstract-interpretation/{absint-visitor.js → absint-inference.js} +327 -97
- package/abstract-interpretation/abstract-semantics.d.ts +246 -0
- package/abstract-interpretation/abstract-semantics.js +3 -0
- package/abstract-interpretation/data-frame/{mappers/arguments.d.ts → arguments.d.ts} +18 -16
- package/abstract-interpretation/data-frame/{mappers/arguments.js → arguments.js} +20 -21
- package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +52 -0
- package/abstract-interpretation/data-frame/dataframe-semantics.js +1665 -0
- package/abstract-interpretation/data-frame/resolve-args.js +4 -4
- package/abstract-interpretation/data-frame/semantics.d.ts +15 -21
- package/abstract-interpretation/data-frame/semantics.js +27 -29
- package/abstract-interpretation/data-frame/shape-inference.d.ts +28 -24
- package/abstract-interpretation/data-frame/shape-inference.js +14 -79
- package/abstract-interpretation/domains/interval-domain.d.ts +5 -1
- package/abstract-interpretation/domains/interval-domain.js +25 -33
- package/abstract-interpretation/domains/multi-value-state-domain.d.ts +6 -3
- package/abstract-interpretation/domains/multi-value-state-domain.js +24 -4
- package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -6
- package/abstract-interpretation/domains/partial-product-domain.js +26 -43
- package/abstract-interpretation/domains/positive-interval-domain.d.ts +1 -6
- package/abstract-interpretation/domains/positive-interval-domain.js +3 -29
- package/abstract-interpretation/domains/product-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-range-domain.d.ts +6 -0
- package/abstract-interpretation/domains/set-range-domain.js +29 -62
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +9 -2
- package/abstract-interpretation/domains/state-abstract-domain.js +26 -37
- package/abstract-interpretation/domains/{state-domain-like.d.ts → state-domain.d.ts} +10 -6
- package/abstract-interpretation/domains/{state-domain-like.js → state-domain.js} +1 -1
- package/abstract-interpretation/value-semantics.d.ts +113 -0
- package/abstract-interpretation/value-semantics.js +115 -0
- package/benchmark/slicer.js +12 -6
- package/benchmark/stats/feature-counts.d.ts +2 -1
- package/benchmark/stats/feature-counts.js +25 -1
- package/benchmark/stats/stats.d.ts +4 -0
- package/benchmark/summarizer/second-phase/graph.js +7 -0
- package/cli/repl/commands/repl-parse.js +11 -22
- package/cli/repl/parser/slice-query-parser.d.ts +2 -0
- package/cli/repl/parser/slice-query-parser.js +1 -0
- package/config.d.ts +30 -205
- package/config.js +37 -3
- package/control-flow/cfg-properties.d.ts +5 -0
- package/control-flow/cfg-properties.js +25 -7
- package/control-flow/control-flow-graph.d.ts +11 -37
- package/control-flow/control-flow-graph.js +33 -77
- package/control-flow/semantic-cfg-guided-visitor.d.ts +63 -320
- package/control-flow/semantic-cfg-guided-visitor.js +65 -320
- package/dataflow/environments/built-in-config.d.ts +2 -0
- package/dataflow/environments/built-in-proc-name.d.ts +4 -0
- package/dataflow/environments/built-in-proc-name.js +4 -0
- package/dataflow/environments/built-in-props.d.ts +192 -82
- package/dataflow/environments/built-in-props.js +336 -106
- package/dataflow/environments/built-in.d.ts +21 -9
- package/dataflow/environments/built-in.js +43 -12
- package/dataflow/environments/default-builtin-config.d.ts +3219 -313
- package/dataflow/environments/default-builtin-config.js +803 -1012
- package/dataflow/environments/environment.d.ts +26 -49
- package/dataflow/environments/environment.js +34 -47
- package/dataflow/environments/group-generics.d.ts +11 -2
- package/dataflow/environments/group-generics.js +22 -3
- package/dataflow/environments/identifier.d.ts +106 -6
- package/dataflow/environments/identifier.js +19 -1
- package/dataflow/environments/query-fn-props.d.ts +16 -8
- package/dataflow/environments/query-fn-props.js +45 -21
- package/dataflow/environments/resolve-by-name.js +9 -2
- package/dataflow/environments/scoping.d.ts +5 -0
- package/dataflow/environments/scoping.js +11 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
- package/dataflow/eval/resolve/alias-tracking.js +24 -6
- package/dataflow/eval/resolve/resolve-numbers.d.ts +182 -7
- package/dataflow/eval/resolve/resolve-numbers.js +44 -9
- package/dataflow/eval/resolve/resolve-strings.d.ts +79 -2
- package/dataflow/eval/resolve/resolve-strings.js +16 -7
- package/dataflow/eval/resolve/resolve.d.ts +5 -22
- package/dataflow/eval/resolve/resolve.js +34 -34
- package/dataflow/eval/values/general.d.ts +9 -1
- package/dataflow/eval/values/general.js +22 -3
- package/dataflow/eval/values/sets/set-constants.d.ts +5 -0
- package/dataflow/eval/values/sets/set-constants.js +9 -1
- package/dataflow/eval/values/string/string-constants.d.ts +16 -15
- package/dataflow/eval/values/string/string-constants.js +59 -27
- package/dataflow/extractor.d.ts +2 -1
- package/dataflow/extractor.js +16 -4
- package/dataflow/fn/argument-roles.d.ts +35 -0
- package/dataflow/fn/argument-roles.js +252 -0
- package/dataflow/fn/class-declaration.d.ts +148 -0
- package/dataflow/fn/class-declaration.js +317 -0
- package/dataflow/fn/condition-handlers.d.ts +5 -0
- package/dataflow/fn/condition-handlers.js +13 -0
- package/dataflow/fn/exceptions-of-function.d.ts +21 -7
- package/dataflow/fn/exceptions-of-function.js +74 -43
- package/dataflow/fn/frame-reflection.d.ts +46 -0
- package/dataflow/fn/frame-reflection.js +169 -0
- package/dataflow/fn/function-props.d.ts +32 -0
- package/dataflow/fn/function-props.js +160 -0
- package/dataflow/fn/higher-order-function.d.ts +23 -5
- package/dataflow/fn/higher-order-function.js +64 -18
- package/dataflow/fn/strict-function.d.ts +24 -2
- package/dataflow/fn/strict-function.js +49 -19
- package/dataflow/graph/call-graph.js +10 -2
- package/dataflow/graph/df-helper.d.ts +1 -12
- package/dataflow/graph/df-helper.js +2 -19
- package/dataflow/graph/diff-dataflow-graph.d.ts +1 -1
- package/dataflow/graph/diff-dataflow-graph.js +2 -2
- package/dataflow/graph/graph.d.ts +39 -188
- package/dataflow/graph/graph.js +46 -163
- package/dataflow/graph/match-args.d.ts +34 -2
- package/dataflow/graph/match-args.js +45 -12
- package/dataflow/graph/vertex.d.ts +8 -0
- package/dataflow/info.d.ts +7 -5
- package/dataflow/info.js +1 -5
- package/dataflow/internal/control-flow.js +20 -17
- package/dataflow/internal/linker.d.ts +8 -37
- package/dataflow/internal/linker.js +22 -55
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +3 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +8 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +43 -50
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +4 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +5 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.d.ts +23 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.js +24 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +0 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +73 -27
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +131 -92
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +17 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +187 -99
- package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +0 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +31 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +101 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +23 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +22 -1
- package/dataflow/internal/process/functions/call/common.d.ts +4 -6
- package/dataflow/internal/process/functions/call/common.js +2 -2
- package/dataflow/internal/process/functions/call/deferred.d.ts +1 -1
- package/dataflow/internal/process/functions/call/deferred.js +2 -2
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +5 -3
- package/dataflow/internal/process/functions/call/known-call-handling.js +6 -4
- package/dataflow/internal/process/functions/call/named-call-handling.js +19 -13
- package/dataflow/internal/process/functions/call/quoted.d.ts +2 -2
- package/dataflow/internal/process/functions/call/quoted.js +144 -28
- package/dataflow/origin/dfg-get-origin.js +23 -10
- package/dataflow/processor.d.ts +2 -1
- package/dataflow/processor.js +6 -0
- package/documentation/data/interface/doc-writing-code.js +2 -0
- package/documentation/doc-util/doc-search.js +1 -1
- package/documentation/wiki-absint.d.ts +11 -14
- package/documentation/wiki-absint.js +73 -59
- package/documentation/wiki-core.js +64 -24
- package/documentation/wiki-linter.js +1 -0
- package/documentation/wiki-query.js +82 -264
- package/documentation/wiki-signature-database.js +17 -5
- package/gas.d.ts +91 -47
- package/gas.js +97 -13
- package/index.d.ts +31 -0
- package/index.js +52 -0
- package/linter/linter-rules.d.ts +87 -23
- package/linter/linter-rules.js +3 -1
- package/linter/rules/absolute-path.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +10 -8
- package/linter/rules/dead-code.d.ts +1 -1
- package/linter/rules/deprecated-functions.js +14 -5
- package/linter/rules/file-path-validity.d.ts +1 -1
- package/linter/rules/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +13 -2
- package/linter/rules/network-functions.d.ts +10 -5
- package/linter/rules/network-functions.js +48 -36
- package/linter/rules/no-leaked-credentials.d.ts +1 -1
- package/linter/rules/problematic-inputs.d.ts +1 -1
- package/linter/rules/problematic-inputs.js +1 -1
- package/linter/rules/seeded-randomness.d.ts +3 -2
- package/linter/rules/seeded-randomness.js +7 -3
- package/linter/rules/software-has-license.d.ts +1 -1
- package/linter/rules/software-has-tests.d.ts +1 -1
- package/linter/rules/stop-with-call-arg.d.ts +1 -1
- package/linter/rules/syntactically-valid.d.ts +1 -1
- package/linter/rules/unclosed-connection.d.ts +3 -3
- package/linter/rules/unclosed-connection.js +3 -4
- package/linter/rules/undefined-symbol.d.ts +1 -1
- package/linter/rules/unescaped-arguments.d.ts +161 -0
- package/linter/rules/unescaped-arguments.js +293 -0
- package/linter/rules/unused-definition.d.ts +1 -1
- package/linter/rules/unused-definition.js +49 -4
- package/linter/rules/unused-import.d.ts +1 -1
- package/linter/rules/useless-loop.d.ts +1 -1
- package/package.json +3 -198
- package/project/context/flowr-analyzer-environment-context.d.ts +12 -1
- package/project/context/flowr-analyzer-environment-context.js +33 -1
- package/project/context/flowr-analyzer-files-context.d.ts +24 -1
- package/project/context/flowr-analyzer-files-context.js +42 -21
- package/project/context/flowr-analyzer-functions-context.d.ts +8 -0
- package/project/context/flowr-analyzer-functions-context.js +2 -0
- package/project/context/flowr-analyzer-gas-context.d.ts +9 -1
- package/project/context/flowr-analyzer-gas-context.js +21 -0
- package/project/context/flowr-file.d.ts +16 -1
- package/project/context/flowr-file.js +26 -2
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +19 -20
- package/project/plugins/file-plugins/files/flowr-description-file.js +55 -41
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +9 -4
- package/project/plugins/file-plugins/files/flowr-jupyter-file.js +11 -3
- package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +6 -9
- package/project/plugins/file-plugins/files/flowr-manifest-files.js +5 -21
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +11 -12
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +48 -61
- package/project/plugins/file-plugins/files/flowr-news-file.d.ts +3 -12
- package/project/plugins/file-plugins/files/flowr-news-file.js +2 -19
- package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +145 -0
- package/project/plugins/file-plugins/files/flowr-rd-file.js +676 -0
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +122 -422
- package/project/plugins/file-plugins/files/flowr-rda-file.js +517 -1005
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +8 -2
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +10 -1
- package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +7 -2
- package/project/plugins/file-plugins/files/flowr-sweave-file.js +9 -1
- package/project/plugins/file-plugins/files/flowr-sysdata-file.d.ts +17 -0
- package/project/plugins/file-plugins/files/flowr-sysdata-file.js +40 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +2 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +3 -1
- package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.d.ts +58 -0
- package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.js +95 -0
- package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.d.ts +23 -0
- package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.js +33 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +33 -72
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +17 -15
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +20 -37
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +29 -53
- package/project/plugins/package-version-plugins/package.js +2 -1
- package/project/plugins/plugin-registry.d.ts +3 -1
- package/project/plugins/plugin-registry.js +11 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +20 -4
- package/project/sigdb/build.d.ts +9 -15
- package/project/sigdb/build.js +101 -42
- package/project/sigdb/decode.d.ts +10 -4
- package/project/sigdb/decode.js +60 -21
- package/project/sigdb/memory-source.d.ts +4 -0
- package/project/sigdb/memory-source.js +8 -0
- package/project/sigdb/reader.d.ts +57 -100
- package/project/sigdb/reader.js +157 -108
- package/project/sigdb/schema.d.ts +90 -26
- package/project/sigdb/schema.js +12 -6
- package/queries/base-query-format.d.ts +7 -0
- package/queries/base-query-format.js +29 -0
- package/queries/catalog/absint-query/absint-query-executor.js +8 -6
- package/queries/catalog/absint-query/absint-query-format.d.ts +20 -9
- package/queries/catalog/absint-query/absint-query-format.js +32 -19
- package/queries/catalog/call-context-query/call-context-query-executor.js +3 -3
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +33 -7
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +2 -2
- package/queries/catalog/dependencies-query/function-info/derived-functions.js +14 -4
- package/queries/catalog/dependencies-query/function-info/read-functions.js +7 -121
- package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/statistics-functions.js +2 -2
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +4 -46
- package/queries/catalog/dependencies-query/function-info/write-functions.js +3 -76
- package/queries/catalog/dependencies-query/implicit-echo.js +2 -2
- package/queries/catalog/dependencies-query/link-devices.d.ts +2 -2
- package/queries/catalog/dependencies-query/link-devices.js +6 -7
- package/queries/catalog/dice-query/dice-query-executor.js +1 -1
- package/queries/catalog/dice-query/dice-query-format.d.ts +1 -1
- package/queries/catalog/does-call-query/does-call-query-executor.js +4 -0
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +7 -1
- package/queries/catalog/files-query/files-query-format.d.ts +1 -1
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
- package/queries/catalog/input-sources-query/input-source-functions.d.ts +1 -1
- package/queries/catalog/input-sources-query/input-source-functions.js +2 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +7 -17
- package/queries/catalog/input-sources-query/input-sources-query-format.js +11 -27
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +3 -8
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -11
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.d.ts +4 -0
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +60 -0
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.d.ts +35 -0
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +63 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -6
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +3 -8
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -11
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +3 -8
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -12
- package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
- package/queries/catalog/project-query/project-query-format.d.ts +1 -1
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +3 -8
- package/queries/catalog/provenance-query/provenance-query-format.js +2 -14
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
- package/queries/catalog/search-query/search-query-format.d.ts +1 -1
- package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -10
- package/queries/catalog/signature-query/signature-query-executor.js +87 -93
- package/queries/catalog/signature-query/signature-query-format.d.ts +20 -5
- package/queries/catalog/signature-query/signature-query-format.js +16 -4
- package/queries/catalog/signature-query/signature-query-render.js +18 -4
- package/queries/catalog/slice-query-options.d.ts +14 -0
- package/queries/catalog/slice-query-options.js +15 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +2 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.js +7 -5
- package/queries/query-function-filter.d.ts +8 -3
- package/queries/query-function-filter.js +16 -6
- package/queries/query.d.ts +38 -38
- package/queries/query.js +30 -4
- package/r-bridge/lang-4.x/ast/model/model.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/model.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +17 -9
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +35 -27
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +33 -22
- package/reconstruct/reconstruct.d.ts +9 -20
- package/reconstruct/reconstruct.js +66 -28
- package/search/flowr-search-filters.d.ts +7 -6
- package/search/flowr-search-filters.js +6 -4
- package/search/search-executor/search-enrichers.d.ts +10 -10
- package/search/search-executor/search-enrichers.js +32 -3
- package/search/search-executor/search-transformer.js +15 -23
- package/slicing/criterion/parse.js +2 -12
- package/slicing/static/slice-call.js +1 -8
- package/slicing/static/static-slicer.js +1 -1
- package/util/collections/bimap.js +14 -6
- package/util/objects.js +16 -17
- package/util/r-value.d.ts +5 -4
- package/util/record.d.ts +38 -3
- package/util/record.js +48 -1
- package/util/simple-df/dfg-ascii.js +1 -1
- package/util/text/strings.d.ts +5 -0
- package/util/text/strings.js +10 -0
- package/util/version.js +2 -2
- package/abstract-interpretation/absint-visitor.d.ts +0 -223
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +0 -19
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +0 -151
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +0 -287
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +0 -1096
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +0 -15
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +0 -207
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +0 -6
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +0 -25
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +0 -31
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +0 -56
|
@@ -34,11 +34,8 @@ export declare function pMatch<Targets extends NodeId>(args: readonly FunctionAr
|
|
|
34
34
|
*/
|
|
35
35
|
export declare function linkFunctionCallWithSingleTarget(graph: DataflowGraph, { subflow: fnSubflow, exitPoints, id: fnId, params }: DataflowGraphVertexFunctionDefinition, info: DataflowGraphVertexFunctionCall, idMap: AstIdMap): ExitPoint[];
|
|
36
36
|
/**
|
|
37
|
-
* Returns the called functions within
|
|
38
|
-
*
|
|
39
|
-
* @param graph - The graph to use for search and resolution traversals (ideally a superset of the `thisGraph`)
|
|
40
|
-
* @param idMap - The map to resolve ids to names
|
|
41
|
-
* @param thisGraph - The graph to search for function calls in
|
|
37
|
+
* Returns the called functions within `graph` (ideally a superset of `thisGraph`, the graph searched for calls), which
|
|
38
|
+
* can be used to merge the environments with the call; also links the corresponding arguments.
|
|
42
39
|
*/
|
|
43
40
|
export declare function linkFunctionCalls(graph: DataflowGraph, idMap: AstIdMap, thisGraph: DataflowGraph): {
|
|
44
41
|
functionCall: NodeId;
|
|
@@ -50,19 +47,8 @@ export declare function linkFunctionCalls(graph: DataflowGraph, idMap: AstIdMap,
|
|
|
50
47
|
*/
|
|
51
48
|
export declare function getAllFunctionCallTargets(call: NodeId, graph: DataflowGraph, environment?: REnvironmentInformation): NodeId[];
|
|
52
49
|
/**
|
|
53
|
-
* Finds all linked function definitions starting from the given
|
|
54
|
-
*
|
|
55
|
-
* For example, if you are interested in the called functions of a function call, use {@link getAllFunctionCallTargets} instead.
|
|
56
|
-
* This function here expects you to handle the accessed objects yourself (e.g,. already resolve the first layer of reads/returns/calls/... or resolve the identifier by name)
|
|
57
|
-
* and then pass in the relevant read ids.
|
|
58
|
-
* @example
|
|
59
|
-
* Consider a scenario like this:
|
|
60
|
-
* ```R
|
|
61
|
-
* x <- function() 3
|
|
62
|
-
* x()
|
|
63
|
-
* ```
|
|
64
|
-
* To resolve the call `x` in the second line, use {@link getAllFunctionCallTargets}!
|
|
65
|
-
* To know what fdefs the definition of `x` in the first line links to, you can use {@link getAllLinkedFunctionDefinitions|this function}.
|
|
50
|
+
* Finds all linked function definitions starting from the given read ids; expects the caller to already have resolved
|
|
51
|
+
* the accessed objects (first layer of reads/returns/calls/...). For call targets, use {@link getAllFunctionCallTargets} instead.
|
|
66
52
|
*/
|
|
67
53
|
export declare function getAllLinkedFunctionDefinitions(functionDefinitionReadIds: ReadonlySet<NodeId>, dataflowGraph: DataflowGraph): [Set<Required<DataflowGraphVertexFunctionDefinition>>, Set<BuiltIn>];
|
|
68
54
|
/**
|
|
@@ -72,28 +58,13 @@ export declare function getAllLinkedFunctionDefinitions(functionDefinitionReadId
|
|
|
72
58
|
*/
|
|
73
59
|
export declare function linkExpressionIn<Info>(this: void, graph: DataflowGraph, expr: NodeId, environment: REnvironmentInformation, idMap: AstIdMap<Info & ParentInformation>): readonly IdentifierReference[];
|
|
74
60
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* @param environmentInformation - The environment information to link against
|
|
78
|
-
* @param givenInputs - The existing list of inputs that might be extended
|
|
79
|
-
* @param graph - The graph to enter the found links
|
|
80
|
-
* @param maybeForRemaining - Each input that can not be linked, will be added to `givenInputs`. If this flag is `true`, it will be marked as `maybe`.
|
|
81
|
-
* @returns the given inputs, possibly extended with the remaining inputs (those of `referencesToLinkAgainstEnvironment` that could not be linked against the environment)
|
|
61
|
+
* Links a set of read variables to definitions in `environmentInformation`; each reference that cannot be linked is
|
|
62
|
+
* added to `givenInputs` (marked maybe if `maybeForRemaining`), and the extended list is returned.
|
|
82
63
|
*/
|
|
83
64
|
export declare function linkInputs(referencesToLinkAgainstEnvironment: readonly IdentifierReference[], environmentInformation: REnvironmentInformation, givenInputs: IdentifierReference[], graph: DataflowGraph, maybeForRemaining: boolean): IdentifierReference[];
|
|
84
65
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* ```R
|
|
88
|
-
* for(i in 1:10) {
|
|
89
|
-
* x_1 <- x_2 + 1
|
|
90
|
-
* }
|
|
91
|
-
* ```
|
|
92
|
-
* `x_2` must get a read marker to `x_1` as `x_1` is the active redefinition in the second loop iteration.
|
|
93
|
-
*
|
|
94
|
-
* When `environment` is supplied the function uses it to discover ALL definitions that are still live at the
|
|
95
|
-
* loop exit, so sequential overwrites contribute a single candidate while if-else branches contribute one
|
|
96
|
-
* candidate per branch.
|
|
66
|
+
* A loop variable read before its within-loop redefinition gets a maybe marker to that def (e.g. `x_2` may read the
|
|
67
|
+
* prior iteration's `x_1` in `for(...) { x_1 <- x_2 + 1 }`); with `environment`, this uses all defs live at loop exit.
|
|
97
68
|
*/
|
|
98
69
|
export declare function linkCircularRedefinitionsWithinALoop(graph: DataflowGraph, openIns: NameIdMap, outgoing: readonly IdentifierReference[], environment?: REnvironmentInformation): void;
|
|
99
70
|
/**
|
|
@@ -46,7 +46,7 @@ function findNonLocalReads(graph, ignores = new Set()) {
|
|
|
46
46
|
}
|
|
47
47
|
const outgoing = graph.outgoingEdges(nodeId);
|
|
48
48
|
const origin = graph.getVertex(nodeId);
|
|
49
|
-
const name =
|
|
49
|
+
const name = node_id_1.NodeId.recoverName(nodeId, graph.idMap);
|
|
50
50
|
const type = vertex_2.FunctionCallVertex.is(origin) ? identifier_1.ReferenceType.Function : identifier_1.ReferenceType.Variable;
|
|
51
51
|
const identifierRef = { nodeId, name, type };
|
|
52
52
|
/* control flow edges say nothing about what a name resolves to, so they do not count as a link */
|
|
@@ -102,7 +102,6 @@ function pMatch(args, params) {
|
|
|
102
102
|
* Links the function call arguments to the target function definition and returns a map from argument ids to parameter ids.
|
|
103
103
|
*/
|
|
104
104
|
function linkFunctionCallArguments(targetId, idMap, functionCallName, functionRootId, callArgs, finalGraph) {
|
|
105
|
-
// we get them by just choosing the rhs of the definition
|
|
106
105
|
const linkedFunction = idMap.get(targetId);
|
|
107
106
|
if (linkedFunction === undefined) {
|
|
108
107
|
logger_1.dataflowLogger.trace(`no fdef found for ${functionCallName} (${functionRootId})`);
|
|
@@ -134,7 +133,6 @@ function linkFunctionCallWithSingleTarget(graph, { subflow: fnSubflow, exitPoint
|
|
|
134
133
|
for (const v of value) {
|
|
135
134
|
graph.addEdge(id, v, edge_1.EdgeType.Calls);
|
|
136
135
|
graph.addEdge(ingoing.nodeId, v, edge_1.EdgeType.Calls);
|
|
137
|
-
// add s7 to vertex
|
|
138
136
|
const vInfo = graph.getVertex(v);
|
|
139
137
|
if (vInfo && vertex_2.FunctionDefinitionVertex.is(vInfo)) {
|
|
140
138
|
vInfo.mode ??= [];
|
|
@@ -152,12 +150,11 @@ function linkFunctionCallWithSingleTarget(graph, { subflow: fnSubflow, exitPoint
|
|
|
152
150
|
for (const exitPoint of exitPoints) {
|
|
153
151
|
graph.addEdge(id, exitPoint.nodeId, edge_1.EdgeType.Returns);
|
|
154
152
|
if ((0, info_1.doesExitPointPropagateCalls)(exitPoint.type)) {
|
|
155
|
-
// add the exit point to the call!
|
|
156
153
|
propagateExitPoints.push(exitPoint);
|
|
157
154
|
}
|
|
158
155
|
}
|
|
159
|
-
const defName =
|
|
160
|
-
(0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `recording expr-list-level call from ${
|
|
156
|
+
const defName = node_id_1.NodeId.recoverName(fnId, idMap);
|
|
157
|
+
(0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `recording expr-list-level call from ${node_id_1.NodeId.recoverName(info.id, idMap)} to ${defName}`);
|
|
161
158
|
graph.addEdge(id, fnId, edge_1.EdgeType.Calls);
|
|
162
159
|
applyForForcedArgs(graph, info.id, params, linkFunctionCallArguments(fnId, idMap, defName, id, info.args, graph));
|
|
163
160
|
return propagateExitPoints;
|
|
@@ -178,7 +175,6 @@ const FCallLinkReadBits = edge_1.EdgeType.Reads | edge_1.EdgeType.Calls | edge_1
|
|
|
178
175
|
function linkFunctionCall(graph, id, info, idMap, thisGraph, calledFunctionDefinitions) {
|
|
179
176
|
const edges = graph.outgoingEdges(id);
|
|
180
177
|
if (edges === undefined) {
|
|
181
|
-
/* no outgoing edges */
|
|
182
178
|
return;
|
|
183
179
|
}
|
|
184
180
|
const functionDefinitionReadIds = new Set();
|
|
@@ -204,11 +200,8 @@ function linkFunctionCall(graph, id, info, idMap, thisGraph, calledFunctionDefin
|
|
|
204
200
|
}
|
|
205
201
|
}
|
|
206
202
|
/**
|
|
207
|
-
* Returns the called functions within
|
|
208
|
-
*
|
|
209
|
-
* @param graph - The graph to use for search and resolution traversals (ideally a superset of the `thisGraph`)
|
|
210
|
-
* @param idMap - The map to resolve ids to names
|
|
211
|
-
* @param thisGraph - The graph to search for function calls in
|
|
203
|
+
* Returns the called functions within `graph` (ideally a superset of `thisGraph`, the graph searched for calls), which
|
|
204
|
+
* can be used to merge the environments with the call; also links the corresponding arguments.
|
|
212
205
|
*/
|
|
213
206
|
function linkFunctionCalls(graph, idMap, thisGraph) {
|
|
214
207
|
const calledFunctionDefinitions = [];
|
|
@@ -232,18 +225,22 @@ function getAllFunctionCallTargets(call, graph, environment) {
|
|
|
232
225
|
if (!vertex_2.FunctionCallVertex.is(info)) {
|
|
233
226
|
return [];
|
|
234
227
|
}
|
|
235
|
-
|
|
236
|
-
|
|
228
|
+
const known = environment ?? info.environment;
|
|
229
|
+
let functionCallDefs = [];
|
|
230
|
+
if (known !== undefined) {
|
|
237
231
|
const refType = info.origin.includes(built_in_proc_name_1.BuiltInProcName.S3Dispatch) ? identifier_1.ReferenceType.S3MethodPrefix :
|
|
238
232
|
info.origin.includes(built_in_proc_name_1.BuiltInProcName.S7Dispatch) ? identifier_1.ReferenceType.S7MethodPrefix : identifier_1.ReferenceType.Function;
|
|
239
233
|
if (info.name !== undefined && !identifier_1.Identifier.getName(info.name).startsWith(unnamed_call_handling_1.UnnamedFunctionCallPrefix)) {
|
|
240
|
-
functionCallDefs = resolve_helper_1.Resolve.byNameAndType(info.name,
|
|
234
|
+
functionCallDefs = resolve_helper_1.Resolve.byNameAndType(info.name, known, refType)?.map(d => d.nodeId) ?? [];
|
|
241
235
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
236
|
+
}
|
|
237
|
+
/* a call that kept no environment still knows the user definitions it was linked to, and those are targets */
|
|
238
|
+
for (const [target, outgoingEdge] of outgoingEdges.entries()) {
|
|
239
|
+
if (edge_1.DfEdge.includesType(outgoingEdge, edge_1.EdgeType.Calls) && (known !== undefined || !node_id_1.NodeId.isBuiltIn(target))) {
|
|
240
|
+
functionCallDefs.push(target);
|
|
246
241
|
}
|
|
242
|
+
}
|
|
243
|
+
if (functionCallDefs.length > 0) {
|
|
247
244
|
const [functionCallTargets, builtInTargets] = getAllLinkedFunctionDefinitions(new Set(functionCallDefs), graph);
|
|
248
245
|
for (const target of functionCallTargets) {
|
|
249
246
|
found.add(target.id);
|
|
@@ -258,19 +255,8 @@ function getAllFunctionCallTargets(call, graph, environment) {
|
|
|
258
255
|
}
|
|
259
256
|
const LinkedFnFollowBits = edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedBy | edge_1.EdgeType.DefinedByOnCall;
|
|
260
257
|
/**
|
|
261
|
-
* Finds all linked function definitions starting from the given
|
|
262
|
-
*
|
|
263
|
-
* For example, if you are interested in the called functions of a function call, use {@link getAllFunctionCallTargets} instead.
|
|
264
|
-
* This function here expects you to handle the accessed objects yourself (e.g,. already resolve the first layer of reads/returns/calls/... or resolve the identifier by name)
|
|
265
|
-
* and then pass in the relevant read ids.
|
|
266
|
-
* @example
|
|
267
|
-
* Consider a scenario like this:
|
|
268
|
-
* ```R
|
|
269
|
-
* x <- function() 3
|
|
270
|
-
* x()
|
|
271
|
-
* ```
|
|
272
|
-
* To resolve the call `x` in the second line, use {@link getAllFunctionCallTargets}!
|
|
273
|
-
* To know what fdefs the definition of `x` in the first line links to, you can use {@link getAllLinkedFunctionDefinitions|this function}.
|
|
258
|
+
* Finds all linked function definitions starting from the given read ids; expects the caller to already have resolved
|
|
259
|
+
* the accessed objects (first layer of reads/returns/calls/...). For call targets, use {@link getAllFunctionCallTargets} instead.
|
|
274
260
|
*/
|
|
275
261
|
function getAllLinkedFunctionDefinitions(functionDefinitionReadIds, dataflowGraph) {
|
|
276
262
|
const result = new Set();
|
|
@@ -291,7 +277,6 @@ function getAllLinkedFunctionDefinitions(functionDefinitionReadIds, dataflowGrap
|
|
|
291
277
|
if (vertex === undefined) {
|
|
292
278
|
continue;
|
|
293
279
|
}
|
|
294
|
-
// Found a function definition
|
|
295
280
|
if (vertex.subflow !== undefined) {
|
|
296
281
|
result.add(vertex);
|
|
297
282
|
continue;
|
|
@@ -349,13 +334,8 @@ function linkExpressionIn(graph, expr, environment, idMap) {
|
|
|
349
334
|
return unresolved;
|
|
350
335
|
}
|
|
351
336
|
/**
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
* @param environmentInformation - The environment information to link against
|
|
355
|
-
* @param givenInputs - The existing list of inputs that might be extended
|
|
356
|
-
* @param graph - The graph to enter the found links
|
|
357
|
-
* @param maybeForRemaining - Each input that can not be linked, will be added to `givenInputs`. If this flag is `true`, it will be marked as `maybe`.
|
|
358
|
-
* @returns the given inputs, possibly extended with the remaining inputs (those of `referencesToLinkAgainstEnvironment` that could not be linked against the environment)
|
|
337
|
+
* Links a set of read variables to definitions in `environmentInformation`; each reference that cannot be linked is
|
|
338
|
+
* added to `givenInputs` (marked maybe if `maybeForRemaining`), and the extended list is returned.
|
|
359
339
|
*/
|
|
360
340
|
function linkInputs(referencesToLinkAgainstEnvironment, environmentInformation, givenInputs, graph, maybeForRemaining) {
|
|
361
341
|
for (const bodyInput of referencesToLinkAgainstEnvironment) {
|
|
@@ -369,7 +349,6 @@ function linkInputs(referencesToLinkAgainstEnvironment, environmentInformation,
|
|
|
369
349
|
else {
|
|
370
350
|
let allBuiltIn = true;
|
|
371
351
|
for (const target of probableTarget) {
|
|
372
|
-
// we can stick with maybe even if readId.attribute is always
|
|
373
352
|
graph.addEdge(bodyInput.nodeId, target.nodeId, edge_1.EdgeType.Reads);
|
|
374
353
|
if (!(0, identifier_1.isReferenceType)(target.type, identifier_1.ReferenceType.BuiltInConstant | identifier_1.ReferenceType.BuiltInFunction)) {
|
|
375
354
|
allBuiltIn = false;
|
|
@@ -380,22 +359,11 @@ function linkInputs(referencesToLinkAgainstEnvironment, environmentInformation,
|
|
|
380
359
|
}
|
|
381
360
|
}
|
|
382
361
|
}
|
|
383
|
-
// data.graph.get(node.id).definedAtPosition = false
|
|
384
362
|
return givenInputs;
|
|
385
363
|
}
|
|
386
364
|
/**
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
* ```R
|
|
390
|
-
* for(i in 1:10) {
|
|
391
|
-
* x_1 <- x_2 + 1
|
|
392
|
-
* }
|
|
393
|
-
* ```
|
|
394
|
-
* `x_2` must get a read marker to `x_1` as `x_1` is the active redefinition in the second loop iteration.
|
|
395
|
-
*
|
|
396
|
-
* When `environment` is supplied the function uses it to discover ALL definitions that are still live at the
|
|
397
|
-
* loop exit, so sequential overwrites contribute a single candidate while if-else branches contribute one
|
|
398
|
-
* candidate per branch.
|
|
365
|
+
* A loop variable read before its within-loop redefinition gets a maybe marker to that def (e.g. `x_2` may read the
|
|
366
|
+
* prior iteration's `x_1` in `for(...) { x_1 <- x_2 + 1 }`); with `environment`, this uses all defs live at loop exit.
|
|
399
367
|
*/
|
|
400
368
|
function linkCircularRedefinitionsWithinALoop(graph, openIns, outgoing, environment) {
|
|
401
369
|
if (environment !== undefined) {
|
|
@@ -437,7 +405,6 @@ function linkCircularRedefinitionsWithinALoop(graph, openIns, outgoing, environm
|
|
|
437
405
|
* Reapplies the loop exit points' control dependencies to the given identifier references.
|
|
438
406
|
*/
|
|
439
407
|
function reapplyLoopExitPoints(exits, references, graph) {
|
|
440
|
-
// just apply the cds of all exit points not already present
|
|
441
408
|
const exitCds = exits.flatMap(e => e.cds?.map(info_1.negateControlDependency))
|
|
442
409
|
.filter(assert_1.isNotUndefined)
|
|
443
410
|
.map(cd => ({ ...cd, byIteration: true }));
|
|
@@ -4,7 +4,6 @@ import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/
|
|
|
4
4
|
import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
5
5
|
import { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
6
6
|
import { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
|
-
import type { ForceArguments } from '../common';
|
|
8
7
|
/**
|
|
9
8
|
* Processes different types of access operations.
|
|
10
9
|
*
|
|
@@ -19,7 +18,7 @@ import type { ForceArguments } from '../common';
|
|
|
19
18
|
export declare function processAccess<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: {
|
|
20
19
|
treatIndicesAsString: boolean;
|
|
21
20
|
resolveField?: boolean;
|
|
22
|
-
}
|
|
21
|
+
}): DataflowInformation;
|
|
23
22
|
/**
|
|
24
23
|
* Converts symbol arguments to string arguments within the specified range.
|
|
25
24
|
*/
|
|
@@ -37,21 +37,21 @@ function tableAssignmentProcessor(name, args, rootId, data, outInfo) {
|
|
|
37
37
|
function processAccess(name, args, rootId, data, config) {
|
|
38
38
|
if (args.length < 1) {
|
|
39
39
|
logger_1.dataflowLogger.warn(`Access ${identifier_1.Identifier.getName(name.content)} has less than 1 argument, skipping`);
|
|
40
|
-
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data,
|
|
40
|
+
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
41
41
|
}
|
|
42
42
|
const head = args[0];
|
|
43
43
|
let fnCall;
|
|
44
44
|
if (r_argument_1.RArgument.isEmpty(head)) {
|
|
45
45
|
// in this case we may be within a pipe
|
|
46
|
-
fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data,
|
|
46
|
+
fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Access });
|
|
47
47
|
}
|
|
48
48
|
else if (config.treatIndicesAsString) {
|
|
49
|
-
fnCall = processStringBasedAccess(args, data, name, rootId
|
|
49
|
+
fnCall = processStringBasedAccess(args, data, name, rootId);
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
52
|
/* within an access operation which treats its fields, we redefine the table assignment ':=' as a trigger if this is to be treated as a definition */
|
|
53
53
|
// do we have a local definition that needs to be recovered?
|
|
54
|
-
fnCall = processNumberBasedAccess(data, name, args, rootId,
|
|
54
|
+
fnCall = processNumberBasedAccess(data, name, args, rootId, head);
|
|
55
55
|
}
|
|
56
56
|
const info = fnCall.information;
|
|
57
57
|
if (head !== r_function_call_1.EmptyArgument) {
|
|
@@ -119,7 +119,7 @@ function processAccess(name, args, rootId, data, config) {
|
|
|
119
119
|
* a[[i]]
|
|
120
120
|
* ```
|
|
121
121
|
*/
|
|
122
|
-
function processNumberBasedAccess(data, name, args, rootId,
|
|
122
|
+
function processNumberBasedAccess(data, name, args, rootId, head) {
|
|
123
123
|
const existing = data.environment.current.memory.get(':=');
|
|
124
124
|
const outInfo = { definitionRootNodes: [] };
|
|
125
125
|
const tableAssignId = node_id_1.NodeId.toBuiltIn(':=-table');
|
|
@@ -131,7 +131,7 @@ function processNumberBasedAccess(data, name, args, rootId, config, head) {
|
|
|
131
131
|
name: ':=',
|
|
132
132
|
nodeId: tableAssignId
|
|
133
133
|
}]);
|
|
134
|
-
const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data,
|
|
134
|
+
const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Access });
|
|
135
135
|
/* recover the environment */
|
|
136
136
|
if (existing !== undefined) {
|
|
137
137
|
data.environment.current.writableMemory.set(':=', existing);
|
|
@@ -176,13 +176,12 @@ function symbolArgumentsToStrings(args, firstIndexInclusive = 1, lastIndexInclus
|
|
|
176
176
|
* a@foo
|
|
177
177
|
* ```
|
|
178
178
|
*/
|
|
179
|
-
function processStringBasedAccess(args, data, name, rootId
|
|
179
|
+
function processStringBasedAccess(args, data, name, rootId) {
|
|
180
180
|
return (0, known_call_handling_1.processKnownFunctionCall)({
|
|
181
181
|
name,
|
|
182
182
|
args: symbolArgumentsToStrings(args),
|
|
183
183
|
rootId,
|
|
184
184
|
data,
|
|
185
|
-
forceArgs: config.forceArgs,
|
|
186
185
|
origin: built_in_proc_name_1.BuiltInProcName.Access
|
|
187
186
|
});
|
|
188
187
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveFunctionArgument = resolveFunctionArgument;
|
|
4
4
|
exports.processApply = processApply;
|
|
5
|
+
const built_in_props_1 = require("../../../../../environments/built-in-props");
|
|
5
6
|
const known_call_handling_1 = require("../known-call-handling");
|
|
6
7
|
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
7
8
|
const r_symbol_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
@@ -38,11 +39,9 @@ function resolveFunctionArgument(val, data, opts) {
|
|
|
38
39
|
*/
|
|
39
40
|
function processApply(name, args, rootId, data, config) {
|
|
40
41
|
const { indexOfFunction = 1, nameOfFunctionArgument, unquoteFunction, resolveInEnvironment, resolveValue, hasUnknownSideEffects } = config;
|
|
41
|
-
/*
|
|
42
|
-
const forceArgsMask = new Array(indexOfFunction).fill(false);
|
|
43
|
-
forceArgsMask.push(true);
|
|
42
|
+
/* the length is one-based and the argument mapping zero-based, so the function sits at `indexOfFunction` */
|
|
44
43
|
const resFn = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
45
|
-
name, args, rootId, data,
|
|
44
|
+
name, args, rootId, data, sig: built_in_props_1.FnSig.only(indexOfFunction, nameOfFunctionArgument ?? 'FUN'), origin: built_in_proc_name_1.BuiltInProcName.Apply
|
|
46
45
|
});
|
|
47
46
|
let information = resFn.information;
|
|
48
47
|
if (hasUnknownSideEffects) {
|
|
@@ -7,10 +7,9 @@ import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-
|
|
|
7
7
|
import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
8
8
|
import { Identifier, type InGraphIdentifierDefinition } from '../../../../../environments/identifier';
|
|
9
9
|
import type { DataflowGraphVertexFunctionDefinition } from '../../../../../graph/vertex';
|
|
10
|
-
import type { ForceArguments } from '../common';
|
|
11
10
|
import type { REnvironmentInformation } from '../../../../../environments/environment';
|
|
12
11
|
import type { DataflowGraph } from '../../../../../graph/graph';
|
|
13
|
-
export interface AssignmentConfiguration
|
|
12
|
+
export interface AssignmentConfiguration {
|
|
14
13
|
readonly superAssignment?: boolean;
|
|
15
14
|
readonly swapSourceAndTarget?: boolean;
|
|
16
15
|
/** Make maybe if assigned to symbol */
|
|
@@ -22,9 +21,8 @@ export interface AssignmentConfiguration extends ForceArguments {
|
|
|
22
21
|
readonly mayHaveMoreArgs?: boolean;
|
|
23
22
|
readonly modesForFn?: DataflowGraphVertexFunctionDefinition['mode'];
|
|
24
23
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* the assignment is routed into that environment instead of the current scope.
|
|
24
|
+
* Name of the arg selecting the target env (e.g. `'envir'` for `assign`); if it resolves to a tracked
|
|
25
|
+
* {@link InGraphIdentifierDefinition#envState}, the assignment is routed there instead of the current scope.
|
|
28
26
|
*/
|
|
29
27
|
readonly environmentArg?: string;
|
|
30
28
|
}
|
|
@@ -38,14 +36,11 @@ export interface ExtendedAssignmentConfiguration extends AssignmentConfiguration
|
|
|
38
36
|
name: string;
|
|
39
37
|
};
|
|
40
38
|
}
|
|
41
|
-
/**
|
|
42
|
-
* In contrast to `processAssignment`, this function allows more flexible handling of assignment-like functions.
|
|
43
|
-
*/
|
|
39
|
+
/** In contrast to `processAssignment`, this function allows more flexible handling of assignment-like functions. */
|
|
44
40
|
export declare function processAssignmentLike<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: ExtendedAssignmentConfiguration): DataflowInformation;
|
|
45
41
|
/**
|
|
46
|
-
* Processes an assignment
|
|
47
|
-
*
|
|
48
|
-
* This includes handling of replacement functions (e.g., `names(x) <- ...` as \`names<-\` `(x, ...)`).
|
|
42
|
+
* Processes an assignment `<target> <- <source>` as the function call \`<-\` `(<target>, <source>)`,
|
|
43
|
+
* including replacement functions (e.g., `names(x) <- ...` as \`names<-\` `(x, ...)`).
|
|
49
44
|
*/
|
|
50
45
|
export declare function processAssignment<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: AssignmentConfiguration): DataflowInformation;
|
|
51
46
|
export interface AssignmentToSymbolParameters<OtherInfo> extends AssignmentConfiguration {
|
|
@@ -60,9 +55,8 @@ export interface AssignmentToSymbolParameters<OtherInfo> extends AssignmentConfi
|
|
|
60
55
|
readonly information: DataflowInformation;
|
|
61
56
|
}
|
|
62
57
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* Unlike {@link markAsAssignment} we keep the read edge.
|
|
58
|
+
* Models a call like `Hmisc::getHdata(x)` that loads a dataset into the variable it is *given*: `x` is both
|
|
59
|
+
* **read** (its value comes from outside) and **defined** by the call; unlike {@link markAsAssignment} we keep the read edge.
|
|
66
60
|
*/
|
|
67
61
|
export declare function processDefineArgument<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: AssignmentConfiguration): DataflowInformation;
|
|
68
62
|
/** Define `nodeToDefine` in the environment and wire the `DefinedBy` edges from it to its sources and the assignment root (dropping the child-added read edges). */
|
|
@@ -10,7 +10,6 @@ const data_masking_functions_1 = require("../../../../../environments/data-maski
|
|
|
10
10
|
const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
11
11
|
const log_1 = require("../../../../../../util/log");
|
|
12
12
|
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
13
|
-
const process_named_call_1 = require("../../../process-named-call");
|
|
14
13
|
const make_argument_1 = require("../argument/make-argument");
|
|
15
14
|
const r_access_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-access");
|
|
16
15
|
const r_symbol_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
@@ -59,30 +58,41 @@ function findRootAccess(node) {
|
|
|
59
58
|
}
|
|
60
59
|
return undefined;
|
|
61
60
|
}
|
|
62
|
-
function tryReplacement(rootId, functionName, data,
|
|
61
|
+
function tryReplacement(rootId, functionName, data, superAssignment, args) {
|
|
63
62
|
const resolved = resolve_helper_1.Resolve.byNameAndType(functionName.content, data.environment, identifier_1.ReferenceType.Function) ?? [];
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
const builtIn = resolved.length === 1 && resolved[0].type === identifier_1.ReferenceType.BuiltInFunction ? resolved[0] : undefined;
|
|
64
|
+
/* every replacement function rebinds its target, no matter whether we ship a built-in for it or the user wrote
|
|
65
|
+
* it; a user-defined one is only ever bound under its `<-` name, the `<<-` form stays in the configuration */
|
|
66
|
+
const name = builtIn ? functionName.content : identifier_1.Identifier.mapName(functionName.content, n => superAssignment ? n.slice(0, -'<<-'.length) + '<-' : n);
|
|
68
67
|
const info = built_in_1.BuiltInProcessorMapper[built_in_proc_name_1.BuiltInProcName.Replacement]({
|
|
69
68
|
type: type_1.RType.Symbol,
|
|
70
69
|
info: functionName.info,
|
|
71
70
|
content: name,
|
|
72
71
|
lexeme: functionName.lexeme,
|
|
73
72
|
location: functionName.location
|
|
74
|
-
}, (0, make_argument_1.wrapArgumentsUnnamed)(args, data.completeAst.idMap), functionName.info.id, data, {
|
|
75
|
-
...
|
|
73
|
+
}, (0, make_argument_1.wrapArgumentsUnnamed)(args, data.completeAst.idMap), functionName.info.id, data, builtIn ? {
|
|
74
|
+
...builtIn.config,
|
|
75
|
+
assignRootId: rootId
|
|
76
|
+
} : {
|
|
77
|
+
readIndices: true,
|
|
78
|
+
makeMaybe: true,
|
|
79
|
+
assignmentOperator: superAssignment ? '<<-' : '<-',
|
|
76
80
|
assignRootId: rootId
|
|
77
81
|
});
|
|
78
|
-
(
|
|
79
|
-
|
|
82
|
+
if (builtIn) {
|
|
83
|
+
(0, named_call_handling_1.markAsOnlyBuiltIn)(info.graph, functionName.info.id);
|
|
84
|
+
return info;
|
|
85
|
+
}
|
|
86
|
+
/* the replacement marks its callee as an S3 prefix, which only ever resolves to `name.<class>`; a user-defined
|
|
87
|
+
* replacement is bound under the plain name, so we read that first to link the call to its definition */
|
|
88
|
+
return {
|
|
89
|
+
...info,
|
|
90
|
+
in: [{ nodeId: functionName.info.id, name, cds: data.cds, type: identifier_1.ReferenceType.Function }, ...info.in]
|
|
91
|
+
};
|
|
80
92
|
}
|
|
81
|
-
/**
|
|
82
|
-
* In contrast to `processAssignment`, this function allows more flexible handling of assignment-like functions.
|
|
83
|
-
*/
|
|
93
|
+
/** In contrast to `processAssignment`, this function allows more flexible handling of assignment-like functions. */
|
|
84
94
|
function processAssignmentLike(name,
|
|
85
|
-
/*
|
|
95
|
+
/* args may come in any order; matched via config.source/config.target, then normalized to processAssignment's convention below */
|
|
86
96
|
args, rootId, data, config) {
|
|
87
97
|
const argsWithNames = new Map();
|
|
88
98
|
const argsWithoutNames = [];
|
|
@@ -134,9 +144,8 @@ function processMaskedNamePair(name, args, rootId, data) {
|
|
|
134
144
|
return information;
|
|
135
145
|
}
|
|
136
146
|
/**
|
|
137
|
-
* Processes an assignment
|
|
138
|
-
*
|
|
139
|
-
* This includes handling of replacement functions (e.g., `names(x) <- ...` as \`names<-\` `(x, ...)`).
|
|
147
|
+
* Processes an assignment `<target> <- <source>` as the function call \`<-\` `(<target>, <source>)`,
|
|
148
|
+
* including replacement functions (e.g., `names(x) <- ...` as \`names<-\` `(x, ...)`).
|
|
140
149
|
*/
|
|
141
150
|
function processAssignment(name,
|
|
142
151
|
/* we expect them to be ordered in the sense that we have (source, target): `<source> <- <target>` */
|
|
@@ -146,7 +155,7 @@ args, rootId, data, config) {
|
|
|
146
155
|
}
|
|
147
156
|
if (!config.mayHaveMoreArgs && args.length !== 2) {
|
|
148
157
|
logger_1.dataflowLogger.warn(`Assignment ${identifier_1.Identifier.toString(name.content)} has something else than 2 arguments, skipping`);
|
|
149
|
-
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data,
|
|
158
|
+
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
150
159
|
}
|
|
151
160
|
/* route into a custom environment when envir resolves to a tracked env variable */
|
|
152
161
|
if (config.environmentArg) {
|
|
@@ -156,10 +165,11 @@ args, rootId, data, config) {
|
|
|
156
165
|
}
|
|
157
166
|
}
|
|
158
167
|
const effectiveArgs = getEffectiveOrder(config, args);
|
|
159
|
-
const
|
|
168
|
+
const target = (0, unpack_argument_1.unpackArg)(effectiveArgs[0]);
|
|
169
|
+
const source = (0, unpack_argument_1.unpackArg)(effectiveArgs[1]);
|
|
160
170
|
if (target === undefined || source === undefined) {
|
|
161
171
|
logger_1.dataflowLogger.warn(`Assignment ${identifier_1.Identifier.toString(name.content)} has an undefined target or source, skipping`);
|
|
162
|
-
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data,
|
|
172
|
+
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
|
|
163
173
|
}
|
|
164
174
|
const { type, named } = target;
|
|
165
175
|
/** the target is a plain name, so the assignment defines it directly (with `targetName` set whenever the name had to be resolved first) */
|
|
@@ -170,7 +180,6 @@ args, rootId, data, config) {
|
|
|
170
180
|
rootId,
|
|
171
181
|
data,
|
|
172
182
|
reverseOrder: !config.swapSourceAndTarget,
|
|
173
|
-
forceArgs: config.forceArgs,
|
|
174
183
|
origin: config.superAssignment ? built_in_proc_name_1.BuiltInProcName.SuperAssignment : built_in_proc_name_1.BuiltInProcName.Assignment
|
|
175
184
|
});
|
|
176
185
|
return processAssignmentToSymbol({
|
|
@@ -199,7 +208,7 @@ args, rootId, data, config) {
|
|
|
199
208
|
/* 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 */
|
|
200
209
|
logger_1.dataflowLogger.debug(`Assignment ${identifier_1.Identifier.toString(name.content)} has a function call as target ==> replacement function ${target.lexeme}`);
|
|
201
210
|
const replacement = toReplacementSymbol(target, target.functionName.content, config.superAssignment ?? false);
|
|
202
|
-
return tryReplacement(rootId, replacement, data,
|
|
211
|
+
return tryReplacement(rootId, replacement, data, config.superAssignment ?? false, [...target.arguments, source]);
|
|
203
212
|
}
|
|
204
213
|
else if (config.canBeReplacement && type === type_1.RType.Access) {
|
|
205
214
|
logger_1.dataflowLogger.debug(`Assignment ${identifier_1.Identifier.toString(name.content)} has an access-type node as target ==> replacement function ${target.lexeme}`);
|
|
@@ -208,7 +217,7 @@ args, rootId, data, config) {
|
|
|
208
217
|
if (envRouted !== undefined) {
|
|
209
218
|
return envRouted;
|
|
210
219
|
}
|
|
211
|
-
return tryReplacement(rootId, replacement, data,
|
|
220
|
+
return tryReplacement(rootId, replacement, data, config.superAssignment ?? false, [(0, make_argument_1.toUnnamedArgument)(target.accessed, data.completeAst.idMap), ...target.access, source]);
|
|
212
221
|
}
|
|
213
222
|
else if (type === type_1.RType.Access) {
|
|
214
223
|
const rootArg = findRootAccess(target);
|
|
@@ -219,7 +228,6 @@ args, rootId, data, config) {
|
|
|
219
228
|
rootId,
|
|
220
229
|
data,
|
|
221
230
|
reverseOrder: !config.swapSourceAndTarget,
|
|
222
|
-
forceArgs: config.forceArgs,
|
|
223
231
|
origin: config.superAssignment ? built_in_proc_name_1.BuiltInProcName.SuperAssignment : built_in_proc_name_1.BuiltInProcName.Assignment
|
|
224
232
|
});
|
|
225
233
|
return processAssignmentToSymbol({
|
|
@@ -239,20 +247,13 @@ args, rootId, data, config) {
|
|
|
239
247
|
}
|
|
240
248
|
logger_1.dataflowLogger.warn(`Assignment ${identifier_1.Identifier.toString(name.content)} has an unknown target type ${target.type} => unknown impact`);
|
|
241
249
|
const info = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
242
|
-
name, args: effectiveArgs, rootId, data,
|
|
250
|
+
name, args: effectiveArgs, rootId, data,
|
|
243
251
|
origin: config.superAssignment ? built_in_proc_name_1.BuiltInProcName.SuperAssignment : built_in_proc_name_1.BuiltInProcName.Assignment
|
|
244
252
|
}).information;
|
|
245
253
|
(0, unknown_side_effect_1.handleUnknownSideEffect)(info.graph, info.environment, rootId);
|
|
246
254
|
return info;
|
|
247
255
|
}
|
|
248
|
-
|
|
249
|
-
const source = (0, unpack_argument_1.unpackArg)(args[1]);
|
|
250
|
-
const target = (0, unpack_argument_1.unpackArg)(args[0]);
|
|
251
|
-
return { source, target };
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Promotes the ingoing/unknown references of target (an assignment) to definitions
|
|
255
|
-
*/
|
|
256
|
+
/** Promotes the ingoing/unknown references of target (an assignment) to definitions. */
|
|
256
257
|
function produceWrittenNodes(rootId, target, referenceType, data, makeMaybe, value) {
|
|
257
258
|
const written = [];
|
|
258
259
|
for (const refs of [target.in, target.unknownReferences]) {
|
|
@@ -289,7 +290,6 @@ function processAssignmentToString(target, args, name, rootId, data, config, sou
|
|
|
289
290
|
rootId,
|
|
290
291
|
data,
|
|
291
292
|
reverseOrder: !config.swapSourceAndTarget,
|
|
292
|
-
forceArgs: config.forceArgs,
|
|
293
293
|
origin: config.superAssignment ? built_in_proc_name_1.BuiltInProcName.SuperAssignment : built_in_proc_name_1.BuiltInProcName.Assignment
|
|
294
294
|
});
|
|
295
295
|
return processAssignmentToSymbol({
|
|
@@ -332,9 +332,8 @@ function isEnvCreatorSource(sourceInfo) {
|
|
|
332
332
|
return vertex_1.FunctionCallVertex.hasOrigin(vert, built_in_proc_name_1.BuiltInProcName.NewEnv);
|
|
333
333
|
}
|
|
334
334
|
/**
|
|
335
|
-
* When `e$x <- val` and `e` holds a tracked {@link InGraphIdentifierDefinition#envState},
|
|
336
|
-
*
|
|
337
|
-
* Returns `undefined` when routing is not applicable.
|
|
335
|
+
* When `e$x <- val` and `e` holds a tracked {@link InGraphIdentifierDefinition#envState}, adds field `x` into that
|
|
336
|
+
* envState instead of redefining `e`; returns `undefined` when routing is not applicable.
|
|
338
337
|
*/
|
|
339
338
|
function tryRouteDollarEnvAssign(rootId, data, config, target, source, replacement) {
|
|
340
339
|
if (target.operator !== '$' || !r_symbol_1.RSymbol.is(target.accessed)) {
|
|
@@ -349,7 +348,7 @@ function tryRouteDollarEnvAssign(rootId, data, config, target, source, replaceme
|
|
|
349
348
|
return undefined;
|
|
350
349
|
}
|
|
351
350
|
const fieldName = (r_string_1.RString.is(fieldNode) ? fieldNode.content.str : fieldNode.lexeme);
|
|
352
|
-
const normalResult = tryReplacement(rootId, replacement, data,
|
|
351
|
+
const normalResult = tryReplacement(rootId, replacement, data, config.superAssignment ?? false, [(0, make_argument_1.toUnnamedArgument)(target.accessed, data.completeAst.idMap), ...target.access, source]);
|
|
353
352
|
const fieldDef = {
|
|
354
353
|
type: identifier_1.ReferenceType.Variable,
|
|
355
354
|
name: fieldName,
|
|
@@ -371,11 +370,8 @@ function tryRouteDollarEnvAssign(rootId, data, config, target, source, replaceme
|
|
|
371
370
|
return { ...normalResult, environment: (0, define_1.define)(updatedEnvDef, false, strippedEnv) };
|
|
372
371
|
}
|
|
373
372
|
/**
|
|
374
|
-
* When `config.environmentArg`
|
|
375
|
-
*
|
|
376
|
-
* this function routes the written definitions into that custom environment instead of the current
|
|
377
|
-
* global scope.
|
|
378
|
-
* @returns `undefined` if routing is not possible
|
|
373
|
+
* When `config.environmentArg` (e.g. `'envir'` for `assign`) resolves to a variable with a tracked
|
|
374
|
+
* {@link InGraphIdentifierDefinition#envState}, routes the written definitions there instead of the current scope; returns `undefined` if not possible.
|
|
379
375
|
*/
|
|
380
376
|
function tryRouteToCustomEnv(name, args, rootId, data, config) {
|
|
381
377
|
const resolution = (0, built_in_envir_utils_1.resolveEnvirArg)(args, data, config.environmentArg);
|
|
@@ -405,12 +401,11 @@ function tryRouteToCustomEnv(name, args, rootId, data, config) {
|
|
|
405
401
|
return (0, built_in_envir_utils_1.routeWrittenToCustomEnv)(normalResult, resolution.envDef, rootId, rootId);
|
|
406
402
|
}
|
|
407
403
|
/**
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
* Unlike {@link markAsAssignment} we keep the read edge.
|
|
404
|
+
* Models a call like `Hmisc::getHdata(x)` that loads a dataset into the variable it is *given*: `x` is both
|
|
405
|
+
* **read** (its value comes from outside) and **defined** by the call; unlike {@link markAsAssignment} we keep the read edge.
|
|
411
406
|
*/
|
|
412
407
|
function processDefineArgument(name, args, rootId, data, config) {
|
|
413
|
-
const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data,
|
|
408
|
+
const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.DefineArgument });
|
|
414
409
|
const info = res.information;
|
|
415
410
|
const targetArg = res.processedArguments[0]; // the read argument, e.g. `prostate`
|
|
416
411
|
if (targetArg !== undefined) {
|
|
@@ -438,9 +433,7 @@ function markAsAssignment(information, nodeToDefine, sourceIds, rootIdOfAssignme
|
|
|
438
433
|
information.graph.removeEdgeType(nodeToDefine.nodeId, id, edge_1.EdgeType.Reads);
|
|
439
434
|
}
|
|
440
435
|
}
|
|
441
|
-
/**
|
|
442
|
-
* Helper function whenever it is known that the _target_ of an assignment is a (single) symbol (i.e. `x <- ...`, but not `names(x) <- ...`).
|
|
443
|
-
*/
|
|
436
|
+
/** Helper for when the _target_ of an assignment is known to be a (single) symbol (i.e. `x <- ...`, not `names(x) <- ...`). */
|
|
444
437
|
function processAssignmentToSymbol(config) {
|
|
445
438
|
const { nameOfAssignmentFunction, source, args: [targetArg, sourceArg], targetId, targetName, rootId, data, information, makeMaybe, quoteSource } = config;
|
|
446
439
|
const referenceType = checkTargetReferenceType(sourceArg, config.modesForFn);
|