@eagleoutice/flowr 2.11.1 → 2.12.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 +187 -257
- package/abstract-interpretation/absint-visitor.d.ts +1 -0
- package/abstract-interpretation/data-frame/mappers/arguments.js +7 -1
- package/abstract-interpretation/domains/set-range-domain.js +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.js +6 -2
- package/benchmark/slicer.d.ts +1 -1
- package/benchmark/slicer.js +3 -1
- package/benchmark/summarizer/second-phase/graph.js +5 -0
- package/cli/common/options.d.ts +8 -0
- package/cli/common/options.js +2 -0
- package/cli/common/scripts-info.d.ts +8 -0
- package/cli/repl/commands/repl-commands.d.ts +1 -0
- package/cli/repl/commands/repl-commands.js +66 -15
- package/cli/repl/commands/repl-dataflow.js +48 -4
- package/cli/repl/commands/repl-main.d.ts +2 -0
- package/cli/repl/commands/repl-main.js +5 -0
- package/cli/repl/commands/repl-query.d.ts +4 -1
- package/cli/repl/commands/repl-query.js +72 -22
- package/cli/repl/commands/repl-signature.d.ts +7 -0
- package/cli/repl/commands/repl-signature.js +119 -0
- package/cli/repl/core.d.ts +8 -1
- package/cli/repl/core.js +46 -6
- package/cli/repl/ghost-hint.d.ts +37 -0
- package/cli/repl/ghost-hint.js +72 -0
- package/cli/repl/parser/slice-query-parser.d.ts +11 -1
- package/cli/repl/parser/slice-query-parser.js +45 -16
- package/cli/repl/print-version.d.ts +2 -4
- package/cli/repl/print-version.js +41 -23
- package/cli/repl/server/connection.js +19 -17
- package/cli/slicer-app.d.ts +2 -0
- package/cli/slicer-app.js +3 -3
- package/cli/wiki.d.ts +2 -2
- package/cli/wiki.js +2 -2
- package/config.d.ts +63 -2
- package/config.js +64 -8
- package/control-flow/cfg-dead-code.js +0 -1
- package/control-flow/control-flow-graph.js +6 -6
- package/control-flow/diff-cfg.js +2 -2
- package/control-flow/semantic-cfg-guided-visitor.js +2 -0
- package/core/print/slice-diff-ansi.js +8 -8
- package/core/steps/all/core/20-dataflow.d.ts +2 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +5 -0
- package/core/steps/all/static-slicing/00-slice.js +1 -1
- package/core/steps/all/static-slicing/10-reconstruct.d.ts +7 -0
- package/core/steps/all/static-slicing/10-reconstruct.js +6 -2
- package/core/steps/pipeline/default-pipelines.d.ts +20 -16
- package/data/r-base-packages.generated.d.ts +44 -0
- package/data/r-base-packages.generated.js +32 -0
- package/data/r-base-primitives.generated.d.ts +1 -0
- package/data/r-base-primitives.generated.js +15 -0
- package/data/sigdb/sigdb.remote.json +112 -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.d.ts +14 -4
- package/dataflow/environments/built-in.js +13 -2
- package/dataflow/environments/data-masking-functions.d.ts +12 -0
- package/dataflow/environments/data-masking-functions.js +46 -0
- package/dataflow/environments/default-builtin-config.d.ts +72 -19
- package/dataflow/environments/default-builtin-config.js +48 -14
- package/dataflow/environments/diff.js +1 -1
- package/dataflow/environments/environment.js +1 -2
- package/dataflow/environments/identifier.d.ts +11 -4
- package/dataflow/environments/identifier.js +28 -10
- package/dataflow/environments/resolve-by-name.js +16 -2
- package/dataflow/extractor.js +6 -3
- package/dataflow/graph/call-graph.d.ts +2 -2
- package/dataflow/graph/df-helper.d.ts +4 -4
- package/dataflow/graph/diff-dataflow-graph.js +2 -2
- package/dataflow/graph/edge.d.ts +3 -3
- package/dataflow/graph/edge.js +3 -3
- package/dataflow/graph/graph-helper.d.ts +2 -2
- package/dataflow/internal/linker.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +20 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -49
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +7 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +111 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +12 -4
- package/dataflow/internal/process/functions/call/common.js +8 -1
- package/dataflow/internal/process/functions/call/default-call-handling.js +6 -0
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +17 -0
- package/dataflow/internal/process/functions/call/known-call-handling.js +32 -0
- package/dataflow/internal/process/functions/call/named-call-handling.js +29 -7
- package/dataflow/internal/process/functions/process-argument.js +12 -1
- package/dataflow/internal/process/process-named-call.d.ts +18 -1
- package/dataflow/internal/process/process-named-call.js +94 -0
- package/dataflow/processor.d.ts +18 -0
- package/documentation/data/faq/faqs.js +5 -1
- package/documentation/doc-capabilities.js +1 -1
- package/documentation/doc-util/doc-cli-option.d.ts +10 -0
- package/documentation/doc-util/doc-cli-option.js +23 -0
- package/documentation/doc-util/doc-dfg.js +2 -1
- package/documentation/doc-util/doc-query.d.ts +9 -3
- package/documentation/doc-util/doc-query.js +9 -4
- package/documentation/wiki-dataflow-graph.js +8 -5
- package/documentation/wiki-interface.js +4 -2
- package/documentation/wiki-linter.js +1 -1
- package/documentation/wiki-linting-and-testing.js +4 -1
- package/documentation/wiki-mk/doc-context.d.ts +14 -0
- package/documentation/wiki-mk/doc-context.js +3 -0
- package/documentation/wiki-mk/doc-maker.js +3 -1
- package/documentation/wiki-query.js +36 -15
- package/documentation/wiki-setup.js +10 -7
- package/documentation/wiki-signature-database.d.ts +16 -0
- package/documentation/wiki-signature-database.js +293 -0
- package/linter/linter-format.d.ts +7 -0
- package/linter/linter-rules.d.ts +10 -9
- package/linter/rules/naming-convention.d.ts +1 -0
- package/linter/rules/naming-convention.js +2 -0
- package/linter/rules/no-leaked-credentials.js +1 -2
- package/linter/rules/roxygen-arguments.js +18 -5
- package/linter/rules/stop-with-call-arg.js +2 -2
- package/linter/rules/undefined-symbol-util.d.ts +36 -0
- package/linter/rules/undefined-symbol-util.js +149 -0
- package/linter/rules/undefined-symbol.d.ts +58 -17
- package/linter/rules/undefined-symbol.js +143 -33
- package/linter/rules/unused-definition.d.ts +8 -1
- package/linter/rules/unused-definition.js +126 -1
- package/package.json +22 -10
- package/project/context/abstract-flowr-analyzer-context.js +7 -1
- package/project/context/flowr-analyzer-context.d.ts +8 -0
- package/project/context/flowr-analyzer-context.js +10 -0
- package/project/context/flowr-analyzer-dependencies-context.d.ts +28 -4
- package/project/context/flowr-analyzer-dependencies-context.js +51 -2
- package/project/context/flowr-analyzer-files-context.d.ts +1 -0
- package/project/context/flowr-analyzer-files-context.js +2 -1
- package/project/context/flowr-analyzer-functions-context.js +1 -1
- package/project/context/flowr-file.d.ts +5 -0
- package/project/context/flowr-file.js +5 -0
- package/project/flowr-analyzer-builder.js +12 -2
- package/project/plugins/file-plugins/files/flowr-description-file.js +6 -3
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +9 -3
- package/project/plugins/file-plugins/files/flowr-news-file.js +1 -3
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +26 -0
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +39 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +18 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +19 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +120 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +518 -0
- package/project/plugins/package-version-plugins/package.d.ts +5 -3
- package/project/plugins/package-version-plugins/package.js +27 -25
- package/project/plugins/plugin-registry.d.ts +3 -2
- package/project/plugins/plugin-registry.js +4 -2
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +7 -2
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +3 -1
- package/project/sigdb/build.d.ts +131 -0
- package/project/sigdb/build.js +628 -0
- package/project/sigdb/codec.d.ts +51 -0
- package/project/sigdb/codec.js +122 -0
- package/project/sigdb/decode.d.ts +58 -0
- package/project/sigdb/decode.js +129 -0
- package/project/sigdb/decompress.d.ts +44 -0
- package/project/sigdb/decompress.js +176 -0
- package/project/sigdb/hash.d.ts +9 -0
- package/project/sigdb/hash.js +54 -0
- package/project/sigdb/index-format.d.ts +40 -0
- package/project/sigdb/index-format.js +28 -0
- package/project/sigdb/manifest.d.ts +68 -0
- package/project/sigdb/manifest.js +146 -0
- package/project/sigdb/reader.d.ts +250 -0
- package/project/sigdb/reader.js +692 -0
- package/project/sigdb/schema.d.ts +196 -0
- package/project/sigdb/schema.js +33 -0
- package/project/sigdb/sigdb-download.d.ts +65 -0
- package/project/sigdb/sigdb-download.js +237 -0
- package/project/sigdb/signature-match.d.ts +26 -0
- package/project/sigdb/signature-match.js +40 -0
- package/project/sigdb/version.d.ts +20 -0
- package/project/sigdb/version.js +55 -0
- package/queries/catalog/absint-query/absint-query-executor.d.ts +6 -0
- package/queries/catalog/absint-query/absint-query-executor.js +63 -0
- package/queries/catalog/absint-query/absint-query-format.d.ts +37 -0
- package/queries/catalog/absint-query/absint-query-format.js +102 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +1 -3
- package/queries/catalog/config-query/config-query-format.d.ts +3 -1
- package/queries/catalog/config-query/config-query-format.js +68 -9
- package/queries/catalog/dataflow-query/dataflow-query-format.js +11 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
- package/queries/catalog/linter-query/linter-query-executor.d.ts +2 -0
- package/queries/catalog/linter-query/linter-query-executor.js +6 -1
- package/queries/catalog/linter-query/linter-query-format.d.ts +2 -1
- package/queries/catalog/linter-query/linter-query-format.js +40 -8
- package/queries/catalog/project-query/project-query-executor.d.ts +15 -0
- package/queries/catalog/project-query/project-query-executor.js +96 -4
- package/queries/catalog/project-query/project-query-format.d.ts +44 -0
- package/queries/catalog/project-query/project-query-format.js +33 -2
- package/queries/catalog/signature-query/signature-query-executor.d.ts +29 -0
- package/queries/catalog/signature-query/signature-query-executor.js +461 -0
- package/queries/catalog/signature-query/signature-query-format.d.ts +138 -0
- package/queries/catalog/signature-query/signature-query-format.js +76 -0
- package/queries/catalog/signature-query/signature-query-render.d.ts +15 -0
- package/queries/catalog/signature-query/signature-query-render.js +155 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +9 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +10 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +19 -1
- package/queries/query-print.js +5 -0
- package/queries/query.d.ts +15 -5
- package/queries/query.js +7 -4
- package/r-bridge/init.js +5 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +10 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +55 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +16 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +27 -0
- package/r-bridge/lang-4.x/ast/parser/json/format.js +89 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +2 -1
- package/r-bridge/parser.d.ts +2 -0
- package/r-bridge/retriever.js +4 -1
- package/r-bridge/roxygen2/documentation-provider.js +2 -1
- package/r-bridge/shell.d.ts +5 -0
- package/r-bridge/shell.js +17 -1
- package/reconstruct/inline/source-inline-map.d.ts +48 -0
- package/reconstruct/inline/source-inline-map.js +94 -0
- package/reconstruct/reconstruct.d.ts +19 -2
- package/reconstruct/reconstruct.js +79 -16
- package/search/search-executor/search-generators.js +5 -22
- package/search/search-executor/search-transformer.js +10 -6
- package/slicing/criterion/parse.d.ts +28 -4
- package/slicing/criterion/parse.js +133 -18
- package/slicing/static/slice-call.d.ts +24 -1
- package/slicing/static/slice-call.js +90 -0
- package/slicing/static/static-slicer.d.ts +7 -0
- package/slicing/static/static-slicer.js +38 -3
- package/util/collections/arrays.d.ts +4 -5
- package/util/collections/arrays.js +7 -18
- package/util/hash.d.ts +14 -0
- package/util/hash.js +31 -0
- package/util/mermaid/dfg.d.ts +7 -2
- package/util/mermaid/dfg.js +53 -13
- package/util/r-base-packages.d.ts +19 -0
- package/util/r-base-packages.js +72 -0
- package/util/r-license.js +2 -10
- package/util/r-version.d.ts +45 -15
- package/util/r-version.js +97 -36
- package/util/range.d.ts +15 -0
- package/util/range.js +39 -0
- package/util/schema.d.ts +10 -0
- package/util/schema.js +22 -0
- package/util/text/ansi.d.ts +3 -0
- package/util/text/ansi.js +10 -0
- package/util/text/args.js +1 -2
- package/util/version.js +28 -8
- package/data/pkgdb/pkgdb-latest.json.br +0 -0
- package/data/pkgdb/pkgdb-tiny.json.br +0 -0
- package/documentation/wiki-package-database.d.ts +0 -9
- package/documentation/wiki-package-database.js +0 -63
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +0 -63
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +0 -176
- package/project/plugins/package-version-plugins/pkgdb.d.ts +0 -133
- package/project/plugins/package-version-plugins/pkgdb.js +0 -370
- package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +0 -6
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +0 -58
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +0 -27
- package/queries/catalog/df-shape-query/df-shape-query-format.js +0 -56
|
@@ -9,6 +9,8 @@ const unnamed_call_handling_1 = require("../internal/process/functions/call/unna
|
|
|
9
9
|
const hooks_1 = require("../hooks");
|
|
10
10
|
const identifier_1 = require("./identifier");
|
|
11
11
|
const built_in_proc_name_1 = require("./built-in-proc-name");
|
|
12
|
+
const known_call_handling_1 = require("../internal/process/functions/call/known-call-handling");
|
|
13
|
+
const data_masking_functions_1 = require("./data-masking-functions");
|
|
12
14
|
/** Which stack environment an env-returning/-transforming builtin denotes (see {@link StackEnvBuiltins}). */
|
|
13
15
|
var StackEnvKind;
|
|
14
16
|
(function (StackEnvKind) {
|
|
@@ -144,11 +146,34 @@ exports.DefaultBuiltinConfig = [
|
|
|
144
146
|
value: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], assumePrimitive: true },
|
|
145
147
|
{ type: 'constant', names: [identifier_1.Identifier.from(['month.name', "base" /* PkgName.Base */])],
|
|
146
148
|
value: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], assumePrimitive: true },
|
|
149
|
+
/* formula: operands are model terms/columns, not variables (NSE) */
|
|
150
|
+
{
|
|
151
|
+
type: 'function',
|
|
152
|
+
names: [identifier_1.Identifier.from(['~', "base" /* PkgName.Base */])],
|
|
153
|
+
processor: built_in_proc_name_1.BuiltInProcName.DefaultReadAllArgs,
|
|
154
|
+
config: { markArgsAsNSE: known_call_handling_1.NseArguments.All },
|
|
155
|
+
assumePrimitive: false
|
|
156
|
+
},
|
|
157
|
+
/* data-masking: the non-data arguments name columns of the (first) data object, not variables (NSE) */
|
|
158
|
+
{
|
|
159
|
+
type: 'function',
|
|
160
|
+
names: data_masking_functions_1.DataMaskingFunctionIdentifiers,
|
|
161
|
+
processor: built_in_proc_name_1.BuiltInProcName.Default,
|
|
162
|
+
config: { markArgsAsNSE: known_call_handling_1.NseArguments.AllButFirst },
|
|
163
|
+
assumePrimitive: false
|
|
164
|
+
},
|
|
165
|
+
/* data-masking without a data argument, e.g. `aes(x, y)` */
|
|
166
|
+
{
|
|
167
|
+
type: 'function',
|
|
168
|
+
names: [identifier_1.Identifier.from(['aes', "ggplot2" /* PkgName.GgPlot2 */]), identifier_1.Identifier.from(['aes_string', "ggplot2" /* PkgName.GgPlot2 */]), identifier_1.Identifier.from(['vars', "ggplot2" /* PkgName.GgPlot2 */])],
|
|
169
|
+
processor: built_in_proc_name_1.BuiltInProcName.DefaultReadAllArgs,
|
|
170
|
+
config: { markArgsAsNSE: known_call_handling_1.NseArguments.All },
|
|
171
|
+
assumePrimitive: false
|
|
172
|
+
},
|
|
147
173
|
{
|
|
148
174
|
type: 'function',
|
|
149
175
|
names: [
|
|
150
176
|
/* arithmetic & comparison operators (base) */
|
|
151
|
-
identifier_1.Identifier.from(['~', "base" /* PkgName.Base */]),
|
|
152
177
|
identifier_1.Identifier.from(['+', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['-', "base" /* PkgName.Base */]),
|
|
153
178
|
identifier_1.Identifier.from(['*', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['/', "base" /* PkgName.Base */]),
|
|
154
179
|
identifier_1.Identifier.from(['^', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['**', "base" /* PkgName.Base */]),
|
|
@@ -182,7 +207,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
182
207
|
identifier_1.Identifier.from(['as.data.frame', "base" /* PkgName.Base */]),
|
|
183
208
|
/* collections & data (base) */
|
|
184
209
|
identifier_1.Identifier.from(['unique', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['intersect', "base" /* PkgName.Base */]),
|
|
185
|
-
identifier_1.Identifier.from(['
|
|
210
|
+
identifier_1.Identifier.from(['match', "base" /* PkgName.Base */]),
|
|
186
211
|
identifier_1.Identifier.from(['which', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['any', "base" /* PkgName.Base */]),
|
|
187
212
|
identifier_1.Identifier.from(['length', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['expression', "base" /* PkgName.Base */]),
|
|
188
213
|
identifier_1.Identifier.from(['factor', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['missing', "base" /* PkgName.Base */]),
|
|
@@ -230,9 +255,11 @@ exports.DefaultBuiltinConfig = [
|
|
|
230
255
|
{ type: 'function', names: [identifier_1.Identifier.from(['apply', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['tapply', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['Tapply', "functools" /* PkgName.Functools */])],
|
|
231
256
|
processor: built_in_proc_name_1.BuiltInProcName.Apply, config: { indexOfFunction: 2, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
|
|
232
257
|
{ type: 'function', names: [identifier_1.Identifier.from(['print', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['message', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['warning', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['warn', "rlang" /* PkgName.Rlang */]), identifier_1.Identifier.from(['warn', "R.utils" /* PkgName.Rutils */]), identifier_1.Identifier.from(['info', "msgr" /* PkgName.Msgr */])],
|
|
233
|
-
processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, forceArgs: 'all', hasUnknownSideEffects: { type: 'link-to-last-call', callName: /^sink$/ } }, assumePrimitive: false },
|
|
258
|
+
processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, forceArgs: 'all', keepArgumentOut: true, hasUnknownSideEffects: { type: 'link-to-last-call', callName: /^sink$/ } }, assumePrimitive: false },
|
|
234
259
|
{ type: 'function', names: [identifier_1.Identifier.from(['invisible', "base" /* PkgName.Base */])],
|
|
235
|
-
processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, forceArgs: 'all' }, assumePrimitive: true },
|
|
260
|
+
processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, forceArgs: 'all', keepArgumentOut: true }, assumePrimitive: true },
|
|
261
|
+
{ type: 'function', names: [identifier_1.Identifier.from(['force', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['identity', "base" /* PkgName.Base */])],
|
|
262
|
+
processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, forceArgs: 'all', keepArgumentOut: true }, assumePrimitive: false },
|
|
236
263
|
// graphics base
|
|
237
264
|
{ type: 'function', names: exports.PlotCreate,
|
|
238
265
|
processor: built_in_proc_name_1.BuiltInProcName.Default,
|
|
@@ -321,7 +348,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
321
348
|
}, assumePrimitive: true
|
|
322
349
|
},
|
|
323
350
|
{ type: 'function', names: ['('],
|
|
324
|
-
processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0 }, assumePrimitive: true },
|
|
351
|
+
processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, keepArgumentOut: true }, assumePrimitive: true },
|
|
325
352
|
{ type: 'function', names: [identifier_1.Identifier.from(['load_all', "pkgload" /* PkgName.PkgLoad */]), identifier_1.Identifier.from(['load_all', "devtools" /* PkgName.Devtools */]), identifier_1.Identifier.from(['setwd', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['set.seed', "base" /* PkgName.Base */])],
|
|
326
353
|
processor: built_in_proc_name_1.BuiltInProcName.Default, config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: false },
|
|
327
354
|
{ type: 'function', names: [identifier_1.Identifier.from(['body', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['formals', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['environment', "base" /* PkgName.Base */])],
|
|
@@ -333,6 +360,8 @@ exports.DefaultBuiltinConfig = [
|
|
|
333
360
|
config: {
|
|
334
361
|
hasUnknownSideEffects: true,
|
|
335
362
|
forceArgs: [true],
|
|
363
|
+
/* first arg names a native routine (useDynLib), not a variable */
|
|
364
|
+
markArgsAsNSE: known_call_handling_1.NseArguments.First,
|
|
336
365
|
treatAsFnCall: {
|
|
337
366
|
'.Call': ['.NAME'],
|
|
338
367
|
'.External': ['.NAME'],
|
|
@@ -351,7 +380,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
351
380
|
{ type: 'function', names: [identifier_1.Identifier.from(['switch', "base" /* PkgName.Base */])],
|
|
352
381
|
processor: built_in_proc_name_1.BuiltInProcName.Default, config: { forceArgs: [true] }, assumePrimitive: false },
|
|
353
382
|
{ type: 'function', names: ['return'],
|
|
354
|
-
processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, cfg: 1 /* ExitPointType.Return */, useAsProcessor: built_in_proc_name_1.BuiltInProcName.Return }, assumePrimitive: true },
|
|
383
|
+
processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, cfg: 1 /* ExitPointType.Return */, keepArgumentOut: true, useAsProcessor: built_in_proc_name_1.BuiltInProcName.Return }, assumePrimitive: true },
|
|
355
384
|
{
|
|
356
385
|
type: 'function',
|
|
357
386
|
names: [
|
|
@@ -422,6 +451,8 @@ exports.DefaultBuiltinConfig = [
|
|
|
422
451
|
processor: built_in_proc_name_1.BuiltInProcName.Assignment, config: { swapSourceAndTarget: true, canBeReplacement: true }, assumePrimitive: true },
|
|
423
452
|
{ type: 'function', names: ['->>'],
|
|
424
453
|
processor: built_in_proc_name_1.BuiltInProcName.Assignment, config: { superAssignment: true, swapSourceAndTarget: true, canBeReplacement: true }, assumePrimitive: true },
|
|
454
|
+
{ type: 'function', names: [identifier_1.Identifier.from(['data', "utils" /* PkgName.Utils */]), identifier_1.Identifier.from(['getHdata', "Hmisc" /* PkgName.Hmisc */])],
|
|
455
|
+
processor: built_in_proc_name_1.BuiltInProcName.DefineArgument, config: { superAssignment: true }, assumePrimitive: false },
|
|
425
456
|
{ type: 'function', names: [identifier_1.Identifier.from(['&&', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['&', "base" /* PkgName.Base */])],
|
|
426
457
|
processor: built_in_proc_name_1.BuiltInProcName.SpecialBinOp, config: { lazy: true, evalRhsWhen: true }, assumePrimitive: true },
|
|
427
458
|
{ type: 'function', names: [identifier_1.Identifier.from(['||', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['|', "base" /* PkgName.Base */])],
|
|
@@ -562,13 +593,6 @@ exports.DefaultBuiltinConfig = [
|
|
|
562
593
|
'.f': { index: 1, name: '.fns' },
|
|
563
594
|
ignore: ['.names', '.unpack']
|
|
564
595
|
} },
|
|
565
|
-
{ type: 'function', names: [identifier_1.Identifier.from(['filter', "dplyr" /* PkgName.Dplyr */]), identifier_1.Identifier.from(['filter_out', "janitor" /* PkgName.Janitor */])], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
566
|
-
args: {
|
|
567
|
-
'.x': { index: 0, name: '.data' },
|
|
568
|
-
},
|
|
569
|
-
'.f': { index: 1, name: '...' },
|
|
570
|
-
ignore: ['.by', '.preserve']
|
|
571
|
-
} },
|
|
572
596
|
{ type: 'function', names: [identifier_1.Identifier.from(['rename_with', "dplyr" /* PkgName.Dplyr */])], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
573
597
|
args: {
|
|
574
598
|
'.x': { index: 0, name: '.data' },
|
|
@@ -622,6 +646,16 @@ exports.DefaultBuiltinConfig = [
|
|
|
622
646
|
processor: built_in_proc_name_1.BuiltInProcName.S7NewGeneric, config: { args: { name: 'name', dispatchArg: undefined, fun: 'fun' } }, assumePrimitive: true },
|
|
623
647
|
{ type: 'function', names: [identifier_1.Identifier.from(['S7_dispatch', "S7" /* PkgName.S7 */])],
|
|
624
648
|
processor: built_in_proc_name_1.BuiltInProcName.S7Dispatch, config: { libFn: true }, assumePrimitive: true },
|
|
649
|
+
{ type: 'function', names: [
|
|
650
|
+
identifier_1.Identifier.from(['make_constructor', "ggplot2" /* PkgName.GgPlot2 */]),
|
|
651
|
+
identifier_1.Identifier.from(['new_class', "S7" /* PkgName.S7 */])
|
|
652
|
+
], processor: built_in_proc_name_1.BuiltInProcName.S7MakeConstructor, config: { mode: ['s7'] }, assumePrimitive: true },
|
|
653
|
+
{ type: 'function', names: [identifier_1.Identifier.from(['setClass', "methods" /* PkgName.Methods */])],
|
|
654
|
+
processor: built_in_proc_name_1.BuiltInProcName.S7MakeConstructor, config: { mode: ['s4'] }, assumePrimitive: true },
|
|
655
|
+
{ type: 'function', names: [
|
|
656
|
+
identifier_1.Identifier.from(['Negate', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['Vectorize', "base" /* PkgName.Base */]),
|
|
657
|
+
identifier_1.Identifier.from(['partial', "purrr" /* PkgName.Purrr */])
|
|
658
|
+
], processor: built_in_proc_name_1.BuiltInProcName.S7MakeConstructor, config: {}, assumePrimitive: true },
|
|
625
659
|
{ type: 'function', names: [identifier_1.Identifier.from(['.Primitive', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['.Internal', "base" /* PkgName.Base */])],
|
|
626
660
|
processor: built_in_proc_name_1.BuiltInProcName.Apply, config: { indexOfFunction: 0, unquoteFunction: true, resolveInEnvironment: 'global' }, assumePrimitive: true },
|
|
627
661
|
{ type: 'function', names: [identifier_1.Identifier.from(['interference', "inferference" /* PkgName.Inferference */])],
|
|
@@ -662,7 +696,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
662
696
|
/* library/require/(require|load|attach)Namespace/use are handled above */
|
|
663
697
|
identifier_1.Identifier.from(['asNamespace', "base" /* PkgName.Base */]),
|
|
664
698
|
/* env attachment */
|
|
665
|
-
identifier_1.Identifier.from(['unname', "base" /* PkgName.Base */]),
|
|
699
|
+
identifier_1.Identifier.from(['unname', "base" /* PkgName.Base */]),
|
|
666
700
|
/* file creation/removal (base) */
|
|
667
701
|
identifier_1.Identifier.from(['dir.create', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['dir_create', "fs" /* PkgName.Fs */]),
|
|
668
702
|
identifier_1.Identifier.from(['Sys.chmod', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['unlink', "base" /* PkgName.Base */]),
|
|
@@ -76,7 +76,7 @@ function diffEnvironment(a, b, info, depth) {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
diffMemory(a, b, { ...info, position: `${info.position}[at level: ${depth}] ` });
|
|
79
|
-
diffEnvironment(a.parent, b.parent, { ...info, position: `${info.position}Parents of ${a.id} & ${b.id}. ` }, depth
|
|
79
|
+
diffEnvironment(a.parent, b.parent, { ...info, position: `${info.position}Parents of ${a.id} & ${b.id}. ` }, depth - 1);
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
82
|
* Compares two REnvironmentInformation objects and reports differences.
|
|
@@ -213,8 +213,7 @@ class Environment {
|
|
|
213
213
|
const updated = old?.slice() ?? [];
|
|
214
214
|
for (const v of values) {
|
|
215
215
|
const { nodeId, definedAt } = v;
|
|
216
|
-
|
|
217
|
-
if (index) {
|
|
216
|
+
if (updated.some(o => o.nodeId === nodeId && o.definedAt === definedAt)) {
|
|
218
217
|
continue;
|
|
219
218
|
}
|
|
220
219
|
if (applyCds === undefined) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BuiltInIdentifierConstant, BuiltInIdentifierDefinition } from './built-in';
|
|
2
|
-
import
|
|
2
|
+
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
3
3
|
import type { ControlDependency } from '../info';
|
|
4
4
|
import type { REnvironmentInformation } from './environment';
|
|
5
5
|
import type { Origin } from '../origin/dfg-get-origin';
|
|
@@ -113,12 +113,17 @@ export declare const Identifier: {
|
|
|
113
113
|
readonly toArray: (this: void, id: Identifier) => [BrandedIdentifier, BrandedNamespace | undefined, boolean | undefined];
|
|
114
114
|
/**
|
|
115
115
|
* The qualified identifier of a call from its dataflow {@link Origin}s (via `getOriginInDfg`), if it
|
|
116
|
-
* resolves to an export of a loaded package (the
|
|
116
|
+
* resolves to an export of a loaded package (the signature-database info attached by `library()`/`use()`);
|
|
117
117
|
* `undefined` otherwise. With `purrr` loaded, `map()` yields `Identifier.make('map', 'purrr')`.
|
|
118
|
+
*
|
|
119
|
+
* Pass the call's `name` to additionally get *edge-free* base-R qualification: a bare base call is qualified
|
|
120
|
+
* from the base package that exports it (`sd` yields `stats::sd`, `plot` yields `base::plot`) via the
|
|
121
|
+
* precomputed {@link baseRExportOwner} store -- no loaded database, no graph edges. This is suppressed when
|
|
122
|
+
* the call resolves to a user definition or is already namespaced, so a local `sd()` is never `stats::sd`.
|
|
118
123
|
*/
|
|
119
|
-
readonly toQualified: (this: void, origins: readonly Origin[] | undefined) => Identifier | undefined;
|
|
124
|
+
readonly toQualified: (this: void, origins: readonly Origin[] | undefined, name?: Identifier) => Identifier | undefined;
|
|
120
125
|
/** The fully qualified `package::name` of a resolved call (see {@link Identifier.toQualified}). */
|
|
121
|
-
readonly toQualifiedName: (this: void, origins: readonly Origin[] | undefined) => string | undefined;
|
|
126
|
+
readonly toQualifiedName: (this: void, origins: readonly Origin[] | undefined, name?: Identifier) => string | undefined;
|
|
122
127
|
};
|
|
123
128
|
/**
|
|
124
129
|
* Well-known R package names used in {@link DefaultBuiltinConfig}.
|
|
@@ -141,6 +146,7 @@ export declare const enum PkgName {
|
|
|
141
146
|
Fs = "fs",
|
|
142
147
|
Functools = "functools",
|
|
143
148
|
GgPlot2 = "ggplot2",
|
|
149
|
+
Hmisc = "Hmisc",
|
|
144
150
|
Import = "import",
|
|
145
151
|
Inferference = "inferference",
|
|
146
152
|
Janitor = "janitor",
|
|
@@ -161,6 +167,7 @@ export declare const enum PkgName {
|
|
|
161
167
|
S7 = "S7",
|
|
162
168
|
Soda = "SoDA",
|
|
163
169
|
Testthat = "testthat",
|
|
170
|
+
TidyR = "tidyr",
|
|
164
171
|
TinyPlot = "tinyplot",
|
|
165
172
|
TryCatchLog = "tryCatchLog"
|
|
166
173
|
}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReferenceTypeReverseMapping = exports.ReferenceType = exports.Identifier = void 0;
|
|
4
4
|
exports.isReferenceType = isReferenceType;
|
|
5
|
+
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
5
6
|
const strings_1 = require("../../util/text/strings");
|
|
7
|
+
const r_base_packages_1 = require("../../util/r-base-packages");
|
|
6
8
|
const dotDotDotAccess = /^\.\.\d+$/;
|
|
7
9
|
/**
|
|
8
10
|
* Helper functions to work with {@link Identifier|identifiers}.
|
|
@@ -191,25 +193,41 @@ exports.Identifier = {
|
|
|
191
193
|
},
|
|
192
194
|
/**
|
|
193
195
|
* The qualified identifier of a call from its dataflow {@link Origin}s (via `getOriginInDfg`), if it
|
|
194
|
-
* resolves to an export of a loaded package (the
|
|
196
|
+
* resolves to an export of a loaded package (the signature-database info attached by `library()`/`use()`);
|
|
195
197
|
* `undefined` otherwise. With `purrr` loaded, `map()` yields `Identifier.make('map', 'purrr')`.
|
|
198
|
+
*
|
|
199
|
+
* Pass the call's `name` to additionally get *edge-free* base-R qualification: a bare base call is qualified
|
|
200
|
+
* from the base package that exports it (`sd` yields `stats::sd`, `plot` yields `base::plot`) via the
|
|
201
|
+
* precomputed {@link baseRExportOwner} store -- no loaded database, no graph edges. This is suppressed when
|
|
202
|
+
* the call resolves to a user definition or is already namespaced, so a local `sd()` is never `stats::sd`.
|
|
196
203
|
*/
|
|
197
|
-
toQualified(origins) {
|
|
204
|
+
toQualified(origins, name) {
|
|
205
|
+
let sawUserDefinition = false;
|
|
198
206
|
for (const origin of origins ?? []) {
|
|
199
|
-
//
|
|
200
|
-
if ('proc' in origin
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return exports.Identifier.make(rest.slice(sep + 1), rest.slice(0, sep));
|
|
207
|
+
// an attached package export carries the target builtin id `built-in:pkg:func` in `proc`
|
|
208
|
+
if ('proc' in origin) {
|
|
209
|
+
const pkgFn = node_id_1.NodeId.toPkgFn(origin.proc); // [pkg, func], or undefined for a bare/processor-level builtin
|
|
210
|
+
if (pkgFn) {
|
|
211
|
+
return exports.Identifier.make(pkgFn[1], pkgFn[0]);
|
|
205
212
|
}
|
|
206
213
|
}
|
|
214
|
+
else {
|
|
215
|
+
sawUserDefinition = true; // a function-call/variable origin: resolves to a user definition
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
// only qualify a bare base call: never override a user definition, nor an explicitly namespaced call
|
|
219
|
+
if (name !== undefined && !sawUserDefinition && exports.Identifier.getNamespace(name) === undefined) {
|
|
220
|
+
const bare = exports.Identifier.getName(name);
|
|
221
|
+
const owner = (0, r_base_packages_1.baseRExportOwner)(bare);
|
|
222
|
+
if (owner !== undefined) {
|
|
223
|
+
return exports.Identifier.make(bare, owner);
|
|
224
|
+
}
|
|
207
225
|
}
|
|
208
226
|
return undefined;
|
|
209
227
|
},
|
|
210
228
|
/** The fully qualified `package::name` of a resolved call (see {@link Identifier.toQualified}). */
|
|
211
|
-
toQualifiedName(origins) {
|
|
212
|
-
const qualified = exports.Identifier.toQualified(origins);
|
|
229
|
+
toQualifiedName(origins, name) {
|
|
230
|
+
const qualified = exports.Identifier.toQualified(origins, name);
|
|
213
231
|
return qualified === undefined ? undefined : exports.Identifier.toString(qualified);
|
|
214
232
|
}
|
|
215
233
|
};
|
|
@@ -47,6 +47,11 @@ function resolveByName(id, environment, target) {
|
|
|
47
47
|
}
|
|
48
48
|
const [name, ns, internal] = identifier_1.Identifier.toArray(id);
|
|
49
49
|
let current = environment.current;
|
|
50
|
+
/* `current` can already be the built-in environment itself (e.g. `get(x, envir=baseenv())`);
|
|
51
|
+
* it has no parent to walk to, so resolve directly instead of entering the loop below. */
|
|
52
|
+
if (current.builtInEnv) {
|
|
53
|
+
return current.memory.get(name);
|
|
54
|
+
}
|
|
50
55
|
let definitions = undefined;
|
|
51
56
|
const wantedType = TargetTypePredicate[target];
|
|
52
57
|
do {
|
|
@@ -57,9 +62,9 @@ function resolveByName(id, environment, target) {
|
|
|
57
62
|
let definition;
|
|
58
63
|
if (target === identifier_1.ReferenceType.S3MethodPrefix || target === identifier_1.ReferenceType.S7MethodPrefix) {
|
|
59
64
|
// S3 method prefixes only resolve to functions, S3s must not match the exported criteria!
|
|
60
|
-
const
|
|
65
|
+
const prefix = name + (target === identifier_1.ReferenceType.S3MethodPrefix ? '.' : built_in_s_seven_dispatch_1.S7DispatchSeparator);
|
|
61
66
|
definition = current.memory.entries()
|
|
62
|
-
.filter(([defName]) => defName.startsWith(
|
|
67
|
+
.filter(([defName]) => defName.startsWith(prefix))
|
|
63
68
|
.flatMap(([, defs]) => defs)
|
|
64
69
|
.toArray();
|
|
65
70
|
}
|
|
@@ -107,6 +112,15 @@ function resolveByNameAnyType(id, environment) {
|
|
|
107
112
|
}
|
|
108
113
|
}
|
|
109
114
|
const [name, ns, internal] = identifier_1.Identifier.toArray(id);
|
|
115
|
+
/* `current` can already be the built-in environment itself */
|
|
116
|
+
if (current.builtInEnv) {
|
|
117
|
+
const ret = current.memory.get(name);
|
|
118
|
+
if (ret && cacheable) {
|
|
119
|
+
current.cache ??= new Map();
|
|
120
|
+
current.cache.set(id, ret);
|
|
121
|
+
}
|
|
122
|
+
return ret;
|
|
123
|
+
}
|
|
110
124
|
let definitions = undefined;
|
|
111
125
|
do {
|
|
112
126
|
if (layerSkipped(current, ns)) {
|
package/dataflow/extractor.js
CHANGED
|
@@ -14,6 +14,7 @@ const named_call_handling_1 = require("./internal/process/functions/call/named-c
|
|
|
14
14
|
const make_argument_1 = require("./internal/process/functions/call/argument/make-argument");
|
|
15
15
|
const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
|
|
16
16
|
const built_in_source_1 = require("./internal/process/functions/call/built-in/built-in-source");
|
|
17
|
+
const built_in_library_1 = require("./internal/process/functions/call/built-in/built-in-library");
|
|
17
18
|
const extract_cfg_1 = require("../control-flow/extract-cfg");
|
|
18
19
|
const edge_1 = require("./graph/edge");
|
|
19
20
|
const identify_link_to_last_call_relation_1 = require("../queries/catalog/call-context-query/identify-link-to-last-call-relation");
|
|
@@ -38,8 +39,8 @@ exports.processors = {
|
|
|
38
39
|
[type_1.RType.LineDirective]: process_uninteresting_leaf_1.processUninterestingLeaf,
|
|
39
40
|
[type_1.RType.Symbol]: process_symbol_1.processSymbol,
|
|
40
41
|
[type_1.RType.Access]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.operator, [n.accessed, ...n.access]),
|
|
41
|
-
[type_1.RType.BinaryOp]:
|
|
42
|
-
[type_1.RType.Pipe]:
|
|
42
|
+
[type_1.RType.BinaryOp]: process_named_call_1.processChainedCall,
|
|
43
|
+
[type_1.RType.Pipe]: process_named_call_1.processChainedCall,
|
|
43
44
|
[type_1.RType.UnaryOp]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.operator, [n.operand]),
|
|
44
45
|
[type_1.RType.ForLoop]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.lexeme, [n.variable, n.vector, n.body]),
|
|
45
46
|
[type_1.RType.WhileLoop]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.lexeme, [n.condition, n.body]),
|
|
@@ -125,10 +126,12 @@ function produceDataFlowGraph(parser, completeAst, ctx) {
|
|
|
125
126
|
ctx.files.addConsideredFile(files[0].filePath ? files[0].filePath : flowr_file_1.FlowrFile.INLINE_PATH);
|
|
126
127
|
const env = ctx.env.makeCleanEnv();
|
|
127
128
|
env.current.n = ctx.meta.getNamespace();
|
|
129
|
+
// eagerly attach the always-available base-R namespaces, then the project's declared DESCRIPTION dependencies
|
|
130
|
+
const environment = (0, built_in_library_1.attachDeclaredDependencies)((0, built_in_library_1.attachBaseRNamespaces)(env, ctx), ctx);
|
|
128
131
|
const dfData = {
|
|
129
132
|
parser,
|
|
130
133
|
completeAst,
|
|
131
|
-
environment
|
|
134
|
+
environment,
|
|
132
135
|
processors: ctx.config.solver.instrument.dataflowExtractors?.(exports.processors, ctx) ?? exports.processors,
|
|
133
136
|
cds: undefined,
|
|
134
137
|
referenceChain: [files[0].filePath],
|
|
@@ -42,8 +42,8 @@ export declare const CallGraph: {
|
|
|
42
42
|
string: string;
|
|
43
43
|
mermaid: import("../../util/mermaid/dfg").MermaidGraph;
|
|
44
44
|
};
|
|
45
|
-
readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
|
|
46
|
-
readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
|
|
45
|
+
readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
|
|
46
|
+
readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
|
|
47
47
|
};
|
|
48
48
|
readonly quads: {
|
|
49
49
|
readonly convert: typeof import("./quads").df2quads;
|
|
@@ -52,8 +52,8 @@ export declare const Dataflow: {
|
|
|
52
52
|
string: string;
|
|
53
53
|
mermaid: import("../../util/mermaid/dfg").MermaidGraph;
|
|
54
54
|
};
|
|
55
|
-
readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
|
|
56
|
-
readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
|
|
55
|
+
readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
|
|
56
|
+
readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
|
|
57
57
|
};
|
|
58
58
|
readonly quads: {
|
|
59
59
|
readonly convert: typeof import("./quads").df2quads;
|
|
@@ -137,8 +137,8 @@ export declare const Dataflow: {
|
|
|
137
137
|
string: string;
|
|
138
138
|
mermaid: import("../../util/mermaid/dfg").MermaidGraph;
|
|
139
139
|
};
|
|
140
|
-
readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
|
|
141
|
-
readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
|
|
140
|
+
readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
|
|
141
|
+
readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
|
|
142
142
|
};
|
|
143
143
|
readonly quads: {
|
|
144
144
|
readonly convert: typeof import("./quads").df2quads;
|
|
@@ -115,8 +115,8 @@ function diffFunctionArguments(fn, a, b, ctx) {
|
|
|
115
115
|
*/
|
|
116
116
|
function diffVertices(ctx) {
|
|
117
117
|
// collect vertices from both sides
|
|
118
|
-
const lVert = ctx.left.vertices(true).
|
|
119
|
-
const rVert = ctx.right.vertices(true).
|
|
118
|
+
const lVert = ctx.left.vertices(true).toArray();
|
|
119
|
+
const rVert = ctx.right.vertices(true).toArray();
|
|
120
120
|
if (lVert.length < rVert.length && !ctx.config.leftIsSubgraph
|
|
121
121
|
|| lVert.length > rVert.length && !ctx.config.rightIsSubgraph) {
|
|
122
122
|
ctx.report.addComment(`Detected different number of vertices! ${ctx.leftname} has ${lVert.length}, ${ctx.rightname} has ${rVert.length}`);
|
package/dataflow/graph/edge.d.ts
CHANGED
|
@@ -45,9 +45,9 @@ export declare const enum EdgeTypeName {
|
|
|
45
45
|
DefinedBy = "defined-by",
|
|
46
46
|
Calls = "calls",
|
|
47
47
|
Returns = "returns",
|
|
48
|
-
DefinesOnCall = "
|
|
49
|
-
DefinedByOnCall = "
|
|
50
|
-
Argument = "
|
|
48
|
+
DefinesOnCall = "def-on-call",
|
|
49
|
+
DefinedByOnCall = "def-by-on-call",
|
|
50
|
+
Argument = "arg",
|
|
51
51
|
SideEffectOnCall = "side-effect-on-call",
|
|
52
52
|
NonStandardEvaluation = "non-standard-evaluation"
|
|
53
53
|
}
|
package/dataflow/graph/edge.js
CHANGED
|
@@ -38,9 +38,9 @@ const edgeTypeToHumanReadableName = new Map([
|
|
|
38
38
|
[EdgeType.DefinedBy, "defined-by" /* EdgeTypeName.DefinedBy */],
|
|
39
39
|
[EdgeType.Calls, "calls" /* EdgeTypeName.Calls */],
|
|
40
40
|
[EdgeType.Returns, "returns" /* EdgeTypeName.Returns */],
|
|
41
|
-
[EdgeType.DefinesOnCall, "
|
|
42
|
-
[EdgeType.DefinedByOnCall, "
|
|
43
|
-
[EdgeType.Argument, "
|
|
41
|
+
[EdgeType.DefinesOnCall, "def-on-call" /* EdgeTypeName.DefinesOnCall */],
|
|
42
|
+
[EdgeType.DefinedByOnCall, "def-by-on-call" /* EdgeTypeName.DefinedByOnCall */],
|
|
43
|
+
[EdgeType.Argument, "arg" /* EdgeTypeName.Argument */],
|
|
44
44
|
[EdgeType.SideEffectOnCall, "side-effect-on-call" /* EdgeTypeName.SideEffectOnCall */],
|
|
45
45
|
[EdgeType.NonStandardEvaluation, "non-standard-evaluation" /* EdgeTypeName.NonStandardEvaluation */]
|
|
46
46
|
]);
|
|
@@ -29,8 +29,8 @@ export declare const GraphHelper: {
|
|
|
29
29
|
string: string;
|
|
30
30
|
mermaid: import("../../util/mermaid/dfg").MermaidGraph;
|
|
31
31
|
};
|
|
32
|
-
readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
|
|
33
|
-
readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
|
|
32
|
+
readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
|
|
33
|
+
readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
|
|
34
34
|
};
|
|
35
35
|
readonly quads: {
|
|
36
36
|
readonly convert: typeof df2quads;
|
|
@@ -292,7 +292,7 @@ function linkFunctionCall(graph, id, info, idMap, thisGraph, calledFunctionDefin
|
|
|
292
292
|
functionDefinitionReadIds.add(t);
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
const [functionDefs] = getAllLinkedFunctionDefinitions(
|
|
295
|
+
const [functionDefs] = getAllLinkedFunctionDefinitions(functionDefinitionReadIds, graph);
|
|
296
296
|
const propagateExitPoints = [];
|
|
297
297
|
for (const def of functionDefs.values()) {
|
|
298
298
|
// we can skip this if we already linked it
|
|
@@ -68,6 +68,13 @@ export interface AssignmentToSymbolParameters<OtherInfo> extends AssignmentConfi
|
|
|
68
68
|
* @param data - The dataflow analysis fold backpack
|
|
69
69
|
* @param assignmentConfig - configuration for the assignment processing
|
|
70
70
|
*/
|
|
71
|
+
/**
|
|
72
|
+
* Model a call like `Hmisc::getHdata(x)` that loads a dataset into the variable it is *given*: the argument symbol
|
|
73
|
+
* `x` is both **read** (as the call's argument, its value comes from outside the code) and **defined** by the call.
|
|
74
|
+
* Unlike {@link markAsAssignment} we keep the read edge.
|
|
75
|
+
*/
|
|
76
|
+
export declare function processDefineArgument<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: AssignmentConfiguration): DataflowInformation;
|
|
77
|
+
/** 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). */
|
|
71
78
|
export declare function markAsAssignment<OtherInfo>(information: {
|
|
72
79
|
environment: REnvironmentInformation;
|
|
73
80
|
graph: DataflowGraph;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processAssignmentLike = processAssignmentLike;
|
|
4
4
|
exports.processAssignment = processAssignment;
|
|
5
|
+
exports.processDefineArgument = processDefineArgument;
|
|
5
6
|
exports.markAsAssignment = markAsAssignment;
|
|
6
7
|
const known_call_handling_1 = require("../known-call-handling");
|
|
7
8
|
const log_1 = require("../../../../../../util/log");
|
|
@@ -389,6 +390,25 @@ function tryRouteToCustomEnv(name, args, rootId, data, config) {
|
|
|
389
390
|
* @param data - The dataflow analysis fold backpack
|
|
390
391
|
* @param assignmentConfig - configuration for the assignment processing
|
|
391
392
|
*/
|
|
393
|
+
/**
|
|
394
|
+
* Model a call like `Hmisc::getHdata(x)` that loads a dataset into the variable it is *given*: the argument symbol
|
|
395
|
+
* `x` is both **read** (as the call's argument, its value comes from outside the code) and **defined** by the call.
|
|
396
|
+
* Unlike {@link markAsAssignment} we keep the read edge.
|
|
397
|
+
*/
|
|
398
|
+
function processDefineArgument(name, args, rootId, data, config) {
|
|
399
|
+
const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: built_in_proc_name_1.BuiltInProcName.DefineArgument });
|
|
400
|
+
const info = res.information;
|
|
401
|
+
const targetArg = res.processedArguments[0]; // the read argument, e.g. `prostate`
|
|
402
|
+
if (targetArg !== undefined) {
|
|
403
|
+
for (const node of produceWrittenNodes(rootId, targetArg, identifier_1.ReferenceType.Variable, data, false, undefined)) {
|
|
404
|
+
info.environment = (0, define_1.define)(node, config.superAssignment, info.environment);
|
|
405
|
+
info.graph.setDefinitionOfVertex(node, [rootId]);
|
|
406
|
+
info.graph.addEdge(node.nodeId, rootId, edge_1.EdgeType.DefinedBy); // defined by the call; the read edge is left intact
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return info;
|
|
410
|
+
}
|
|
411
|
+
/** 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). */
|
|
392
412
|
function markAsAssignment(information, nodeToDefine, sourceIds, rootIdOfAssignment, data, assignmentConfig) {
|
|
393
413
|
information.environment = (0, define_1.define)(nodeToDefine, assignmentConfig?.superAssignment, information.environment);
|
|
394
414
|
information.graph.setDefinitionOfVertex(nodeToDefine, sourceIds);
|
|
@@ -22,6 +22,7 @@ export interface EnvirResolution<OtherInfo> {
|
|
|
22
22
|
/**
|
|
23
23
|
* Binds call arguments to formal parameter names using R's matching rules: exact name, then partial (pmatch) name, then remaining unnamed args left-to-right.
|
|
24
24
|
* Pass `paramNames` as the full formal parameter list (excluding `...`) so ambiguous prefixes are rejected.
|
|
25
|
+
* Thin alias for {@link RFunctionCall.matchArgumentsToParameters}, which owns the (pure) matching logic.
|
|
25
26
|
*/
|
|
26
27
|
export declare function bindArgs<OtherInfo>(args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], paramNames: readonly string[]): ReadonlyMap<string, PotentiallyEmptyRArgument<OtherInfo & ParentInformation>>;
|
|
27
28
|
/** Resolves a single already-found argument (e.g. from {@link bindArgs}) to an {@link EnvirResolution} when it is a symbol holding a tracked envState. */
|
|
@@ -54,57 +54,10 @@ function resolveDefsToEnvirResolution(defs, nodeId, data) {
|
|
|
54
54
|
/**
|
|
55
55
|
* Binds call arguments to formal parameter names using R's matching rules: exact name, then partial (pmatch) name, then remaining unnamed args left-to-right.
|
|
56
56
|
* Pass `paramNames` as the full formal parameter list (excluding `...`) so ambiguous prefixes are rejected.
|
|
57
|
+
* Thin alias for {@link RFunctionCall.matchArgumentsToParameters}, which owns the (pure) matching logic.
|
|
57
58
|
*/
|
|
58
59
|
function bindArgs(args, paramNames) {
|
|
59
|
-
|
|
60
|
-
const used = new Set();
|
|
61
|
-
/* pass 1: exact name matches */
|
|
62
|
-
for (let i = 0; i < args.length; i++) {
|
|
63
|
-
const arg = args[i];
|
|
64
|
-
if (arg === r_function_call_1.EmptyArgument || arg.name === undefined) {
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
const n = arg.name.content;
|
|
68
|
-
if (paramNames.includes(n) && !bound.has(n)) {
|
|
69
|
-
bound.set(n, arg);
|
|
70
|
-
used.add(i);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
/* pass 2: partial (pmatch) name matches */
|
|
74
|
-
for (let i = 0; i < args.length; i++) {
|
|
75
|
-
if (used.has(i)) {
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
const arg = args[i];
|
|
79
|
-
if (arg === r_function_call_1.EmptyArgument || arg.name === undefined) {
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
const matched = (0, prefix_1.findByPrefixIfUnique)(arg.name.content, paramNames);
|
|
83
|
-
if (matched !== undefined && !bound.has(matched)) {
|
|
84
|
-
bound.set(matched, arg);
|
|
85
|
-
used.add(i);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
/* pass 3: remaining unnamed args fill remaining formal params left-to-right */
|
|
89
|
-
let formalIdx = 0;
|
|
90
|
-
for (let i = 0; i < args.length; i++) {
|
|
91
|
-
if (used.has(i)) {
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
const arg = args[i];
|
|
95
|
-
if (arg === r_function_call_1.EmptyArgument || arg.name !== undefined) {
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
while (formalIdx < paramNames.length && bound.has(paramNames[formalIdx])) {
|
|
99
|
-
formalIdx++;
|
|
100
|
-
}
|
|
101
|
-
if (formalIdx < paramNames.length) {
|
|
102
|
-
bound.set(paramNames[formalIdx], arg);
|
|
103
|
-
used.add(i);
|
|
104
|
-
formalIdx++;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return bound;
|
|
60
|
+
return r_function_call_1.RFunctionCall.matchArgsToParams(args, paramNames);
|
|
108
61
|
}
|
|
109
62
|
/** Resolves a single already-found argument (e.g. from {@link bindArgs}) to an {@link EnvirResolution} when it is a symbol holding a tracked envState. */
|
|
110
63
|
function resolveArgToEnvir(arg, data) {
|
|
@@ -104,7 +104,12 @@ function processFunctionDefinition(name, args, rootId, data) {
|
|
|
104
104
|
/* theoretically, we should just check if there is a global effect-write somewhere within */
|
|
105
105
|
if (remainingRead.length > 0) {
|
|
106
106
|
const nameIdShares = (0, linker_1.produceNameSharedIdMap)(remainingRead);
|
|
107
|
-
const definedInLocalEnvironment = new Set(
|
|
107
|
+
const definedInLocalEnvironment = new Set();
|
|
108
|
+
for (const defs of bodyEnvironment.current.memory.values()) {
|
|
109
|
+
for (const d of defs) {
|
|
110
|
+
definedInLocalEnvironment.add(d.nodeId);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
108
113
|
// Everything that is in body.out but not within the local environment populated for the function scope is a potential escape ~> global definition
|
|
109
114
|
const globalBodyOut = body.out.filter(d => !definedInLocalEnvironment.has(d.nodeId));
|
|
110
115
|
(0, linker_1.linkCircularRedefinitionsWithinALoop)(body.graph, nameIdShares, globalBodyOut);
|
|
@@ -55,7 +55,13 @@ function processGet(name, args, rootId, data) {
|
|
|
55
55
|
if (resolution) {
|
|
56
56
|
information.graph.addEdge(rootId, resolution.envirNodeId, edge_1.EdgeType.Reads);
|
|
57
57
|
}
|
|
58
|
+
const isolatedTarget = resolution?.envirData.environment.current.builtInEnv === true;
|
|
59
|
+
const readsToDrop = isolatedTarget && firstProcessed ? new Set([firstProcessed.entryPoint]) : undefined;
|
|
58
60
|
/* restore the caller's (global) environment so we don't leak envState upward */
|
|
59
|
-
return {
|
|
61
|
+
return {
|
|
62
|
+
...information,
|
|
63
|
+
in: readsToDrop ? information.in.filter(({ nodeId }) => !readsToDrop.has(nodeId)) : information.in,
|
|
64
|
+
environment: data.environment
|
|
65
|
+
};
|
|
60
66
|
}
|
|
61
67
|
//# sourceMappingURL=built-in-get.js.map
|