@eagleoutice/flowr 2.17.5 → 2.17.6

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 (357) hide show
  1. package/README.md +13 -51
  2. package/abstract-interpretation/absint-inference.d.ts +4 -4
  3. package/abstract-interpretation/absint-inference.js +11 -11
  4. package/abstract-interpretation/abstract-semantics.d.ts +2 -1
  5. package/abstract-interpretation/branch-paths-interpreter.d.ts +1 -0
  6. package/abstract-interpretation/branch-paths-interpreter.js +60 -0
  7. package/abstract-interpretation/branch-paths.d.ts +60 -0
  8. package/abstract-interpretation/branch-paths.js +120 -0
  9. package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +6 -1
  10. package/abstract-interpretation/data-frame/dataframe-semantics.js +60 -1
  11. package/abstract-interpretation/data-frame/semantics.js +4 -10
  12. package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
  13. package/cli/repl/core.js +51 -0
  14. package/control-flow/cfg-dead-code.js +12 -7
  15. package/data/packed.d.ts +10 -0
  16. package/data/packed.js +33 -0
  17. package/data/r-base-guards.generated.d.ts +7 -0
  18. package/data/r-base-guards.generated.js +12 -0
  19. package/data/r-datasets.generated.d.ts +4 -0
  20. package/data/r-datasets.generated.js +10 -0
  21. package/data/r-formals.generated.d.ts +4 -0
  22. package/data/r-formals.generated.js +10 -0
  23. package/data/r-group-method-guards.generated.d.ts +3 -0
  24. package/data/r-group-method-guards.generated.js +8 -0
  25. package/dataflow/environments/ambient-effect.d.ts +1000 -0
  26. package/dataflow/environments/ambient-effect.js +234 -0
  27. package/dataflow/environments/ambient-state-name.d.ts +45 -2
  28. package/dataflow/environments/ambient-state-name.js +61 -3
  29. package/dataflow/environments/apply-kill.js +11 -4
  30. package/dataflow/environments/built-in-kinds.d.ts +4 -46
  31. package/dataflow/environments/built-in-kinds.js +6 -2
  32. package/dataflow/environments/built-in-props.d.ts +16 -4
  33. package/dataflow/environments/built-in-props.js +11 -3
  34. package/dataflow/environments/built-in.d.ts +6 -1
  35. package/dataflow/environments/built-in.js +13 -36
  36. package/dataflow/environments/default-builtin-config/base-functions.d.ts +1 -1
  37. package/dataflow/environments/default-builtin-config/base-functions.js +110 -52
  38. package/dataflow/environments/default-builtin-config/base-language.d.ts +1 -1
  39. package/dataflow/environments/default-builtin-config/base-language.js +11 -8
  40. package/dataflow/environments/default-builtin-config/dev-tooling.js +1 -1
  41. package/dataflow/environments/default-builtin-config/file-io.js +6 -4
  42. package/dataflow/environments/default-builtin-config/graphics-devices.d.ts +1 -1
  43. package/dataflow/environments/default-builtin-config/graphics-devices.js +24 -14
  44. package/dataflow/environments/default-builtin-config/guard-builders.d.ts +16 -0
  45. package/dataflow/environments/default-builtin-config/guard-builders.js +29 -0
  46. package/dataflow/environments/default-builtin-config/guards-primitive-lang.d.ts +15 -0
  47. package/dataflow/environments/default-builtin-config/guards-primitive-lang.js +228 -0
  48. package/dataflow/environments/default-builtin-config/guards-primitive-ops.d.ts +11 -0
  49. package/dataflow/environments/default-builtin-config/guards-primitive-ops.js +154 -0
  50. package/dataflow/environments/default-builtin-config/guards.d.ts +9 -0
  51. package/dataflow/environments/default-builtin-config/guards.js +211 -0
  52. package/dataflow/environments/default-builtin-config/index.d.ts +3 -3
  53. package/dataflow/environments/default-builtin-config/index.js +22 -7
  54. package/dataflow/environments/default-builtin-config/media-formats.js +4 -4
  55. package/dataflow/environments/default-builtin-config/package-spatial.js +2 -1
  56. package/dataflow/environments/default-builtin-config/package-tidyverse.js +3 -2
  57. package/dataflow/environments/default-builtin-config/package-utils.d.ts +1 -1
  58. package/dataflow/environments/default-builtin-config/package-utils.js +5 -2
  59. package/dataflow/environments/default-builtin-config/parallel-execution.d.ts +1 -1
  60. package/dataflow/environments/default-builtin-config/parallel-execution.js +3 -1
  61. package/dataflow/environments/default-builtin-config/r-formals.d.ts +13 -0
  62. package/dataflow/environments/default-builtin-config/r-formals.js +110 -0
  63. package/dataflow/environments/default-builtin-config/shared-configs.d.ts +138 -77
  64. package/dataflow/environments/default-builtin-config/shared-configs.js +52 -88
  65. package/dataflow/environments/default-builtin-config/statistics.d.ts +1 -1
  66. package/dataflow/environments/default-builtin-config/statistics.js +4 -1
  67. package/dataflow/environments/diff.js +5 -2
  68. package/dataflow/environments/environment.d.ts +20 -0
  69. package/dataflow/environments/environment.js +39 -4
  70. package/dataflow/environments/group-generics.d.ts +5 -1
  71. package/dataflow/environments/group-generics.js +13 -3
  72. package/dataflow/environments/guard-facts.d.ts +169 -0
  73. package/dataflow/environments/guard-facts.js +26 -0
  74. package/dataflow/environments/identifier.d.ts +9 -1
  75. package/dataflow/environments/identifier.js +5 -0
  76. package/dataflow/environments/pkg-name.d.ts +1 -0
  77. package/dataflow/environments/query-fn-props.d.ts +3 -5
  78. package/dataflow/environments/query-fn-props.js +44 -21
  79. package/dataflow/environments/removal-marker.d.ts +2 -0
  80. package/dataflow/environments/removal-marker.js +5 -0
  81. package/dataflow/eval/resolve/resolve-strings.d.ts +2 -5
  82. package/dataflow/eval/resolve/resolve-strings.js +2 -2
  83. package/dataflow/extractor.js +24 -15
  84. package/dataflow/fn/condition-handlers.d.ts +2 -0
  85. package/dataflow/fn/condition-handlers.js +3 -1
  86. package/dataflow/fn/frame-reflection.d.ts +4 -2
  87. package/dataflow/fn/frame-reflection.js +16 -0
  88. package/dataflow/fn/function-props.js +15 -22
  89. package/dataflow/fn/function-semantics.d.ts +31 -1
  90. package/dataflow/fn/function-semantics.js +15 -0
  91. package/dataflow/fn/guards/built-in-guards.d.ts +112 -0
  92. package/dataflow/fn/guards/built-in-guards.js +199 -0
  93. package/dataflow/fn/guards/call-contracts.d.ts +97 -0
  94. package/dataflow/fn/guards/call-contracts.js +331 -0
  95. package/dataflow/fn/guards/condition-grouping.d.ts +20 -0
  96. package/dataflow/fn/guards/condition-grouping.js +135 -0
  97. package/dataflow/fn/guards/function-guards.d.ts +112 -0
  98. package/dataflow/fn/guards/function-guards.js +1549 -0
  99. package/dataflow/fn/guards/group-method-guards.d.ts +28 -0
  100. package/dataflow/fn/guards/group-method-guards.js +56 -0
  101. package/dataflow/fn/guards/guard-claims.d.ts +125 -0
  102. package/dataflow/fn/guards/guard-claims.js +678 -0
  103. package/dataflow/fn/guards/guard-knowledge.d.ts +41 -0
  104. package/dataflow/fn/guards/guard-knowledge.js +180 -0
  105. package/dataflow/fn/guards/guard-term-syntax.d.ts +9 -0
  106. package/dataflow/fn/guards/guard-term-syntax.js +210 -0
  107. package/dataflow/fn/guards/guard-term.d.ts +136 -0
  108. package/dataflow/fn/guards/guard-term.js +550 -0
  109. package/dataflow/fn/guards/stated-guards.d.ts +13 -0
  110. package/dataflow/fn/guards/stated-guards.js +35 -0
  111. package/dataflow/fn/higher-order-function.d.ts +2 -0
  112. package/dataflow/fn/higher-order-function.js +1 -0
  113. package/dataflow/fn/strict-function.d.ts +4 -0
  114. package/dataflow/fn/strict-function.js +66 -17
  115. package/dataflow/graph/ambient-access.d.ts +4 -1
  116. package/dataflow/graph/ambient-access.js +8 -2
  117. package/dataflow/graph/closure-frames.js +1 -1
  118. package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
  119. package/dataflow/graph/dataflowgraph-builder.js +2 -2
  120. package/dataflow/graph/df-helper.d.ts +6 -0
  121. package/dataflow/graph/df-helper.js +15 -0
  122. package/dataflow/graph/graph.d.ts +12 -6
  123. package/dataflow/graph/graph.js +21 -28
  124. package/dataflow/info.d.ts +2 -1
  125. package/dataflow/info.js +3 -1
  126. package/dataflow/internal/dispatch-linking.d.ts +3 -1
  127. package/dataflow/internal/dispatch-linking.js +1 -0
  128. package/dataflow/internal/linker.d.ts +2 -0
  129. package/dataflow/internal/linker.js +115 -6
  130. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -1
  131. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +5 -2
  132. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +2 -1
  133. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +19 -57
  134. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +471 -295
  135. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +13 -1
  136. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +2 -0
  137. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +106 -19
  138. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -1
  139. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +24 -3
  140. package/dataflow/internal/process/functions/call/built-in/built-in-deferred-env-ops.d.ts +1 -1
  141. package/dataflow/internal/process/functions/call/built-in/built-in-deferred-env-ops.js +33 -11
  142. package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.js +4 -0
  143. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +4 -4
  144. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +23 -7
  145. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -4
  146. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +19 -2
  147. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +347 -46
  148. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -1
  149. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +5 -0
  150. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +110 -16
  151. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +2 -0
  152. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +9 -2
  153. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +1 -1
  154. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -2
  155. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +5 -0
  156. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +28 -0
  157. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +16 -6
  158. package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +6 -1
  159. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +37 -2
  160. package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +4 -0
  161. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +19 -1
  162. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -1
  163. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +55 -11
  164. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -2
  165. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +11 -10
  166. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -1
  167. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +8 -0
  168. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +64 -7
  169. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +1 -1
  170. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +160 -20
  171. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +5 -3
  172. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +6 -0
  173. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +142 -4
  174. package/dataflow/internal/process/functions/call/quoted.d.ts +2 -0
  175. package/dataflow/internal/process/functions/call/quoted.js +23 -4
  176. package/dataflow/processor.d.ts +2 -0
  177. package/documentation/data/dfg/doc-ambient.d.ts +4 -0
  178. package/documentation/data/dfg/doc-ambient.js +74 -0
  179. package/documentation/wiki-dataflow-graph.js +10 -4
  180. package/documentation/wiki-linter.js +12 -0
  181. package/documentation/wiki-query.js +112 -1
  182. package/linter/linter-rules.d.ts +41 -1
  183. package/linter/linter-rules.js +5 -1
  184. package/linter/rules/call-contracts.d.ts +40 -0
  185. package/linter/rules/call-contracts.js +56 -0
  186. package/linter/rules/cmd-check/bogus-return.js +1 -1
  187. package/linter/rules/cmd-check/call-arguments.js +5 -6
  188. package/linter/rules/cmd-check/cmd-check-util.d.ts +0 -6
  189. package/linter/rules/cmd-check/cmd-check-util.js +0 -28
  190. package/linter/rules/cmd-check/package-hooks.js +2 -1
  191. package/linter/rules/cmd-check/s-three-method-consistency.js +1 -1
  192. package/linter/rules/interactive-functions.d.ts +30 -0
  193. package/linter/rules/interactive-functions.js +87 -0
  194. package/linter/rules/process-state-in-session.js +1 -1
  195. package/linter/rules/undefined-symbol-util.d.ts +1 -1
  196. package/linter/rules/undefined-symbol-util.js +8 -2
  197. package/linter/rules/undefined-symbol.js +18 -7
  198. package/linter/rules/useless-loop.d.ts +1 -1
  199. package/package.json +1 -1
  200. package/project/context/flowr-analyzer-dependencies-context.js +2 -1
  201. package/project/flowr-analyzer.d.ts +1 -0
  202. package/project/flowr-analyzer.js +5 -5
  203. package/project/sigdb/build.js +14 -4
  204. package/project/sigdb/decode.d.ts +3 -0
  205. package/project/sigdb/decode.js +10 -1
  206. package/project/sigdb/guarded-source.d.ts +6 -0
  207. package/project/sigdb/guarded-source.js +29 -0
  208. package/project/sigdb/reader.d.ts +5 -0
  209. package/project/sigdb/reader.js +27 -1
  210. package/project/sigdb/schema.d.ts +24 -2
  211. package/queries/catalog/absint-query/absint-query-format.d.ts +6 -3
  212. package/queries/catalog/absint-query/absint-query-format.js +57 -2
  213. package/queries/catalog/ambient-access-query/ambient-access-query-format.d.ts +6 -2
  214. package/queries/catalog/ambient-access-query/ambient-access-query-format.js +48 -3
  215. package/queries/catalog/cluster-query/cluster-query-format.d.ts +5 -2
  216. package/queries/catalog/cluster-query/cluster-query-format.js +19 -2
  217. package/queries/catalog/code-clones-query/code-clones-query-format.d.ts +5 -2
  218. package/queries/catalog/code-clones-query/code-clones-query-format.js +34 -2
  219. package/queries/catalog/config-query/config-query-format.d.ts +5 -2
  220. package/queries/catalog/config-query/config-query-format.js +41 -2
  221. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +5 -2
  222. package/queries/catalog/control-flow-query/control-flow-query-format.js +19 -2
  223. package/queries/catalog/data-columns-query/data-columns-query-format.d.ts +72 -0
  224. package/queries/catalog/data-columns-query/data-columns-query-format.js +215 -0
  225. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +5 -2
  226. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +38 -2
  227. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +5 -2
  228. package/queries/catalog/dataflow-query/dataflow-query-format.js +18 -2
  229. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
  230. package/queries/catalog/dependencies-query/dependencies-query-format.js +8 -3
  231. package/queries/catalog/dependencies-query/function-info/other-path-functions.js +1 -1
  232. package/queries/catalog/dependencies-query/function-info/tagged-functions.d.ts +11 -0
  233. package/queries/catalog/dependencies-query/function-info/tagged-functions.js +18 -0
  234. package/queries/catalog/dice-query/dice-query-format.d.ts +7 -2
  235. package/queries/catalog/dice-query/dice-query-format.js +34 -2
  236. package/queries/catalog/does-call-query/does-call-query-format.d.ts +7 -4
  237. package/queries/catalog/does-call-query/does-call-query-format.js +114 -2
  238. package/queries/catalog/files-query/files-query-format.d.ts +5 -2
  239. package/queries/catalog/files-query/files-query-format.js +45 -2
  240. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +6 -3
  241. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +303 -2
  242. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +8 -4
  243. package/queries/catalog/happens-before-query/happens-before-query-format.js +37 -2
  244. package/queries/catalog/id-map-query/id-map-query-format.d.ts +5 -2
  245. package/queries/catalog/id-map-query/id-map-query-format.js +18 -2
  246. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +5 -2
  247. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +29 -2
  248. package/queries/catalog/inspect-fn-guards-query/inspect-fn-guards-query-format.d.ts +37 -0
  249. package/queries/catalog/inspect-fn-guards-query/inspect-fn-guards-query-format.js +125 -0
  250. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.d.ts +3 -2
  251. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +54 -2
  252. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +6 -2
  253. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +23 -2
  254. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +6 -2
  255. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +15 -2
  256. package/queries/catalog/linter-query/linter-query-format.d.ts +8 -2
  257. package/queries/catalog/linter-query/linter-query-format.js +69 -4
  258. package/queries/catalog/location-map-query/location-map-query-format.d.ts +7 -3
  259. package/queries/catalog/location-map-query/location-map-query-format.js +70 -2
  260. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +5 -2
  261. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +18 -2
  262. package/queries/catalog/origin-query/origin-query-format.d.ts +6 -3
  263. package/queries/catalog/origin-query/origin-query-format.js +29 -2
  264. package/queries/catalog/project-query/project-query-format.d.ts +6 -3
  265. package/queries/catalog/project-query/project-query-format.js +98 -2
  266. package/queries/catalog/provenance-query/provenance-query-format.d.ts +6 -3
  267. package/queries/catalog/provenance-query/provenance-query-format.js +30 -2
  268. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +9 -2
  269. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +38 -2
  270. package/queries/catalog/search-query/search-query-format.d.ts +5 -2
  271. package/queries/catalog/search-query/search-query-format.js +23 -2
  272. package/queries/catalog/signature-query/signature-query-executor.js +3 -1
  273. package/queries/catalog/signature-query/signature-query-format.d.ts +3 -0
  274. package/queries/catalog/signature-query/signature-query-render.js +23 -0
  275. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +13 -2
  276. package/queries/catalog/static-slice-query/static-slice-query-format.js +55 -2
  277. package/queries/catalog/taint-query/taint-query-format.d.ts +6 -3
  278. package/queries/catalog/taint-query/taint-query-format.js +28 -2
  279. package/queries/query.d.ts +48 -27
  280. package/queries/query.js +6 -4
  281. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +2 -0
  282. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +4 -0
  283. package/r-bridge/shell.js +7 -2
  284. package/reconstruct/reconstruct.js +18 -3
  285. package/slicing/static/removal-slice.js +4 -3
  286. package/slicing/static/slice-call.d.ts +11 -0
  287. package/slicing/static/slice-call.js +43 -2
  288. package/slicing/static/static-slicer.d.ts +2 -0
  289. package/slicing/static/static-slicer.js +137 -21
  290. package/slicing/static/visiting-queue.d.ts +2 -0
  291. package/slicing/static/visiting-queue.js +4 -0
  292. package/util/flowr-version.d.ts +1 -1
  293. package/util/flowr-version.js +2 -2
  294. package/util/objects.d.ts +2 -0
  295. package/util/objects.js +5 -0
  296. package/util/r-datasets.d.ts +27 -0
  297. package/util/r-datasets.js +45 -0
  298. package/util/text/playground-link.d.ts +2 -0
  299. package/util/text/playground-link.js +2 -0
  300. package/queries/catalog/absint-query/absint-query-executor.d.ts +0 -6
  301. package/queries/catalog/absint-query/absint-query-executor.js +0 -61
  302. package/queries/catalog/ambient-access-query/ambient-access-query-executor.d.ts +0 -6
  303. package/queries/catalog/ambient-access-query/ambient-access-query-executor.js +0 -50
  304. package/queries/catalog/cluster-query/cluster-query-executor.d.ts +0 -6
  305. package/queries/catalog/cluster-query/cluster-query-executor.js +0 -21
  306. package/queries/catalog/code-clones-query/code-clones-query-executor.d.ts +0 -6
  307. package/queries/catalog/code-clones-query/code-clones-query-executor.js +0 -38
  308. package/queries/catalog/config-query/config-query-executor.d.ts +0 -6
  309. package/queries/catalog/config-query/config-query-executor.js +0 -45
  310. package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +0 -6
  311. package/queries/catalog/control-flow-query/control-flow-query-executor.js +0 -21
  312. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.d.ts +0 -6
  313. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +0 -40
  314. package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +0 -6
  315. package/queries/catalog/dataflow-query/dataflow-query-executor.js +0 -20
  316. package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +0 -9
  317. package/queries/catalog/dependencies-query/function-info/statistics-functions.js +0 -18
  318. package/queries/catalog/dice-query/dice-query-executor.d.ts +0 -8
  319. package/queries/catalog/dice-query/dice-query-executor.js +0 -37
  320. package/queries/catalog/does-call-query/does-call-query-executor.d.ts +0 -6
  321. package/queries/catalog/does-call-query/does-call-query-executor.js +0 -116
  322. package/queries/catalog/files-query/files-query-executor.d.ts +0 -6
  323. package/queries/catalog/files-query/files-query-executor.js +0 -47
  324. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.d.ts +0 -6
  325. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +0 -307
  326. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +0 -7
  327. package/queries/catalog/happens-before-query/happens-before-query-executor.js +0 -40
  328. package/queries/catalog/id-map-query/id-map-query-executor.d.ts +0 -6
  329. package/queries/catalog/id-map-query/id-map-query-executor.js +0 -20
  330. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +0 -6
  331. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +0 -31
  332. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.d.ts +0 -4
  333. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +0 -58
  334. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +0 -7
  335. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +0 -25
  336. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.d.ts +0 -7
  337. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +0 -17
  338. package/queries/catalog/linter-query/linter-query-executor.d.ts +0 -9
  339. package/queries/catalog/linter-query/linter-query-executor.js +0 -62
  340. package/queries/catalog/location-map-query/location-map-query-executor.d.ts +0 -7
  341. package/queries/catalog/location-map-query/location-map-query-executor.js +0 -73
  342. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +0 -6
  343. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +0 -20
  344. package/queries/catalog/origin-query/origin-query-executor.d.ts +0 -6
  345. package/queries/catalog/origin-query/origin-query-executor.js +0 -31
  346. package/queries/catalog/project-query/project-query-executor.d.ts +0 -6
  347. package/queries/catalog/project-query/project-query-executor.js +0 -103
  348. package/queries/catalog/provenance-query/provenance-query-executor.d.ts +0 -6
  349. package/queries/catalog/provenance-query/provenance-query-executor.js +0 -33
  350. package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +0 -10
  351. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +0 -40
  352. package/queries/catalog/search-query/search-query-executor.d.ts +0 -6
  353. package/queries/catalog/search-query/search-query-executor.js +0 -25
  354. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +0 -14
  355. package/queries/catalog/static-slice-query/static-slice-query-executor.js +0 -59
  356. package/queries/catalog/taint-query/taint-query-executor.d.ts +0 -7
  357. package/queries/catalog/taint-query/taint-query-executor.js +0 -30
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.strictnessOfEach = strictnessOfEach;
4
+ exports.promiseForcingPoints = promiseForcingPoints;
4
5
  exports.promiseDependencies = promiseDependencies;
6
+ exports.promiseRaises = promiseRaises;
5
7
  exports.promiseForcing = promiseForcing;
6
8
  exports.settleDefinitionsInPromises = settleDefinitionsInPromises;
7
9
  exports.settleJumpsInPromises = settleJumpsInPromises;
@@ -13,6 +15,7 @@ const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id"
13
15
  const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
14
16
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
15
17
  const info_1 = require("../info");
18
+ const linker_1 = require("../internal/linker");
16
19
  const edge_1 = require("../graph/edge");
17
20
  const node_value_1 = require("../eval/resolve/node-value");
18
21
  const resolve_helper_1 = require("../environments/resolve-helper");
@@ -360,11 +363,9 @@ function computeStrictness(id, state) {
360
363
  function strictnessOfEach(ids, graph, { ctx } = {}) {
361
364
  const state = strictnessStateOf(graph, ctx);
362
365
  const result = {};
363
- graph.sharingTargetWalks(() => {
364
- for (const id of ids) {
365
- result[id] = strictnessOf(id, state);
366
- }
367
- });
366
+ for (const id of ids) {
367
+ result[id] = strictnessOf(id, state);
368
+ }
368
369
  return result;
369
370
  }
370
371
  /** Where the promises bound to `params` may be forced: their reads, calls of closures capturing them, and the callees they are handed to. */
@@ -379,8 +380,10 @@ function forcingPointsOf(params, graph, idMap, seen = new Set()) {
379
380
  const element = isElementRead(param, graph);
380
381
  const binding = element ? df_helper_1.Dataflow.targetsOf(graph, param, edge_1.EdgeType.Reads).find(t => idMap.get(t)?.info.role === "param-n" /* RoleInParent.ParameterName */) : param;
381
382
  const owner = idMap.get(idMap.get(binding ?? -1)?.info.parent ?? -1)?.info.parent;
382
- for (const read of element ? [param] : df_helper_1.Dataflow.sourcesOf(graph, param, edge_1.EdgeType.Reads)) {
383
- found.push(read);
383
+ /* a promise bound outside of every function (`delayedAssign`) is forced by each call running a closure reading it */
384
+ const global = !element && !vertex_1.DfgVertex.isFunctionDefinition(graph.getVertex(owner ?? ''));
385
+ for (const read of element ? [param] : df_helper_1.Dataflow.sourcesOf(graph, param, global ? edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedByOnCall : edge_1.EdgeType.Reads)) {
386
+ found.push(read, ...global ? callersOf(read, graph, idMap) : []);
384
387
  /* only a closure within the function owning the parameter captures it, a read elsewhere is no call of one */
385
388
  const closures = [];
386
389
  let closure = model_1.RNode.findEnclosing(read, idMap, r_function_definition_1.RFunctionDefinition.is);
@@ -407,6 +410,19 @@ function forcingPointsOf(params, graph, idMap, seen = new Set()) {
407
410
  }
408
411
  return found;
409
412
  }
413
+ /** The calls running the closures holding `id`, and those running the closures holding these calls in turn. */
414
+ function callersOf(id, graph, idMap, seen = new Set()) {
415
+ const closure = model_1.RNode.strictlyEnclosingFunction(id, idMap);
416
+ if (closure === undefined || seen.has(closure)) {
417
+ return [];
418
+ }
419
+ seen.add(closure);
420
+ return df_helper_1.Dataflow.sourcesOf(graph, closure, edge_1.EdgeType.Calls).flatMap(call => [call, ...callersOf(call, graph, idMap, seen)]);
421
+ }
422
+ /** Where the promise bound to `binding` may be forced, see {@link promiseDependencies}. */
423
+ function promiseForcingPoints(binding, graph) {
424
+ return graph.idMap === undefined ? [] : forcingPointsOf([binding], graph, graph.idMap);
425
+ }
410
426
  /** What a node within promises depends on to run: the holder of each `byPromise` dependency and where that promise may be forced. */
411
427
  function promiseDependencies(id, graph) {
412
428
  const idMap = graph.idMap;
@@ -415,21 +431,48 @@ function promiseDependencies(id, graph) {
415
431
  return found;
416
432
  }
417
433
  for (const cd of graph.getVertex(id)?.cds ?? []) {
418
- if (cd.byPromise !== true) {
419
- continue;
434
+ if (cd.byPromise === true) {
435
+ const forcing = forcingPointsOfPromise(cd.id, id, graph, idMap);
436
+ found.push(...vertex_1.DfgVertex.isFunctionCall(graph.getVertex(cd.id)) ? [cd.id] : [], ...forcing, ...forcing.flatMap(at => catchersOf(at, idMap, graph)));
420
437
  }
421
- const call = graph.getVertex(cd.id);
422
- if (vertex_1.DfgVertex.isFunctionCall(call)) {
423
- const argument = model_1.RNode.findEnclosing(id, idMap, n => n.info.parent === cd.id);
424
- const bound = argument === undefined ? [] : boundParameters(call, argument, idMap, graph) ?? [];
425
- found.push(cd.id, ...forcingPointsOf(bound, graph, idMap));
438
+ }
439
+ return found;
440
+ }
441
+ /** The calls catching what is raised at `at` before it leaves its function, as `try(a)` does for what forcing the promise `a` raises. */
442
+ function catchersOf(at, idMap, graph) {
443
+ const found = [];
444
+ for (const node of model_1.RNode.iterateParents(idMap.get(at), idMap)) {
445
+ if (r_function_definition_1.RFunctionDefinition.is(node)) {
446
+ break;
426
447
  }
427
- else {
428
- found.push(...forcingPointsOf([cd.id], graph, idMap));
448
+ else if (vertex_1.DfgVertex.hasOrigin(graph.getVertex(node.info.id), built_in_proc_name_1.BuiltInProcName.Try)) {
449
+ found.push(node.info.id);
429
450
  }
430
451
  }
431
452
  return found;
432
453
  }
454
+ /** Where the promise that `holder` (a call handed it, or the binding of a `delayedAssign`) holds and `inner` lies in may be forced. */
455
+ function forcingPointsOfPromise(holder, inner, graph, idMap) {
456
+ const call = graph.getVertex(holder);
457
+ if (!vertex_1.DfgVertex.isFunctionCall(call)) {
458
+ return forcingPointsOf([holder], graph, idMap);
459
+ }
460
+ const argument = model_1.RNode.findEnclosing(inner, idMap, n => n.info.parent === holder);
461
+ return forcingPointsOf(argument === undefined ? [] : boundParameters(call, argument, idMap, graph) ?? [], graph, idMap);
462
+ }
463
+ /** Whether an error raised within the promise may be caught where it is forced, as `tryCatch(x, error = ...)` does within the callee. */
464
+ function caughtWhereForced(holder, inner, graph) {
465
+ const idMap = graph.idMap;
466
+ return idMap === undefined || forcingPointsOfPromise(holder, inner, graph, idMap).some(at => {
467
+ const fn = idMap.get(model_1.RNode.findEnclosing(at, idMap, r_function_definition_1.RFunctionDefinition.is) ?? '');
468
+ return !(0, linker_1.errorEscapes)(at, r_function_definition_1.RFunctionDefinition.is(fn) ? fn.body.info.id : undefined, idMap, graph);
469
+ });
470
+ }
471
+ /** Whether an error raised by `inner` within the promise of `holder` surely leaves the holder: the holder always forces it and nowhere catches it. */
472
+ function promiseRaises(graph, options = {}) {
473
+ const forcing = promiseForcing(graph, options);
474
+ return (holder, inner) => forcing(holder, inner) === logic_1.Ternary.Always && !caughtWhereForced(holder, inner, graph);
475
+ }
433
476
  /** How surely the holder of a promise forces it, asked for a node `inner` within the promise. */
434
477
  function promiseForcing(graph, { ctx, constantBranches, knownOnly } = {}) {
435
478
  const idMap = graph.idMap;
@@ -504,13 +547,19 @@ function settleDefinitionsInPromises(graph, { ctx } = {}) {
504
547
  program_order_1.ProgramOrder.replaceEarlier(id, statement, graph, false);
505
548
  }
506
549
  }
550
+ function isParameterName(id, graph) {
551
+ const node = graph.idMap?.get(id);
552
+ const parent = node === undefined ? undefined : graph.idMap?.get(node.info.parent);
553
+ return r_parameter_1.RParameter.is(parent) && parent.name === node;
554
+ }
507
555
  /** Drops the resume of a jump within a promise ({@link ControlFlow.promise}) once the linked holder surely forces it. */
508
556
  function settleJumpsInPromises(graph, topLevel, { ctx } = {}) {
509
557
  const forcing = promiseForcing(graph, { ctx });
510
558
  const definitions = graph.verticesOfType(vertex_1.VertexType.FunctionDefinition).map(([, definition]) => definition.exitPoints);
511
559
  for (const exit of [topLevel, ...definitions].flat()) {
512
560
  for (const cd of exit.cds ?? []) {
513
- if (cd.byPromise === true && forcing(cd.id, exit.nodeId) === logic_1.Ternary.Always) {
561
+ /* a default sits in front of the body in the control flow, but R forces it where the parameter is first read, so the body before that read still runs */
562
+ if (cd.byPromise === true && !isParameterName(cd.id, graph) && forcing(cd.id, exit.nodeId) === logic_1.Ternary.Always && (exit.type !== 4 /* ExitPointType.Error */ || !caughtWhereForced(cd.id, exit.nodeId, graph))) {
514
563
  graph.removeEdgeType(exit.nodeId, cd.id, edge_1.EdgeType.FlowEdge);
515
564
  }
516
565
  }
@@ -12,7 +12,9 @@ export declare enum AmbientAccessKind {
12
12
  /** the state is only assumed changed by a body flowR cannot see, like `#rng` for `function(f) f()` */
13
13
  Assumed = "assumed",
14
14
  /** the code changes the state in the current frame only */
15
- Local = "local"
15
+ Local = "local",
16
+ /** the code ends the state, like `dev.off()` the active device or `sink()` the last diversion */
17
+ Kill = "kills"
16
18
  }
17
19
  /**
18
20
  * What code accesses of the global state, for a single call (see {@link DataflowGraph#ambientAccessOf}) just like for a function or any other part of a program (see {@link Dataflow.sideEffects.ambientAccess}).
@@ -23,6 +25,7 @@ export interface AmbientAccess {
23
25
  readonly [AmbientAccessKind.Write]: Relation<AmbientStateName, NodeId>;
24
26
  readonly [AmbientAccessKind.Assumed]: Relation<AmbientStateName, NodeId>;
25
27
  readonly [AmbientAccessKind.Local]: Relation<AmbientStateName, NodeId>;
28
+ readonly [AmbientAccessKind.Kill]: Relation<AmbientStateName, NodeId>;
26
29
  /** the global variables the functions the code calls may bind, by `x <<- 1` reaching the global frame or `assign("x", 1, envir = .GlobalEnv)`, with the ids of these definitions; the graph does not know them for a single call */
27
30
  readonly variables: Relation<BrandedIdentifier, NodeId>;
28
31
  /** the calls tagged {@link SemanticCallTag.Graphics} (`plot`, `lines`, `par`, ...), which write the canvas only if `semantics.ambient.drawingWritesDevice` is set; the graph does not know them for a single call */
@@ -14,6 +14,8 @@ var AmbientAccessKind;
14
14
  AmbientAccessKind["Assumed"] = "assumed";
15
15
  /** the code changes the state in the current frame only */
16
16
  AmbientAccessKind["Local"] = "local";
17
+ /** the code ends the state, like `dev.off()` the active device or `sink()` the last diversion */
18
+ AmbientAccessKind["Kill"] = "kills";
17
19
  })(AmbientAccessKind || (exports.AmbientAccessKind = AmbientAccessKind = {}));
18
20
  const Kinds = Object.values(AmbientAccessKind);
19
21
  const Empty = {
@@ -21,6 +23,7 @@ const Empty = {
21
23
  [AmbientAccessKind.Write]: relation_1.Relation.empty(),
22
24
  [AmbientAccessKind.Assumed]: relation_1.Relation.empty(),
23
25
  [AmbientAccessKind.Local]: relation_1.Relation.empty(),
26
+ [AmbientAccessKind.Kill]: relation_1.Relation.empty(),
24
27
  variables: relation_1.Relation.empty(),
25
28
  draws: new Set()
26
29
  };
@@ -37,6 +40,7 @@ function concatAll(accesses) {
37
40
  [AmbientAccessKind.Write]: writes,
38
41
  [AmbientAccessKind.Assumed]: relation_1.Relation.withoutKeysOf(union(AmbientAccessKind.Assumed), writes),
39
42
  [AmbientAccessKind.Local]: union(AmbientAccessKind.Local),
43
+ [AmbientAccessKind.Kill]: union(AmbientAccessKind.Kill),
40
44
  variables: relation_1.Relation.unionAll(given.map(a => a.variables)),
41
45
  draws: new Set(given.flatMap(a => [...a.draws]))
42
46
  };
@@ -60,7 +64,8 @@ exports.AmbientAccess = {
60
64
  [AmbientAccessKind.Read]: ofKind(AmbientAccessKind.Read),
61
65
  [AmbientAccessKind.Write]: ofKind(AmbientAccessKind.Write),
62
66
  [AmbientAccessKind.Assumed]: ofKind(AmbientAccessKind.Assumed),
63
- [AmbientAccessKind.Local]: ofKind(AmbientAccessKind.Local)
67
+ [AmbientAccessKind.Local]: ofKind(AmbientAccessKind.Local),
68
+ [AmbientAccessKind.Kill]: ofKind(AmbientAccessKind.Kill)
64
69
  };
65
70
  },
66
71
  /** The state of each kind `access` accesses, without who accesses it. Mind that the order of names is not stable, so use {@link AmbientAccess.equals} to compare them. */
@@ -69,7 +74,8 @@ exports.AmbientAccess = {
69
74
  [AmbientAccessKind.Read]: [...access[AmbientAccessKind.Read].keys()],
70
75
  [AmbientAccessKind.Write]: [...access[AmbientAccessKind.Write].keys()],
71
76
  [AmbientAccessKind.Assumed]: [...access[AmbientAccessKind.Assumed].keys()],
72
- [AmbientAccessKind.Local]: [...access[AmbientAccessKind.Local].keys()]
77
+ [AmbientAccessKind.Local]: [...access[AmbientAccessKind.Local].keys()],
78
+ [AmbientAccessKind.Kill]: [...access[AmbientAccessKind.Kill].keys()]
73
79
  };
74
80
  },
75
81
  /** Whether both access the same state in the same way, no matter by which calls. */
@@ -202,7 +202,7 @@ function boundAround(closure, graph, environment, name) {
202
202
  let frame = made.subflow.environment.current.parent;
203
203
  for (let level = made.subflow.environment.level - 1; level > 0 && frame !== undefined; level--, frame = frame.parent) {
204
204
  /* the body of a function sees the frames around it emptied, standing in for what they bound */
205
- const bound = frame.lookup(name) ?? frame.superMemory?.get(name);
205
+ const bound = frame.boundForSuper(name);
206
206
  if (bound !== undefined) {
207
207
  return bound;
208
208
  }
@@ -40,7 +40,7 @@ export declare class DataflowGraphBuilder<Vertex extends DataflowGraphVertexInfo
40
40
  }, asRoot?: boolean): this;
41
41
  /** automatically adds argument links if they do not already exist */
42
42
  private addArgumentLinks;
43
- /** States that R prints the top-level values `ids` by an implicit `print`, which reads the printing options, or every option for a value a method may print (`dispatched`), see {@link autoPrintReads}. */
43
+ /** States that R prints the top-level values `ids` by an implicit `print`, which reads the printing options, or every option for a value a method may print (`dispatched`), and prints into the diversion of the output, see {@link autoPrintReads}. */
44
44
  autoPrints(ids: readonly NodeId[], dispatched?: boolean): this;
45
45
  /** Adds a **vertex** for a **variable definition** (V4). */
46
46
  defineVariable(id: NodeId, name?: BrandedIdentifier, info?: {
@@ -103,10 +103,10 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
103
103
  }
104
104
  }
105
105
  }
106
- /** States that R prints the top-level values `ids` by an implicit `print`, which reads the printing options, or every option for a value a method may print (`dispatched`), see {@link autoPrintReads}. */
106
+ /** States that R prints the top-level values `ids` by an implicit `print`, which reads the printing options, or every option for a value a method may print (`dispatched`), and prints into the diversion of the output, see {@link autoPrintReads}. */
107
107
  autoPrints(ids, dispatched = false) {
108
108
  for (const id of ids) {
109
- this.recordAmbientAccess(id, { reads: (0, built_in_ambient_state_1.autoPrintReads)(dispatched) });
109
+ this.recordAmbientAccess(id, { reads: (0, built_in_ambient_state_1.autoPrintReads)(dispatched), writes: built_in_ambient_state_1.PrintWrites });
110
110
  }
111
111
  return this;
112
112
  }
@@ -11,6 +11,8 @@ import { type LinkedFunctionResolver } from '../internal/linker';
11
11
  import type { FlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
12
12
  import { type AttachSpec } from '../internal/process/functions/call/built-in/built-in-library';
13
13
  import { type Environment, type REnvironmentInformation } from '../environments/environment';
14
+ import { RFunctionDefinition } from '../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition';
15
+ import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
14
16
  /**
15
17
  * This is the root helper object to work with the {@link DataflowGraph}.
16
18
  * @helper dataflow This is the root helper object to work with the DataflowGraph.
@@ -42,6 +44,8 @@ export declare const Dataflow: {
42
44
  readonly hasEdge: (this: void, graph: DataflowGraph, from: NodeId, to: NodeId, types: EdgeType) => boolean;
43
45
  /** The ids of the function definitions a call is linked to by a {@link EdgeType.Calls} edge (empty if none, e.g. for built-ins). */
44
46
  readonly calleeIdsOf: (this: void, graph: DataflowGraph, call: NodeId) => NodeId[];
47
+ /** The function definitions (as nodes of the normalized AST) a call is linked to by a {@link EdgeType.Calls} edge, see {@link Dataflow.calleeIdsOf}. */
48
+ readonly calleeDefinitionsOf: (this: void, graph: DataflowGraph, call: NodeId) => RFunctionDefinition<ParentInformation>[];
45
49
  /** All known targets of a call, as well as the name sources which define them (empty if there are none). */
46
50
  readonly callTargetsOf: (this: void, call: NodeId, graph: DataflowGraph, environment?: REnvironmentInformation, resolver?: LinkedFunctionResolver) => NodeId[];
47
51
  /** Whether every function the call may run is a built-in or one the program defines, so that what flowR knows about those functions is all there is to know about the call. */
@@ -79,6 +83,8 @@ export declare const Dataflow: {
79
83
  readonly reduceAndInvertGraph: <G extends DataflowGraph>(this: void, graph: G, select: ReadonlySet<NodeId>, cleanEnv: REnvironmentInformation) => G;
80
84
  /** See {@link DataflowGraph#isQuoted}, which this answers for `graph`. */
81
85
  readonly isQuoted: (this: void, id: NodeId, graph: DataflowGraph, withOutgoing?: boolean) => boolean;
86
+ /** Whether the node or one of its AST ancestors is quoted or evaluated elsewhere (`quote(...)`, a data mask), see {@link DataflowGraph#isQuoted}. */
87
+ readonly isWithinQuoted: (this: void, id: NodeId, graph: DataflowGraph) => boolean;
82
88
  /** Given the id of a vertex (usually a variable use), this returns a reachable provenance set by calculating a non-interprocedural and non-context sensitive backward slice, but stopping at the given ids! */
83
89
  readonly provenance: (this: void, id: NodeId, graph: DataflowGraph, consider?: ReadonlySet<NodeId>, followEdges?: number | undefined) => Set<NodeId>;
84
90
  /** A simple visitor akin to {@link RNode.visitAst} to traverse the dataflow graph starting from the start id and only respecting edge direction. */
@@ -24,6 +24,7 @@ const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-fun
24
24
  const attached_packages_1 = require("../../project/attached-packages");
25
25
  const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
26
26
  const r_binary_op_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
27
+ const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
27
28
  /**
28
29
  * This is the root helper object to work with the {@link DataflowGraph}.
29
30
  * @helper dataflow This is the root helper object to work with the DataflowGraph.
@@ -109,6 +110,10 @@ exports.Dataflow = {
109
110
  calleeIdsOf(graph, call) {
110
111
  return exports.Dataflow.targetsOf(graph, call, edge_1.EdgeType.Calls).filter(t => vertex_1.DfgVertex.isFunctionDefinition(graph.getVertex(t)));
111
112
  },
113
+ /** The function definitions (as nodes of the normalized AST) a call is linked to by a {@link EdgeType.Calls} edge, see {@link Dataflow.calleeIdsOf}. */
114
+ calleeDefinitionsOf(graph, call) {
115
+ return exports.Dataflow.calleeIdsOf(graph, call).map(id => graph.idMap?.get(id)).filter(r_function_definition_1.RFunctionDefinition.is);
116
+ },
112
117
  /** All known targets of a call, as well as the name sources which define them (empty if there are none). */
113
118
  callTargetsOf(call, graph, environment, resolver) {
114
119
  return (0, linker_1.getAllFunctionCallTargets)(call, graph, environment, resolver);
@@ -289,6 +294,16 @@ exports.Dataflow = {
289
294
  isQuoted(id, graph, withOutgoing = false) {
290
295
  return graph.isQuoted(id, withOutgoing);
291
296
  },
297
+ /** Whether the node or one of its AST ancestors is quoted or evaluated elsewhere (`quote(...)`, a data mask), see {@link DataflowGraph#isQuoted}. */
298
+ isWithinQuoted(id, graph) {
299
+ const idMap = graph.idMap;
300
+ for (let cur = idMap?.get(id); cur !== undefined; cur = cur.info.parent === undefined ? undefined : idMap?.get(cur.info.parent)) {
301
+ if (graph.isQuoted(cur.info.id)) {
302
+ return true;
303
+ }
304
+ }
305
+ return false;
306
+ },
292
307
  /** Given the id of a vertex (usually a variable use), this returns a reachable provenance set by calculating a non-interprocedural and non-context sensitive backward slice, but stopping at the given ids! */
293
308
  provenance(id, graph, consider, followEdges = edge_1.EdgeType.Calls | edge_1.EdgeType.Reads | edge_1.EdgeType.Returns | edge_1.EdgeType.Argument | edge_1.EdgeType.DefinedBy | edge_1.EdgeType.DefinedByOnCall) {
294
309
  return exports.Dataflow.reachable(graph, id, { follow: followEdges, consider, cds: true });
@@ -160,13 +160,19 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
160
160
  private resolveInto;
161
161
  /** set by a `consume` merge, see {@link DataflowGraph#mergeWith|mergeWith()}; the graph must not change after that */
162
162
  private consumed;
163
- /** how many {@link DataflowGraph#sharingTargetWalks} are running, the shared walks are dropped once none is */
164
- private walkSharers;
163
+ /** how many {@link DataflowGraph#withoutSharedTargetWalks} are running */
164
+ private walkLoners;
165
+ /**
166
+ * The walks for call targets ({@link Dataflow.callTargetsOf}) done so far, which every later one builds on until the graph
167
+ * changes (see {@link DataflowGraph#dropQualifications}): resolving the calls one by one would walk the same reads again for each.
168
+ */
165
169
  private targetWalks?;
166
- /** Runs `fn`, sharing the walks for call targets ({@link Dataflow.callTargetsOf}) between all the calls it asks about, as long as the graph does not change. */
167
- sharingTargetWalks<T>(fn: () => T): T;
168
- private stopSharingTargetWalks;
169
- /** The walks shared while {@link DataflowGraph#sharingTargetWalks} runs, made by `create` on demand, else `undefined`. */
170
+ /**
171
+ * Runs `fn` with each walk for call targets on its own: code that changes the graph after nearly every call it asks about
172
+ * (as linking calls does) would only start the shared walks anew each time, which costs more than walking alone.
173
+ */
174
+ withoutSharedTargetWalks<T>(fn: () => T): T;
175
+ /** The walks shared until the graph changes, made by `create` on demand, `undefined` within {@link DataflowGraph#withoutSharedTargetWalks}. */
170
176
  sharedTargetWalks(create: (graph: this) => LinkedFunctionResolver): LinkedFunctionResolver | undefined;
171
177
  /** Drops the cached qualifications, as the graph may no longer imply them. Every mutator runs through here, so the guard covers them all. */
172
178
  private dropQualifications;
@@ -234,13 +234,11 @@ class DataflowGraph {
234
234
  if (cache.complete) {
235
235
  return wanted;
236
236
  }
237
- this.sharingTargetWalks(() => {
238
- for (const id of this.types.get(vertex_1.VertexType.FunctionCall) ?? []) {
239
- if (!wanted.has(id)) {
240
- this.resolveInto(cache, id, this.vertexInformation.get(id), resolve);
241
- }
237
+ for (const id of this.types.get(vertex_1.VertexType.FunctionCall) ?? []) {
238
+ if (!wanted.has(id)) {
239
+ this.resolveInto(cache, id, this.vertexInformation.get(id), resolve);
242
240
  }
243
- });
241
+ }
244
242
  cache.complete = true;
245
243
  return wanted;
246
244
  }
@@ -255,34 +253,29 @@ class DataflowGraph {
255
253
  }
256
254
  /** set by a `consume` merge, see {@link DataflowGraph#mergeWith|mergeWith()}; the graph must not change after that */
257
255
  consumed = false;
258
- /** how many {@link DataflowGraph#sharingTargetWalks} are running, the shared walks are dropped once none is */
259
- walkSharers = 0;
256
+ /** how many {@link DataflowGraph#withoutSharedTargetWalks} are running */
257
+ walkLoners = 0;
258
+ /**
259
+ * The walks for call targets ({@link Dataflow.callTargetsOf}) done so far, which every later one builds on until the graph
260
+ * changes (see {@link DataflowGraph#dropQualifications}): resolving the calls one by one would walk the same reads again for each.
261
+ */
260
262
  targetWalks;
261
- /** Runs `fn`, sharing the walks for call targets ({@link Dataflow.callTargetsOf}) between all the calls it asks about, as long as the graph does not change. */
262
- sharingTargetWalks(fn) {
263
- this.walkSharers++;
264
- let result;
263
+ /**
264
+ * Runs `fn` with each walk for call targets on its own: code that changes the graph after nearly every call it asks about
265
+ * (as linking calls does) would only start the shared walks anew each time, which costs more than walking alone.
266
+ */
267
+ withoutSharedTargetWalks(fn) {
268
+ this.walkLoners++;
265
269
  try {
266
- result = fn();
267
- }
268
- catch (e) {
269
- this.stopSharingTargetWalks();
270
- throw e;
270
+ return fn();
271
271
  }
272
- if (result instanceof Promise) {
273
- return result.finally(() => this.stopSharingTargetWalks());
274
- }
275
- this.stopSharingTargetWalks();
276
- return result;
277
- }
278
- stopSharingTargetWalks() {
279
- if (--this.walkSharers === 0) {
280
- this.targetWalks = undefined;
272
+ finally {
273
+ this.walkLoners--;
281
274
  }
282
275
  }
283
- /** The walks shared while {@link DataflowGraph#sharingTargetWalks} runs, made by `create` on demand, else `undefined`. */
276
+ /** The walks shared until the graph changes, made by `create` on demand, `undefined` within {@link DataflowGraph#withoutSharedTargetWalks}. */
284
277
  sharedTargetWalks(create) {
285
- return this.walkSharers === 0 ? undefined : this.targetWalks ??= create(this);
278
+ return this.walkLoners > 0 ? undefined : this.targetWalks ??= create(this);
286
279
  }
287
280
  /** Drops the cached qualifications, as the graph may no longer imply them. Every mutator runs through here, so the guard covers them all. */
288
281
  dropQualifications() {
@@ -119,7 +119,8 @@ export type KillReference =
119
119
  | {
120
120
  readonly kind: 'all';
121
121
  readonly cds?: readonly ControlDependency[];
122
- readonly except?: ReadonlySet<BrandedIdentifier>;
122
+ readonly except?: ReadonlySet<BrandedIdentifier>; /** the call performing the removal */
123
+ readonly killedBy?: NodeId;
123
124
  }
124
125
  /** a not statically resolvable set of names, e.g., `rm(list = someVector)` */
125
126
  | {
package/dataflow/info.js CHANGED
@@ -95,9 +95,11 @@ function leaveThrough(exit, rootId) {
95
95
  * Adds all non-default exit points to the existing list and updates the `invertExitCds` accordingly.
96
96
  */
97
97
  function addNonDefaultExitPoints(existing, invertExitCds, activeCds, add) {
98
+ /* an exit that follows a conditional one (`if(c) return(1); stop()`) only happens if the earlier one did not */
99
+ const notEarlier = invertExitCds.slice();
98
100
  for (const ep of add) {
99
101
  if (ep.type !== 0 /* ExitPointType.Default */) {
100
- existing.push(ep);
102
+ existing.push(notEarlier.length > 0 ? { ...ep, cds: withCds(ep.cds ?? activeCds, notEarlier) } : ep);
101
103
  const ownCds = exports.ControlDependency.minus(ep.cds ?? [], activeCds ?? []);
102
104
  appendCds(invertExitCds, ownCds.map(negateControlDependency));
103
105
  }
@@ -7,7 +7,7 @@ import { RNode } from '../../r-bridge/lang-4.x/ast/model/model';
7
7
  import type { FlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
8
8
  import { type ClassFlowInfo } from '../fn/dispatch';
9
9
  import type { REnvironmentInformation } from '../environments/environment';
10
- import { type BrandedIdentifier, type IdentifierDefinition } from '../environments/identifier';
10
+ import { type BrandedIdentifier, type IdentifierDefinition, type ClassName } from '../environments/identifier';
11
11
  /** The methods each method hands on to with `NextMethod()`, in the order they run. */
12
12
  export type NextMethods = ReadonlyMap<NodeId, readonly NodeId[]>;
13
13
  /** What the dispatch of one call rules out, and what the next-method calls of the methods it runs may run. */
@@ -61,6 +61,8 @@ export declare class DispatchNarrower {
61
61
  export declare function callsNextMethod(fn: NodeId, graph: DataflowGraph): boolean;
62
62
  /** Whether every run of `call` comes after the top-level `statement`, which runs once: `call` runs once after it, or it is in a function that only calls by name run, each of which only after the statement. */
63
63
  export declare function runsOnlyAfter(call: NodeId, statement: RNode<ParentInformation>, graph: DataflowGraph, depth?: number): boolean;
64
+ /** The class the function `fn` is the S3 method of, for one of the generics `prefixes`, `undefined` unless every name it is bound to says the same. */
65
+ export declare function s3ClassOfMethod(fn: NodeId, prefixes: readonly BrandedIdentifier[], graph: DataflowGraph): ClassName | undefined;
64
66
  /** The function definitions the definitions or reads `ids` lead to. */
65
67
  export declare function linkedFunctionIds(ids: ReadonlySet<NodeId>, graph: DataflowGraph): NodeId[];
66
68
  /** The methods `environment` binds for the generics a built-in dispatches to on its own (see `dispatches` of a built-in): every `<generic>.<class>` and every function `setMethod` registers for one, whatever the class, as it may be that of a part. */
@@ -4,6 +4,7 @@ exports.DispatchNarrower = exports.MaxContextDepth = void 0;
4
4
  exports.ruledOutPerCall = ruledOutPerCall;
5
5
  exports.callsNextMethod = callsNextMethod;
6
6
  exports.runsOnlyAfter = runsOnlyAfter;
7
+ exports.s3ClassOfMethod = s3ClassOfMethod;
7
8
  exports.linkedFunctionIds = linkedFunctionIds;
8
9
  exports.internalGenericMethods = internalGenericMethods;
9
10
  exports.methodOnlyEdges = methodOnlyEdges;
@@ -20,6 +20,8 @@ export declare function linkInstanceReads(graph: DataflowGraph, info: DataflowGr
20
20
  export declare function readsOfUncalledClosures(fn: NodeId, subflow: DataflowFunctionFlowInformation, graph: DataflowGraph, idMap: AstIdMap): (read: NodeId) => boolean;
21
21
  /** Links a function call with a single target function definition. */
22
22
  export declare function linkFunctionCallWithSingleTarget(graph: DataflowGraph, { subflow: fnSubflow, exitPoints, id: fnId, params, envOps }: DataflowGraphVertexFunctionDefinition, info: DataflowGraphVertexFunctionCall, idMap: AstIdMap): ExitPoint[];
23
+ /** Whether an error raised by the call `from` still leaves the expression it is written in (the whole program for `undefined`): redoes what a `stop` written at that spot would have done, since we only learn a callee always throws after linking it here. */
24
+ export declare function errorEscapes(from: NodeId, expression: NodeId | undefined, idMap: AstIdMap, graph: DataflowGraph): boolean;
23
25
  /** What {@link linkFunctionCalls} reports for a call it linked. */
24
26
  export type CalledFunctions = {
25
27
  functionCall: NodeId;