@eagleoutice/flowr 2.15.9 → 2.16.0

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 (244) hide show
  1. package/README.md +47 -41
  2. package/abstract-interpretation/absint-inference.d.ts +2 -2
  3. package/abstract-interpretation/absint-inference.js +32 -79
  4. package/abstract-interpretation/data-frame/arguments.js +11 -7
  5. package/benchmark/slicer.d.ts +0 -1
  6. package/benchmark/slicer.js +1 -2
  7. package/cli/repl/commands/repl-signature.js +12 -3
  8. package/config.d.ts +5 -1
  9. package/control-flow/cfg-properties.js +0 -22
  10. package/control-flow/happens-before.d.ts +7 -2
  11. package/control-flow/happens-before.js +55 -31
  12. package/control-flow/useless-loop.d.ts +1 -1
  13. package/control-flow/useless-loop.js +29 -42
  14. package/dataflow/environments/apply-kill.js +6 -2
  15. package/dataflow/environments/built-in-config.d.ts +2 -0
  16. package/dataflow/environments/built-in-props.d.ts +16 -1
  17. package/dataflow/environments/built-in-props.js +33 -20
  18. package/dataflow/environments/built-in.d.ts +8 -3
  19. package/dataflow/environments/built-in.js +52 -82
  20. package/dataflow/environments/default-builtin-config.d.ts +551 -21
  21. package/dataflow/environments/default-builtin-config.js +121 -45
  22. package/dataflow/environments/define.d.ts +3 -2
  23. package/dataflow/environments/define.js +4 -3
  24. package/dataflow/environments/deprecation-info.d.ts +45 -0
  25. package/dataflow/environments/deprecation-info.js +13 -0
  26. package/dataflow/environments/environment.d.ts +7 -5
  27. package/dataflow/environments/environment.js +55 -121
  28. package/dataflow/environments/identifier.d.ts +6 -2
  29. package/dataflow/environments/identifier.js +23 -69
  30. package/dataflow/environments/reference-to-maybe.d.ts +9 -0
  31. package/dataflow/environments/reference-to-maybe.js +23 -51
  32. package/dataflow/environments/resolve-by-name.js +37 -76
  33. package/dataflow/eval/resolve/resolve-argument.d.ts +3 -1
  34. package/dataflow/eval/resolve/resolve-argument.js +61 -64
  35. package/dataflow/eval/resolve/resolve-working-directory.d.ts +8 -2
  36. package/dataflow/eval/resolve/resolve-working-directory.js +12 -20
  37. package/dataflow/eval/resolve/resolve.d.ts +4 -0
  38. package/dataflow/eval/resolve/resolve.js +23 -14
  39. package/dataflow/extractor.js +180 -58
  40. package/dataflow/fn/class-declaration.d.ts +8 -13
  41. package/dataflow/fn/class-declaration.js +95 -116
  42. package/dataflow/fn/exceptions-of-function.js +68 -37
  43. package/dataflow/fn/frame-reflection.d.ts +12 -4
  44. package/dataflow/fn/frame-reflection.js +51 -41
  45. package/dataflow/fn/function-props.js +15 -33
  46. package/dataflow/fn/function-semantics.d.ts +11 -3
  47. package/dataflow/fn/function-semantics.js +6 -0
  48. package/dataflow/fn/higher-order-function.d.ts +9 -1
  49. package/dataflow/fn/higher-order-function.js +27 -24
  50. package/dataflow/fn/strict-function.d.ts +13 -0
  51. package/dataflow/fn/strict-function.js +291 -123
  52. package/dataflow/graph/call-graph.d.ts +7 -6
  53. package/dataflow/graph/call-graph.js +35 -46
  54. package/dataflow/graph/graph.d.ts +13 -1
  55. package/dataflow/graph/graph.js +74 -66
  56. package/dataflow/graph/vertex.d.ts +1 -1
  57. package/dataflow/info.d.ts +8 -1
  58. package/dataflow/info.js +24 -30
  59. package/dataflow/internal/control-flow.d.ts +31 -4
  60. package/dataflow/internal/control-flow.js +61 -39
  61. package/dataflow/internal/linker.d.ts +17 -8
  62. package/dataflow/internal/linker.js +286 -213
  63. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +179 -0
  64. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +874 -0
  65. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +3 -1
  66. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +60 -48
  67. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +4 -2
  68. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +135 -198
  69. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +7 -9
  70. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +5 -1
  71. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +21 -14
  72. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -4
  73. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +1 -1
  74. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +141 -146
  75. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +56 -24
  76. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +292 -253
  77. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
  78. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +30 -32
  79. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +68 -67
  80. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +91 -129
  81. package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -3
  82. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +16 -12
  83. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +4 -4
  84. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -35
  85. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -0
  86. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +8 -3
  87. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +5 -3
  88. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +13 -31
  89. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +1 -1
  90. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +42 -119
  91. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -3
  92. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +21 -21
  93. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -0
  94. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +93 -102
  95. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +7 -3
  96. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +173 -114
  97. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +1 -3
  98. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +23 -26
  99. package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +1 -1
  100. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +34 -9
  101. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +1 -1
  102. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +119 -93
  103. package/dataflow/internal/process/functions/call/common.d.ts +4 -4
  104. package/dataflow/internal/process/functions/call/common.js +49 -71
  105. package/dataflow/internal/process/functions/call/deferred.d.ts +12 -2
  106. package/dataflow/internal/process/functions/call/deferred.js +81 -63
  107. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +4 -2
  108. package/dataflow/internal/process/functions/call/known-call-handling.js +65 -68
  109. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +3 -5
  110. package/dataflow/internal/process/functions/call/named-call-handling.js +48 -19
  111. package/dataflow/internal/process/functions/call/quoted.d.ts +2 -0
  112. package/dataflow/internal/process/functions/call/quoted.js +257 -154
  113. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +17 -38
  114. package/dataflow/internal/process/functions/process-parameter.js +25 -32
  115. package/dataflow/internal/process/process-symbol.js +4 -3
  116. package/dataflow/internal/program-order.d.ts +26 -0
  117. package/dataflow/internal/program-order.js +49 -0
  118. package/documentation/data/faq/faqs.js +3 -3
  119. package/documentation/data/interface/doc-writing-code.js +1 -2
  120. package/documentation/data/server/doc-data-server-messages.js +7 -7
  121. package/documentation/doc-capabilities.js +80 -34
  122. package/documentation/doc-util/doc-query.d.ts +0 -3
  123. package/documentation/doc-util/doc-query.js +4 -3
  124. package/documentation/wiki-analyzer.js +1 -1
  125. package/documentation/wiki-cfg.js +5 -6
  126. package/documentation/wiki-core.js +8 -8
  127. package/documentation/wiki-dataflow-graph.js +10 -11
  128. package/documentation/wiki-interface.js +2 -2
  129. package/documentation/wiki-linting-and-testing.js +3 -3
  130. package/documentation/wiki-overview.js +6 -6
  131. package/documentation/wiki-query.js +9 -101
  132. package/documentation/wiki-setup.js +23 -0
  133. package/documentation/wiki-signature-database.js +1 -1
  134. package/linter/linter-rules.d.ts +18 -9
  135. package/linter/rules/absolute-path.js +63 -87
  136. package/linter/rules/deprecated-functions.d.ts +1 -45
  137. package/linter/rules/deprecated-functions.js +24 -33
  138. package/linter/rules/file-path-validity.d.ts +4 -2
  139. package/linter/rules/file-path-validity.js +114 -80
  140. package/linter/rules/namespace-access.js +21 -33
  141. package/linter/rules/naming-convention.d.ts +1 -1
  142. package/linter/rules/naming-convention.js +60 -48
  143. package/linter/rules/network-functions.js +11 -7
  144. package/linter/rules/no-leaked-credentials.js +15 -18
  145. package/linter/rules/problematic-inputs.d.ts +2 -1
  146. package/linter/rules/problematic-inputs.js +39 -59
  147. package/linter/rules/roxygen-arguments.d.ts +9 -4
  148. package/linter/rules/roxygen-arguments.js +29 -48
  149. package/linter/rules/seeded-randomness.d.ts +7 -4
  150. package/linter/rules/seeded-randomness.js +128 -89
  151. package/linter/rules/stop-with-call-arg.d.ts +4 -2
  152. package/linter/rules/stop-with-call-arg.js +25 -22
  153. package/linter/rules/unclosed-connection.js +31 -24
  154. package/linter/rules/undefined-symbol.d.ts +4 -6
  155. package/linter/rules/undefined-symbol.js +58 -75
  156. package/linter/rules/unescaped-arguments.js +18 -44
  157. package/linter/rules/unused-definition.d.ts +6 -0
  158. package/linter/rules/unused-definition.js +105 -145
  159. package/linter/rules/unused-import.d.ts +3 -0
  160. package/linter/rules/unused-import.js +25 -43
  161. package/package.json +5 -2
  162. package/project/flowr-analyzer.d.ts +2 -0
  163. package/project/flowr-analyzer.js +28 -1
  164. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -2
  165. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +8 -12
  166. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +0 -2
  167. package/project/plugins/file-plugins/files/flowr-rda-file.js +10 -55
  168. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +7 -5
  169. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +34 -56
  170. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +2 -1
  171. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +22 -45
  172. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
  173. package/project/sigdb/build.js +4 -0
  174. package/project/sigdb/manifest.d.ts +2 -0
  175. package/project/sigdb/manifest.js +10 -1
  176. package/project/sigdb/reader.js +23 -61
  177. package/project/sigdb/sigdb-download.d.ts +29 -6
  178. package/project/sigdb/sigdb-download.js +212 -64
  179. package/queries/base-query-format.js +1 -2
  180. package/queries/catalog/absint-query/absint-query-format.js +1 -1
  181. package/queries/catalog/call-context-query/cascade-action.d.ts +3 -1
  182. package/queries/catalog/call-context-query/cascade-action.js +2 -0
  183. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +3 -0
  184. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
  185. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +2 -0
  186. package/queries/catalog/dataflow-query/dataflow-query-format.js +4 -7
  187. package/queries/catalog/dependencies-query/dependencies-query-executor.js +50 -114
  188. package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +5 -9
  189. package/queries/catalog/dependencies-query/function-info/library-functions.js +6 -0
  190. package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
  191. package/queries/catalog/dependencies-query/function-info/write-functions.js +7 -3
  192. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +4 -4
  193. package/queries/catalog/input-sources-query/simple-input-classifier.js +192 -301
  194. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +2 -1
  195. package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
  196. package/queries/catalog/origin-query/origin-query-executor.js +2 -2
  197. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -2
  198. package/queries/catalog/origin-query/origin-query-format.js +1 -1
  199. package/queries/query.d.ts +1 -1
  200. package/r-bridge/data/data.d.ts +21 -14
  201. package/r-bridge/data/data.js +28 -20
  202. package/r-bridge/lang-4.x/ast/model/model.d.ts +3 -1
  203. package/r-bridge/lang-4.x/ast/model/model.js +19 -43
  204. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
  205. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -0
  206. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +5 -12
  207. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
  208. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
  209. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
  210. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
  211. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
  212. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
  213. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
  214. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
  215. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
  216. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
  217. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
  218. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
  219. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
  220. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
  221. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
  222. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
  223. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
  224. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
  225. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
  226. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
  227. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +11 -2
  228. package/r-bridge/roxygen2/roxygen-parse.js +28 -42
  229. package/r-bridge/shell.js +6 -0
  230. package/search/search-executor/search-enrichers.js +25 -37
  231. package/slicing/static/slice-call.d.ts +4 -3
  232. package/slicing/static/slice-call.js +56 -88
  233. package/slicing/static/static-slicer.js +115 -79
  234. package/slicing/static/visiting-queue.d.ts +4 -6
  235. package/slicing/static/visiting-queue.js +9 -13
  236. package/util/files.d.ts +2 -0
  237. package/util/files.js +3 -1
  238. package/util/mermaid/mermaid.js +6 -2
  239. package/util/proc.js +2 -1
  240. package/util/r-base-packages.d.ts +2 -0
  241. package/util/r-base-packages.js +23 -13
  242. package/util/text/playground-link.d.ts +12 -3
  243. package/util/text/playground-link.js +18 -27
  244. package/util/version.js +4 -10
@@ -4,7 +4,7 @@ import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/node
4
4
  import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
5
5
  import type { DataflowInformation } from '../../../../../info';
6
6
  import type { DataflowProcessorInformation } from '../../../../../processor';
7
- import { type ClassArgRef, argFor } from '../../../../../fn/class-declaration';
7
+ import { type ClassArgRef } from '../../../../../fn/class-declaration';
8
8
  import { type Identifier } from '../../../../../environments/identifier';
9
9
  /** shorthand for the decorated-info generics every helper below carries through */
10
10
  type Data<O> = DataflowProcessorInformation<O & ParentInformation>;
@@ -15,17 +15,19 @@ export declare function s4ClassName(cls: string): Identifier;
15
15
  export interface S4UseConfig {
16
16
  /** the argument naming the S4 generic the call answers or asks about (`f` in `setMethod`) */
17
17
  readonly genericArg?: ClassArgRef;
18
+ /** appended to the generic named by {@link genericArg} (`setReplaceMethod("f", ...)` answers `f<-`) */
19
+ readonly genericSuffix?: string;
18
20
  /** the arguments naming S4 classes the call uses (`Class` in `new`, `signature` in `setMethod`) */
19
21
  readonly classArgs?: readonly ClassArgRef[];
20
22
  /** the argument naming an S4 class the call adds to without declaring it (`to` in `setAs`): read and registered anew, so a later use depends on this call as well as on the declaration */
21
23
  readonly registersArg?: ClassArgRef;
22
24
  }
23
- export { argFor };
24
25
  /** wires the S4 registrations a call *uses* (the classes and generic its arguments name by string), read against the registry so the call depends on whatever `setClass`/`setGeneric` wrote them */
25
26
  export declare function linkS4Uses<O>(info: DataflowInformation, args: Args<O>, rootId: NodeId, data: Data<O>, config: S4UseConfig): void;
26
- /** wires what the attached {@link DataflowGraphVertexFunctionCall.classDecl|class declaration} states, S4 only: a declaration reads the classes it builds on and registers its own name; a mere relation (`setIs`, `setValidity`) reads and re-registers the class it names */
27
+ /** wires what the attached {@link DataflowGraphVertexFunctionCall.classDecl|class declaration} states, S4 and Reference Classes only: a declaration reads the classes it builds on and registers its own name; a mere relation (`setIs`, `setValidity`) reads and re-registers the class it names */
27
28
  export declare function linkS4Declaration<O>(info: DataflowInformation, rootId: NodeId, data: Data<O>): void;
28
29
  /** Records that the call registers the S4 generics it names, which `setMethod` and a call of the name depend on. */
29
30
  export declare function linkS4Generic<O>(info: DataflowInformation, rootId: NodeId, names: readonly string[], data: Data<O>): void;
30
31
  /** Processes a call that consumes S4 registrations without declaring any, like `new("P")` or `getMethod("f", "P")`. */
31
32
  export declare function processS4Use<O>(name: RSymbol<O & ParentInformation>, args: Args<O>, rootId: NodeId, data: Data<O>, config: S4UseConfig): DataflowInformation;
33
+ export {};
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.argFor = void 0;
4
3
  exports.s4ClassName = s4ClassName;
5
4
  exports.linkS4Uses = linkS4Uses;
6
5
  exports.linkS4Declaration = linkS4Declaration;
@@ -9,7 +8,6 @@ exports.processS4Use = processS4Use;
9
8
  const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
10
9
  const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
11
10
  const class_declaration_1 = require("../../../../../fn/class-declaration");
12
- Object.defineProperty(exports, "argFor", { enumerable: true, get: function () { return class_declaration_1.argFor; } });
13
11
  const identifier_1 = require("../../../../../environments/identifier");
14
12
  const define_1 = require("../../../../../environments/define");
15
13
  const node_value_1 = require("../../../../../eval/resolve/node-value");
@@ -24,29 +22,16 @@ function s4ClassName(cls) {
24
22
  }
25
23
  /** The names an argument states, looking through the `c(...)`/`signature(...)` wrappers a signature may use. */
26
24
  function namesOf(node, data) {
27
- if (node === undefined) {
28
- return [];
29
- }
30
- const known = node_value_1.NodeValue.knownStringsOf(node.info.id, data);
25
+ const known = node === undefined ? [] : node_value_1.NodeValue.knownStringsOf(node.info.id, data);
31
26
  if (known.length > 0 || !r_function_call_1.RFunctionCall.isNamed(node)) {
32
27
  return known;
33
28
  }
34
- const collected = [];
35
- for (const arg of node.arguments) {
36
- if (!r_argument_1.RArgument.isEmpty(arg) && arg.value !== undefined) {
37
- collected.push(...namesOf(arg.value, data));
38
- }
39
- }
40
- return collected;
29
+ return node.arguments.flatMap(arg => namesOf(r_argument_1.RArgument.valueOf(arg), data));
41
30
  }
42
31
  /** Adds a read of every given name to the call, so the call depends on whatever registered them. */
43
32
  function readNames(info, rootId, names, type, data) {
44
- const added = [];
45
- for (const name of names) {
46
- added.push({ nodeId: rootId, name, type, cds: data.cds });
47
- }
48
- if (added.length > 0) {
49
- info.in = [...info.in, ...added];
33
+ if (names.length > 0) {
34
+ info.in = [...info.in, ...names.map(name => ({ nodeId: rootId, name, type, cds: data.cds }))];
50
35
  }
51
36
  }
52
37
  /** Defines `name` in the environment and records it as an out-reference of the call at `rootId`. */
@@ -57,24 +42,21 @@ function defineOut(info, rootId, name, type, data) {
57
42
  /** wires the S4 registrations a call *uses* (the classes and generic its arguments name by string), read against the registry so the call depends on whatever `setClass`/`setGeneric` wrote them */
58
43
  function linkS4Uses(info, args, rootId, data, config) {
59
44
  for (const ref of config.classArgs ?? []) {
60
- readNames(info, rootId, namesOf((0, class_declaration_1.argFor)(args, ref), data).map(s4ClassName), identifier_1.ReferenceType.Variable, data);
61
- }
62
- if (config.genericArg !== undefined) {
63
- readNames(info, rootId, namesOf((0, class_declaration_1.argFor)(args, config.genericArg), data), identifier_1.ReferenceType.Function, data);
45
+ readNames(info, rootId, namesOf((0, class_declaration_1.argForImpl)(args, ref), data).map(s4ClassName), identifier_1.ReferenceType.Variable, data);
64
46
  }
65
- if (config.registersArg !== undefined) {
66
- const registered = namesOf((0, class_declaration_1.argFor)(args, config.registersArg), data);
67
- readNames(info, rootId, registered.map(s4ClassName), identifier_1.ReferenceType.Variable, data);
68
- for (const cls of registered) {
69
- defineOut(info, rootId, s4ClassName(cls), identifier_1.ReferenceType.Variable, data);
70
- }
47
+ const generics = namesOf((0, class_declaration_1.argForImpl)(args, config.genericArg), data).map(n => n + (config.genericSuffix ?? ''));
48
+ readNames(info, rootId, generics, identifier_1.ReferenceType.Function, data);
49
+ const registered = namesOf((0, class_declaration_1.argForImpl)(args, config.registersArg), data).map(s4ClassName);
50
+ readNames(info, rootId, registered, identifier_1.ReferenceType.Variable, data);
51
+ for (const cls of registered) {
52
+ defineOut(info, rootId, cls, identifier_1.ReferenceType.Variable, data);
71
53
  }
72
54
  }
73
- /** wires what the attached {@link DataflowGraphVertexFunctionCall.classDecl|class declaration} states, S4 only: a declaration reads the classes it builds on and registers its own name; a mere relation (`setIs`, `setValidity`) reads and re-registers the class it names */
55
+ /** wires what the attached {@link DataflowGraphVertexFunctionCall.classDecl|class declaration} states, S4 and Reference Classes only: a declaration reads the classes it builds on and registers its own name; a mere relation (`setIs`, `setValidity`) reads and re-registers the class it names */
74
56
  function linkS4Declaration(info, rootId, data) {
75
57
  const vertex = info.graph.getVertex(rootId);
76
58
  const decl = vertex_1.DfgVertex.isFunctionCall(vertex) ? vertex.classDecl : undefined;
77
- if (decl === undefined || decl.system !== "s4" /* ClassSystem.S4 */) {
59
+ if (decl === undefined || (decl.system !== "s4" /* ClassSystem.S4 */ && decl.system !== "rc" /* ClassSystem.RefClass */)) {
78
60
  return;
79
61
  }
80
62
  const used = [...decl.contains, ...(decl.union ?? []), ...decl.members.map(m => m.type).filter(t => t !== undefined)];
@@ -21,7 +21,7 @@ interface S7GenericDispatchConfig {
21
21
  export declare function processS7NewGeneric<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: S7GenericDispatchConfig): DataflowInformation;
22
22
  /**
23
23
  * Process a call that **returns a function**: S7/S4 constructor factories (`make_constructor`, `new_class`,
24
- * `setClass`) and generic function factories (`Negate`, `Vectorize`, `partial`, …). We model the result as a
24
+ * `setClass`) and generic function factories (`Negate`, `Vectorize`, `partial`, ...). We model the result as a
25
25
  * synthetic function definition so the assigned symbol is recognized as a **function** rather than a plain
26
26
  * constant.
27
27
  */
@@ -14,11 +14,13 @@ const edge_1 = require("../../../../../graph/edge");
14
14
  const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
15
15
  const assert_1 = require("../../../../../../util/assert");
16
16
  const identifier_1 = require("../../../../../environments/identifier");
17
+ const resolve_helper_1 = require("../../../../../environments/resolve-helper");
17
18
  const node_value_1 = require("../../../../../eval/resolve/node-value");
18
19
  const vertex_1 = require("../../../../../graph/vertex");
19
20
  const range_1 = require("../../../../../../util/range");
20
21
  const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
21
22
  const built_in_s_four_1 = require("./built-in-s-four");
23
+ const class_declaration_1 = require("../../../../../fn/class-declaration");
22
24
  const function_semantics_1 = require("../../../../../fn/function-semantics");
23
25
  /**
24
26
  * Process an S7 new generic dispatch call like `new_generic` or `setGeneric`.
@@ -28,16 +30,15 @@ function processS7NewGeneric(name, args, rootId, data, config) {
28
30
  logger_1.dataflowLogger.warn('empty s7 new_generic, skipping');
29
31
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
30
32
  }
31
- const params = {
33
+ const { dispatchArg } = config.args;
34
+ const argMaps = function_semantics_1.FunctionSemantics.call.match.toSpec((0, common_1.convertFnArguments)(args), {
32
35
  [config.args.name]: 'name',
33
- };
34
- if (config.args.dispatchArg) {
35
- params[config.args.dispatchArg] = 'dispatchArg';
36
- }
37
- params[config.args.fun] = 'fun';
38
- params['...'] = '...';
39
- const argMaps = function_semantics_1.FunctionSemantics.call.match.toSpec((0, common_1.convertFnArguments)(args), params);
40
- const genName = (0, unpack_argument_1.unpackArg)(r_argument_1.RArgument.getWithId(args, argMaps.get('name')?.[0]));
36
+ ...dispatchArg ? { [dispatchArg]: 'dispatchArg' } : {},
37
+ [config.args.fun]: 'fun',
38
+ '...': '...'
39
+ });
40
+ const argNamed = (formal) => (0, unpack_argument_1.unpackArg)(r_argument_1.RArgument.getWithId(args, argMaps.get(formal)?.[0]));
41
+ const genName = argNamed('name');
41
42
  if (!genName) {
42
43
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
43
44
  }
@@ -47,14 +48,12 @@ function processS7NewGeneric(name, args, rootId, data, config) {
47
48
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
48
49
  }
49
50
  data = { ...data, currentS7name: accessedIdentifiers };
50
- let funArg = (0, unpack_argument_1.unpackArg)(r_argument_1.RArgument.getWithId(args, argMaps.get('fun')?.[0]))?.info.id;
51
+ let funArg = argNamed('fun')?.info.id;
51
52
  const effectiveArgs = args.slice();
52
53
  if (!funArg) {
53
- const dispatchArg = (0, unpack_argument_1.unpackArg)(r_argument_1.RArgument.getWithId(args, argMaps.get('dispatchArg')?.[0]));
54
- const newFun = makeS7DispatchFDef(name, [dispatchArg?.lexeme ?? undefined], rootId, args.length, data.completeAst.idMap);
55
- // fake it 'function([dispatch_args],...) S7_dispatch()'
56
- effectiveArgs.push(newFun[0]);
57
- funArg = newFun[1];
54
+ const [fun, funId] = makeS7DispatchFDef(name, [argNamed('dispatchArg')?.lexeme], rootId, args.length, data.completeAst.idMap);
55
+ effectiveArgs.push(fun);
56
+ funArg = funId;
58
57
  }
59
58
  const info = (0, known_call_handling_1.processKnownFunctionCall)({ name, sig: function_semantics_1.FunctionSemantics.call.signature.every, args: effectiveArgs, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.S7NewGeneric }).information;
60
59
  info.graph.addEdge(rootId, funArg, edge_1.EdgeType.Returns);
@@ -70,7 +69,7 @@ function processS7NewGeneric(name, args, rootId, data, config) {
70
69
  }
71
70
  /**
72
71
  * Process a call that **returns a function**: S7/S4 constructor factories (`make_constructor`, `new_class`,
73
- * `setClass`) and generic function factories (`Negate`, `Vectorize`, `partial`, …). We model the result as a
72
+ * `setClass`) and generic function factories (`Negate`, `Vectorize`, `partial`, ...). We model the result as a
74
73
  * synthetic function definition so the assigned symbol is recognized as a **function** rather than a plain
75
74
  * constant.
76
75
  */
@@ -82,7 +81,8 @@ function processMakeConstructor(name, args, rootId, data, config) {
82
81
  info.entryPoint = funId;
83
82
  const fArg = info.graph.getVertex(funId);
84
83
  if (vertex_1.DfgVertex.isFunctionDefinition(fArg) && config?.mode) {
85
- fArg.mode ??= config.mode.slice(); // copy: mode is mutated in place later, config.mode is shared
84
+ /* a copy, as the mode is mutated in place later and config.mode is shared */
85
+ fArg.mode ??= config.mode.slice();
86
86
  }
87
87
  if (config?.wrapIndex !== undefined) {
88
88
  linkWrappedFunction(info, args, rootId, config.wrapIndex, config.wrapName, data);
@@ -93,25 +93,25 @@ function processMakeConstructor(name, args, rootId, data, config) {
93
93
  }
94
94
  /** Records on the call vertex what a class-declaring call states, see {@link DataflowGraphVertexFunctionCall.classDecl}. */
95
95
  function attachClassDeclaration(info, rootId, args, config) {
96
- if (config === undefined) {
97
- return;
98
- }
99
96
  const vertex = info.graph.getVertex(rootId);
100
- if (vertex_1.DfgVertex.isFunctionCall(vertex)) {
97
+ if (config !== undefined && vertex_1.DfgVertex.isFunctionCall(vertex)) {
101
98
  vertex.classDecl = function_semantics_1.FunctionSemantics.classes.of(config, args);
102
99
  }
103
100
  }
104
101
  function linkWrappedFunction(info, args, rootId, wrapIndex, wrapName, data) {
105
- const wrapped = (0, built_in_s_four_1.argFor)(args, { name: wrapName, idx: wrapIndex });
106
- if (wrapped === undefined) {
102
+ const wrapped = (0, class_declaration_1.argForImpl)(args, { name: wrapName, idx: wrapIndex });
103
+ const resolved = wrapped === undefined ? undefined : (0, built_in_apply_1.resolveFunctionArgument)(wrapped, data, {});
104
+ if (resolved === undefined) {
107
105
  return;
108
106
  }
109
- const resolved = (0, built_in_apply_1.resolveFunctionArgument)(wrapped, data, {});
110
- if (resolved === undefined || resolved.anonymous) {
111
- return;
107
+ const body = rootId + '-s7-new-generic-fun-body';
108
+ /* the wrapper runs what it wraps, so a call of it does what the wrapped function does */
109
+ const targets = resolved.anonymous ? [resolved.functionId] : (resolve_helper_1.Resolve.byNameAndType(resolved.functionName, data.environment, identifier_1.ReferenceType.Function) ?? [])
110
+ .flatMap(d => d.type === identifier_1.ReferenceType.BuiltInFunction ? [d.nodeId] : d.value ?? []);
111
+ for (const target of targets) {
112
+ info.graph.addEdge(body, target, edge_1.EdgeType.Calls);
112
113
  }
113
- const vertex = info.graph.getVertex(resolved.functionId);
114
- if (!vertex_1.DfgVertex.isUse(vertex)) {
114
+ if (resolved.anonymous || !vertex_1.DfgVertex.isUse(info.graph.getVertex(resolved.functionId))) {
115
115
  return;
116
116
  }
117
117
  info.graph.updateToFunctionCall({
@@ -124,7 +124,7 @@ function linkWrappedFunction(info, args, rootId, wrapIndex, wrapName, data) {
124
124
  cds: data.cds,
125
125
  origin: [built_in_proc_name_1.BuiltInProcName.Function]
126
126
  });
127
- info.graph.addEdge(rootId + '-s7-new-generic-fun-body', resolved.functionId, edge_1.EdgeType.Reads | edge_1.EdgeType.Calls);
127
+ info.graph.addEdge(body, resolved.functionId, edge_1.EdgeType.Reads | edge_1.EdgeType.Calls);
128
128
  }
129
129
  /**
130
130
  * Node-id suffix of the `fun = function(...) S7_dispatch()` argument flowR synthesizes for S7 calls that do not
@@ -132,41 +132,17 @@ function linkWrappedFunction(info, args, rootId, wrapIndex, wrapName, data) {
132
132
  * about how the *code* calls a function (e.g. matching a call against a package's signature history) must skip it.
133
133
  */
134
134
  exports.S7SyntheticFunArgSuffix = '-s7-new-generic-fun-arg';
135
- // 'function([dispatch_args],...) S7_dispatch()'; returns the value id
135
+ /** Synthesizes the argument `fun = function([dispatch_args], ...) S7_dispatch()`, returning it and the id of its value. */
136
136
  function makeS7DispatchFDef(name, names, rootId, args, idMap) {
137
- const argNameId = rootId + '-s7-new-generic-fun-arg-name';
138
137
  const r = name.location ?? range_1.SourceRange.invalid();
139
- const argName = {
140
- type: type_1.RType.Symbol,
141
- lexeme: 'fun',
142
- content: 'fun',
143
- info: {
144
- id: argNameId,
145
- nest: name.info.nest,
146
- role: "arg-n" /* RoleInParent.ArgumentName */,
147
- fullRange: r,
148
- adToks: undefined,
149
- file: name.info.file,
150
- parent: rootId,
151
- index: 0
152
- },
153
- location: r,
154
- };
155
- idMap.set(argNameId, argName);
156
- const funcNameId = rootId + '-s7-new-generic-fun-name';
138
+ const info = (id, role, parent, index = 0) => ({ id, nest: name.info.nest, role, fullRange: r, adToks: undefined, file: name.info.file, parent, index });
139
+ const symbol = (id, lexeme, role, parent, index = 0) => ({ type: type_1.RType.Symbol, lexeme, content: lexeme, info: info(id, role, parent, index), location: r });
140
+ const argName = symbol(rootId + '-s7-new-generic-fun-arg-name', 'fun', "arg-n" /* RoleInParent.ArgumentName */, rootId);
141
+ idMap.set(argName.info.id, argName);
157
142
  const funcName = {
158
143
  type: type_1.RType.Symbol,
159
144
  lexeme: 'S7_dispatch',
160
- info: {
161
- id: funcNameId,
162
- nest: name.info.nest,
163
- role: "call-name" /* RoleInParent.FunctionCallName */,
164
- fullRange: r,
165
- adToks: undefined,
166
- file: name.info.file,
167
- parent: rootId,
168
- index: 0
169
- },
145
+ info: info(rootId + '-s7-new-generic-fun-name', "call-name" /* RoleInParent.FunctionCallName */, rootId),
170
146
  location: r,
171
147
  content: identifier_1.Identifier.make('S7_dispatch', 'S7'),
172
148
  };
@@ -177,51 +153,17 @@ function makeS7DispatchFDef(name, names, rootId, args, idMap) {
177
153
  named: true,
178
154
  functionName: funcName,
179
155
  arguments: [],
180
- info: {
181
- id: rootId + '-s7-new-generic-fun-body',
182
- nest: name.info.nest,
183
- role: "fun-b" /* RoleInParent.FunctionDefinitionBody */,
184
- fullRange: r,
185
- adToks: undefined,
186
- file: name.info.file,
187
- parent: rootId,
188
- index: 0
189
- }
156
+ info: info(rootId + '-s7-new-generic-fun-body', "fun-b" /* RoleInParent.FunctionDefinitionBody */, rootId)
190
157
  };
191
158
  const fdefId = rootId + '-s7-new-generic-fun-fdef';
192
159
  const argValue = {
193
160
  type: type_1.RType.FunctionDefinition,
194
- info: {
195
- file: name.info.file,
196
- id: fdefId,
197
- nest: name.info.nest,
198
- role: "arg-v" /* RoleInParent.ArgumentValue */,
199
- parent: rootId,
200
- index: args + 1,
201
- adToks: undefined,
202
- fullRange: r,
203
- },
161
+ info: info(fdefId, "arg-v" /* RoleInParent.ArgumentValue */, rootId, args + 1),
204
162
  lexeme: 'function',
205
163
  location: r,
206
164
  parameters: [...names.filter(assert_1.isNotUndefined), '...'].map((n, i) => {
207
165
  const paramId = fdefId + `-param-${i}`;
208
- const paramNameId = paramId + '-name';
209
- const paramName = {
210
- type: type_1.RType.Symbol,
211
- lexeme: n,
212
- content: n,
213
- info: {
214
- id: paramNameId,
215
- nest: name.info.nest,
216
- role: "param-n" /* RoleInParent.ParameterName */,
217
- fullRange: r,
218
- adToks: undefined,
219
- file: name.info.file,
220
- index: i,
221
- parent: paramId
222
- },
223
- location: r,
224
- };
166
+ const paramName = symbol(paramId + '-name', n, "param-n" /* RoleInParent.ParameterName */, paramId, i);
225
167
  const param = {
226
168
  type: type_1.RType.Parameter,
227
169
  location: r,
@@ -229,41 +171,22 @@ function makeS7DispatchFDef(name, names, rootId, args, idMap) {
229
171
  name: paramName,
230
172
  defaultValue: undefined,
231
173
  special: n === '...',
232
- info: {
233
- id: paramId,
234
- nest: name.info.nest,
235
- role: "param" /* RoleInParent.FunctionDefinitionParameter */,
236
- parent: fdefId,
237
- index: i,
238
- adToks: undefined,
239
- file: name.info.file,
240
- fullRange: r,
241
- }
174
+ info: info(paramId, "param" /* RoleInParent.FunctionDefinitionParameter */, fdefId, i)
242
175
  };
243
- idMap.set(paramNameId, paramName);
176
+ idMap.set(paramName.info.id, paramName);
244
177
  idMap.set(paramId, param);
245
178
  return param;
246
179
  }),
247
180
  body: funcBody,
248
181
  };
249
- idMap.set(funcNameId, funcName);
182
+ idMap.set(funcName.info.id, funcName);
250
183
  idMap.set(funcBody.info.id, funcBody);
251
184
  idMap.set(fdefId, argValue);
252
- const argId = rootId + exports.S7SyntheticFunArgSuffix;
253
185
  const argument = {
254
186
  type: type_1.RType.Argument,
255
187
  lexeme: 'fun',
256
188
  location: r,
257
- info: {
258
- id: argId,
259
- nest: name.info.nest,
260
- role: "call-arg" /* RoleInParent.FunctionCallArgument */,
261
- fullRange: r,
262
- adToks: undefined,
263
- file: name.info.file,
264
- parent: rootId,
265
- index: args + 1
266
- },
189
+ info: info(rootId + exports.S7SyntheticFunArgSuffix, "call-arg" /* RoleInParent.FunctionCallArgument */, rootId, args + 1),
267
190
  name: argName,
268
191
  value: argValue
269
192
  };
@@ -13,8 +13,6 @@ interface S3DispatchConfig {
13
13
  /** For NextMethod/if `generic` is not given, try to infer from the closure? */
14
14
  inferFromClosure?: boolean;
15
15
  }
16
- /**
17
- * Process an S3 dispatch call like `UseMethod`.
18
- */
16
+ /** Process an S3 dispatch call like `UseMethod`. */
19
17
  export declare function processS3Dispatch<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: S3DispatchConfig): DataflowInformation;
20
18
  export {};
@@ -9,33 +9,34 @@ const logger_1 = require("../../../../../logger");
9
9
  const common_1 = require("../common");
10
10
  const unpack_argument_1 = require("../argument/unpack-argument");
11
11
  const node_value_1 = require("../../../../../eval/resolve/node-value");
12
+ const edge_1 = require("../../../../../graph/edge");
12
13
  const identifier_1 = require("../../../../../environments/identifier");
13
14
  const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
14
15
  const range_1 = require("../../../../../../util/range");
15
16
  const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
16
17
  const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
17
18
  const control_flow_1 = require("../../../../control-flow");
18
- /**
19
- * Process an S3 dispatch call like `UseMethod`.
20
- */
19
+ const model_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/model");
20
+ const r_function_definition_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
21
+ /** Process an S3 dispatch call like `UseMethod`. */
21
22
  function processS3Dispatch(name, args, rootId, data, config) {
22
23
  if (args.length === 0 && !config.inferFromClosure) {
23
24
  logger_1.dataflowLogger.warn('empty s3, skipping');
24
25
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
25
26
  }
26
- const params = {
27
+ const argMaps = function_semantics_1.FunctionSemantics.call.match.toSpec((0, common_1.convertFnArguments)(args), {
27
28
  [config.args.generic]: 'generic',
28
29
  [config.args.object]: 'object',
29
30
  '...': '...'
30
- };
31
- const argMaps = function_semantics_1.FunctionSemantics.call.match.toSpec((0, common_1.convertFnArguments)(args), params);
31
+ });
32
32
  const generic = (0, unpack_argument_1.unpackArg)(r_argument_1.RArgument.getWithId(args, argMaps.get('generic')?.[0]));
33
33
  if (!generic && !config.inferFromClosure) {
34
34
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
35
35
  }
36
36
  const obj = (0, unpack_argument_1.unpackArg)(r_argument_1.RArgument.getWithId(args, argMaps.get('object')?.[0]));
37
37
  const dfObj = obj ? (0, processor_1.processDataflowFor)(obj, data) : info_1.DataflowInformation.initialize(rootId, data);
38
- if (control_flow_1.ControlFlow.alwaysExits(dfObj)) {
38
+ const fnRef = { nodeId: rootId, name: name.content, cds: data.cds, type: identifier_1.ReferenceType.Function };
39
+ if (control_flow_1.ControlFlow.alwaysExits(dfObj, data.cds)) {
39
40
  (0, common_1.patchFunctionCall)({
40
41
  nextGraph: dfObj.graph,
41
42
  rootId,
@@ -55,18 +56,20 @@ function processS3Dispatch(name, args, rootId, data, config) {
55
56
  argumentProcessResult: [dfObj],
56
57
  origin: built_in_proc_name_1.BuiltInProcName.S3DispatchNext
57
58
  });
58
- const ingoing = dfObj.in.concat(dfObj.unknownReferences);
59
- ingoing.push({ nodeId: rootId, name: name.content, cds: data.cds, type: identifier_1.ReferenceType.Function });
60
- const cfgEntry = control_flow_1.ControlFlow.inSequence(dfObj.graph, [dfObj], rootId);
59
+ /* the next method receives the current values of the formals of the method it is called from */
60
+ const idMap = data.completeAst.idMap;
61
+ const enclosing = idMap.get(model_1.RNode.findEnclosing(rootId, idMap, r_function_definition_1.RFunctionDefinition.is) ?? rootId);
62
+ const formals = r_function_definition_1.RFunctionDefinition.is(enclosing) ? enclosing.parameters : [];
63
+ const formalReads = formals.map(param => ({ nodeId: rootId, name: param.name.content, cds: data.cds, type: identifier_1.ReferenceType.Variable }));
61
64
  return {
62
65
  hooks: dfObj.hooks,
63
66
  environment: dfObj.environment,
64
67
  exitPoints: dfObj.exitPoints,
65
68
  graph: dfObj.graph,
66
69
  entryPoint: rootId,
67
- cfgEntry,
70
+ cfgEntry: control_flow_1.ControlFlow.inSequence(dfObj.graph, [dfObj], rootId),
68
71
  cfgExit: rootId,
69
- in: ingoing,
72
+ in: [...dfObj.in, ...dfObj.unknownReferences, fnRef, ...formalReads],
70
73
  out: dfObj.out,
71
74
  unknownReferences: []
72
75
  };
@@ -100,22 +103,19 @@ function processS3Dispatch(name, args, rootId, data, config) {
100
103
  argumentProcessResult: [dfGeneric, dfObj],
101
104
  origin: built_in_proc_name_1.BuiltInProcName.Function
102
105
  });
103
- const ingoing = dfObj.in.concat(dfGeneric.in, dfObj.unknownReferences, dfGeneric.unknownReferences);
104
- ingoing.push({ nodeId: rootId, name: name.content, cds: data.cds, type: identifier_1.ReferenceType.Function });
105
- for (const id of accessedIdentifiers) {
106
- ingoing.push({ nodeId: generic.info.id, name: id, cds: data.cds, type: identifier_1.ReferenceType.S3MethodPrefix });
107
- }
106
+ /* the method runs only as the dispatch does */
107
+ dfGeneric.graph.addEdge(generic.info.id, rootId, edge_1.EdgeType.Reads);
108
108
  const graph = dfObj.graph.mergeWith(dfGeneric.graph);
109
- const cfgEntry = control_flow_1.ControlFlow.inSequence(graph, [dfGeneric, dfObj], rootId);
109
+ const methodPrefixes = accessedIdentifiers.map(id => ({ nodeId: generic.info.id, name: id, cds: data.cds, type: identifier_1.ReferenceType.S3MethodPrefix }));
110
110
  return {
111
- hooks: dfGeneric.hooks.concat(dfObj?.hooks),
111
+ hooks: dfGeneric.hooks.concat(dfObj.hooks),
112
112
  environment: dfGeneric.environment,
113
113
  exitPoints: dfObj.exitPoints.concat(dfGeneric.exitPoints),
114
114
  graph,
115
115
  entryPoint: rootId,
116
- cfgEntry,
116
+ cfgEntry: control_flow_1.ControlFlow.inSequence(graph, [dfGeneric, dfObj], rootId),
117
117
  cfgExit: rootId,
118
- in: ingoing,
118
+ in: [...dfObj.in, ...dfGeneric.in, ...dfObj.unknownReferences, ...dfGeneric.unknownReferences, fnRef, ...methodPrefixes],
119
119
  out: dfGeneric.out.concat(dfObj.out),
120
120
  unknownReferences: []
121
121
  };
@@ -1,3 +1,4 @@
1
+ import { type AmbientStateAccess } from './built-in-ambient-state';
1
2
  import { type DataflowProcessorInformation } from '../../../../../processor';
2
3
  import { DataflowInformation } from '../../../../../info';
3
4
  import { type FlowrLaxSourcingOptions, InferWorkingDirectory } from '../../../../../../config';
@@ -40,6 +41,7 @@ export declare function processSourceCall<OtherInfo>(name: RSymbol<OtherInfo & P
40
41
  includeFunctionCall?: boolean;
41
42
  /** should this function call be followed, even when the configuration disables it? */
42
43
  forceFollow?: boolean;
44
+ ambient?: AmbientStateAccess | readonly AmbientStateAccess[];
43
45
  }): DataflowInformation;
44
46
  /**
45
47
  * Processes a source request with the given dataflow processor information and existing dataflow information