@eagleoutice/flowr 2.17.4 → 2.17.5

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 (544) hide show
  1. package/README.md +13 -52
  2. package/abstract-interpretation/absint-inference.js +1 -2
  3. package/abstract-interpretation/data-frame/arguments.d.ts +14 -3
  4. package/abstract-interpretation/data-frame/arguments.js +34 -0
  5. package/abstract-interpretation/data-frame/dataframe-semantics.js +7 -15
  6. package/abstract-interpretation/data-frame/resolve-args.d.ts +2 -2
  7. package/abstract-interpretation/data-frame/semantics.d.ts +8 -1
  8. package/abstract-interpretation/data-frame/semantics.js +14 -6
  9. package/abstract-interpretation/domains/state-abstract-domain.js +28 -18
  10. package/abstract-interpretation/domains/state-map.d.ts +43 -0
  11. package/abstract-interpretation/domains/state-map.js +147 -0
  12. package/benchmark/slicer.d.ts +1 -1
  13. package/benchmark/slicer.js +8 -7
  14. package/cli/repl/commands/repl-dataflow.js +5 -5
  15. package/cli/repl/commands/repl-execute.js +3 -2
  16. package/cli/repl/commands/repl-parse.js +2 -1
  17. package/cli/repl/print-version.d.ts +1 -1
  18. package/cli/repl/print-version.js +2 -1
  19. package/cli/repl/server/connection.d.ts +1 -1
  20. package/cli/repl/server/connection.js +7 -9
  21. package/cli/slicer-app.js +2 -1
  22. package/clones/algorithms/baxter-ast.d.ts +33 -0
  23. package/clones/algorithms/baxter-ast.js +70 -0
  24. package/clones/algorithms/greedy-string-tiling.d.ts +17 -0
  25. package/clones/algorithms/greedy-string-tiling.js +56 -0
  26. package/clones/algorithms/winnowing.d.ts +27 -0
  27. package/clones/algorithms/winnowing.js +66 -0
  28. package/clones/clone-ast.d.ts +75 -0
  29. package/clones/clone-ast.js +174 -0
  30. package/clones/clone-dataflow.d.ts +11 -0
  31. package/clones/clone-dataflow.js +83 -0
  32. package/clones/clone-detector.d.ts +116 -0
  33. package/clones/clone-detector.js +200 -0
  34. package/clones/clone-index.d.ts +54 -0
  35. package/clones/clone-index.js +56 -0
  36. package/config.d.ts +21 -2
  37. package/config.js +7 -1
  38. package/control-flow/basic-cfg-guided-visitor.js +1 -2
  39. package/control-flow/happens-before.d.ts +2 -0
  40. package/control-flow/happens-before.js +15 -9
  41. package/control-flow/simple-visitor.js +2 -4
  42. package/core/steps/all/core/00-parse.js +2 -1
  43. package/core/steps/all/core/01-parse-tree-sitter.js +2 -1
  44. package/core/steps/all/core/10-normalize.js +2 -1
  45. package/core/steps/all/core/11-normalize-tree-sitter.js +2 -1
  46. package/core/steps/all/static-slicing/00-slice.js +2 -1
  47. package/core/steps/all/static-slicing/10-reconstruct.js +2 -1
  48. package/core/steps/pipeline/create-pipeline.js +1 -2
  49. package/core/steps/pipeline/default-pipelines.d.ts +1 -1
  50. package/core/steps/pipeline/default-pipelines.js +5 -4
  51. package/core/steps/pipeline-step.d.ts +3 -1
  52. package/core/steps/pipeline-step.js +5 -0
  53. package/data/r-base-primitives.generated.d.ts +2 -1
  54. package/dataflow/cluster.js +1 -2
  55. package/dataflow/environments/ambient-state-name.d.ts +14 -22
  56. package/dataflow/environments/ambient-state-name.js +4 -18
  57. package/dataflow/environments/apply-kill.d.ts +9 -20
  58. package/dataflow/environments/apply-kill.js +51 -25
  59. package/dataflow/environments/built-in-config.d.ts +7 -15
  60. package/dataflow/environments/built-in-config.js +15 -16
  61. package/dataflow/environments/built-in-eval-name.d.ts +5 -6
  62. package/dataflow/environments/built-in-eval-name.js +4 -5
  63. package/dataflow/environments/built-in-kinds.d.ts +111 -0
  64. package/dataflow/environments/built-in-kinds.js +35 -0
  65. package/dataflow/environments/built-in-proc-name.d.ts +4 -0
  66. package/dataflow/environments/built-in-proc-name.js +11 -0
  67. package/dataflow/environments/built-in-props.d.ts +62 -175
  68. package/dataflow/environments/built-in-props.js +42 -154
  69. package/dataflow/environments/built-in.d.ts +37 -73
  70. package/dataflow/environments/built-in.js +41 -62
  71. package/dataflow/environments/data-masking-functions.d.ts +2 -2
  72. package/dataflow/environments/default-builtin-config/base-functions.d.ts +7 -0
  73. package/dataflow/environments/default-builtin-config/base-functions.js +339 -0
  74. package/dataflow/environments/default-builtin-config/base-language.d.ts +3 -0
  75. package/dataflow/environments/default-builtin-config/base-language.js +66 -0
  76. package/dataflow/environments/default-builtin-config/base-operators.d.ts +58 -0
  77. package/dataflow/environments/default-builtin-config/base-operators.js +169 -0
  78. package/dataflow/environments/default-builtin-config/database-access.d.ts +3 -0
  79. package/dataflow/environments/default-builtin-config/database-access.js +16 -0
  80. package/dataflow/environments/default-builtin-config/define-helpers.d.ts +45 -0
  81. package/dataflow/environments/default-builtin-config/define-helpers.js +50 -0
  82. package/dataflow/environments/default-builtin-config/dev-tooling.d.ts +3 -0
  83. package/dataflow/environments/default-builtin-config/dev-tooling.js +63 -0
  84. package/dataflow/environments/default-builtin-config/file-io.d.ts +3 -0
  85. package/dataflow/environments/default-builtin-config/file-io.js +81 -0
  86. package/dataflow/environments/default-builtin-config/graphics-devices.d.ts +3 -0
  87. package/dataflow/environments/default-builtin-config/graphics-devices.js +57 -0
  88. package/dataflow/environments/default-builtin-config/index.d.ts +18 -0
  89. package/dataflow/environments/default-builtin-config/index.js +114 -0
  90. package/dataflow/environments/default-builtin-config/media-formats.d.ts +3 -0
  91. package/dataflow/environments/default-builtin-config/media-formats.js +41 -0
  92. package/dataflow/environments/default-builtin-config/misc-packages.d.ts +3 -0
  93. package/dataflow/environments/default-builtin-config/misc-packages.js +18 -0
  94. package/dataflow/environments/default-builtin-config/network-access.d.ts +3 -0
  95. package/dataflow/environments/default-builtin-config/network-access.js +47 -0
  96. package/dataflow/environments/default-builtin-config/object-systems.d.ts +3 -0
  97. package/dataflow/environments/default-builtin-config/object-systems.js +39 -0
  98. package/dataflow/environments/default-builtin-config/package-data-table.d.ts +3 -0
  99. package/dataflow/environments/default-builtin-config/package-data-table.js +18 -0
  100. package/dataflow/environments/default-builtin-config/package-spatial.d.ts +3 -0
  101. package/dataflow/environments/default-builtin-config/package-spatial.js +32 -0
  102. package/dataflow/environments/default-builtin-config/package-tidyverse.d.ts +3 -0
  103. package/dataflow/environments/default-builtin-config/package-tidyverse.js +96 -0
  104. package/dataflow/environments/default-builtin-config/package-utils.d.ts +3 -0
  105. package/dataflow/environments/default-builtin-config/package-utils.js +35 -0
  106. package/dataflow/environments/default-builtin-config/package-withr.d.ts +3 -0
  107. package/dataflow/environments/default-builtin-config/package-withr.js +41 -0
  108. package/dataflow/environments/default-builtin-config/parallel-execution.d.ts +3 -0
  109. package/dataflow/environments/default-builtin-config/parallel-execution.js +31 -0
  110. package/dataflow/environments/default-builtin-config/session-interactive.d.ts +3 -0
  111. package/dataflow/environments/default-builtin-config/session-interactive.js +31 -0
  112. package/dataflow/environments/default-builtin-config/shared-configs.d.ts +267 -0
  113. package/dataflow/environments/default-builtin-config/shared-configs.js +483 -0
  114. package/dataflow/environments/default-builtin-config/shared-signatures.d.ts +21 -0
  115. package/dataflow/environments/default-builtin-config/shared-signatures.js +32 -0
  116. package/dataflow/environments/default-builtin-config/statistics.d.ts +3 -0
  117. package/dataflow/environments/default-builtin-config/statistics.js +32 -0
  118. package/dataflow/environments/default-builtin-config/unit-testing.d.ts +3 -0
  119. package/dataflow/environments/default-builtin-config/unit-testing.js +13 -0
  120. package/dataflow/environments/environment.d.ts +28 -52
  121. package/dataflow/environments/environment.js +24 -71
  122. package/dataflow/environments/group-generics.d.ts +12 -19
  123. package/dataflow/environments/group-generics.js +17 -14
  124. package/dataflow/environments/identifier.d.ts +72 -427
  125. package/dataflow/environments/identifier.js +34 -145
  126. package/dataflow/environments/pkg-name.d.ts +197 -0
  127. package/dataflow/environments/pkg-name.js +3 -0
  128. package/dataflow/environments/query-fn-props.d.ts +27 -76
  129. package/dataflow/environments/query-fn-props.js +34 -95
  130. package/dataflow/environments/resolve-by-name.d.ts +6 -16
  131. package/dataflow/environments/resolve-by-name.js +23 -35
  132. package/dataflow/environments/scoping.d.ts +5 -5
  133. package/dataflow/environments/scoping.js +13 -5
  134. package/dataflow/eval/resolve/alias-tracking.d.ts +31 -68
  135. package/dataflow/eval/resolve/alias-tracking.js +611 -126
  136. package/dataflow/eval/resolve/match-arguments.d.ts +5 -3
  137. package/dataflow/eval/resolve/resolve-argument.d.ts +11 -11
  138. package/dataflow/eval/resolve/resolve-argument.js +25 -30
  139. package/dataflow/eval/resolve/resolve-field.d.ts +10 -0
  140. package/dataflow/eval/resolve/resolve-field.js +127 -0
  141. package/dataflow/eval/resolve/resolve-replacement.d.ts +10 -0
  142. package/dataflow/eval/resolve/resolve-replacement.js +80 -0
  143. package/dataflow/eval/resolve/resolve-strings.d.ts +2 -2
  144. package/dataflow/eval/resolve/resolve.d.ts +13 -10
  145. package/dataflow/eval/resolve/resolve.js +81 -32
  146. package/dataflow/eval/values/general.d.ts +6 -24
  147. package/dataflow/eval/values/general.js +12 -29
  148. package/dataflow/eval/values/lists/list-constants.d.ts +11 -0
  149. package/dataflow/eval/values/lists/list-constants.js +65 -0
  150. package/dataflow/eval/values/r-value.d.ts +20 -23
  151. package/dataflow/eval/values/r-value.js +22 -17
  152. package/dataflow/extractor.d.ts +2 -10
  153. package/dataflow/extractor.js +100 -46
  154. package/dataflow/fn/argument-roles.d.ts +2 -4
  155. package/dataflow/fn/argument-roles.js +49 -23
  156. package/dataflow/fn/class-declaration.d.ts +36 -52
  157. package/dataflow/fn/class-declaration.js +22 -56
  158. package/dataflow/fn/condition-handlers.d.ts +2 -1
  159. package/dataflow/fn/dispatch.d.ts +70 -0
  160. package/dataflow/fn/dispatch.js +434 -0
  161. package/dataflow/fn/exceptions-of-function.d.ts +1 -2
  162. package/dataflow/fn/exceptions-of-function.js +36 -106
  163. package/dataflow/fn/frame-reflection.d.ts +1 -3
  164. package/dataflow/fn/frame-reflection.js +8 -16
  165. package/dataflow/fn/function-props.d.ts +2 -5
  166. package/dataflow/fn/function-props.js +27 -36
  167. package/dataflow/fn/function-semantics.d.ts +14 -26
  168. package/dataflow/fn/function-semantics.js +4 -18
  169. package/dataflow/fn/higher-order-function.js +2 -4
  170. package/dataflow/fn/strict-function.d.ts +10 -35
  171. package/dataflow/fn/strict-function.js +126 -138
  172. package/dataflow/graph/ambient-access.d.ts +51 -0
  173. package/dataflow/graph/ambient-access.js +80 -0
  174. package/dataflow/graph/call-graph.d.ts +9 -29
  175. package/dataflow/graph/call-graph.js +17 -41
  176. package/dataflow/graph/closure-frames.d.ts +46 -0
  177. package/dataflow/graph/closure-frames.js +225 -0
  178. package/dataflow/graph/dataflowgraph-builder.d.ts +25 -96
  179. package/dataflow/graph/dataflowgraph-builder.js +29 -97
  180. package/dataflow/graph/df-helper.d.ts +48 -188
  181. package/dataflow/graph/df-helper.js +107 -208
  182. package/dataflow/graph/diff-dataflow-graph.d.ts +5 -15
  183. package/dataflow/graph/diff-dataflow-graph.js +25 -25
  184. package/dataflow/graph/edge.js +1 -1
  185. package/dataflow/graph/graph-helper.d.ts +10 -46
  186. package/dataflow/graph/graph-helper.js +16 -50
  187. package/dataflow/graph/graph.d.ts +44 -97
  188. package/dataflow/graph/graph.js +83 -79
  189. package/dataflow/graph/match-args.d.ts +21 -88
  190. package/dataflow/graph/match-args.js +284 -97
  191. package/dataflow/graph/vertex.d.ts +101 -128
  192. package/dataflow/graph/vertex.js +23 -20
  193. package/dataflow/hooks.d.ts +7 -14
  194. package/dataflow/hooks.js +15 -13
  195. package/dataflow/info.d.ts +2 -17
  196. package/dataflow/internal/dispatch-linking.d.ts +71 -0
  197. package/dataflow/internal/dispatch-linking.js +332 -0
  198. package/dataflow/internal/linker.d.ts +48 -50
  199. package/dataflow/internal/linker.js +457 -155
  200. package/dataflow/internal/process/functions/call/argument/make-argument.js +2 -1
  201. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +2 -14
  202. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +16 -46
  203. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +7 -6
  204. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +10 -9
  205. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +23 -75
  206. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +263 -97
  207. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +10 -7
  208. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +66 -45
  209. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +15 -19
  210. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +82 -62
  211. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +4 -4
  212. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +2 -2
  213. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +2 -2
  214. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +3 -2
  215. package/dataflow/internal/process/functions/call/built-in/built-in-deferred-env-ops.d.ts +15 -0
  216. package/dataflow/internal/process/functions/call/built-in/built-in-deferred-env-ops.js +416 -0
  217. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +37 -54
  218. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +192 -111
  219. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +4 -3
  220. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +60 -13
  221. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +1 -3
  222. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +80 -76
  223. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.d.ts +1 -7
  224. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +4 -13
  225. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +4 -8
  226. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +436 -140
  227. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +18 -10
  228. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +90 -12
  229. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +1 -5
  230. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +5 -14
  231. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +9 -8
  232. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +12 -7
  233. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -2
  234. package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +3 -5
  235. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +2 -6
  236. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +9 -24
  237. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +10 -6
  238. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +5 -6
  239. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +3 -4
  240. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -4
  241. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +8 -11
  242. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -5
  243. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +20 -28
  244. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +17 -4
  245. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +117 -4
  246. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +5 -3
  247. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
  248. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +8 -4
  249. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +18 -29
  250. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +7 -25
  251. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +31 -35
  252. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +4 -18
  253. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +13 -19
  254. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +18 -16
  255. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +130 -65
  256. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +2 -1
  257. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +38 -30
  258. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +584 -114
  259. package/dataflow/internal/process/functions/call/common.d.ts +8 -24
  260. package/dataflow/internal/process/functions/call/common.js +24 -24
  261. package/dataflow/internal/process/functions/call/deferred.d.ts +7 -27
  262. package/dataflow/internal/process/functions/call/deferred.js +6 -27
  263. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +6 -26
  264. package/dataflow/internal/process/functions/call/known-call-handling.js +6 -16
  265. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -4
  266. package/dataflow/internal/process/functions/call/named-call-handling.js +14 -35
  267. package/dataflow/internal/process/functions/call/nse.d.ts +2 -9
  268. package/dataflow/internal/process/functions/call/nse.js +6 -13
  269. package/dataflow/internal/process/functions/call/quoted.d.ts +4 -15
  270. package/dataflow/internal/process/functions/call/quoted.js +26 -62
  271. package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +3 -6
  272. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +29 -11
  273. package/dataflow/internal/process/functions/process-parameter.js +1 -1
  274. package/dataflow/internal/program-order.d.ts +3 -10
  275. package/dataflow/internal/program-order.js +19 -10
  276. package/dataflow/origin/dfg-get-origin.js +2 -1
  277. package/documentation/data/faq/faqs.js +16 -1
  278. package/documentation/data/interface/doc-writing-code.js +5 -7
  279. package/documentation/doc-capabilities.js +3 -3
  280. package/documentation/doc-readme.js +1 -1
  281. package/documentation/doc-util/doc-code.d.ts +0 -5
  282. package/documentation/doc-util/doc-code.js +2 -22
  283. package/documentation/doc-util/doc-query.d.ts +1 -2
  284. package/documentation/doc-util/doc-query.js +4 -5
  285. package/documentation/doc-util/doc-search.js +1 -1
  286. package/documentation/wiki-analyzer.js +4 -3
  287. package/documentation/wiki-core.js +5 -5
  288. package/documentation/wiki-dataflow-graph.js +6 -0
  289. package/documentation/wiki-interface.js +2 -1
  290. package/documentation/wiki-linter.js +15 -3
  291. package/documentation/wiki-linting-and-testing.js +15 -2
  292. package/documentation/wiki-query.js +111 -29
  293. package/index.d.ts +3 -1
  294. package/index.js +6 -3
  295. package/linter/linter-executor.js +1 -1
  296. package/linter/linter-rules.d.ts +37 -8
  297. package/linter/linter-rules.js +8 -1
  298. package/linter/linter-util.d.ts +3 -3
  299. package/linter/linter-util.js +1 -1
  300. package/linter/rules/cmd-check/bogus-return.d.ts +2 -1
  301. package/linter/rules/cmd-check/call-arguments.d.ts +3 -2
  302. package/linter/rules/cmd-check/call-arguments.js +5 -5
  303. package/linter/rules/cmd-check/cmd-check-util.d.ts +9 -8
  304. package/linter/rules/cmd-check/dependency-declaration.d.ts +2 -1
  305. package/linter/rules/cmd-check/dependency-declaration.js +1 -1
  306. package/linter/rules/cmd-check/documentation-mismatch.d.ts +3 -2
  307. package/linter/rules/cmd-check/documentation-mismatch.js +2 -1
  308. package/linter/rules/cmd-check/file-checks.d.ts +2 -2
  309. package/linter/rules/cmd-check/foreign-function-calls.d.ts +2 -1
  310. package/linter/rules/cmd-check/global-environment-modification.d.ts +6 -5
  311. package/linter/rules/cmd-check/namespace-tampering.d.ts +2 -1
  312. package/linter/rules/cmd-check/non-ascii-code.js +1 -1
  313. package/linter/rules/cmd-check/package-files.d.ts +2 -2
  314. package/linter/rules/cmd-check/package-hooks.d.ts +5 -4
  315. package/linter/rules/cmd-check/package-runtime.js +2 -2
  316. package/linter/rules/cmd-check/rd-files.js +2 -1
  317. package/linter/rules/cmd-check/s-three-method-consistency.d.ts +3 -2
  318. package/linter/rules/cmd-check/s-three-method-consistency.js +2 -1
  319. package/linter/rules/code-clones.d.ts +57 -0
  320. package/linter/rules/code-clones.js +53 -0
  321. package/linter/rules/deprecated-functions.js +3 -6
  322. package/linter/rules/file-path-validity.js +6 -4
  323. package/linter/rules/function-finder-util.d.ts +4 -2
  324. package/linter/rules/naming-convention.d.ts +6 -5
  325. package/linter/rules/naming-convention.js +2 -3
  326. package/linter/rules/no-leaked-credentials.d.ts +2 -1
  327. package/linter/rules/no-leaked-credentials.js +1 -1
  328. package/linter/rules/overwritten-file.d.ts +2 -1
  329. package/linter/rules/problematic-inputs.d.ts +2 -1
  330. package/linter/rules/problematic-inputs.js +3 -3
  331. package/linter/rules/process-state-in-session.d.ts +7 -6
  332. package/linter/rules/process-state-in-session.js +1 -1
  333. package/linter/rules/roxygen-arguments.d.ts +1 -1
  334. package/linter/rules/secret-exfiltration.js +1 -1
  335. package/linter/rules/seeded-randomness.d.ts +3 -3
  336. package/linter/rules/unclosed-connection.js +1 -2
  337. package/linter/rules/undefined-symbol-util.d.ts +3 -2
  338. package/linter/rules/undefined-symbol.d.ts +3 -2
  339. package/linter/rules/unescaped-arguments.d.ts +1 -1
  340. package/linter/rules/unescaped-arguments.js +6 -8
  341. package/linter/rules/unused-definition.d.ts +4 -3
  342. package/linter/rules/unused-definition.js +10 -12
  343. package/linter/rules/unused-import.d.ts +6 -5
  344. package/package.json +1 -1
  345. package/project/attached-packages.d.ts +5 -4
  346. package/project/cache/flowr-analyzer-cache.d.ts +14 -1
  347. package/project/cache/flowr-analyzer-cache.js +40 -3
  348. package/project/context/flowr-analyzer-dependencies-context.d.ts +12 -12
  349. package/project/context/flowr-analyzer-environment-context.d.ts +3 -3
  350. package/project/context/flowr-analyzer-environment-context.js +3 -3
  351. package/project/context/flowr-analyzer-functions-context.d.ts +9 -7
  352. package/project/context/flowr-analyzer-gas-context.d.ts +25 -0
  353. package/project/context/flowr-analyzer-gas-context.js +34 -4
  354. package/project/dependency-version-space.d.ts +30 -29
  355. package/project/dependency-version-space.js +1 -2
  356. package/project/flowr-analyzer-builder.d.ts +2 -3
  357. package/project/flowr-analyzer.d.ts +35 -3
  358. package/project/flowr-analyzer.js +11 -5
  359. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +15 -14
  360. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-on-demand-plugin.d.ts +5 -4
  361. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-on-demand-plugin.js +1 -1
  362. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +2 -1
  363. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +4 -3
  364. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +2 -1
  365. package/project/plugins/package-version-plugins/package.d.ts +6 -5
  366. package/project/sigdb/build.js +1 -1
  367. package/project/sigdb/decode.d.ts +8 -7
  368. package/project/sigdb/decode.js +1 -2
  369. package/project/sigdb/dict.d.ts +2 -1
  370. package/project/sigdb/dict.js +2 -2
  371. package/project/sigdb/index-format.d.ts +2 -1
  372. package/project/sigdb/manifest.d.ts +1 -1
  373. package/project/sigdb/memory-source.d.ts +18 -17
  374. package/project/sigdb/on-demand/package-sources.d.ts +4 -3
  375. package/project/sigdb/on-demand/recoverer.d.ts +2 -1
  376. package/project/sigdb/on-demand/remote-sources.d.ts +2 -1
  377. package/project/sigdb/reader.d.ts +85 -80
  378. package/project/sigdb/reader.js +0 -4
  379. package/project/sigdb/schema.d.ts +9 -8
  380. package/project/sigdb/signature-db.d.ts +6 -6
  381. package/queries/catalog/ambient-access-query/ambient-access-query-executor.d.ts +6 -0
  382. package/queries/catalog/ambient-access-query/ambient-access-query-executor.js +50 -0
  383. package/queries/catalog/ambient-access-query/ambient-access-query-format.d.ts +54 -0
  384. package/queries/catalog/ambient-access-query/ambient-access-query-format.js +45 -0
  385. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +2 -1
  386. package/queries/catalog/call-context-query/call-context-query-executor.js +2 -2
  387. package/queries/catalog/call-graph-query/expand-library-internals.d.ts +3 -2
  388. package/queries/catalog/code-clones-query/code-clones-query-executor.d.ts +6 -0
  389. package/queries/catalog/code-clones-query/code-clones-query-executor.js +38 -0
  390. package/queries/catalog/code-clones-query/code-clones-query-format.d.ts +54 -0
  391. package/queries/catalog/code-clones-query/code-clones-query-format.js +73 -0
  392. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +3 -3
  393. package/queries/catalog/dependencies-query/data-flow.d.ts +5 -4
  394. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +5 -2
  395. package/queries/catalog/dependencies-query/dependencies-query-executor.js +5 -5
  396. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -2
  397. package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
  398. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +6 -4
  399. package/queries/catalog/dependencies-query/implicit-echo.js +2 -1
  400. package/queries/catalog/dice-query/dice-query-format.d.ts +1 -0
  401. package/queries/catalog/dice-query/dice-query-format.js +1 -0
  402. package/queries/catalog/does-call-query/does-call-query-executor.js +1 -2
  403. package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -0
  404. package/queries/catalog/does-call-query/does-call-query-format.js +1 -0
  405. package/queries/catalog/function-info-query/function-info-query-format.d.ts +2 -1
  406. package/queries/catalog/function-info-query/function-origin.d.ts +3 -2
  407. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +3 -3
  408. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +5 -4
  409. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
  410. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -0
  411. package/queries/catalog/input-sources-query/input-sources-query-executor.js +7 -3
  412. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +9 -9
  413. package/queries/catalog/input-sources-query/simple-input-classifier.js +1 -1
  414. package/queries/catalog/linter-query/linter-query-executor.js +4 -1
  415. package/queries/catalog/linter-query/linter-query-format.js +3 -2
  416. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -0
  417. package/queries/catalog/origin-query/origin-query-format.js +1 -0
  418. package/queries/catalog/project-query/project-query-format.d.ts +2 -1
  419. package/queries/catalog/provenance-query/provenance-query-format.d.ts +1 -0
  420. package/queries/catalog/provenance-query/provenance-query-format.js +1 -0
  421. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -0
  422. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -0
  423. package/queries/catalog/signature-query/signature-query-executor.d.ts +9 -6
  424. package/queries/catalog/signature-query/signature-query-executor.js +14 -15
  425. package/queries/catalog/signature-query/signature-query-format.d.ts +21 -20
  426. package/queries/catalog/signature-query/signature-query-render.js +1 -1
  427. package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
  428. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +9 -5
  429. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
  430. package/queries/query-function-filter.d.ts +1 -1
  431. package/queries/query.d.ts +59 -8
  432. package/queries/query.js +59 -37
  433. package/r-bridge/data/data.d.ts +39 -28
  434. package/r-bridge/data/data.js +37 -28
  435. package/r-bridge/lang-4.x/ast/model/model.d.ts +10 -1
  436. package/r-bridge/lang-4.x/ast/model/model.js +30 -0
  437. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +21 -0
  438. package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +25 -2
  439. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +2 -1
  440. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -2
  441. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +2 -2
  442. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
  443. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
  444. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
  445. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
  446. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +4 -3
  447. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
  448. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
  449. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
  450. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
  451. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
  452. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
  453. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
  454. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
  455. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
  456. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +5 -6
  457. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +2 -7
  458. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
  459. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -2
  460. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +2 -2
  461. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
  462. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +4 -5
  463. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +7 -2
  464. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +14 -6
  465. package/r-bridge/lang-4.x/ast/model/processing/visitor.d.ts +1 -1
  466. package/r-bridge/lang-4.x/ast/model/processing/visitor.js +2 -2
  467. package/r-bridge/lang-4.x/ast/model/type.d.ts +1 -1
  468. package/r-bridge/lang-4.x/ast/model/type.js +1 -1
  469. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +2 -2
  470. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -2
  471. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
  472. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +3 -2
  473. package/r-bridge/parser.d.ts +8 -2
  474. package/r-bridge/parser.js +6 -0
  475. package/r-bridge/shell-executor.d.ts +2 -2
  476. package/r-bridge/shell-executor.js +3 -2
  477. package/r-bridge/shell.d.ts +2 -2
  478. package/r-bridge/shell.js +3 -2
  479. package/reconstruct/auto-select/magic-comments.js +1 -1
  480. package/reconstruct/reconstruct.d.ts +0 -5
  481. package/reconstruct/reconstruct.js +6 -5
  482. package/search/flowr-search-builder.d.ts +14 -0
  483. package/search/flowr-search-builder.js +7 -0
  484. package/search/flowr-search-executor.js +2 -2
  485. package/search/flowr-search-filters.js +8 -9
  486. package/search/flowr-search.js +1 -1
  487. package/search/search-executor/search-enrichers.d.ts +2 -0
  488. package/search/search-executor/search-enrichers.js +6 -1
  489. package/search/search-executor/search-generators.d.ts +2 -2
  490. package/search/search-executor/search-generators.js +13 -8
  491. package/search/search-executor/search-mappers.js +1 -1
  492. package/search/search-executor/search-transformer.d.ts +2 -2
  493. package/search/search-executor/search-transformer.js +6 -6
  494. package/slicing/criterion/parse.d.ts +2 -1
  495. package/slicing/criterion/parse.js +2 -1
  496. package/slicing/static/removal-slice.js +2 -1
  497. package/slicing/static/slice-call.d.ts +30 -4
  498. package/slicing/static/slice-call.js +74 -9
  499. package/slicing/static/slicer-types.d.ts +2 -1
  500. package/slicing/static/static-slicer.js +66 -11
  501. package/slicing/static/visiting-queue.d.ts +2 -0
  502. package/slicing/static/visiting-queue.js +4 -0
  503. package/taint-analysis/builder/report-template.d.ts +3 -3
  504. package/util/arg-matching.d.ts +1 -1
  505. package/util/collections/relation.d.ts +23 -0
  506. package/util/collections/relation.js +63 -0
  507. package/util/fixpoint.d.ts +65 -0
  508. package/util/fixpoint.js +216 -0
  509. package/util/flowr-version.d.ts +1 -1
  510. package/util/flowr-version.js +2 -2
  511. package/util/json.d.ts +4 -0
  512. package/util/json.js +12 -3
  513. package/util/mermaid/cfg.js +1 -2
  514. package/util/mermaid/dfg.d.ts +1 -1
  515. package/util/mermaid/dfg.js +1 -1
  516. package/util/mermaid/mermaid.d.ts +2 -1
  517. package/util/monoid.d.ts +26 -0
  518. package/util/monoid.js +31 -0
  519. package/util/prefix.d.ts +1 -1
  520. package/util/r-base-packages.d.ts +10 -7
  521. package/util/r-base-packages.js +11 -6
  522. package/util/r-package-urls.d.ts +10 -9
  523. package/util/r-value.js +2 -1
  524. package/util/r-version-order.d.ts +2 -0
  525. package/util/r-version-order.js +19 -0
  526. package/util/r-version.d.ts +2 -1
  527. package/util/r-version.js +2 -14
  528. package/util/range.d.ts +38 -29
  529. package/util/range.js +10 -5
  530. package/util/simple-df/dfg-ascii.js +2 -2
  531. package/util/text/ansi.d.ts +13 -9
  532. package/util/text/ansi.js +4 -6
  533. package/util/text/strings.d.ts +10 -3
  534. package/util/text/strings.js +10 -1
  535. package/util/version.d.ts +1 -1
  536. package/util/version.js +2 -1
  537. package/dataflow/environments/default-builtin-config.d.ts +0 -8874
  538. package/dataflow/environments/default-builtin-config.js +0 -1737
  539. package/r-bridge/lang-4.x/ast/model/operators.d.ts +0 -33
  540. package/r-bridge/lang-4.x/ast/model/operators.js +0 -54
  541. package/taint-analysis/eval/eval.d.ts +0 -1
  542. package/taint-analysis/eval/eval.js +0 -124
  543. package/taint-analysis/eval/instrumentation.d.ts +0 -59
  544. package/taint-analysis/eval/instrumentation.js +0 -124
@@ -0,0 +1,434 @@
1
+ "use strict";
2
+ /** Which methods a dispatching call reaches for the classes its arguments have, uniformly for S3 (`UseMethod`, a built-in generic, `NextMethod`) and S4 (`standardGeneric`, `callNextMethod`): the class of a value is followed through its value flow to where it is made (`structure(..., class = )`, `class<-`, `new("C")`, a constant), and a call whose classes are not all known keeps every method, which is sound. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.classesOfValue = classesOfValue;
5
+ exports.s3DispatchClassesOf = s3DispatchClassesOf;
6
+ exports.s3Dispatch = s3Dispatch;
7
+ exports.s4HierarchyOf = s4HierarchyOf;
8
+ exports.selectS4Methods = selectS4Methods;
9
+ exports.signatureFor = signatureFor;
10
+ exports.s4MethodsOf = s4MethodsOf;
11
+ exports.s4DispatchFormals = s4DispatchFormals;
12
+ exports.s4CandidatesFor = s4CandidatesFor;
13
+ exports.s4ActualClasses = s4ActualClasses;
14
+ exports.nextS4Methods = nextS4Methods;
15
+ const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
16
+ const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
17
+ const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
18
+ const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
19
+ const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
20
+ const edge_1 = require("../graph/edge");
21
+ const vertex_1 = require("../graph/vertex");
22
+ const df_helper_1 = require("../graph/df-helper");
23
+ const alias_tracking_1 = require("../eval/resolve/alias-tracking");
24
+ const node_value_1 = require("../eval/resolve/node-value");
25
+ const string_constants_1 = require("../eval/values/string/string-constants");
26
+ const r_value_1 = require("../eval/values/r-value");
27
+ const built_in_proc_name_1 = require("../environments/built-in-proc-name");
28
+ const class_declaration_1 = require("./class-declaration");
29
+ const arg_matching_1 = require("../../util/arg-matching");
30
+ const group_generics_1 = require("../environments/group-generics");
31
+ const arrays_1 = require("../../util/collections/arrays");
32
+ /** how many producers the walk for one value visits before it gives up */
33
+ const MaxProducers = 64;
34
+ /** The class vectors the value at `id` may have, one per producer its value flow reaches, `undefined` unless all are known. */
35
+ function classesOfValue(id, info) {
36
+ const found = [];
37
+ const seen = new Set();
38
+ /* the ids to visit, with whether only a class attribute may reach them (`x$a <- 1` keeps the class of `x`, not its type) */
39
+ const todo = [[id, false]];
40
+ for (let next = todo.pop(); next !== undefined; next = todo.pop()) {
41
+ const [at, attributeOnly] = next;
42
+ if (seen.has(at)) {
43
+ continue;
44
+ }
45
+ if (seen.size >= MaxProducers) {
46
+ return undefined;
47
+ }
48
+ seen.add(at);
49
+ const step = flowStepOf(node_id_1.NodeId.normalize(at), info);
50
+ if (step === undefined) {
51
+ return undefined;
52
+ }
53
+ else if ('from' in step) {
54
+ todo.push(...step.from.map(f => [f, attributeOnly || step.keepsAttribute === true]));
55
+ }
56
+ else if (attributeOnly && step.source === "implicit" /* ClassSource.Implicit */) {
57
+ return undefined;
58
+ }
59
+ else {
60
+ found.push(step);
61
+ }
62
+ }
63
+ return found.length > 0 ? found : undefined;
64
+ }
65
+ function flowStepOf(id, info) {
66
+ const { graph, idMap } = info;
67
+ const node = idMap.get(id);
68
+ if (r_argument_1.RArgument.is(node)) {
69
+ return node.value === undefined ? undefined : { from: [node.value.info.id] };
70
+ }
71
+ const vertex = graph.getVertex(id);
72
+ switch (vertex?.tag) {
73
+ case vertex_1.VertexType.Value:
74
+ return implicitClassOf(id, info);
75
+ case vertex_1.VertexType.FunctionDefinition:
76
+ return { source: "implicit" /* ClassSource.Implicit */, classes: ['function'] };
77
+ case vertex_1.VertexType.Use: {
78
+ const defs = df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Reads);
79
+ return defs.length === 0 || defs.some(node_id_1.NodeId.isBuiltIn) ? implicitClassOf(id, info) : { from: supersededByClassChange(defs, graph) };
80
+ }
81
+ case vertex_1.VertexType.VariableDefinition:
82
+ return definitionStep(id, node, info);
83
+ case vertex_1.VertexType.FunctionCall:
84
+ return callStep(vertex, info);
85
+ default:
86
+ return undefined;
87
+ }
88
+ }
89
+ /** The definitions without those a later, unconditional `class<-` on the same variable replaces, which a read sees alongside it. */
90
+ function supersededByClassChange(defs, graph) {
91
+ const replaced = new Set();
92
+ for (const def of defs) {
93
+ const cds = graph.getVertex(def)?.cds ?? [];
94
+ for (const previous of df_helper_1.Dataflow.targetsOf(graph, def, edge_1.EdgeType.Reads)) {
95
+ const before = graph.getVertex(previous)?.cds ?? [];
96
+ if (defs.includes(previous) && classChangeOf(def, graph) !== undefined && cds.every(cd => before.some(b => b.id === cd.id && b.when === cd.when))) {
97
+ replaced.add(previous);
98
+ }
99
+ }
100
+ }
101
+ return replaced.size === 0 ? [...defs] : defs.filter(d => !replaced.has(d));
102
+ }
103
+ /** the replacement functions that set the class attribute to the value they are given */
104
+ const ClassReplacements = ['class<-', 'oldClass<-'];
105
+ /** the replacement functions that change a part of the value and keep its class attribute */
106
+ const AttributeKeepingReplacements = ['$<-', '[[<-', '[<-', '@<-', 'names<-'];
107
+ /** The replacement call defining `def` if it is a built-in one, with whether it sets the class. */
108
+ function replacementOf(def, graph) {
109
+ const call = df_helper_1.Dataflow.sourcesOf(graph, def, edge_1.EdgeType.Returns).find(c => vertex_1.DfgVertex.hasOrigin(graph.getVertex(c), built_in_proc_name_1.BuiltInProcName.Replacement));
110
+ if (call === undefined) {
111
+ return undefined;
112
+ }
113
+ const targets = df_helper_1.Dataflow.targetsOf(graph, call, edge_1.EdgeType.Calls);
114
+ if (targets.some(t => !node_id_1.NodeId.isBuiltIn(t))) {
115
+ return 'other';
116
+ }
117
+ const calls = (names) => names.some(n => targets.includes(node_id_1.NodeId.toBuiltIn(n)));
118
+ return calls(ClassReplacements) ? { call, setsClass: true } : calls(AttributeKeepingReplacements) ? { call, setsClass: false } : 'other';
119
+ }
120
+ /** The class a `class(x) <- value` definition sets, `undefined` if `def` is no such definition. */
121
+ function classChangeOf(def, graph) {
122
+ const replacement = replacementOf(def, graph);
123
+ return typeof replacement === 'object' && replacement.setsClass ? replacement.call : undefined;
124
+ }
125
+ /** What the argument `bound` hands a function: its value, but for the target of a replacement call (`a` in `lab(a) <- 1`), which the call defines anew, the value the target has before. */
126
+ function handedValueOf(bound, graph) {
127
+ if (!vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(bound)) || !df_helper_1.Dataflow.sourcesOf(graph, bound, edge_1.EdgeType.Returns).some(c => vertex_1.DfgVertex.hasOrigin(graph.getVertex(c), built_in_proc_name_1.BuiltInProcName.Replacement))) {
128
+ return [bound];
129
+ }
130
+ return df_helper_1.Dataflow.targetsOf(graph, bound, edge_1.EdgeType.Reads).filter(r => vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(r)));
131
+ }
132
+ function definitionStep(id, node, info) {
133
+ const { graph } = info;
134
+ if (node?.info.role === "param-n" /* RoleInParent.ParameterName */) {
135
+ /* R dispatches on the promise the call binds, so every call of the function has to bind one */
136
+ const fn = node.info.parent === undefined ? undefined : info.idMap.get(node.info.parent)?.info.parent;
137
+ const bound = df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.DefinedByOnCall);
138
+ /* in the context of one call, the parameter holds what that call binds */
139
+ const inCall = fn === undefined ? undefined : info.callContext?.get(fn);
140
+ if (inCall !== undefined) {
141
+ const handed = bound.filter(b => (0, alias_tracking_1.callOfArgument)(b, info.idMap) === inCall);
142
+ return handed.length === 0 ? undefined : { from: handed.flatMap(b => handedValueOf(b, graph)) };
143
+ }
144
+ const calls = fn === undefined ? 0 : df_helper_1.Dataflow.sourcesOf(graph, fn, edge_1.EdgeType.Calls).length;
145
+ return calls === 0 || bound.length < calls ? undefined : { from: bound.flatMap(b => handedValueOf(b, graph)) };
146
+ }
147
+ const replacement = replacementOf(id, graph);
148
+ if (replacement === 'other') {
149
+ return undefined;
150
+ }
151
+ else if (replacement !== undefined) {
152
+ const values = df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.DefinedBy).filter(v => v !== replacement.call);
153
+ if (!replacement.setsClass) {
154
+ return { from: df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Reads).filter(r => vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(r))), keepsAttribute: true };
155
+ }
156
+ const classes = values.length === 1 ? node_value_1.NodeValue.stringsOf(values[0], info) : undefined;
157
+ return classes?.length ? { source: "attribute" /* ClassSource.Attribute */, classes } : undefined;
158
+ }
159
+ const value = df_helper_1.Dataflow.assignedValueOf(id, graph);
160
+ return value === undefined ? undefined : { from: [value] };
161
+ }
162
+ function callStep(vertex, info) {
163
+ const { graph } = info;
164
+ const id = vertex.id;
165
+ if (vertex.instantiates !== undefined) {
166
+ return vertex.instantiates.length === 1 ? { source: "instance" /* ClassSource.Instance */, classes: vertex.instantiates } : undefined;
167
+ }
168
+ const node = info.idMap.get(id);
169
+ const targets = df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Calls);
170
+ if (r_function_call_1.RFunctionCall.is(node) && targets.includes(node_id_1.NodeId.toBuiltIn('structure'))) {
171
+ const cls = node_value_1.NodeValue.soleOf((0, class_declaration_1.argForImpl)(node.arguments, { name: 'class' }), info);
172
+ const classes = cls?.type === 'string' ? (0, string_constants_1.collectStrings)([cls]) : cls?.type === 'vector' && (0, r_value_1.isValue)(cls.elements) ? (0, string_constants_1.collectStrings)(cls.elements) : undefined;
173
+ return classes?.length ? { source: "attribute" /* ClassSource.Attribute */, classes } : undefined;
174
+ }
175
+ /* an access hands back a part of what it accesses, a replacement the value it assigns */
176
+ if (vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.Access) || vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.Replacement)) {
177
+ return undefined;
178
+ }
179
+ const defined = targets.filter(t => !node_id_1.NodeId.isBuiltIn(t));
180
+ if (defined.length > 0 && defined.length < targets.length) {
181
+ return undefined;
182
+ }
183
+ /* what a function of the program returns, or the argument a built-in hands back unchanged */
184
+ const returned = df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Returns);
185
+ if (returned.length > 0) {
186
+ return { from: returned };
187
+ }
188
+ return defined.length > 0 ? undefined : implicitClassOf(id, info);
189
+ }
190
+ /** The implicit class vector S3 dispatch sees for a constant, `undefined` if the value is not one. */
191
+ function implicitClassOf(id, info) {
192
+ const sole = node_value_1.NodeValue.soleOf(id, info);
193
+ /* a number resolves to the interval of just that number */
194
+ const value = sole?.type === 'interval' ? sole.start : sole;
195
+ if (value?.type === 'string') {
196
+ return { source: "implicit" /* ClassSource.Implicit */, classes: ['character'] };
197
+ }
198
+ else if (value?.type === 'logical') {
199
+ return { source: "implicit" /* ClassSource.Implicit */, classes: ['logical'] };
200
+ }
201
+ else if (value?.type === 'number' && (0, r_value_1.isValue)(value.value)) {
202
+ return { source: "implicit" /* ClassSource.Implicit */, classes: value.value.complexNumber ? ['complex'] : value.value.markedAsInt ? ['integer', 'numeric'] : ['double', 'numeric'] };
203
+ }
204
+ return undefined;
205
+ }
206
+ /** The class vectors S3 dispatch may see for the argument at `id`, `undefined` unless all are known. */
207
+ function s3DispatchClassesOf(id, info) {
208
+ const classes = classesOfValue(id, info);
209
+ return classes?.every(c => c.source !== "instance" /* ClassSource.Instance */) ? classes.map(c => c.classes) : undefined;
210
+ }
211
+ /** The class S4 dispatch sees for a value: the class of an instance, or of a constant; for an S3 class vector, what `s3Class` makes of it, `undefined` by default. */
212
+ function s4ClassOf({ source, classes }, s3Class) {
213
+ switch (source) {
214
+ case "instance" /* ClassSource.Instance */:
215
+ return classes[0];
216
+ case "implicit" /* ClassSource.Implicit */:
217
+ return classes[0] === 'double' ? 'numeric' : classes[0];
218
+ default:
219
+ return s3Class(classes);
220
+ }
221
+ }
222
+ /** The S3 methods a dispatch on the class vectors `classes` may run, in each vector the method of a class or else that of a later one, then the default, and for each such method what its `NextMethod()` may run: the methods of the classes after its own in a vector it was run for. */
223
+ function s3Dispatch(classes, methods, methodOf) {
224
+ const runs = new Set();
225
+ const next = new Map();
226
+ for (const vector of classes) {
227
+ const chain = [...vector, 'default'].map(cls => methods.filter(m => methodOf(m) === cls));
228
+ chain.flat().forEach(m => runs.add(m));
229
+ for (let i = 0; i < chain.length; i++) {
230
+ for (const method of chain[i]) {
231
+ const after = next.get(method) ?? new Set();
232
+ chain.slice(i + 1).flat().forEach(m => after.add(m));
233
+ next.set(method, after);
234
+ }
235
+ }
236
+ }
237
+ return { runs, next };
238
+ }
239
+ /** the distance R gives `ANY`, beyond that of any real superclass */
240
+ const AnyDistance = 1_000_000;
241
+ /** the virtual class every S3 class `setOldClass` registers extends last */
242
+ const OldClass = 'oldClass';
243
+ /** The S4 class hierarchy the graph declares, with the superclasses `setClassUnion` and `setIs` give classes it does not declare, and the S3 classes `setOldClass` registers, each extending the next of its vector. */
244
+ function s4HierarchyOf(graph) {
245
+ const classes = (0, class_declaration_1.declaredClassesImpl)(graph);
246
+ const supers = new Map([...classes].map(([name, decl]) => [name, [...decl.contains]]));
247
+ const declared = new Set(classes.keys());
248
+ let oldClasses = new Map();
249
+ const add = (sub, sup) => {
250
+ const list = supers.get(sub) ?? [];
251
+ if (sup !== undefined && sup !== sub && !list.includes(sup)) {
252
+ supers.set(sub, [...list, sup]);
253
+ }
254
+ };
255
+ for (const [id, { classDecl }] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
256
+ const registered = classDecl?.oldClasses;
257
+ if (registered !== undefined) {
258
+ if (registered.length === 0) {
259
+ oldClasses = undefined;
260
+ }
261
+ registered.forEach((cls, i) => {
262
+ add(cls, registered[i + 1] ?? OldClass);
263
+ declared.add(cls);
264
+ oldClasses?.set(cls, [...oldClasses.get(cls) ?? [], id]);
265
+ });
266
+ declared.add(OldClass);
267
+ }
268
+ if (classDecl?.name === undefined) {
269
+ continue;
270
+ }
271
+ for (const member of classDecl.union ?? []) {
272
+ add(member, classDecl.name);
273
+ }
274
+ if (classDecl.relation === 'is') {
275
+ add(classDecl.name, classDecl.contains[0]);
276
+ }
277
+ }
278
+ /* the basic classes R places below `numeric` */
279
+ add('integer', 'numeric');
280
+ add('double', 'numeric');
281
+ /* a class declared by `setClass` as well is no plain S3 class */
282
+ classes.keys().forEach(c => oldClasses?.delete(c));
283
+ return { supers, declared, oldClasses };
284
+ }
285
+ /** Per class, the fewest steps from `cls` up to it, and the fewest to a class whose superclasses are open. */
286
+ function distancesFrom(cls, hierarchy) {
287
+ const depth = new Map([[cls, 0]]);
288
+ let open;
289
+ for (const [at, d] of depth) {
290
+ if (!hierarchy.declared.has(at)) {
291
+ open ??= d;
292
+ }
293
+ for (const sup of hierarchy.supers.get(at) ?? []) {
294
+ if (!depth.has(sup)) {
295
+ depth.set(sup, d + 1);
296
+ }
297
+ }
298
+ }
299
+ return { depth, open };
300
+ }
301
+ /** The classes a class with open superclasses may reach through them: the undeclared ones, and what the program places above an undeclared one. */
302
+ function reachableThroughOpen(hierarchy) {
303
+ const reachable = new Set();
304
+ for (const [sub, sups] of hierarchy.supers) {
305
+ if (!hierarchy.declared.has(sub)) {
306
+ sups.forEach(s => reachable.add(s));
307
+ }
308
+ }
309
+ for (const cls of reachable) {
310
+ hierarchy.supers.get(cls)?.forEach(s => reachable.add(s));
311
+ }
312
+ return reachable;
313
+ }
314
+ /** The range of distances R may see from the class `actual` of an argument to the class `wanted` of a signature, and whether it surely matches; `undefined` if it never matches. */
315
+ function distanceRange(actual, wanted, hierarchy, open) {
316
+ if (wanted === 'ANY') {
317
+ return [AnyDistance, AnyDistance, true];
318
+ }
319
+ else if (actual === wanted) {
320
+ return [0, 0, true];
321
+ }
322
+ else if (actual === 'missing' || actual === 'ANY') {
323
+ return undefined;
324
+ }
325
+ const { depth, open: openAt } = distancesFrom(actual, hierarchy);
326
+ const known = depth.get(wanted);
327
+ const viaOpen = openAt !== undefined && (!hierarchy.declared.has(wanted) || open.has(wanted));
328
+ if (!viaOpen) {
329
+ return known === undefined ? undefined : [known, known, true];
330
+ }
331
+ return [Math.min(known ?? AnyDistance, openAt + 1), known ?? AnyDistance - 1, known !== undefined];
332
+ }
333
+ /** The methods R may select among `methods` for arguments of the classes `actual` (one per dispatched formal, `missing` for an argument not given): every applicable method whose least possible distance is no more than the greatest possible one of the closest; ties are kept, as R would pick among them. */
334
+ function selectS4Methods(methods, formals, actual, hierarchy) {
335
+ const open = reachableThroughOpen(hierarchy);
336
+ const ranges = [];
337
+ for (const method of methods) {
338
+ const wanted = signatureFor(method, formals) ?? formals.map(() => 'ANY');
339
+ let low = 0;
340
+ let high = 0;
341
+ let applies = true;
342
+ let surely = true;
343
+ for (let i = 0; i < formals.length && applies; i++) {
344
+ const range = distanceRange(actual[i], wanted[i], hierarchy, open);
345
+ applies = range !== undefined;
346
+ low += range?.[0] ?? 0;
347
+ high += range?.[1] ?? 0;
348
+ surely &&= range?.[2] === true;
349
+ }
350
+ if (applies) {
351
+ ranges.push([method, low, high, surely]);
352
+ }
353
+ }
354
+ /* only a method that surely applies rules out those further away, one that may not apply leaves them */
355
+ const best = Math.min(...ranges.filter(([, , , surely]) => surely).map(([, , high]) => high));
356
+ return ranges.filter(([, low]) => low <= best).map(([m]) => m);
357
+ }
358
+ /** The class a method's signature wants per dispatched formal, `ANY` where it states none; `undefined` if it names a formal not dispatched on. */
359
+ function signatureFor(method, formals) {
360
+ const wanted = formals.map(() => 'ANY');
361
+ let position = 0;
362
+ for (const { cls, name } of method.signature ?? []) {
363
+ const at = name === undefined ? position : formals.indexOf(name);
364
+ if (at < 0 || at >= formals.length) {
365
+ return undefined;
366
+ }
367
+ wanted[at] = cls;
368
+ position = at + 1;
369
+ }
370
+ return wanted;
371
+ }
372
+ /** Every method `setMethod` registers in the graph, by the generic it is for. */
373
+ function s4MethodsOf(graph, linked) {
374
+ const methods = new Map();
375
+ for (const [registration, { s4Method }] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
376
+ if (s4Method === undefined) {
377
+ continue;
378
+ }
379
+ const definition = df_helper_1.Dataflow.targetsOf(graph, registration, edge_1.EdgeType.Returns).find(t => vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(t)));
380
+ const functions = definition === undefined ? [] : linked(new Set([definition]));
381
+ methods.set(s4Method.generic, [...methods.get(s4Method.generic) ?? [], { registration, definition, functions, generic: s4Method.generic, signature: s4Method.signature }]);
382
+ }
383
+ return methods;
384
+ }
385
+ /** The formals of the generic S4 dispatches on: the formals of the program's generic, or those all its methods share, without `...`. */
386
+ function s4DispatchFormals(generic, methods, idMap) {
387
+ const formalsOf = (fn) => {
388
+ const node = idMap.get(fn);
389
+ return r_function_definition_1.RFunctionDefinition.is(node) ? node.parameters.map(p => p.special ? arg_matching_1.DotsParameterName : p.name.content).filter(n => n !== arg_matching_1.DotsParameterName) : undefined;
390
+ };
391
+ if (generic !== undefined) {
392
+ /* a `setGeneric(signature = )` restricts the formals dispatched on */
393
+ const own = idMap.get(generic);
394
+ const definer = own === undefined ? undefined : model_1.RNode.directParent(own, idMap);
395
+ const call = r_argument_1.RArgument.is(definer) ? model_1.RNode.directParent(definer, idMap) : definer;
396
+ if (r_function_call_1.RFunctionCall.is(call) && (0, class_declaration_1.argForImpl)(call.arguments, { name: 'signature', idx: 6 }) !== undefined) {
397
+ return undefined;
398
+ }
399
+ return formalsOf(generic);
400
+ }
401
+ const all = methods.flatMap(m => m.functions).map(formalsOf);
402
+ const first = all[0];
403
+ return first !== undefined && all.every(f => f !== undefined && f.length === first.length && f.every((n, i) => n === first[i])) ? first : undefined;
404
+ }
405
+ /** The S4 methods of the program a call of `name` may reach: those of the generic and of the group generics it belongs to, `undefined` if any of them has a signature that does not resolve, so none can be ruled out. */
406
+ function s4CandidatesFor(name, methods) {
407
+ const candidates = [name, ...(0, group_generics_1.s4GroupGenericsOf)(name)].flatMap(g => methods.get(g) ?? []);
408
+ return candidates.every(m => m.signature !== undefined) ? candidates : undefined;
409
+ }
410
+ /** The classes an S4 call dispatches on, one tuple per combination the arguments may have, `undefined` unless all are known. */
411
+ function s4ActualClasses(bound, info, s3Class) {
412
+ let tuples = [[]];
413
+ for (const arg of bound) {
414
+ const classes = arg === undefined ? ['missing'] : classesOfValue(arg, info)?.map(c => s4ClassOf(c, s3Class));
415
+ if (classes === undefined || classes.includes(undefined)) {
416
+ return undefined;
417
+ }
418
+ tuples = tuples.flatMap(t => (0, arrays_1.uniqueArray)(classes).map(c => [...t, c]));
419
+ if (tuples.length > MaxProducers) {
420
+ return undefined;
421
+ }
422
+ }
423
+ return tuples;
424
+ }
425
+ /** The methods `callNextMethod()` within `method` may run: those R would select for the signature `method` is defined for, `method` aside. */
426
+ function nextS4Methods(method, candidates, formals, hierarchy) {
427
+ const own = signatureFor(method, formals);
428
+ if (own === undefined) {
429
+ return [...candidates];
430
+ }
431
+ const others = candidates.filter(m => m.functions.every(f => !method.functions.includes(f)));
432
+ return selectS4Methods(others, formals, own, hierarchy);
433
+ }
434
+ //# sourceMappingURL=dispatch.js.map
@@ -13,8 +13,7 @@ export interface FunctionExceptionsOptions {
13
13
  readonly knownThrower?: ExceptionsByFunction;
14
14
  }
15
15
  /**
16
- * The `NodeId`s of functions that may throw exceptions when called by `id`, restricted to functions known by
17
- * flowR. `knownThrower` seeds additional throwers, e.g. the result of an earlier call, counting its callees.
16
+ * The `NodeId`s of functions that may throw exceptions when called by `id`, restricted to functions known by flowR.
18
17
  * @useInstead {@link FunctionSemantics.exceptions}
19
18
  */
20
19
  export declare function exceptionsOfFunction(this: void, id: NodeId, graph: CallGraph, { knownThrower }?: FunctionExceptionsOptions): ExceptionsByFunction;
@@ -12,11 +12,8 @@ const built_in_props_1 = require("../environments/built-in-props");
12
12
  const query_fn_props_1 = require("../environments/query-fn-props");
13
13
  const condition_handlers_1 = require("./condition-handlers");
14
14
  const defaultmap_1 = require("../../util/collections/defaultmap");
15
- /**
16
- * Whether the vertex catches an error raised below it, which ends the walk. A construct declaring no condition
17
- * handler of its own (`try`) catches whatever arrives; one that matches handlers by condition class
18
- * (`tryCatch`) catches only what the names written for it say.
19
- */
15
+ const fixpoint_1 = require("../../util/fixpoint");
16
+ /** Whether the vertex catches an error raised below it, which ends the walk. */
20
17
  function catches(vertex, graph, info) {
21
18
  if (!vertex_1.DfgVertex.isFunctionCall(vertex) || !vertex_1.DfgVertex.hasOrigin(vertex, built_in_proc_name_1.BuiltInProcName.Try)) {
22
19
  return false;
@@ -28,12 +25,7 @@ function catches(vertex, graph, info) {
28
25
  const node = graph.idMap?.get(vertex.id);
29
26
  return r_function_call_1.RFunctionCall.is(node) && (0, condition_handlers_1.namesAnErrorHandler)(node.arguments);
30
27
  }
31
- /**
32
- * Whether the call is written in the block of a construct catching what it raises, which keeps an error its
33
- * callee raises from reaching the function around it. Only the block is guarded, as a handler runs after the
34
- * error was raised, and the walk ends at the definition the call is written in, as a function defined in the
35
- * block is not run there.
36
- */
28
+ /** Whether the call is written in the block of a construct catching what it raises, which keeps an error its callee raises from reaching the function around it. */
37
29
  function guarded(id, graph, info) {
38
30
  const idMap = graph.idMap;
39
31
  let node = idMap?.get(id);
@@ -46,113 +38,51 @@ function guarded(id, graph, info) {
46
38
  }
47
39
  return false;
48
40
  }
49
- function reach(id, graph, knownThrower) {
41
+ const RaisesNothing = new Map();
42
+ function joinRaised(a, b) {
43
+ if (b.size === 0 || b.keys().every(k => a.has(k))) {
44
+ return a;
45
+ }
46
+ else if (a.size === 0) {
47
+ return b;
48
+ }
49
+ const joined = new Map(a);
50
+ for (const [at, point] of b) {
51
+ if (!joined.has(at)) {
52
+ joined.set(at, point);
53
+ }
54
+ }
55
+ return joined;
56
+ }
57
+ /**
58
+ * The `NodeId`s of functions that may throw exceptions when called by `id`, restricted to functions known by flowR.
59
+ * @useInstead {@link FunctionSemantics.exceptions}
60
+ */
61
+ function exceptionsOfFunction(id, graph, { knownThrower = {} } = {}) {
50
62
  const info = (0, query_fn_props_1.builtInLookup)();
51
63
  const isGuarded = (0, defaultmap_1.memoize)((n) => guarded(n, graph, info));
52
- const calls = new Map();
53
64
  const own = new Map();
54
- const defs = new Set();
55
- const toVisit = [id];
56
- while (toVisit.length > 0) {
57
- const current = toVisit.pop();
58
- if (calls.has(current)) {
59
- continue;
60
- }
65
+ const defs = [];
66
+ const raised = new fixpoint_1.ReachSummaries(current => {
61
67
  const known = knownThrower[current];
62
68
  if (known !== undefined) {
63
- own.set(current, known);
64
- calls.set(current, []);
65
- continue;
69
+ own.set(current, new Map(known.map(e => [e.id, e])));
70
+ return [];
66
71
  }
67
72
  const vertex = graph.getVertex(current);
68
73
  if (vertex === undefined || node_id_1.NodeId.isBuiltIn(current)) {
69
- calls.set(current, []);
70
- continue;
74
+ return [];
71
75
  }
72
76
  if (vertex_1.DfgVertex.isFunctionDefinition(vertex)) {
73
- defs.add(current);
74
- own.set(current, vertex.exitPoints.filter(e => e.type === 4 /* ExitPointType.Error */).map(e => ({ id: e.nodeId, cds: e.cds })));
77
+ defs.push(current);
78
+ own.set(current, new Map(vertex.exitPoints.filter(e => e.type === 4 /* ExitPointType.Error */).map(e => [e.nodeId, { id: e.nodeId, cds: e.cds }])));
75
79
  }
76
80
  /* a guarded call is only ever reached through the construct guarding it, which ends the walk of its own */
77
- const next = [...graph.edgesFrom(current).keys()].filter(n => !isGuarded(n));
78
- calls.set(current, next);
79
- toVisit.push(...next);
80
- }
81
- return { calls, own, defs };
82
- }
83
- /** What each node may raise, its callees included; Tarjan yields the call cycles callees first, so each is settled once. */
84
- function raisedPerNode(calls, own) {
85
- const raised = new Map();
86
- const index = new Map();
87
- const low = new Map();
88
- const stack = [];
89
- const onStack = new Set();
90
- const lower = (node, to) => low.set(node, Math.min(low.get(node), to));
91
- for (const root of calls.keys()) {
92
- if (index.has(root)) {
93
- continue;
94
- }
95
- /* each frame is a node and how many of its callees have been looked at */
96
- const frames = [[root, 0]];
97
- while (frames.length > 0) {
98
- const frame = frames[frames.length - 1];
99
- const [node, at] = frame;
100
- if (at === 0) {
101
- low.set(node, index.size);
102
- index.set(node, index.size);
103
- stack.push(node);
104
- onStack.add(node);
105
- }
106
- const callee = calls.get(node)?.[at];
107
- if (callee !== undefined) {
108
- frame[1]++;
109
- if (!index.has(callee)) {
110
- frames.push([callee, 0]);
111
- }
112
- else if (onStack.has(callee)) {
113
- lower(node, index.get(callee));
114
- }
115
- continue;
116
- }
117
- frames.pop();
118
- if (frames.length > 0) {
119
- lower(frames[frames.length - 1][0], low.get(node));
120
- }
121
- if (low.get(node) === index.get(node)) {
122
- /* the node roots a component: its members are what lies on the stack above it, taken off top first */
123
- const members = stack.splice(stack.lastIndexOf(node)).reverse();
124
- const points = new Map();
125
- for (const m of members) {
126
- for (const e of own.get(m) ?? []) {
127
- points.set(e.id, e);
128
- }
129
- for (const callee of calls.get(m) ?? []) {
130
- for (const [at, point] of raised.get(callee) ?? []) {
131
- points.set(at, point);
132
- }
133
- }
134
- }
135
- for (const m of members) {
136
- onStack.delete(m);
137
- raised.set(m, points);
138
- }
139
- }
140
- }
141
- }
142
- return raised;
143
- }
144
- /**
145
- * The `NodeId`s of functions that may throw exceptions when called by `id`, restricted to functions known by
146
- * flowR. `knownThrower` seeds additional throwers, e.g. the result of an earlier call, counting its callees.
147
- * @useInstead {@link FunctionSemantics.exceptions}
148
- */
149
- function exceptionsOfFunction(id, graph, { knownThrower = {} } = {}) {
150
- const { calls, own, defs } = reach(id, graph, knownThrower);
151
- const result = {};
152
- for (const [node, points] of raisedPerNode(calls, own)) {
153
- if (defs.has(node) || node === id) {
154
- result[node] = [...points.values()];
155
- }
81
+ return graph.edgesFrom(current).keys().filter(n => !isGuarded(n));
82
+ }, n => own.get(n), { empty: RaisesNothing, concat: joinRaised });
83
+ const result = { [id]: [...raised.of(id).values()] };
84
+ for (const def of defs) {
85
+ result[def] = [...raised.of(def).values()];
156
86
  }
157
87
  return result;
158
88
  }
@@ -10,9 +10,7 @@ export interface FrameReflectionOptions {
10
10
  readonly known: BuiltInLookup;
11
11
  }
12
12
  /**
13
- * What `definition`'s body reaches about its own formals through the frame or call it sits in, as the
14
- * {@link BuiltInFnInfo#frame} bits of the reflective calls it makes (`0` for none). `get("x", envir = e)` and
15
- * `e$x` are followed to the name directly; `as.list(environment())` and a frame handed elsewhere mean any formal.
13
+ * What `definition`'s body reaches about its own formals through the frame or call it sits in, as the {@link BuiltInFnInfo#frame} bits of the reflective calls it makes (`0` for none).
16
14
  * @useInstead {@link FunctionSemantics.frameReflection}
17
15
  */
18
16
  export declare function reflectiveRolesOf(this: void, definition: DataflowGraphVertexFunctionDefinition, graph: DataflowGraph, { known }: FrameReflectionOptions): ArgProps;