@eagleoutice/flowr 2.9.14 → 2.10.2
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 +52 -29
- package/abstract-interpretation/absint-visitor.d.ts +13 -8
- package/abstract-interpretation/absint-visitor.js +35 -26
- package/abstract-interpretation/data-frame/dataframe-domain.d.ts +1 -2
- package/abstract-interpretation/data-frame/dataframe-domain.js +14 -15
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +2 -15
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +11 -17
- package/abstract-interpretation/data-frame/mappers/arguments.js +18 -18
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +41 -15
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +74 -48
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +2 -1
- package/abstract-interpretation/data-frame/semantics.d.ts +1 -1
- package/abstract-interpretation/data-frame/semantics.js +31 -35
- package/abstract-interpretation/data-frame/shape-inference.js +1 -1
- package/abstract-interpretation/domains/interval-domain.d.ts +1 -0
- package/abstract-interpretation/domains/interval-domain.js +3 -0
- package/abstract-interpretation/domains/product-domain.d.ts +9 -0
- package/abstract-interpretation/domains/product-domain.js +26 -6
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +36 -22
- package/abstract-interpretation/domains/state-abstract-domain.js +169 -62
- package/abstract-interpretation/unsupported-functions.d.ts +10 -0
- package/abstract-interpretation/unsupported-functions.js +45 -0
- package/benchmark/slicer.js +10 -13
- package/benchmark/stats/stats.d.ts +2 -2
- package/cli/flowr.js +1 -1
- package/cli/repl/parser/slice-query-parser.d.ts +2 -2
- package/config.d.ts +4 -0
- package/config.js +5 -3
- package/control-flow/control-flow-graph.js +13 -9
- package/control-flow/semantic-cfg-guided-visitor.d.ts +6 -0
- package/control-flow/semantic-cfg-guided-visitor.js +6 -0
- package/dataflow/environments/built-in-proc-name.d.ts +6 -0
- package/dataflow/environments/built-in-proc-name.js +6 -0
- package/dataflow/environments/built-in.d.ts +7 -5
- package/dataflow/environments/built-in.js +2 -0
- package/dataflow/environments/default-builtin-config.d.ts +442 -6
- package/dataflow/environments/default-builtin-config.js +158 -3
- package/dataflow/environments/identifier.d.ts +4 -0
- package/dataflow/environments/identifier.js +17 -0
- package/dataflow/environments/overwrite.js +2 -5
- package/dataflow/graph/call-graph.d.ts +4 -7
- package/dataflow/graph/call-graph.js +0 -22
- package/dataflow/graph/df-helper.d.ts +23 -12
- package/dataflow/graph/df-helper.js +44 -7
- package/dataflow/graph/graph-helper.d.ts +9 -4
- package/dataflow/graph/graph-helper.js +26 -3
- package/dataflow/graph/graph.d.ts +23 -2
- package/dataflow/graph/graph.js +38 -4
- package/dataflow/graph/vertex.d.ts +2 -0
- package/dataflow/instrument/instrument-dataflow-count.d.ts +10 -0
- package/dataflow/instrument/instrument-dataflow-count.js +10 -0
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +8 -19
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +23 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +80 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +41 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +179 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +7 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +62 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.d.ts +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +15 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/common.d.ts +2 -2
- package/dataflow/internal/process/functions/call/common.js +6 -4
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +2 -2
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +2 -2
- package/dataflow/internal/process/functions/process-parameter.js +1 -1
- package/documentation/doc-readme.js +2 -1
- package/documentation/wiki-absint.js +6 -5
- package/documentation/wiki-analyzer.js +0 -2
- package/documentation/wiki-linter.js +6 -0
- package/documentation/wiki-normalized-ast.js +7 -7
- package/linter/linter-rules.d.ts +49 -1
- package/linter/linter-rules.js +5 -1
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +3 -4
- package/linter/rules/problematic-eval.d.ts +44 -0
- package/linter/rules/problematic-eval.js +83 -0
- package/linter/rules/roxygen-arguments.d.ts +35 -0
- package/linter/rules/roxygen-arguments.js +100 -0
- package/package.json +8 -9
- package/project/context/flowr-analyzer-context.d.ts +1 -8
- package/project/context/flowr-analyzer-context.js +1 -7
- package/project/context/flowr-analyzer-environment-context.d.ts +5 -0
- package/project/context/flowr-analyzer-environment-context.js +6 -0
- package/project/context/flowr-analyzer-files-context.d.ts +6 -0
- package/project/context/flowr-analyzer-files-context.js +4 -2
- package/project/flowr-analyzer-builder.js +1 -4
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +10 -5
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/library-functions.js +2 -0
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +3 -3
- package/queries/catalog/df-shape-query/df-shape-query-format.js +7 -2
- package/queries/catalog/does-call-query/does-call-query-executor.js +1 -1
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +2 -2
- package/queries/catalog/files-query/files-query-executor.js +0 -1
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +3 -3
- package/queries/catalog/input-sources-query/input-sources-query-executor.d.ts +6 -0
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +66 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +36 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.js +63 -0
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +92 -0
- package/queries/catalog/input-sources-query/simple-input-classifier.js +310 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +2 -2
- 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 +2 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -2
- package/queries/catalog/location-map-query/location-map-query-executor.js +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-executor.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-executor.js +1 -1
- package/queries/catalog/origin-query/origin-query-format.d.ts +3 -3
- package/queries/catalog/provenance-query/provenance-query-executor.d.ts +1 -4
- package/queries/catalog/provenance-query/provenance-query-executor.js +3 -6
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +1 -1
- package/queries/query.d.ts +9 -1
- package/queries/query.js +2 -0
- package/r-bridge/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/r-bridge/lang-4.x/ast/model/model.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/model.js +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +29 -6
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +16 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +15 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +15 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +19 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +21 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +16 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +25 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +15 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +2 -0
- package/r-bridge/lang-4.x/ast/model/versions.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/versions.js +3 -1
- package/r-bridge/roxygen2/documentation-provider.js +15 -6
- package/r-bridge/roxygen2/roxygen-ast.d.ts +3 -1
- package/search/flowr-search-builder.js +3 -2
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/parse.d.ts +11 -10
- package/slicing/criterion/parse.js +9 -8
- package/slicing/static/static-slicer.js +24 -1
- package/util/collections/arrays.d.ts +4 -0
- package/util/collections/arrays.js +7 -0
- package/util/mermaid/ast.js +2 -1
- package/util/mermaid/dfg.js +2 -1
- package/util/record.d.ts +23 -0
- package/util/record.js +33 -0
- package/util/version.js +1 -1
- package/abstract-interpretation/domains/mapped-abstract-domain.d.ts +0 -41
- package/abstract-interpretation/domains/mapped-abstract-domain.js +0 -213
|
@@ -132,6 +132,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
132
132
|
{ type: 'function', names: ['Lapply', 'Sapply', 'Vapply'], processor: built_in_proc_name_1.BuiltInProcName.Apply, config: { indexOfFunction: 1, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false }, /* functool wrappers */
|
|
133
133
|
{ type: 'function', names: ['apply', 'tapply', 'Tapply'], processor: built_in_proc_name_1.BuiltInProcName.Apply, config: { indexOfFunction: 2, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
|
|
134
134
|
{ type: 'function', names: ['print', 'message', 'warning', 'warn', 'info'], processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, forceArgs: 'all', hasUnknownSideEffects: { type: 'link-to-last-call', callName: /^sink$/ } }, assumePrimitive: false },
|
|
135
|
+
{ type: 'function', names: ['invisible'], processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, forceArgs: 'all' }, assumePrimitive: true },
|
|
135
136
|
// graphics base
|
|
136
137
|
{ type: 'function', names: exports.PlotCreate,
|
|
137
138
|
processor: built_in_proc_name_1.BuiltInProcName.Default,
|
|
@@ -254,7 +255,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
254
255
|
{ type: 'function', names: ['ifelse', 'fifelse', 'IfElse'], processor: built_in_proc_name_1.BuiltInProcName.IfThenElse, config: { args: { cond: 'test', yes: 'yes', no: 'no' } }, assumePrimitive: true },
|
|
255
256
|
{ type: 'function', names: ['if_else'], processor: built_in_proc_name_1.BuiltInProcName.IfThenElse, config: { args: { cond: 'condition', yes: 'true', no: 'false' } }, assumePrimitive: true },
|
|
256
257
|
{ type: 'function', names: ['get'], processor: built_in_proc_name_1.BuiltInProcName.Get, config: {}, assumePrimitive: false },
|
|
257
|
-
{ type: 'function', names: [identifier_1.Identifier.make('library', 'base'), identifier_1.Identifier.make('require', 'base')], processor: built_in_proc_name_1.BuiltInProcName.Library, config: {}, assumePrimitive: false },
|
|
258
|
+
{ type: 'function', names: [identifier_1.Identifier.make('from', 'import'), identifier_1.Identifier.make('library', 'base'), identifier_1.Identifier.make('require', 'base')], processor: built_in_proc_name_1.BuiltInProcName.Library, config: {}, assumePrimitive: false },
|
|
258
259
|
{ type: 'function', names: ['<-', '='], processor: built_in_proc_name_1.BuiltInProcName.Assignment, config: { canBeReplacement: true }, assumePrimitive: true },
|
|
259
260
|
{ type: 'function', names: [':='], processor: built_in_proc_name_1.BuiltInProcName.Assignment, config: {}, assumePrimitive: true },
|
|
260
261
|
{ type: 'function', names: ['assign', 'setValidity'], processor: built_in_proc_name_1.BuiltInProcName.Assignment, config: { targetVariable: true, mayHaveMoreArgs: true }, assumePrimitive: true },
|
|
@@ -265,9 +266,160 @@ exports.DefaultBuiltinConfig = [
|
|
|
265
266
|
{ type: 'function', names: ['->>'], processor: built_in_proc_name_1.BuiltInProcName.Assignment, config: { superAssignment: true, swapSourceAndTarget: true, canBeReplacement: true }, assumePrimitive: true },
|
|
266
267
|
{ type: 'function', names: ['&&', '&'], processor: built_in_proc_name_1.BuiltInProcName.SpecialBinOp, config: { lazy: true, evalRhsWhen: true }, assumePrimitive: true },
|
|
267
268
|
{ type: 'function', names: ['||', '|'], processor: built_in_proc_name_1.BuiltInProcName.SpecialBinOp, config: { lazy: true, evalRhsWhen: false }, assumePrimitive: true },
|
|
268
|
-
{ type: 'function', names: ['|>'
|
|
269
|
+
{ type: 'function', names: ['|>'], processor: built_in_proc_name_1.BuiltInProcName.Pipe, config: { pipePlaceholderName: '_' }, assumePrimitive: true },
|
|
270
|
+
{ type: 'function', names: ['%>%', '%!>%'], processor: built_in_proc_name_1.BuiltInProcName.Pipe, config: { pipePlaceholderName: '.', rhsMightBeSymbol: true }, assumePrimitive: true },
|
|
271
|
+
{ type: 'function', names: ['%<>%'], processor: built_in_proc_name_1.BuiltInProcName.Pipe, config: { pipePlaceholderName: '.', assignLhs: true, rhsMightBeSymbol: true }, assumePrimitive: true },
|
|
272
|
+
{ type: 'function', names: ['%T>%'], processor: built_in_proc_name_1.BuiltInProcName.Pipe, config: { pipePlaceholderName: '.', returnLhs: true, rhsMightBeSymbol: true }, assumePrimitive: true },
|
|
273
|
+
{ type: 'function', names: [identifier_1.Identifier.make('map', 'purrr'), identifier_1.Identifier.make('map_lgl', 'purrr'), identifier_1.Identifier.make('map_int', 'purrr'), identifier_1.Identifier.make('map_dbl', 'purrr'), identifier_1.Identifier.make('map_chr', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
274
|
+
args: {
|
|
275
|
+
'.x': { index: 0, name: '.x' }
|
|
276
|
+
},
|
|
277
|
+
'.f': { index: 1, name: '.f' },
|
|
278
|
+
ignore: ['.progress']
|
|
279
|
+
} },
|
|
280
|
+
{ type: 'function', names: [identifier_1.Identifier.make('pmap', 'purrr'), identifier_1.Identifier.make('pmap_lgl', 'purrr'), identifier_1.Identifier.make('pmap_int', 'purrr'), identifier_1.Identifier.make('pmap_dbl', 'purrr'), identifier_1.Identifier.make('pmap_chr', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
281
|
+
args: {
|
|
282
|
+
'.l': { index: 0, name: '.l' }
|
|
283
|
+
},
|
|
284
|
+
'.f': { index: 1, name: '.f' },
|
|
285
|
+
ignore: ['.progress']
|
|
286
|
+
} },
|
|
287
|
+
{ type: 'function', names: [identifier_1.Identifier.make('map2', 'purrr'), identifier_1.Identifier.make('map2_lgl', 'purrr'), identifier_1.Identifier.make('map2_int', 'purrr'), identifier_1.Identifier.make('map2_dbl', 'purrr'), identifier_1.Identifier.make('map2_chr', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
288
|
+
args: {
|
|
289
|
+
'.x': { index: 0, name: '.x' },
|
|
290
|
+
'.y': { index: 1, name: '.y' },
|
|
291
|
+
},
|
|
292
|
+
'.f': { index: 2, name: '.f' },
|
|
293
|
+
ignore: ['.progress']
|
|
294
|
+
} },
|
|
295
|
+
{ type: 'function', names: [identifier_1.Identifier.make('modify', 'purrr'), identifier_1.Identifier.make('imodify', 'purrr'), identifier_1.Identifier.make('imap', 'purrr'), identifier_1.Identifier.make('imap_lgl', 'purrr'), identifier_1.Identifier.make('imap_int', 'purrr'), identifier_1.Identifier.make('imap_dbl', 'purrr'), identifier_1.Identifier.make('imap_chr', 'purrr'), identifier_1.Identifier.make('imap_vec', 'purrr'), identifier_1.Identifier.make('lmap', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
296
|
+
args: {
|
|
297
|
+
'.x': { index: 0, name: '.x' }
|
|
298
|
+
},
|
|
299
|
+
'.f': { index: 1, name: '.f' },
|
|
300
|
+
ignore: []
|
|
301
|
+
} },
|
|
302
|
+
{ type: 'function', names: [identifier_1.Identifier.make('modify2', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
303
|
+
args: {
|
|
304
|
+
'.x': { index: 0, name: '.x' },
|
|
305
|
+
'.y': { index: 1, name: '.y' }
|
|
306
|
+
},
|
|
307
|
+
'.f': { index: 2, name: '.f' },
|
|
308
|
+
ignore: []
|
|
309
|
+
} },
|
|
310
|
+
{ type: 'function', names: [identifier_1.Identifier.make('map_at', 'purrr'), identifier_1.Identifier.make('modify_at', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
311
|
+
args: {
|
|
312
|
+
'.x': { index: 0, name: '.x' },
|
|
313
|
+
'.at': { index: 1, name: '.at' },
|
|
314
|
+
},
|
|
315
|
+
'.f': { index: 2, name: '.f' },
|
|
316
|
+
ignore: ['.progress']
|
|
317
|
+
} },
|
|
318
|
+
{ type: 'function', names: [identifier_1.Identifier.make('lmap_at', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
319
|
+
args: {
|
|
320
|
+
'.x': { index: 0, name: '.x' },
|
|
321
|
+
'.at': { index: 1, name: '.at' },
|
|
322
|
+
},
|
|
323
|
+
'.f': { index: 2, name: '.f' },
|
|
324
|
+
ignore: []
|
|
325
|
+
} },
|
|
326
|
+
{ type: 'function', names: [identifier_1.Identifier.make('map_if', 'purrr'), identifier_1.Identifier.make('modify_if', 'purrr'), identifier_1.Identifier.make('lmap_if', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
327
|
+
args: {
|
|
328
|
+
'.x': { index: 0, name: '.x' },
|
|
329
|
+
'.p': { index: 1, name: '.p' },
|
|
330
|
+
},
|
|
331
|
+
'.f': { index: 2, name: '.f' },
|
|
332
|
+
ignore: ['.else']
|
|
333
|
+
} },
|
|
334
|
+
{ type: 'function', names: [identifier_1.Identifier.make('walk', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
335
|
+
args: {
|
|
336
|
+
'.x': { index: 0, name: '.x' }
|
|
337
|
+
},
|
|
338
|
+
'.f': { index: 1, name: '.f' },
|
|
339
|
+
ignore: ['.progress'],
|
|
340
|
+
returnArg: '.x'
|
|
341
|
+
} },
|
|
342
|
+
{ type: 'function', names: [identifier_1.Identifier.make('iwalk', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
343
|
+
args: {
|
|
344
|
+
'.x': { index: 0, name: '.x' }
|
|
345
|
+
},
|
|
346
|
+
'.f': { index: 1, name: '.f' },
|
|
347
|
+
ignore: [],
|
|
348
|
+
returnArg: '.x'
|
|
349
|
+
} },
|
|
350
|
+
{ type: 'function', names: [identifier_1.Identifier.make('pwalk', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
351
|
+
args: {
|
|
352
|
+
'.l': { index: 0, name: '.l' }
|
|
353
|
+
},
|
|
354
|
+
'.f': { index: 1, name: '.f' },
|
|
355
|
+
ignore: ['.progress'],
|
|
356
|
+
returnArg: '.l'
|
|
357
|
+
} },
|
|
358
|
+
{ type: 'function', names: [identifier_1.Identifier.make('walk2', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
359
|
+
args: {
|
|
360
|
+
'.x': { index: 0, name: '.x' },
|
|
361
|
+
'.y': { index: 1, name: '.y' }
|
|
362
|
+
},
|
|
363
|
+
'.f': { index: 2, name: '.f' },
|
|
364
|
+
ignore: ['.progress'],
|
|
365
|
+
returnArg: '.x'
|
|
366
|
+
} },
|
|
367
|
+
{ type: 'function', names: [identifier_1.Identifier.make('map_vec', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
368
|
+
args: {
|
|
369
|
+
'.x': { index: 0, name: '.x' }
|
|
370
|
+
},
|
|
371
|
+
'.f': { index: 1, name: '.f' },
|
|
372
|
+
ignore: ['.progress', '.ptype']
|
|
373
|
+
} },
|
|
374
|
+
{ type: 'function', names: [identifier_1.Identifier.make('pmap_vec', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
375
|
+
args: {
|
|
376
|
+
'.l': { index: 0, name: '.l' }
|
|
377
|
+
},
|
|
378
|
+
'.f': { index: 1, name: '.f' },
|
|
379
|
+
ignore: ['.progress', '.ptype']
|
|
380
|
+
} },
|
|
381
|
+
{ type: 'function', names: [identifier_1.Identifier.make('map_depth', 'purrr'), identifier_1.Identifier.make('modify_depth', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
382
|
+
args: {
|
|
383
|
+
'.x': { index: 0, name: '.x' },
|
|
384
|
+
'.depth': { index: 2, name: '.depth' }
|
|
385
|
+
},
|
|
386
|
+
'.f': { index: 2, name: '.f' },
|
|
387
|
+
ignore: ['.ragged', '.is_node']
|
|
388
|
+
} },
|
|
389
|
+
{ type: 'function', names: [identifier_1.Identifier.make('map2_vec', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
390
|
+
args: {
|
|
391
|
+
'.x': { index: 0, name: '.x' },
|
|
392
|
+
'.y': { index: 1, name: '.y' }
|
|
393
|
+
},
|
|
394
|
+
'.f': { index: 2, name: '.f' },
|
|
395
|
+
ignore: ['.progress', '.ptype']
|
|
396
|
+
} },
|
|
397
|
+
{ type: 'function', names: [identifier_1.Identifier.make('across', 'dplyr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
398
|
+
args: {
|
|
399
|
+
'.x': { index: 0, name: '.cols' },
|
|
400
|
+
},
|
|
401
|
+
'.f': { index: 1, name: '.fns' },
|
|
402
|
+
ignore: ['.names', '.unpack']
|
|
403
|
+
} },
|
|
404
|
+
{ type: 'function', names: [identifier_1.Identifier.make('filter', 'dplyr'), identifier_1.Identifier.make('filter_out', 'dplyr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
405
|
+
args: {
|
|
406
|
+
'.x': { index: 0, name: '.data' },
|
|
407
|
+
},
|
|
408
|
+
'.f': { index: 1, name: '...' },
|
|
409
|
+
ignore: ['.by', '.preserve']
|
|
410
|
+
} },
|
|
411
|
+
{ type: 'function', names: [identifier_1.Identifier.make('rename_with', 'dplyr')], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
|
|
412
|
+
args: {
|
|
413
|
+
'.x': { index: 0, name: '.data' },
|
|
414
|
+
},
|
|
415
|
+
'.f': { index: 1, name: '.fn' },
|
|
416
|
+
ignore: ['.cols']
|
|
417
|
+
} },
|
|
269
418
|
{ type: 'function', names: ['function', '\\'], processor: built_in_proc_name_1.BuiltInProcName.FunctionDefinition, config: {}, assumePrimitive: true },
|
|
270
|
-
{ type: 'function', names: ['quote', '
|
|
419
|
+
{ type: 'function', names: ['quote', 'bquote'], processor: built_in_proc_name_1.BuiltInProcName.Quote, config: { quoteArgumentsWithIndex: 0 }, assumePrimitive: true },
|
|
420
|
+
{ type: 'function', names: ['substitute'], processor: built_in_proc_name_1.BuiltInProcName.Quote, config: { quoteArgumentsWithIndex: 0, envArgIndex: 1 }, assumePrimitive: true },
|
|
421
|
+
{ type: 'function', names: [identifier_1.Identifier.make('enquo', 'rlang'), identifier_1.Identifier.make('enquos', 'rlang'), identifier_1.Identifier.make('quo', 'rlang'), identifier_1.Identifier.make('quos', 'rlang'), identifier_1.Identifier.make('sym', 'rlang'), identifier_1.Identifier.make('syms', 'rlang'), identifier_1.Identifier.make('ensym', 'rlang'), identifier_1.Identifier.make('ensyms', 'rlang'), identifier_1.Identifier.make('expr', 'rlang'), identifier_1.Identifier.make('exprs', 'rlang'), identifier_1.Identifier.make('quo_name', 'rlang'), identifier_1.Identifier.make('as_name', 'rlang'), identifier_1.Identifier.make('as_label', 'rlang'), identifier_1.Identifier.make('as_string', 'rlang')], processor: built_in_proc_name_1.BuiltInProcName.Quote, config: { quoteArgumentsWithIndex: 0, libFn: true }, assumePrimitive: true },
|
|
422
|
+
{ type: 'function', names: [identifier_1.Identifier.make('call2', 'rlang'), identifier_1.Identifier.make('exec', 'rlang'), identifier_1.Identifier.make('invoke', 'purrr'), identifier_1.Identifier.make('invoke_map', 'purrr')], processor: built_in_proc_name_1.BuiltInProcName.Default, config: { libFn: true, hasUnknownSideEffects: true, unquoteFunction: true }, assumePrimitive: false },
|
|
271
423
|
{ type: 'function', names: ['local'], processor: built_in_proc_name_1.BuiltInProcName.Local, config: { args: { env: 'envir', expr: 'expr' } }, assumePrimitive: false },
|
|
272
424
|
{ type: 'function', names: ['for'], processor: built_in_proc_name_1.BuiltInProcName.ForLoop, config: {}, assumePrimitive: true },
|
|
273
425
|
{ type: 'function', names: ['repeat'], processor: built_in_proc_name_1.BuiltInProcName.RepeatLoop, config: {}, assumePrimitive: true },
|
|
@@ -283,6 +435,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
283
435
|
{ type: 'function', names: ['ddply'], processor: built_in_proc_name_1.BuiltInProcName.Apply, config: { unquoteFunction: true, indexOfFunction: 2, nameOfFunctionArgument: '.fun', libFn: true }, assumePrimitive: false },
|
|
284
436
|
{ type: 'function', names: ['list'], processor: built_in_proc_name_1.BuiltInProcName.List, config: {}, assumePrimitive: true },
|
|
285
437
|
{ type: 'function', names: ['Recall'], processor: built_in_proc_name_1.BuiltInProcName.Recall, config: { libFn: true }, assumePrimitive: false },
|
|
438
|
+
{ type: 'function', names: ['sys.function'], processor: built_in_proc_name_1.BuiltInProcName.Recall, config: { libFn: true, unknownOnNonZeroArg: true }, assumePrimitive: false },
|
|
286
439
|
{ type: 'function', names: ['c'], processor: built_in_proc_name_1.BuiltInProcName.Vector, config: {}, assumePrimitive: true, evalHandler: 'built-in:c' },
|
|
287
440
|
{
|
|
288
441
|
type: 'function',
|
|
@@ -301,6 +454,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
301
454
|
'sys.on.exit', 'par', 'tpar', 'sink',
|
|
302
455
|
/* library and require is handled above */
|
|
303
456
|
'requireNamespace', 'loadNamespace', 'attachNamespace', 'asNamespace',
|
|
457
|
+
identifier_1.Identifier.make('use', 'base'),
|
|
304
458
|
/* weird env attachments */
|
|
305
459
|
'attach', 'unname', 'data',
|
|
306
460
|
/* file creation/removal */
|
|
@@ -314,6 +468,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
314
468
|
type: 'function',
|
|
315
469
|
names: [
|
|
316
470
|
'tinytheme', 'theme_set',
|
|
471
|
+
identifier_1.Identifier.make('context', 'testthat'),
|
|
317
472
|
/* downloader and installer functions (R, devtools, BiocManager) */
|
|
318
473
|
'library.dynam', 'install.packages', 'install', 'install_github', 'install_gitlab', 'install_bitbucket', 'install_url', 'install_git', 'install_svn', 'install_local', 'install_version', 'update_packages',
|
|
319
474
|
],
|
|
@@ -39,6 +39,10 @@ export declare const Identifier: {
|
|
|
39
39
|
* Please note that for `internal` to count, a namespace must be provided!
|
|
40
40
|
*/
|
|
41
41
|
readonly make: (this: void, name: BrandedIdentifier, namespace?: BrandedNamespace, internal?: boolean) => Identifier;
|
|
42
|
+
/**
|
|
43
|
+
* Verify whether an unknown element has a valid identifier shape!
|
|
44
|
+
*/
|
|
45
|
+
readonly is: (this: void, id: unknown) => id is Identifier;
|
|
42
46
|
/**
|
|
43
47
|
* Parse an identifier from its string representation,
|
|
44
48
|
* Please note, that in R if one writes `"pkg::a"` this refers to a symbol named `pkg::a` and NOT to the namespaced identifier `a` in package `pkg`.
|
|
@@ -33,6 +33,23 @@ exports.Identifier = {
|
|
|
33
33
|
return name;
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
|
+
/**
|
|
37
|
+
* Verify whether an unknown element has a valid identifier shape!
|
|
38
|
+
*/
|
|
39
|
+
is(id) {
|
|
40
|
+
if (typeof id === 'string') {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
if (Array.isArray(id)) {
|
|
44
|
+
if (id.length === 2) {
|
|
45
|
+
return typeof id[0] === 'string' && typeof id[1] === 'string';
|
|
46
|
+
}
|
|
47
|
+
else if (id.length === 3) {
|
|
48
|
+
return typeof id[0] === 'string' && typeof id[1] === 'string' && typeof id[2] === 'boolean';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
},
|
|
36
53
|
/**
|
|
37
54
|
* Parse an identifier from its string representation,
|
|
38
55
|
* Please note, that in R if one writes `"pkg::a"` this refers to a symbol named `pkg::a` and NOT to the namespaced identifier `a` in package `pkg`.
|
|
@@ -8,11 +8,8 @@ const scoping_1 = require("./scoping");
|
|
|
8
8
|
* @see {@link Environment.overwrite} - for details on how definitions are handled.
|
|
9
9
|
*/
|
|
10
10
|
function overwriteEnvironment(base, next, applyCds) {
|
|
11
|
-
if (base === undefined) {
|
|
12
|
-
return next;
|
|
13
|
-
}
|
|
14
|
-
else if (next === undefined) {
|
|
15
|
-
return base;
|
|
11
|
+
if (base === undefined || next === undefined) {
|
|
12
|
+
return next ?? base;
|
|
16
13
|
}
|
|
17
14
|
if (base.level !== next.level) {
|
|
18
15
|
while (next.level < base.level) {
|
|
@@ -24,10 +24,6 @@ export declare const CallGraph: {
|
|
|
24
24
|
* Extracts the sub call graph from the given call graph, starting from the given entry points.
|
|
25
25
|
*/
|
|
26
26
|
readonly computeSubCallGraph: (this: void, graph: CallGraph, entryPoints: Set<NodeId>) => CallGraph;
|
|
27
|
-
/**
|
|
28
|
-
* Determines whether there is a path from `from` to `to` in the given graph (via any edge type, only respecting direction)
|
|
29
|
-
*/
|
|
30
|
-
readonly reaches: (this: void, from: NodeId, to: NodeId, graph: DataflowGraph, knownReachability?: DefaultMap<NodeId, Set<NodeId>>) => boolean;
|
|
31
27
|
/**
|
|
32
28
|
* Reduces the call graph by dropping all transitive edges.
|
|
33
29
|
*/
|
|
@@ -53,8 +49,9 @@ export declare const CallGraph: {
|
|
|
53
49
|
readonly convert: typeof import("./quads").df2quads;
|
|
54
50
|
};
|
|
55
51
|
};
|
|
56
|
-
readonly diffGraphs: (this: void, left: import("../../util/diff-graph").NamedGraph
|
|
57
|
-
readonly invertGraph: (this: void, graph:
|
|
58
|
-
readonly resolveGraphCriteria: (graph:
|
|
52
|
+
readonly diffGraphs: <G extends DataflowGraph>(this: void, left: import("../../util/diff-graph").NamedGraph<G>, right: import("../../util/diff-graph").NamedGraph<G>, config?: Partial<import("../../util/diff").GenericDiffConfiguration>) => import("../../util/diff-graph").GraphDifferenceReport;
|
|
53
|
+
readonly invertGraph: <G extends DataflowGraph>(this: void, graph: G, cleanEnv: REnvironmentInformation) => G;
|
|
54
|
+
readonly resolveGraphCriteria: <G extends DataflowGraph>(graph: G, ctx: import("../../project/context/flowr-analyzer-context").ReadOnlyFlowrAnalyzerContext, idMap?: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").AstIdMap) => G;
|
|
55
|
+
readonly reaches: <G extends DataflowGraph>(this: void, from: NodeId, to: NodeId, graph: G, knownReachability?: DefaultMap<NodeId, Set<NodeId>>) => boolean;
|
|
59
56
|
readonly name: "CallGraph";
|
|
60
57
|
};
|
|
@@ -189,28 +189,6 @@ exports.CallGraph = {
|
|
|
189
189
|
}
|
|
190
190
|
return result;
|
|
191
191
|
},
|
|
192
|
-
/**
|
|
193
|
-
* Determines whether there is a path from `from` to `to` in the given graph (via any edge type, only respecting direction)
|
|
194
|
-
*/
|
|
195
|
-
reaches(from, to, graph, knownReachability = new defaultmap_1.DefaultMap(() => new Set())) {
|
|
196
|
-
const visited = new Set();
|
|
197
|
-
const toVisit = [from];
|
|
198
|
-
while (toVisit.length > 0) {
|
|
199
|
-
const currentId = toVisit.pop();
|
|
200
|
-
if (visited.has(currentId)) {
|
|
201
|
-
continue;
|
|
202
|
-
}
|
|
203
|
-
if (currentId === to || knownReachability.get(currentId).has(to)) {
|
|
204
|
-
knownReachability.get(from).add(to);
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
visited.add(currentId);
|
|
208
|
-
for (const [tar] of graph.outgoingEdges(currentId) ?? []) {
|
|
209
|
-
toVisit.push(tar);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
return false;
|
|
213
|
-
},
|
|
214
192
|
/**
|
|
215
193
|
* Reduces the call graph by dropping all transitive edges.
|
|
216
194
|
*/
|
|
@@ -5,6 +5,7 @@ import { getOriginInDfg } from '../origin/dfg-get-origin';
|
|
|
5
5
|
import { CallGraph } from './call-graph';
|
|
6
6
|
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
7
|
import type { REnvironmentInformation } from '../environments/environment';
|
|
8
|
+
import type { DataflowGraphVertexInfo } from './vertex';
|
|
8
9
|
/**
|
|
9
10
|
* This is the root helper object to work with the {@link DataflowGraph}.
|
|
10
11
|
*
|
|
@@ -41,7 +42,6 @@ export declare const Dataflow: {
|
|
|
41
42
|
*/
|
|
42
43
|
readonly callGraph: {
|
|
43
44
|
readonly computeSubCallGraph: (this: void, graph: CallGraph, entryPoints: Set<NodeId>) => CallGraph;
|
|
44
|
-
readonly reaches: (this: void, from: NodeId, to: NodeId, graph: DataflowGraph, knownReachability?: import("../../util/collections/defaultmap").DefaultMap<NodeId, Set<NodeId>>) => boolean;
|
|
45
45
|
readonly dropTransitiveEdges: (this: void, graph: CallGraph) => CallGraph;
|
|
46
46
|
readonly compute: (this: void, graph: DataflowGraph) => CallGraph;
|
|
47
47
|
readonly visualize: {
|
|
@@ -58,9 +58,10 @@ export declare const Dataflow: {
|
|
|
58
58
|
readonly convert: typeof import("./quads").df2quads;
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
|
-
readonly diffGraphs: (this: void, left: import("../../util/diff-graph").NamedGraph
|
|
62
|
-
readonly invertGraph: (this: void, graph:
|
|
63
|
-
readonly resolveGraphCriteria: (graph:
|
|
61
|
+
readonly diffGraphs: <G extends DataflowGraph>(this: void, left: import("../../util/diff-graph").NamedGraph<G>, right: import("../../util/diff-graph").NamedGraph<G>, config?: Partial<import("../../util/diff").GenericDiffConfiguration>) => import("../../util/diff-graph").GraphDifferenceReport;
|
|
62
|
+
readonly invertGraph: <G extends DataflowGraph>(this: void, graph: G, cleanEnv: REnvironmentInformation) => G;
|
|
63
|
+
readonly resolveGraphCriteria: <G extends DataflowGraph>(graph: G, ctx: import("../../project/context/flowr-analyzer-context").ReadOnlyFlowrAnalyzerContext, idMap?: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").AstIdMap) => G;
|
|
64
|
+
readonly reaches: <G extends DataflowGraph>(this: void, from: NodeId, to: NodeId, graph: G, knownReachability?: import("../../util/collections/defaultmap").DefaultMap<NodeId, Set<NodeId>>) => boolean;
|
|
64
65
|
readonly name: "CallGraph";
|
|
65
66
|
};
|
|
66
67
|
};
|
|
@@ -87,17 +88,26 @@ export declare const Dataflow: {
|
|
|
87
88
|
* @param select - the ids to select in the reduced graph
|
|
88
89
|
* @param includeMissingTargets - if set to true, this will include edges which target vertices that are not selected!
|
|
89
90
|
*/
|
|
90
|
-
readonly reduceGraph: (this: void, graph:
|
|
91
|
+
readonly reduceGraph: <G extends DataflowGraph>(this: void, graph: G, select: ReadonlySet<NodeId>, includeMissingTargets?: boolean) => G;
|
|
91
92
|
/**
|
|
92
93
|
* Given the id of a vertex (usually a variable use),
|
|
93
94
|
* this returns a reachable provenance set by calculating a non-interprocedural and non-context sensitive backward slice, but stopping at the given ids!
|
|
94
95
|
* You can obtain the corresponding graph using {@link Dataflow.reduceGraph}.
|
|
95
|
-
* @param id
|
|
96
|
-
* @param graph
|
|
97
|
-
* @param consider
|
|
96
|
+
* @param id - The id to use as a seed for provenance calculation
|
|
97
|
+
* @param graph - The graph to perform the provenance calculation on
|
|
98
|
+
* @param consider - The ids to restrict the calculation too (e.g., the ids contained within a function definition to restrict the analysis to)
|
|
99
|
+
* @param followEdges - Which edges to consider in the provenance traversal, if you set this to undefined this will automatically track all edges
|
|
98
100
|
* @see {@link Dataflow.provenanceGraph} - for a convenience wrapper to directly obtain the graph of the provenance.
|
|
99
101
|
*/
|
|
100
|
-
readonly provenance: (this: void, id: NodeId, graph: DataflowGraph, consider?: ReadonlySet<NodeId
|
|
102
|
+
readonly provenance: (this: void, id: NodeId, graph: DataflowGraph, consider?: ReadonlySet<NodeId>, followEdges?: number | undefined) => Set<NodeId>;
|
|
103
|
+
/**
|
|
104
|
+
* A simple visitor akin to {@link RNode.visitAst} to traverse the dataflow graph starting from the start id and only
|
|
105
|
+
* respecting edge direction.
|
|
106
|
+
* @param graph - The dataflow graph to operate on.
|
|
107
|
+
* @param start - The start id of the visitation.
|
|
108
|
+
* @param onVertex - The function to execute for each vertex, if this returns `true` the visitation will stop from this vertex.
|
|
109
|
+
*/
|
|
110
|
+
readonly visitDfg: (this: void, graph: DataflowGraph, start: NodeId, onVertex: (vtx: DataflowGraphVertexInfo) => (boolean | void)) => void;
|
|
101
111
|
/**
|
|
102
112
|
* A convenience wrapper for {@link Dataflow.reduceGraph|reducing} the {@link Dataflow.provenance|provenance} of a graph.
|
|
103
113
|
* @param id - The id to use as a seed for provenance calculation
|
|
@@ -120,9 +130,10 @@ export declare const Dataflow: {
|
|
|
120
130
|
readonly convert: typeof import("./quads").df2quads;
|
|
121
131
|
};
|
|
122
132
|
};
|
|
123
|
-
readonly diffGraphs: (this: void, left: import("../../util/diff-graph").NamedGraph
|
|
124
|
-
readonly invertGraph: (this: void, graph:
|
|
125
|
-
readonly resolveGraphCriteria: (graph:
|
|
133
|
+
readonly diffGraphs: <G extends DataflowGraph>(this: void, left: import("../../util/diff-graph").NamedGraph<G>, right: import("../../util/diff-graph").NamedGraph<G>, config?: Partial<import("../../util/diff").GenericDiffConfiguration>) => import("../../util/diff-graph").GraphDifferenceReport;
|
|
134
|
+
readonly invertGraph: <G extends DataflowGraph>(this: void, graph: G, cleanEnv: REnvironmentInformation) => G;
|
|
135
|
+
readonly resolveGraphCriteria: <G extends DataflowGraph>(graph: G, ctx: import("../../project/context/flowr-analyzer-context").ReadOnlyFlowrAnalyzerContext, idMap?: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").AstIdMap) => G;
|
|
136
|
+
readonly reaches: <G extends DataflowGraph>(this: void, from: NodeId, to: NodeId, graph: G, knownReachability?: import("../../util/collections/defaultmap").DefaultMap<NodeId, Set<NodeId>>) => boolean;
|
|
126
137
|
readonly name: "Dataflow";
|
|
127
138
|
/**
|
|
128
139
|
* Maps to flowR's main graph object to store and manipulate the dataflow graph
|
|
@@ -94,29 +94,66 @@ exports.Dataflow = {
|
|
|
94
94
|
* Given the id of a vertex (usually a variable use),
|
|
95
95
|
* this returns a reachable provenance set by calculating a non-interprocedural and non-context sensitive backward slice, but stopping at the given ids!
|
|
96
96
|
* You can obtain the corresponding graph using {@link Dataflow.reduceGraph}.
|
|
97
|
-
* @param id
|
|
98
|
-
* @param graph
|
|
99
|
-
* @param consider
|
|
97
|
+
* @param id - The id to use as a seed for provenance calculation
|
|
98
|
+
* @param graph - The graph to perform the provenance calculation on
|
|
99
|
+
* @param consider - The ids to restrict the calculation too (e.g., the ids contained within a function definition to restrict the analysis to)
|
|
100
|
+
* @param followEdges - Which edges to consider in the provenance traversal, if you set this to undefined this will automatically track all edges
|
|
100
101
|
* @see {@link Dataflow.provenanceGraph} - for a convenience wrapper to directly obtain the graph of the provenance.
|
|
101
102
|
*/
|
|
102
|
-
provenance(id, graph, consider) {
|
|
103
|
+
provenance(id, graph, consider, followEdges = edge_1.EdgeType.Calls | edge_1.EdgeType.Reads | edge_1.EdgeType.Returns | edge_1.EdgeType.Argument | edge_1.EdgeType.DefinedBy | edge_1.EdgeType.DefinedByOnCall) {
|
|
103
104
|
const queue = [id];
|
|
104
105
|
const visited = new Set();
|
|
105
|
-
const followEdges = edge_1.EdgeType.Calls | edge_1.EdgeType.Reads | edge_1.EdgeType.Returns | edge_1.EdgeType.DefinedBy | edge_1.EdgeType.DefinedByOnCall;
|
|
106
106
|
while (queue.length > 0) {
|
|
107
107
|
const nodeId = queue.pop();
|
|
108
108
|
if (nodeId === undefined || visited.has(nodeId) || (consider && !consider.has(nodeId))) {
|
|
109
109
|
continue;
|
|
110
110
|
}
|
|
111
111
|
visited.add(nodeId);
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
const vtx = graph.get(nodeId);
|
|
113
|
+
if (vtx === undefined) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
for (const [to, types] of vtx[1]) {
|
|
117
|
+
if (followEdges === undefined || edge_1.DfEdge.includesType(types, followEdges)) {
|
|
114
118
|
queue.push(to);
|
|
115
119
|
}
|
|
116
120
|
}
|
|
121
|
+
for (const cd of vtx[0].cds ?? []) {
|
|
122
|
+
queue.push(cd.id);
|
|
123
|
+
}
|
|
117
124
|
}
|
|
118
125
|
return visited;
|
|
119
126
|
},
|
|
127
|
+
/**
|
|
128
|
+
* A simple visitor akin to {@link RNode.visitAst} to traverse the dataflow graph starting from the start id and only
|
|
129
|
+
* respecting edge direction.
|
|
130
|
+
* @param graph - The dataflow graph to operate on.
|
|
131
|
+
* @param start - The start id of the visitation.
|
|
132
|
+
* @param onVertex - The function to execute for each vertex, if this returns `true` the visitation will stop from this vertex.
|
|
133
|
+
*/
|
|
134
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
135
|
+
visitDfg(graph, start, onVertex) {
|
|
136
|
+
const queue = [start];
|
|
137
|
+
const visited = new Set();
|
|
138
|
+
while (queue.length > 0) {
|
|
139
|
+
const nodeId = queue.pop();
|
|
140
|
+
if (nodeId === undefined || visited.has(nodeId)) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
visited.add(nodeId);
|
|
144
|
+
const vtx = graph.get(nodeId);
|
|
145
|
+
if (vtx === undefined) {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
const shouldStop = onVertex(vtx[0]);
|
|
149
|
+
if (shouldStop) {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
for (const [to] of vtx[1]) {
|
|
153
|
+
queue.push(to);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
120
157
|
/**
|
|
121
158
|
* A convenience wrapper for {@link Dataflow.reduceGraph|reducing} the {@link Dataflow.provenance|provenance} of a graph.
|
|
122
159
|
* @param id - The id to use as a seed for provenance calculation
|
|
@@ -7,6 +7,7 @@ import type { REnvironmentInformation } from '../environments/environment';
|
|
|
7
7
|
import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
|
|
8
8
|
import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
9
9
|
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
10
|
+
import { DefaultMap } from '../../util/collections/defaultmap';
|
|
10
11
|
/**
|
|
11
12
|
* The underlying functions which work for any graph* like view
|
|
12
13
|
* **Please do not use this object directly but use the helpers**
|
|
@@ -19,7 +20,7 @@ export declare const GraphHelper: {
|
|
|
19
20
|
/**
|
|
20
21
|
* Mermaid rendering helper for dataflow graphs
|
|
21
22
|
* - {@link DataflowMermaid.url}, {@link DataflowMermaid.raw} - to render the graph as a mermaid graph (e.g., in markdown or the mermaid live editor)
|
|
22
|
-
* - {@link DataflowMermaid.convert} - for the
|
|
23
|
+
* - {@link DataflowMermaid.convert} - for the underlying transformation
|
|
23
24
|
* @see {@link DataflowMermaid}
|
|
24
25
|
*/
|
|
25
26
|
readonly mermaid: {
|
|
@@ -40,16 +41,20 @@ export declare const GraphHelper: {
|
|
|
40
41
|
* If you simply want to check whether they equal, use {@link GraphDifferenceReport#isEqual|`<result>.isEqual()`}.
|
|
41
42
|
* @see {@link diffOfControlFlowGraphs} - for control flow graphs
|
|
42
43
|
*/
|
|
43
|
-
readonly diffGraphs: (this: void, left: NamedGraph
|
|
44
|
+
readonly diffGraphs: <G extends DataflowGraph>(this: void, left: NamedGraph<G>, right: NamedGraph<G>, config?: Partial<GenericDiffConfiguration>) => GraphDifferenceReport;
|
|
44
45
|
/**
|
|
45
46
|
* Inverts the given dataflow graph by reversing all edges.
|
|
46
47
|
*/
|
|
47
|
-
readonly invertGraph: (this: void, graph:
|
|
48
|
+
readonly invertGraph: <G extends DataflowGraph>(this: void, graph: G, cleanEnv: REnvironmentInformation) => G;
|
|
48
49
|
/**
|
|
49
50
|
* Resolves the dataflow graph ids from slicing criterion form to ids.
|
|
50
51
|
* This returns a **new** graph with the resolved ids.
|
|
51
52
|
* The main use-case for this is testing - if you do not know/want to fix the specific id,
|
|
52
53
|
* you can use, e.g. `2@x` as a placeholder for the first x in the second line!
|
|
53
54
|
*/
|
|
54
|
-
readonly resolveGraphCriteria: (graph:
|
|
55
|
+
readonly resolveGraphCriteria: <G extends DataflowGraph>(graph: G, ctx: ReadOnlyFlowrAnalyzerContext, idMap?: AstIdMap) => G;
|
|
56
|
+
/**
|
|
57
|
+
* Determines whether there is a path from `from` to `to` in the given graph (via any edge type, only respecting direction)
|
|
58
|
+
*/
|
|
59
|
+
readonly reaches: <G extends DataflowGraph>(this: void, from: NodeId, to: NodeId, graph: G, knownReachability?: DefaultMap<NodeId, Set<NodeId>>) => boolean;
|
|
55
60
|
};
|
|
@@ -9,6 +9,7 @@ const graph_1 = require("./graph");
|
|
|
9
9
|
const assert_1 = require("../../util/assert");
|
|
10
10
|
const parse_1 = require("../../slicing/criterion/parse");
|
|
11
11
|
const edge_1 = require("./edge");
|
|
12
|
+
const defaultmap_1 = require("../../util/collections/defaultmap");
|
|
12
13
|
/**
|
|
13
14
|
* The underlying functions which work for any graph* like view
|
|
14
15
|
* **Please do not use this object directly but use the helpers**
|
|
@@ -21,7 +22,7 @@ exports.GraphHelper = {
|
|
|
21
22
|
/**
|
|
22
23
|
* Mermaid rendering helper for dataflow graphs
|
|
23
24
|
* - {@link DataflowMermaid.url}, {@link DataflowMermaid.raw} - to render the graph as a mermaid graph (e.g., in markdown or the mermaid live editor)
|
|
24
|
-
* - {@link DataflowMermaid.convert} - for the
|
|
25
|
+
* - {@link DataflowMermaid.convert} - for the underlying transformation
|
|
25
26
|
* @see {@link DataflowMermaid}
|
|
26
27
|
*/
|
|
27
28
|
mermaid: dfg_1.DataflowMermaid,
|
|
@@ -70,7 +71,7 @@ exports.GraphHelper = {
|
|
|
70
71
|
if (cached !== undefined) {
|
|
71
72
|
return cached;
|
|
72
73
|
}
|
|
73
|
-
const resolved = parse_1.
|
|
74
|
+
const resolved = parse_1.SlicingCriterion.tryParse(id, resolveMap) ?? id;
|
|
74
75
|
cache.set(id, resolved);
|
|
75
76
|
return resolved;
|
|
76
77
|
};
|
|
@@ -100,6 +101,28 @@ exports.GraphHelper = {
|
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
return resultGraph;
|
|
103
|
-
}
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* Determines whether there is a path from `from` to `to` in the given graph (via any edge type, only respecting direction)
|
|
107
|
+
*/
|
|
108
|
+
reaches(from, to, graph, knownReachability = new defaultmap_1.DefaultMap(() => new Set())) {
|
|
109
|
+
const visited = new Set();
|
|
110
|
+
const toVisit = [from];
|
|
111
|
+
while (toVisit.length > 0) {
|
|
112
|
+
const currentId = toVisit.pop();
|
|
113
|
+
if (visited.has(currentId)) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (currentId === to || knownReachability.get(currentId).has(to)) {
|
|
117
|
+
knownReachability.get(from).add(to);
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
visited.add(currentId);
|
|
121
|
+
for (const [tar] of graph.outgoingEdges(currentId) ?? []) {
|
|
122
|
+
toVisit.push(tar);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
},
|
|
104
127
|
};
|
|
105
128
|
//# sourceMappingURL=graph-helper.js.map
|
|
@@ -25,6 +25,7 @@ export type DataflowFunctionFlowInformation = Omit<DataflowInformation, 'graph'
|
|
|
25
25
|
*/
|
|
26
26
|
export interface NamedFunctionArgument extends IdentifierReference {
|
|
27
27
|
readonly name: string;
|
|
28
|
+
readonly valueId: NodeId | undefined;
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
30
31
|
* A reference which does not have a name, like the references to the arguments `3` and `2` in the following:
|
|
@@ -32,7 +33,6 @@ export interface NamedFunctionArgument extends IdentifierReference {
|
|
|
32
33
|
* ```r
|
|
33
34
|
* foo(3, 2)
|
|
34
35
|
* ```
|
|
35
|
-
* @see #isPositionalArgument
|
|
36
36
|
* @see NamedFunctionArgument
|
|
37
37
|
*/
|
|
38
38
|
export interface PositionalFunctionArgument extends Omit<IdentifierReference, 'name'> {
|
|
@@ -95,12 +95,32 @@ export declare const FunctionArgument: {
|
|
|
95
95
|
* @see {@link FunctionArgument.isEmpty}
|
|
96
96
|
*/
|
|
97
97
|
readonly isNotEmpty: <T>(this: void, arg: T) => arg is Exclude<T, typeof EmptyArgument>;
|
|
98
|
+
/**
|
|
99
|
+
* Returns the id of a non-empty argument.
|
|
100
|
+
* @example
|
|
101
|
+
* ```r
|
|
102
|
+
* foo(a=3, 2) # returns the node id of either `a` or `2`
|
|
103
|
+
* ```
|
|
104
|
+
* @see {@link FunctionArgument.getReference}
|
|
105
|
+
* @see {@link FunctionArgument.getName}
|
|
106
|
+
*/
|
|
107
|
+
readonly getId: (this: void, arg: FunctionArgument) => NodeId | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Returns the name of a named argument.
|
|
110
|
+
* @example
|
|
111
|
+
* ```r
|
|
112
|
+
* foo(a = 3, 2) # returns 'a' or undefined
|
|
113
|
+
* ```
|
|
114
|
+
* @see {@link FunctionArgument.getId}
|
|
115
|
+
*/
|
|
116
|
+
readonly getName: (this: void, arg: FunctionArgument) => string | undefined;
|
|
98
117
|
/**
|
|
99
118
|
* Returns the reference of a non-empty argument.
|
|
100
119
|
* @example
|
|
101
120
|
* ```r
|
|
102
121
|
* foo(a=3, 2) # returns the node id of either `3` or `2`, but skips a
|
|
103
122
|
* ```
|
|
123
|
+
* @see {@link FunctionArgument.getId}
|
|
104
124
|
*/
|
|
105
125
|
readonly getReference: (this: void, arg: FunctionArgument) => NodeId | undefined;
|
|
106
126
|
/**
|
|
@@ -259,8 +279,9 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
|
|
|
259
279
|
/**
|
|
260
280
|
* Marks a vertex in the graph to be a definition
|
|
261
281
|
* @param reference - The reference to the vertex to mark as definition
|
|
282
|
+
* @param sourceIds - The id of the source vertex of the def, if available
|
|
262
283
|
*/
|
|
263
|
-
setDefinitionOfVertex(reference: IdentifierReference): void;
|
|
284
|
+
setDefinitionOfVertex(reference: IdentifierReference, sourceIds: readonly NodeId[] | undefined): void;
|
|
264
285
|
/**
|
|
265
286
|
* Marks a vertex in the graph to be a function call with the new information
|
|
266
287
|
* @param info - The information about the new function call node
|