@eagleoutice/flowr 2.3.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +42 -30
  2. package/abstract-interpretation/data-frame/absint-visitor.d.ts +2 -3
  3. package/abstract-interpretation/data-frame/absint-visitor.js +14 -16
  4. package/abstract-interpretation/data-frame/mappers/function-mapper.js +3 -3
  5. package/abstract-interpretation/data-frame/semantics.d.ts +1 -1
  6. package/abstract-interpretation/data-frame/semantics.js +7 -10
  7. package/abstract-interpretation/data-frame/shape-inference.js +2 -8
  8. package/benchmark/slicer.js +7 -5
  9. package/benchmark/stats/size-of.js +3 -3
  10. package/benchmark/summarizer/second-phase/graph.js +1 -1
  11. package/benchmark/summarizer/second-phase/process.js +1 -1
  12. package/cli/benchmark-app.d.ts +1 -0
  13. package/cli/benchmark-app.js +1 -0
  14. package/cli/benchmark-helper-app.d.ts +1 -0
  15. package/cli/benchmark-helper-app.js +4 -3
  16. package/cli/common/options.js +2 -0
  17. package/cli/repl/commands/repl-query.js +1 -1
  18. package/cli/repl/server/connection.js +14 -5
  19. package/control-flow/basic-cfg-guided-visitor.d.ts +1 -2
  20. package/control-flow/basic-cfg-guided-visitor.js +0 -6
  21. package/control-flow/cfg-simplification.d.ts +6 -0
  22. package/control-flow/cfg-simplification.js +18 -9
  23. package/control-flow/control-flow-graph.d.ts +2 -8
  24. package/control-flow/control-flow-graph.js +1 -6
  25. package/control-flow/extract-cfg.d.ts +2 -2
  26. package/control-flow/extract-cfg.js +52 -63
  27. package/core/pipeline-executor.js +0 -8
  28. package/core/steps/all/static-slicing/00-slice.d.ts +7 -1
  29. package/core/steps/all/static-slicing/00-slice.js +9 -3
  30. package/core/steps/pipeline/default-pipelines.d.ts +74 -74
  31. package/dataflow/environments/append.js +1 -1
  32. package/dataflow/environments/built-in-config.d.ts +12 -4
  33. package/dataflow/environments/built-in-config.js +23 -82
  34. package/dataflow/environments/built-in.d.ts +40 -6
  35. package/dataflow/environments/built-in.js +119 -23
  36. package/dataflow/environments/clone.d.ts +3 -2
  37. package/dataflow/environments/clone.js +6 -5
  38. package/dataflow/environments/define.js +1 -2
  39. package/dataflow/environments/diff.js +1 -3
  40. package/dataflow/environments/environment.d.ts +18 -24
  41. package/dataflow/environments/environment.js +25 -37
  42. package/dataflow/environments/overwrite.d.ts +1 -1
  43. package/dataflow/environments/overwrite.js +1 -1
  44. package/dataflow/environments/remove.d.ts +2 -2
  45. package/dataflow/environments/remove.js +3 -4
  46. package/dataflow/environments/resolve-by-name.d.ts +3 -3
  47. package/dataflow/environments/resolve-by-name.js +4 -5
  48. package/dataflow/eval/resolve/alias-tracking.d.ts +12 -12
  49. package/dataflow/eval/resolve/alias-tracking.js +12 -12
  50. package/dataflow/eval/resolve/resolve.js +1 -1
  51. package/dataflow/extractor.js +6 -1
  52. package/dataflow/graph/dataflowgraph-builder.d.ts +3 -1
  53. package/dataflow/graph/dataflowgraph-builder.js +2 -2
  54. package/dataflow/graph/graph.d.ts +2 -1
  55. package/dataflow/graph/graph.js +6 -2
  56. package/dataflow/graph/invert-dfg.d.ts +2 -0
  57. package/dataflow/graph/invert-dfg.js +17 -0
  58. package/dataflow/info.d.ts +1 -1
  59. package/dataflow/internal/linker.js +9 -9
  60. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +1 -1
  61. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +3 -4
  62. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +5 -5
  63. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -7
  64. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +2 -2
  65. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +1 -1
  66. package/dataflow/processor.d.ts +5 -1
  67. package/documentation/doc-util/doc-env.js +1 -2
  68. package/documentation/doc-util/doc-query.js +1 -1
  69. package/documentation/doc-util/doc-search.js +2 -2
  70. package/documentation/print-cfg-wiki.js +3 -4
  71. package/documentation/print-core-wiki.js +2 -2
  72. package/documentation/print-dataflow-graph-wiki.js +7 -0
  73. package/documentation/print-faq-wiki.js +4 -0
  74. package/documentation/print-linter-wiki.js +32 -4
  75. package/documentation/print-linting-and-testing-wiki.js +13 -1
  76. package/documentation/print-onboarding-wiki.js +4 -0
  77. package/documentation/print-query-wiki.js +12 -3
  78. package/linter/linter-executor.js +1 -2
  79. package/linter/linter-format.d.ts +26 -4
  80. package/linter/linter-format.js +25 -6
  81. package/linter/linter-rules.d.ts +40 -12
  82. package/linter/linter-rules.js +3 -1
  83. package/linter/rules/absolute-path.d.ts +4 -7
  84. package/linter/rules/absolute-path.js +9 -6
  85. package/linter/rules/dataframe-access-validation.d.ts +3 -1
  86. package/linter/rules/dataframe-access-validation.js +3 -1
  87. package/linter/rules/dead-code.d.ts +43 -0
  88. package/linter/rules/dead-code.js +50 -0
  89. package/linter/rules/deprecated-functions.d.ts +3 -2
  90. package/linter/rules/deprecated-functions.js +3 -1
  91. package/linter/rules/file-path-validity.d.ts +4 -4
  92. package/linter/rules/file-path-validity.js +8 -6
  93. package/linter/rules/naming-convention.d.ts +4 -3
  94. package/linter/rules/naming-convention.js +3 -1
  95. package/linter/rules/seeded-randomness.d.ts +4 -3
  96. package/linter/rules/seeded-randomness.js +3 -1
  97. package/linter/rules/unused-definition.d.ts +2 -0
  98. package/linter/rules/unused-definition.js +3 -1
  99. package/package.json +1 -1
  100. package/queries/base-query-format.d.ts +2 -0
  101. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +7 -7
  102. package/queries/catalog/dependencies-query/dependencies-query-executor.js +24 -1
  103. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +9 -5
  104. package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -2
  105. package/queries/catalog/dependencies-query/function-info/write-functions.js +6 -0
  106. package/queries/catalog/linter-query/linter-query-format.js +1 -1
  107. package/queries/catalog/location-map-query/location-map-query-executor.js +7 -5
  108. package/queries/catalog/location-map-query/location-map-query-format.d.ts +3 -0
  109. package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
  110. package/queries/catalog/search-query/search-query-executor.js +1 -1
  111. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
  112. package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -2
  113. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +3 -0
  114. package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -1
  115. package/queries/query-print.d.ts +1 -1
  116. package/queries/query-print.js +0 -1
  117. package/queries/query.d.ts +16 -5
  118. package/queries/query.js +24 -11
  119. package/search/flowr-search-builder.d.ts +6 -6
  120. package/search/flowr-search-executor.d.ts +2 -2
  121. package/search/flowr-search-executor.js +1 -1
  122. package/search/flowr-search.d.ts +13 -8
  123. package/search/flowr-search.js +21 -0
  124. package/search/search-executor/search-enrichers.d.ts +87 -20
  125. package/search/search-executor/search-enrichers.js +44 -5
  126. package/search/search-executor/search-generators.d.ts +4 -4
  127. package/search/search-executor/search-generators.js +12 -7
  128. package/search/search-executor/search-mappers.js +3 -2
  129. package/search/search-executor/search-transformer.d.ts +3 -3
  130. package/search/search-executor/search-transformer.js +2 -2
  131. package/slicing/static/fingerprint.js +1 -2
  132. package/slicing/static/slice-call.d.ts +2 -1
  133. package/slicing/static/slice-call.js +3 -3
  134. package/slicing/static/static-slicer.d.ts +6 -5
  135. package/slicing/static/static-slicer.js +13 -7
  136. package/util/collections/arrays.d.ts +2 -0
  137. package/util/collections/arrays.js +9 -0
  138. package/util/containers.d.ts +1 -0
  139. package/util/containers.js +1 -0
  140. package/util/json.js +1 -4
  141. package/util/mermaid/dfg.js +5 -4
  142. package/util/prefix.d.ts +1 -1
  143. package/util/range.d.ts +1 -0
  144. package/util/range.js +5 -1
  145. package/util/version.js +1 -1
@@ -8,6 +8,20 @@ import type { RShell } from '../../../r-bridge/shell';
8
8
  import type { TreeSitterExecutor } from '../../../r-bridge/lang-4.x/tree-sitter/tree-sitter-executor';
9
9
  import type { FlowrConfigOptions } from '../../../config';
10
10
  export declare const DEFAULT_SLICING_PIPELINE: import("./pipeline").Pipeline<{
11
+ readonly name: "slice";
12
+ readonly humanReadableName: "static slice";
13
+ readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
14
+ readonly processor: (results: {
15
+ dataflow?: import("../../../dataflow/info").DataflowInformation;
16
+ normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
17
+ }, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
18
+ readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
19
+ readonly printer: {
20
+ readonly 0: typeof import("../../print/print").internalPrinter;
21
+ };
22
+ readonly dependencies: readonly ["dataflow"];
23
+ readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
24
+ } | {
11
25
  readonly name: "parse";
12
26
  readonly humanReadableName: "parse with R shell";
13
27
  readonly description: "Parse the given R code into an AST";
@@ -60,20 +74,6 @@ export declare const DEFAULT_SLICING_PIPELINE: import("./pipeline").Pipeline<{
60
74
  readonly 4: typeof import("../../print/dataflow-printer").dataflowGraphToMermaidUrl;
61
75
  };
62
76
  readonly dependencies: readonly ["normalize"];
63
- } | {
64
- readonly name: "slice";
65
- readonly humanReadableName: "static slice";
66
- readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
67
- readonly processor: (results: {
68
- dataflow?: import("../../../dataflow/info").DataflowInformation;
69
- normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
70
- }, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
71
- readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
72
- readonly printer: {
73
- readonly 0: typeof import("../../print/print").internalPrinter;
74
- };
75
- readonly dependencies: readonly ["dataflow"];
76
- readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
77
77
  } | {
78
78
  readonly name: "reconstruct";
79
79
  readonly humanReadableName: "static code reconstruction";
@@ -90,6 +90,20 @@ export declare const DEFAULT_SLICING_PIPELINE: import("./pipeline").Pipeline<{
90
90
  readonly requiredInput: import("../all/static-slicing/10-reconstruct").ReconstructRequiredInput;
91
91
  }>;
92
92
  export declare const DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipeline").Pipeline<{
93
+ readonly name: "slice";
94
+ readonly humanReadableName: "static slice";
95
+ readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
96
+ readonly processor: (results: {
97
+ dataflow?: import("../../../dataflow/info").DataflowInformation;
98
+ normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
99
+ }, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
100
+ readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
101
+ readonly printer: {
102
+ readonly 0: typeof import("../../print/print").internalPrinter;
103
+ };
104
+ readonly dependencies: readonly ["dataflow"];
105
+ readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
106
+ } | {
93
107
  readonly name: "parse";
94
108
  readonly humanReadableName: "parse with R shell";
95
109
  readonly description: "Parse the given R code into an AST";
@@ -142,20 +156,6 @@ export declare const DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipeline"
142
156
  readonly 4: typeof import("../../print/dataflow-printer").dataflowGraphToMermaidUrl;
143
157
  };
144
158
  readonly dependencies: readonly ["normalize"];
145
- } | {
146
- readonly name: "slice";
147
- readonly humanReadableName: "static slice";
148
- readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
149
- readonly processor: (results: {
150
- dataflow?: import("../../../dataflow/info").DataflowInformation;
151
- normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
152
- }, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
153
- readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
154
- readonly printer: {
155
- readonly 0: typeof import("../../print/print").internalPrinter;
156
- };
157
- readonly dependencies: readonly ["dataflow"];
158
- readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
159
159
  } | {
160
160
  readonly name: "reconstruct";
161
161
  readonly humanReadableName: "static code reconstruction";
@@ -172,6 +172,20 @@ export declare const DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipeline"
172
172
  readonly requiredInput: import("../all/static-slicing/10-reconstruct").ReconstructRequiredInput;
173
173
  }>;
174
174
  export declare const DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./pipeline").Pipeline<{
175
+ readonly name: "slice";
176
+ readonly humanReadableName: "static slice";
177
+ readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
178
+ readonly processor: (results: {
179
+ dataflow?: import("../../../dataflow/info").DataflowInformation;
180
+ normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
181
+ }, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
182
+ readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
183
+ readonly printer: {
184
+ readonly 0: typeof import("../../print/print").internalPrinter;
185
+ };
186
+ readonly dependencies: readonly ["dataflow"];
187
+ readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
188
+ } | {
175
189
  readonly name: "parse";
176
190
  readonly humanReadableName: "parse with R shell";
177
191
  readonly description: "Parse the given R code into an AST";
@@ -224,22 +238,22 @@ export declare const DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./pipel
224
238
  readonly 4: typeof import("../../print/dataflow-printer").dataflowGraphToMermaidUrl;
225
239
  };
226
240
  readonly dependencies: readonly ["normalize"];
227
- } | {
241
+ }>;
242
+ export declare const TREE_SITTER_SLICING_PIPELINE: import("./pipeline").Pipeline<{
228
243
  readonly name: "slice";
229
244
  readonly humanReadableName: "static slice";
230
245
  readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
231
246
  readonly processor: (results: {
232
247
  dataflow?: import("../../../dataflow/info").DataflowInformation;
233
248
  normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
234
- }, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
249
+ }, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
235
250
  readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
236
251
  readonly printer: {
237
252
  readonly 0: typeof import("../../print/print").internalPrinter;
238
253
  };
239
254
  readonly dependencies: readonly ["dataflow"];
240
255
  readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
241
- }>;
242
- export declare const TREE_SITTER_SLICING_PIPELINE: import("./pipeline").Pipeline<{
256
+ } | {
243
257
  readonly humanReadableName: "dataflow";
244
258
  readonly processor: (results: {
245
259
  normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
@@ -259,20 +273,6 @@ export declare const TREE_SITTER_SLICING_PIPELINE: import("./pipeline").Pipeline
259
273
  readonly 4: typeof import("../../print/dataflow-printer").dataflowGraphToMermaidUrl;
260
274
  };
261
275
  readonly dependencies: readonly ["normalize"];
262
- } | {
263
- readonly name: "slice";
264
- readonly humanReadableName: "static slice";
265
- readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
266
- readonly processor: (results: {
267
- dataflow?: import("../../../dataflow/info").DataflowInformation;
268
- normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
269
- }, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
270
- readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
271
- readonly printer: {
272
- readonly 0: typeof import("../../print/print").internalPrinter;
273
- };
274
- readonly dependencies: readonly ["dataflow"];
275
- readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
276
276
  } | {
277
277
  readonly name: "reconstruct";
278
278
  readonly humanReadableName: "static code reconstruction";
@@ -321,6 +321,20 @@ export declare const TREE_SITTER_SLICING_PIPELINE: import("./pipeline").Pipeline
321
321
  readonly requiredInput: import("../all/core/10-normalize").NormalizeRequiredInput;
322
322
  }>;
323
323
  export declare const TREE_SITTER_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipeline").Pipeline<{
324
+ readonly name: "slice";
325
+ readonly humanReadableName: "static slice";
326
+ readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
327
+ readonly processor: (results: {
328
+ dataflow?: import("../../../dataflow/info").DataflowInformation;
329
+ normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
330
+ }, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
331
+ readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
332
+ readonly printer: {
333
+ readonly 0: typeof import("../../print/print").internalPrinter;
334
+ };
335
+ readonly dependencies: readonly ["dataflow"];
336
+ readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
337
+ } | {
324
338
  readonly humanReadableName: "dataflow";
325
339
  readonly processor: (results: {
326
340
  normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
@@ -340,20 +354,6 @@ export declare const TREE_SITTER_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipel
340
354
  readonly 4: typeof import("../../print/dataflow-printer").dataflowGraphToMermaidUrl;
341
355
  };
342
356
  readonly dependencies: readonly ["normalize"];
343
- } | {
344
- readonly name: "slice";
345
- readonly humanReadableName: "static slice";
346
- readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
347
- readonly processor: (results: {
348
- dataflow?: import("../../../dataflow/info").DataflowInformation;
349
- normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
350
- }, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
351
- readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
352
- readonly printer: {
353
- readonly 0: typeof import("../../print/print").internalPrinter;
354
- };
355
- readonly dependencies: readonly ["dataflow"];
356
- readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
357
357
  } | {
358
358
  readonly name: "reconstruct";
359
359
  readonly humanReadableName: "static code reconstruction";
@@ -402,6 +402,20 @@ export declare const TREE_SITTER_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipel
402
402
  readonly requiredInput: import("../all/core/10-normalize").NormalizeRequiredInput;
403
403
  }>;
404
404
  export declare const TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./pipeline").Pipeline<{
405
+ readonly name: "slice";
406
+ readonly humanReadableName: "static slice";
407
+ readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
408
+ readonly processor: (results: {
409
+ dataflow?: import("../../../dataflow/info").DataflowInformation;
410
+ normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
411
+ }, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
412
+ readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
413
+ readonly printer: {
414
+ readonly 0: typeof import("../../print/print").internalPrinter;
415
+ };
416
+ readonly dependencies: readonly ["dataflow"];
417
+ readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
418
+ } | {
405
419
  readonly humanReadableName: "dataflow";
406
420
  readonly processor: (results: {
407
421
  normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
@@ -421,20 +435,6 @@ export declare const TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./p
421
435
  readonly 4: typeof import("../../print/dataflow-printer").dataflowGraphToMermaidUrl;
422
436
  };
423
437
  readonly dependencies: readonly ["normalize"];
424
- } | {
425
- readonly name: "slice";
426
- readonly humanReadableName: "static slice";
427
- readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
428
- readonly processor: (results: {
429
- dataflow?: import("../../../dataflow/info").DataflowInformation;
430
- normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
431
- }, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
432
- readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
433
- readonly printer: {
434
- readonly 0: typeof import("../../print/print").internalPrinter;
435
- };
436
- readonly dependencies: readonly ["dataflow"];
437
- readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
438
438
  } | {
439
439
  readonly name: "parse";
440
440
  readonly humanReadableName: "parse with tree-sitter";
@@ -25,7 +25,7 @@ function appendIEnvironmentWith(base, next) {
25
25
  map.set(key, value);
26
26
  }
27
27
  }
28
- const parent = base.parent === environment_1.BuiltInEnvironment ? environment_1.BuiltInEnvironment : appendIEnvironmentWith(base.parent, next.parent);
28
+ const parent = base.parent.builtInEnv ? base.parent : appendIEnvironmentWith(base.parent, next.parent);
29
29
  const out = new environment_1.Environment(parent);
30
30
  out.memory = map;
31
31
  return out;
@@ -1,4 +1,5 @@
1
1
  import type { BuiltInMappingName, ConfigOfBuiltInMappingName } from './built-in';
2
+ import { BuiltIns } from './built-in';
2
3
  import type { Identifier } from './identifier';
3
4
  export interface BaseBuiltInDefinition {
4
5
  /** The type of the built-in configuration */
@@ -45,7 +46,14 @@ export type BuiltInDefinition = BuiltInConstantDefinition<any> | BuiltInFunction
45
46
  * @see DefaultBuiltinConfig
46
47
  */
47
48
  export type BuiltInDefinitions = BuiltInDefinition[];
48
- export declare function registerBuiltInFunctions<BuiltInProcessor extends BuiltInMappingName>({ names, processor, config, assumePrimitive }: BuiltInFunctionDefinition<BuiltInProcessor>): void;
49
- export declare function registerReplacementFunctions({ names, suffixes, assumePrimitive, config }: BuiltInReplacementDefinition): void;
50
- export declare function registerBuiltInDefinition(definition: BuiltInDefinition): void;
51
- export declare function registerBuiltInDefinitions(definitions: BuiltInDefinitions): void;
49
+ /**
50
+ * Get the {@link BuiltIns#builtInMemory} and {@link BuiltIns#emptyBuiltInMemory} for the {@link DefaultBuiltinConfig}.
51
+ */
52
+ export declare function getDefaultBuiltInDefinitions(): BuiltIns;
53
+ /**
54
+ * Get the {@link BuiltIns#builtInMemory} and {@link BuiltIns#emptyBuiltInMemory} for the given list of built-in definitions.
55
+ *
56
+ * @param definitions - the list of built-in definitions
57
+ * @param loadDefaults - whether to first add the {@link DefaultBuiltinConfig} before the given {@link definitions}
58
+ */
59
+ export declare function getBuiltInDefinitions(definitions: BuiltInDefinitions, loadDefaults: boolean | undefined): BuiltIns;
@@ -1,92 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.registerBuiltInFunctions = registerBuiltInFunctions;
4
- exports.registerReplacementFunctions = registerReplacementFunctions;
5
- exports.registerBuiltInDefinition = registerBuiltInDefinition;
6
- exports.registerBuiltInDefinitions = registerBuiltInDefinitions;
3
+ exports.getDefaultBuiltInDefinitions = getDefaultBuiltInDefinitions;
4
+ exports.getBuiltInDefinitions = getBuiltInDefinitions;
7
5
  const built_in_1 = require("./built-in");
8
- const identifier_1 = require("./identifier");
9
- const assert_1 = require("../../util/assert");
10
- function registerBuiltInConstant({ names, value, assumePrimitive }) {
11
- for (const name of names) {
12
- const id = (0, built_in_1.builtInId)(name);
13
- const d = [{
14
- type: identifier_1.ReferenceType.BuiltInConstant,
15
- definedAt: id,
16
- controlDependencies: undefined,
17
- value,
18
- name,
19
- nodeId: id
20
- }];
21
- built_in_1.BuiltInMemory.set(name, d);
22
- if (assumePrimitive) {
23
- built_in_1.EmptyBuiltInMemory.set(name, d);
24
- }
6
+ const default_builtin_config_1 = require("./default-builtin-config");
7
+ /**
8
+ * Get the {@link BuiltIns#builtInMemory} and {@link BuiltIns#emptyBuiltInMemory} for the {@link DefaultBuiltinConfig}.
9
+ */
10
+ function getDefaultBuiltInDefinitions() {
11
+ const builtIns = new built_in_1.BuiltIns();
12
+ for (const definition of default_builtin_config_1.DefaultBuiltinConfig) {
13
+ builtIns.registerBuiltInDefinition(definition);
25
14
  }
15
+ return builtIns;
26
16
  }
27
- function registerBuiltInFunctions({ names, processor, config, assumePrimitive }) {
28
- const mappedProcessor = built_in_1.BuiltInProcessorMapper[processor];
29
- (0, assert_1.guard)(mappedProcessor !== undefined, () => `Processor for ${processor} is undefined! Please pass a valid builtin name ${JSON.stringify(Object.keys(built_in_1.BuiltInProcessorMapper))}!`);
30
- for (const name of names) {
31
- (0, assert_1.guard)(processor !== undefined, `Processor for ${name} is undefined, maybe you have an import loop? You may run 'npm run detect-circular-deps' - although by far not all are bad`);
32
- const id = (0, built_in_1.builtInId)(name);
33
- const d = [{
34
- type: identifier_1.ReferenceType.BuiltInFunction,
35
- definedAt: id,
36
- controlDependencies: undefined,
37
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-argument */
38
- processor: (name, args, rootId, data) => mappedProcessor(name, args, rootId, data, config),
39
- config,
40
- name,
41
- nodeId: id
42
- }];
43
- built_in_1.BuiltInMemory.set(name, d);
44
- if (assumePrimitive) {
45
- built_in_1.EmptyBuiltInMemory.set(name, d);
46
- }
17
+ /**
18
+ * Get the {@link BuiltIns#builtInMemory} and {@link BuiltIns#emptyBuiltInMemory} for the given list of built-in definitions.
19
+ *
20
+ * @param definitions - the list of built-in definitions
21
+ * @param loadDefaults - whether to first add the {@link DefaultBuiltinConfig} before the given {@link definitions}
22
+ */
23
+ function getBuiltInDefinitions(definitions, loadDefaults) {
24
+ let builtIns = new built_in_1.BuiltIns();
25
+ if (loadDefaults) {
26
+ builtIns = getDefaultBuiltInDefinitions();
47
27
  }
48
- }
49
- /* registers all combinations of replacements */
50
- function registerReplacementFunctions({ names, suffixes, assumePrimitive, config }) {
51
- const replacer = built_in_1.BuiltInProcessorMapper['builtin:replacement'];
52
- (0, assert_1.guard)(replacer !== undefined, () => 'Processor for builtin:replacement is undefined!');
53
- for (const assignment of names) {
54
- for (const suffix of suffixes) {
55
- const effectiveName = `${assignment}${suffix}`;
56
- const id = (0, built_in_1.builtInId)(effectiveName);
57
- const d = [{
58
- type: identifier_1.ReferenceType.BuiltInFunction,
59
- definedAt: id,
60
- processor: (name, args, rootId, data) => replacer(name, args, rootId, data, { makeMaybe: true, assignmentOperator: suffix, readIndices: config.readIndices }),
61
- config: {
62
- ...config,
63
- assignmentOperator: suffix,
64
- makeMaybe: true
65
- },
66
- name: effectiveName,
67
- controlDependencies: undefined,
68
- nodeId: id
69
- }];
70
- built_in_1.BuiltInMemory.set(effectiveName, d);
71
- if (assumePrimitive) {
72
- built_in_1.EmptyBuiltInMemory.set(effectiveName, d);
73
- }
74
- }
75
- }
76
- }
77
- function registerBuiltInDefinition(definition) {
78
- switch (definition.type) {
79
- case 'constant':
80
- return registerBuiltInConstant(definition);
81
- case 'function':
82
- return registerBuiltInFunctions(definition);
83
- case 'replacement':
84
- return registerReplacementFunctions(definition);
85
- }
86
- }
87
- function registerBuiltInDefinitions(definitions) {
88
28
  for (const definition of definitions) {
89
- registerBuiltInDefinition(definition);
29
+ builtIns.registerBuiltInDefinition(definition);
90
30
  }
31
+ return builtIns;
91
32
  }
92
33
  //# sourceMappingURL=built-in-config.js.map
@@ -30,9 +30,10 @@ import { processRm } from '../internal/process/functions/call/built-in/built-in-
30
30
  import { processEvalCall } from '../internal/process/functions/call/built-in/built-in-eval';
31
31
  import type { REnvironmentInformation } from './environment';
32
32
  import type { Value } from '../eval/values/r-value';
33
- import { resolveAsVector, resolveAsSeq, resolveAsMinus, resolveAsPlus } from '../eval/resolve/resolve';
33
+ import { resolveAsMinus, resolveAsPlus, resolveAsSeq, resolveAsVector } from '../eval/resolve/resolve';
34
34
  import type { DataflowGraph } from '../graph/graph';
35
35
  import type { VariableResolve } from '../../config';
36
+ import type { BuiltInConstantDefinition, BuiltInDefinition, BuiltInFunctionDefinition, BuiltInReplacementDefinition } from './built-in-config';
36
37
  export type BuiltIn = `built-in:${string}`;
37
38
  export declare function builtInId(name: string): BuiltIn;
38
39
  export declare function isBuiltIn(name: NodeId | string): name is BuiltIn;
@@ -54,7 +55,7 @@ export interface DefaultBuiltInProcessorConfiguration extends ForceArguments {
54
55
  readonly returnsNthArgument?: number | 'last';
55
56
  readonly cfg?: ExitPointType;
56
57
  readonly readAllArguments?: boolean;
57
- readonly hasUnknownSideEffects?: boolean | LinkTo<RegExp | string>;
58
+ readonly hasUnknownSideEffects?: boolean | LinkTo;
58
59
  /** record mapping the actual function name called to the arguments that should be treated as function calls */
59
60
  readonly treatAsFnCall?: Record<string, readonly string[]>;
60
61
  /** Name that should be used for the origin (useful when needing to differentiate between
@@ -63,8 +64,8 @@ export interface DefaultBuiltInProcessorConfiguration extends ForceArguments {
63
64
  readonly useAsProcessor?: UseAsProcessors;
64
65
  }
65
66
  export type BuiltInEvalHandler = (resolve: VariableResolve, a: RNodeWithParent, env?: REnvironmentInformation, graph?: DataflowGraph, map?: AstIdMap) => Value;
66
- declare function defaultBuiltInProcessor<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: DefaultBuiltInProcessorConfiguration): DataflowInformation;
67
- export declare function registerBuiltInFunctions<Config extends object, Proc extends BuiltInIdentifierProcessorWithConfig<Config>>(both: boolean, names: readonly Identifier[], processor: Proc, config: Config): void;
67
+ declare function defaultBuiltInProcessor<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { returnsNthArgument, useAsProcessor, forceArgs, readAllArguments, cfg, hasUnknownSideEffects, treatAsFnCall }: DefaultBuiltInProcessorConfiguration): DataflowInformation;
68
+ export declare function registerBuiltInFunctions<Config extends object, Proc extends BuiltInIdentifierProcessorWithConfig<Config>>(both: boolean, names: readonly Identifier[], processor: Proc, config: Config, builtIns: BuiltIns): void;
68
69
  export declare const BuiltInProcessorMapper: {
69
70
  readonly 'builtin:default': typeof defaultBuiltInProcessor;
70
71
  readonly 'builtin:eval': typeof processEvalCall;
@@ -96,6 +97,39 @@ export declare const BuiltInEvalHandlerMapper: {
96
97
  };
97
98
  export type BuiltInMappingName = keyof typeof BuiltInProcessorMapper;
98
99
  export type ConfigOfBuiltInMappingName<N extends BuiltInMappingName> = Parameters<typeof BuiltInProcessorMapper[N]>[4];
99
- export declare const BuiltInMemory: Map<Identifier, IdentifierDefinition[]>;
100
- export declare const EmptyBuiltInMemory: Map<Identifier, IdentifierDefinition[]>;
100
+ export type BuiltInMemory = Map<Identifier, IdentifierDefinition[]>;
101
+ export declare class BuiltIns {
102
+ /**
103
+ * Register a built-in constant (like `NULL` or `TRUE`) to the given {@link builtIns}
104
+ */
105
+ registerBuiltInConstant<T>({ names, value, assumePrimitive }: BuiltInConstantDefinition<T>): void;
106
+ /**
107
+ * Register a built-in function (like `print` or `c`) to the given {@link builtIns}
108
+ */
109
+ registerBuiltInFunctions<BuiltInProcessor extends BuiltInMappingName>({ names, processor, config, assumePrimitive }: BuiltInFunctionDefinition<BuiltInProcessor>): void;
110
+ /**
111
+ * Registers all combinations of replacements
112
+ */
113
+ registerReplacementFunctions({ names, suffixes, assumePrimitive, config }: BuiltInReplacementDefinition): void;
114
+ /**
115
+ * Register a single {@link BuiltInDefinition} to the given memories in {@link builtIns}
116
+ */
117
+ registerBuiltInDefinition(definition: BuiltInDefinition): void;
118
+ /**
119
+ * The built-in {@link REnvironmentInformation|environment} is the root of all environments.
120
+ *
121
+ * For its default content (when not overwritten by a flowR config),
122
+ * see the {@link DefaultBuiltinConfig}.
123
+ */
124
+ builtInMemory: BuiltInMemory;
125
+ /**
126
+ * The twin of the {@link builtInMemory} but with less built ins defined for
127
+ * cases in which we want some commonly overwritten variables to remain open.
128
+ * If you do not know if you need the empty environment, you do not need the empty environment (right now).
129
+ *
130
+ * @see {@link builtInMemory}
131
+ */
132
+ emptyBuiltInMemory: BuiltInMemory;
133
+ set(identifier: Identifier, definition: IdentifierDefinition[], includeInEmptyMemory: boolean | undefined): void;
134
+ }
101
135
  export {};