@eagleoutice/flowr 2.10.1 → 2.10.3
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 +31 -20
- 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/cli/flowr.js +1 -1
- 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/overwrite.js +2 -5
- package/dataflow/graph/df-helper.d.ts +14 -4
- package/dataflow/graph/df-helper.js +36 -6
- package/dataflow/graph/graph.d.ts +10 -0
- package/dataflow/graph/graph.js +12 -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-assignment.d.ts +3 -3
- 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-function-definition.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +6 -17
- 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 +4 -3
- 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/documentation/wiki-absint.js +6 -5
- package/documentation/wiki-analyzer.js +0 -2
- package/documentation/wiki-cfg.js +3 -3
- package/documentation/wiki-linter.js +1 -0
- package/documentation/wiki-normalized-ast.js +7 -7
- package/documentation/wiki-query.js +29 -0
- package/linter/linter-rules.d.ts +24 -1
- package/linter/linter-rules.js +3 -1
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +3 -4
- package/linter/rules/roxygen-arguments.d.ts +35 -0
- package/linter/rules/roxygen-arguments.js +100 -0
- package/package.json +4 -5
- 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/dependencies-query/function-info/write-functions.js +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-format.js +7 -2
- package/queries/catalog/files-query/files-query-executor.js +0 -1
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +2 -0
- package/queries/catalog/input-sources-query/simple-input-classifier.js +5 -3
- 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/nodes/r-argument.d.ts +13 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +14 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +9 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +13 -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/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -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/util/mermaid/ast.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
|
],
|
|
@@ -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) {
|
|
@@ -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
|
*
|
|
@@ -92,12 +93,21 @@ export declare const Dataflow: {
|
|
|
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
|
|
@@ -94,15 +94,15 @@ 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.Argument | 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))) {
|
|
@@ -114,7 +114,7 @@ exports.Dataflow = {
|
|
|
114
114
|
continue;
|
|
115
115
|
}
|
|
116
116
|
for (const [to, types] of vtx[1]) {
|
|
117
|
-
if (edge_1.DfEdge.includesType(types, followEdges)) {
|
|
117
|
+
if (followEdges === undefined || edge_1.DfEdge.includesType(types, followEdges)) {
|
|
118
118
|
queue.push(to);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -124,6 +124,36 @@ exports.Dataflow = {
|
|
|
124
124
|
}
|
|
125
125
|
return visited;
|
|
126
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
|
+
},
|
|
127
157
|
/**
|
|
128
158
|
* A convenience wrapper for {@link Dataflow.reduceGraph|reducing} the {@link Dataflow.provenance|provenance} of a graph.
|
|
129
159
|
* @param id - The id to use as a seed for provenance calculation
|
|
@@ -102,8 +102,18 @@ export declare const FunctionArgument: {
|
|
|
102
102
|
* foo(a=3, 2) # returns the node id of either `a` or `2`
|
|
103
103
|
* ```
|
|
104
104
|
* @see {@link FunctionArgument.getReference}
|
|
105
|
+
* @see {@link FunctionArgument.getName}
|
|
105
106
|
*/
|
|
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;
|
|
107
117
|
/**
|
|
108
118
|
* Returns the reference of a non-empty argument.
|
|
109
119
|
* @example
|
package/dataflow/graph/graph.js
CHANGED
|
@@ -74,6 +74,7 @@ exports.FunctionArgument = {
|
|
|
74
74
|
* foo(a=3, 2) # returns the node id of either `a` or `2`
|
|
75
75
|
* ```
|
|
76
76
|
* @see {@link FunctionArgument.getReference}
|
|
77
|
+
* @see {@link FunctionArgument.getName}
|
|
77
78
|
*/
|
|
78
79
|
getId(arg) {
|
|
79
80
|
if (arg !== r_function_call_1.EmptyArgument) {
|
|
@@ -81,6 +82,17 @@ exports.FunctionArgument = {
|
|
|
81
82
|
}
|
|
82
83
|
return undefined;
|
|
83
84
|
},
|
|
85
|
+
/**
|
|
86
|
+
* Returns the name of a named argument.
|
|
87
|
+
* @example
|
|
88
|
+
* ```r
|
|
89
|
+
* foo(a = 3, 2) # returns 'a' or undefined
|
|
90
|
+
* ```
|
|
91
|
+
* @see {@link FunctionArgument.getId}
|
|
92
|
+
*/
|
|
93
|
+
getName(arg) {
|
|
94
|
+
return exports.FunctionArgument.isNamed(arg) ? arg.name : undefined;
|
|
95
|
+
},
|
|
84
96
|
/**
|
|
85
97
|
* Returns the reference of a non-empty argument.
|
|
86
98
|
* @example
|
|
@@ -5,5 +5,15 @@ import type { RType } from '../../r-bridge/lang-4.x/ast/model/type';
|
|
|
5
5
|
/**
|
|
6
6
|
* This takes the out parameter `countMap` and fills it with the count of how many times each RType was processed.
|
|
7
7
|
* The accompanying `reset` function can be used to reset the map to an empty state.
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const map = new Map<RType, number>();
|
|
11
|
+
* const analyzer = await new FlowrAnalyzerBuilder()
|
|
12
|
+
* .configure('solver.instrument.dataflowExtractors', instrumentDataflowCount(map, () => map.clear()))
|
|
13
|
+
* .build();
|
|
14
|
+
* analyzer.addRequest(requestFromInput(code));
|
|
15
|
+
* await analyzer.dataflow();
|
|
16
|
+
* ```
|
|
17
|
+
* Now, you can inspect the counts in the `map` objects, these will be reset for each new analysis request using the `() => map.clear()` function.
|
|
8
18
|
*/
|
|
9
19
|
export declare function instrumentDataflowCount(countMap: Map<RType, number>, reset: (map: Map<RType, number>) => void): (extractor: DataflowProcessors<ParentInformation>, ctx: FlowrAnalyzerContext) => DataflowProcessors<ParentInformation>;
|
|
@@ -4,6 +4,16 @@ exports.instrumentDataflowCount = instrumentDataflowCount;
|
|
|
4
4
|
/**
|
|
5
5
|
* This takes the out parameter `countMap` and fills it with the count of how many times each RType was processed.
|
|
6
6
|
* The accompanying `reset` function can be used to reset the map to an empty state.
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const map = new Map<RType, number>();
|
|
10
|
+
* const analyzer = await new FlowrAnalyzerBuilder()
|
|
11
|
+
* .configure('solver.instrument.dataflowExtractors', instrumentDataflowCount(map, () => map.clear()))
|
|
12
|
+
* .build();
|
|
13
|
+
* analyzer.addRequest(requestFromInput(code));
|
|
14
|
+
* await analyzer.dataflow();
|
|
15
|
+
* ```
|
|
16
|
+
* Now, you can inspect the counts in the `map` objects, these will be reset for each new analysis request using the `() => map.clear()` function.
|
|
7
17
|
*/
|
|
8
18
|
function instrumentDataflowCount(countMap, reset) {
|
|
9
19
|
return (extractor, _ctx) => {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
2
2
|
import type { RNode } from '../../../../../../r-bridge/lang-4.x/ast/model/model';
|
|
3
3
|
/**
|
|
4
4
|
* Retrieve the value from an argument, if it is not empty.
|
|
5
5
|
* @see {@link unpackArg} - to specifically retrieve non-named arguments
|
|
6
6
|
*/
|
|
7
|
-
export declare function unpackNonameArg<OtherInfo>(arg:
|
|
7
|
+
export declare function unpackNonameArg<OtherInfo>(arg: PotentiallyEmptyRArgument<OtherInfo> | undefined): RNode<OtherInfo> | undefined;
|
|
8
8
|
/**
|
|
9
9
|
* Retrieve the value from a non-named argument, if it is not empty.
|
|
10
10
|
* @see {@link unpackNonameArg} - to specifically retrieve non-named arguments
|
|
11
11
|
*/
|
|
12
|
-
export declare function unpackArg<OtherInfo>(arg:
|
|
12
|
+
export declare function unpackArg<OtherInfo>(arg: PotentiallyEmptyRArgument<OtherInfo> | undefined): RNode<OtherInfo> | undefined;
|
|
13
13
|
/**
|
|
14
14
|
* Try to unpack the given argument, if it is not empty.
|
|
15
15
|
*/
|
|
16
|
-
export declare function tryUnpackNoNameArg<OtherInfo>(arg:
|
|
16
|
+
export declare function tryUnpackNoNameArg<OtherInfo>(arg: PotentiallyEmptyRArgument<OtherInfo>): RNode<OtherInfo> | PotentiallyEmptyRArgument<OtherInfo>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DataflowProcessorInformation } from '../../../../../processor';
|
|
2
2
|
import type { DataflowInformation } from '../../../../../info';
|
|
3
3
|
import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
|
-
import { type
|
|
4
|
+
import { type PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
5
5
|
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
6
6
|
import { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
7
|
import type { ForceArguments } from '../common';
|
|
@@ -16,10 +16,10 @@ import type { ForceArguments } from '../common';
|
|
|
16
16
|
* a@foo
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export declare function processAccess<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly
|
|
19
|
+
export declare function processAccess<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: {
|
|
20
20
|
treatIndicesAsString: boolean;
|
|
21
21
|
} & ForceArguments): DataflowInformation;
|
|
22
22
|
/**
|
|
23
23
|
* Converts symbol arguments to string arguments within the specified range.
|
|
24
24
|
*/
|
|
25
|
-
export declare function symbolArgumentsToStrings<OtherInfo>(args: readonly
|
|
25
|
+
export declare function symbolArgumentsToStrings<OtherInfo>(args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], firstIndexInclusive?: number, lastIndexInclusive?: number): PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DataflowProcessorInformation } from '../../../../../processor';
|
|
2
2
|
import type { DataflowInformation } from '../../../../../info';
|
|
3
|
-
import { type
|
|
3
|
+
import { type PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
4
4
|
import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
5
5
|
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
6
6
|
import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
@@ -20,4 +20,4 @@ export interface BuiltInApplyConfiguration extends MergeableRecord {
|
|
|
20
20
|
/**
|
|
21
21
|
* Process an apply call like `vapply` or `mapply`.
|
|
22
22
|
*/
|
|
23
|
-
export declare function processApply<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly
|
|
23
|
+
export declare function processApply<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: BuiltInApplyConfiguration): DataflowInformation;
|
|
@@ -3,7 +3,7 @@ import type { DataflowInformation } from '../../../../../info';
|
|
|
3
3
|
import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
4
|
import type { RNode } from '../../../../../../r-bridge/lang-4.x/ast/model/model';
|
|
5
5
|
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
6
|
-
import type {
|
|
6
|
+
import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
7
7
|
import { type NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
8
8
|
import { Identifier, type InGraphIdentifierDefinition } from '../../../../../environments/identifier';
|
|
9
9
|
import type { DataflowGraphVertexFunctionDefinition } from '../../../../../graph/vertex';
|
|
@@ -35,13 +35,13 @@ export interface ExtendedAssignmentConfiguration extends AssignmentConfiguration
|
|
|
35
35
|
/**
|
|
36
36
|
* In contrast to `processAssignment`, this function allows more flexible handling of assignment-like functions.
|
|
37
37
|
*/
|
|
38
|
-
export declare function processAssignmentLike<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly
|
|
38
|
+
export declare function processAssignmentLike<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: ExtendedAssignmentConfiguration): DataflowInformation;
|
|
39
39
|
/**
|
|
40
40
|
* Processes an assignment, i.e., `<target> <- <source>`.
|
|
41
41
|
* Handling it as a function call \`<-\` `(<target>, <source>)`.
|
|
42
42
|
* This includes handling of replacement functions (e.g., `names(x) <- ...` as \`names<-\` `(x, ...)`).
|
|
43
43
|
*/
|
|
44
|
-
export declare function processAssignment<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly
|
|
44
|
+
export declare function processAssignment<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: AssignmentConfiguration): DataflowInformation;
|
|
45
45
|
export interface AssignmentToSymbolParameters<OtherInfo> extends AssignmentConfiguration {
|
|
46
46
|
readonly nameOfAssignmentFunction: Identifier;
|
|
47
47
|
readonly source: RNode<OtherInfo & ParentInformation>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type DataflowProcessorInformation } from '../../../../../processor';
|
|
2
2
|
import { DataflowInformation } from '../../../../../info';
|
|
3
3
|
import { type ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
|
-
import { type
|
|
4
|
+
import { type PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
5
5
|
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
6
6
|
import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
7
|
/**
|
|
8
8
|
* Process a call to `eval()`, trying to resolve the code being evaluated if possible.
|
|
9
9
|
*/
|
|
10
|
-
export declare function processEvalCall<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly
|
|
10
|
+
export declare function processEvalCall<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: {
|
|
11
11
|
/** should this produce an explicit source function call in the graph? */
|
|
12
12
|
includeFunctionCall?: boolean;
|
|
13
13
|
}): DataflowInformation;
|
|
@@ -6,9 +6,9 @@ import type { DataflowInformation } from '../../../../../info';
|
|
|
6
6
|
import { type DataflowProcessorInformation } from '../../../../../processor';
|
|
7
7
|
import { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
8
8
|
import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
9
|
-
import type {
|
|
9
|
+
import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
10
10
|
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
11
11
|
/**
|
|
12
12
|
* Processes a list of expressions joining their dataflow graphs accordingly.
|
|
13
13
|
*/
|
|
14
|
-
export declare function processExpressionList<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly
|
|
14
|
+
export declare function processExpressionList<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type DataflowProcessorInformation } from '../../../../../processor';
|
|
2
2
|
import { type DataflowInformation } from '../../../../../info';
|
|
3
3
|
import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
|
-
import type {
|
|
4
|
+
import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
5
5
|
import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
6
6
|
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
7
7
|
/**
|
|
@@ -11,4 +11,4 @@ import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/node
|
|
|
11
11
|
* `for`(<variable>, <vector>, <body>)
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
|
-
export declare function processForLoop<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly
|
|
14
|
+
export declare function processForLoop<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
|
|
@@ -2,7 +2,7 @@ import { type DataflowProcessorInformation } from '../../../../../processor';
|
|
|
2
2
|
import { type DataflowInformation } from '../../../../../info';
|
|
3
3
|
import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
4
|
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
5
|
-
import { type
|
|
5
|
+
import { type PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
6
6
|
import { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
7
|
import { DataflowGraph } from '../../../../../graph/graph';
|
|
8
8
|
import { type REnvironmentInformation } from '../../../../../environments/environment';
|
|
@@ -10,7 +10,7 @@ import type { ReadOnlyFlowrAnalyzerContext } from '../../../../../../project/con
|
|
|
10
10
|
/**
|
|
11
11
|
* Process a function definition, i.e., `function(a, b) { ... }`
|
|
12
12
|
*/
|
|
13
|
-
export declare function processFunctionDefinition<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly
|
|
13
|
+
export declare function processFunctionDefinition<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
|
|
14
14
|
/**
|
|
15
15
|
* Retrieve the active environment when entering a function definition or call
|
|
16
16
|
* @param callerEnvironment - environment at the call site / function definition site
|
|
@@ -231,20 +231,10 @@ function updateNestedFunctionCalls(graph, outEnvironment) {
|
|
|
231
231
|
// track *all* function definitions - including those nested within the current graph,
|
|
232
232
|
// try to resolve their 'in' by only using the lowest scope which will be popped after this definition
|
|
233
233
|
for (const [id, { onlyBuiltin, environment, name, args, origin }] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
234
|
-
if (onlyBuiltin ||
|
|
234
|
+
if (onlyBuiltin || name === undefined) {
|
|
235
235
|
continue;
|
|
236
236
|
}
|
|
237
|
-
|
|
238
|
-
// only the call environment counts!
|
|
239
|
-
if (environment) {
|
|
240
|
-
while (outEnvironment.level > environment.level) {
|
|
241
|
-
outEnvironment = (0, scoping_1.popLocalEnvironment)(outEnvironment);
|
|
242
|
-
}
|
|
243
|
-
while (outEnvironment.level < environment.level) {
|
|
244
|
-
outEnvironment = (0, scoping_1.pushLocalEnvironment)(outEnvironment);
|
|
245
|
-
}
|
|
246
|
-
effectiveEnvironment = (0, overwrite_1.overwriteEnvironment)(outEnvironment, environment);
|
|
247
|
-
}
|
|
237
|
+
const effectiveEnvironment = environment ? (0, overwrite_1.overwriteEnvironment)(outEnvironment, environment) : outEnvironment;
|
|
248
238
|
const targets = new Set((0, linker_1.getAllFunctionCallTargets)(id, graph, effectiveEnvironment));
|
|
249
239
|
const collectedNextMethods = new Set();
|
|
250
240
|
const treatAsS3 = origin.includes(built_in_proc_name_1.BuiltInProcName.S3Dispatch);
|
|
@@ -255,11 +245,10 @@ function updateNestedFunctionCalls(graph, outEnvironment) {
|
|
|
255
245
|
}
|
|
256
246
|
const targetVertex = graph.getVertex(target);
|
|
257
247
|
// support reads on symbols
|
|
258
|
-
if (targetVertex?.tag
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
else if (targetVertex?.tag !== vertex_1.VertexType.FunctionDefinition) {
|
|
248
|
+
if (targetVertex?.tag !== vertex_1.VertexType.FunctionDefinition) {
|
|
249
|
+
if (targetVertex?.tag === vertex_1.VertexType.Use) {
|
|
250
|
+
graph.addEdge(id, target, edge_1.EdgeType.Reads);
|
|
251
|
+
}
|
|
263
252
|
continue;
|
|
264
253
|
}
|
|
265
254
|
graph.addEdge(id, target, edge_1.EdgeType.Calls);
|