@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,17 +1,28 @@
1
1
  import type { BrandedNamespace } from '../../../dataflow/environments/identifier';
2
- import { type BaseQueryFormat, type BaseQueryResult } from '../../base-query-format';
2
+ import { type BasicQueryData, type BaseQueryFormat, type BaseQueryResult } from '../../base-query-format';
3
3
  import type { PipelineOutput } from '../../../core/steps/pipeline/pipeline';
4
4
  import type { DEFAULT_DATAFLOW_PIPELINE, DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE, DEFAULT_SLICING_PIPELINE } from '../../../core/steps/pipeline/default-pipelines';
5
5
  import type { SlicingCriteria } from '../../../slicing/criterion/parse';
6
6
  import type { ParsedQueryLine } from '../../query';
7
7
  import Joi from 'joi';
8
- import { executeStaticSliceQuery } from './static-slice-query-executor';
9
8
  import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
10
9
  import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
11
10
  import type { FlowrConfig } from '../../../config';
12
11
  import { criteriaQueryCompleter } from '../../../cli/repl/parser/slice-query-parser';
13
12
  import { type SliceQueryOptions } from '../slice-query-options';
14
13
  import { SliceDirection } from '../../../util/slice-direction';
14
+ /**
15
+ * The key a static slice query's result is reported under: the {@link SliceQueryOptions#name|name} it was given,
16
+ * else what it slices. Within a request use {@link sliceResultKeys}, which settles two queries wanting one key.
17
+ */
18
+ export declare function fingerPrintOfQuery(query: StaticSliceQuery): string;
19
+ /**
20
+ * Execute static slice queries, catching duplicates with the same fingerprint
21
+ * @param analyzer - The basic query data containing the analyzer
22
+ * @param queries - The static slice queries to execute
23
+ * @returns The results of the static slice queries
24
+ */
25
+ export declare function executeStaticSliceQuery({ analyzer }: BasicQueryData, queries: readonly StaticSliceQuery[]): Promise<StaticSliceQueryResult>;
15
26
  /** Calculates and returns the static backward or forward slice from the given criteria */
16
27
  export interface StaticSliceQuery extends BaseQueryFormat, SliceQueryOptions {
17
28
  readonly type: 'static-slice';
@@ -4,12 +4,65 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.StaticSliceQueryDefinition = void 0;
7
+ exports.fingerPrintOfQuery = fingerPrintOfQuery;
8
+ exports.executeStaticSliceQuery = executeStaticSliceQuery;
7
9
  const base_query_format_1 = require("../../base-query-format");
8
10
  const joi_1 = __importDefault(require("joi"));
9
- const static_slice_query_executor_1 = require("./static-slice-query-executor");
10
11
  const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parser");
11
12
  const slice_query_options_1 = require("../slice-query-options");
12
13
  const slice_direction_1 = require("../../../util/slice-direction");
14
+ const static_slicer_1 = require("../../../slicing/static/static-slicer");
15
+ const log_1 = require("../../../util/log");
16
+ const query_meta_1 = require("../../query-meta");
17
+ const df_helper_1 = require("../../../dataflow/graph/df-helper");
18
+ const removal_slice_1 = require("../../../slicing/static/removal-slice");
19
+ /** what a static slice is of, which is what its result is keyed by when it was given no name */
20
+ const slicedBy = (query) => query.criteria.join(',');
21
+ /**
22
+ * The key a static slice query's result is reported under: the {@link SliceQueryOptions#name|name} it was given,
23
+ * else what it slices. Within a request use {@link sliceResultKeys}, which settles two queries wanting one key.
24
+ */
25
+ function fingerPrintOfQuery(query) {
26
+ return (0, slice_query_options_1.sliceResultKey)(query, slicedBy);
27
+ }
28
+ /**
29
+ * Execute static slice queries, catching duplicates with the same fingerprint
30
+ * @param analyzer - The basic query data containing the analyzer
31
+ * @param queries - The static slice queries to execute
32
+ * @returns The results of the static slice queries
33
+ */
34
+ async function executeStaticSliceQuery({ analyzer }, queries) {
35
+ const start = Date.now();
36
+ const results = {};
37
+ const keys = (0, slice_query_options_1.sliceResultKeys)(queries, slicedBy);
38
+ for (const [at, query] of queries.entries()) {
39
+ const key = keys[at];
40
+ if (results[key]) {
41
+ log_1.log.warn(`Duplicate Key for slicing-query: ${key}, skipping...`);
42
+ }
43
+ const { criteria, includeCallees } = query;
44
+ const sliceStart = Date.now();
45
+ const n = await analyzer.normalize();
46
+ const df = await analyzer.dataflow();
47
+ const ids = (0, slice_query_options_1.resolveSliceCriteria)(criteria, n);
48
+ const threshold = analyzer.flowrConfig.solver.slicer?.threshold;
49
+ if (query.removal) {
50
+ /* the plots, devices and saves the dependencies state are what a removed plot takes along */
51
+ const dependencies = await analyzer.query({ type: 'dependencies' });
52
+ const removed = (0, removal_slice_1.staticRemovalSlice)(analyzer.inspectContext(), df, n, ids, Object.values(dependencies).filter(Array.isArray).flat(), threshold).result;
53
+ const kept = (0, removal_slice_1.keptAfterRemoval)(n, removed);
54
+ results[key] = (0, slice_query_options_1.timedSliceEntry)(query, { timesHitThreshold: 0, result: removed, slicedFor: ids }, Date.now() - sliceStart, () => (0, slice_query_options_1.reconstructSlice)(n, df.graph, kept, query));
55
+ continue;
56
+ }
57
+ const slice = (0, static_slicer_1.staticSlice)({ ctx: analyzer.inspectContext(), info: df, ast: n, ids, direction: query.direction ?? slice_direction_1.SliceDirection.Backward, threshold, includeCallees });
58
+ const packages = query.reportPackages ? [...df_helper_1.Dataflow.packagesOf(slice.result, df.graph)] : undefined;
59
+ results[key] = { packages, ...(0, slice_query_options_1.timedSliceEntry)(query, slice, Date.now() - sliceStart, () => (0, slice_query_options_1.reconstructSlice)(n, df.graph, slice.result, query)) };
60
+ }
61
+ return {
62
+ ...(0, query_meta_1.metaSince)(start),
63
+ results
64
+ };
65
+ }
13
66
  const SliceCriterionHelp = [
14
67
  'Each criterion picks one element of the program, separate multiple ones with ";":',
15
68
  ' <line>@<name> <name> in line <line>, preferring a call over the symbol (e.g. 2@x)',
@@ -42,7 +95,7 @@ function sliceQueryLineParser(output, line, _config) {
42
95
  }
43
96
  exports.StaticSliceQueryDefinition = {
44
97
  title: 'Static Slice Query',
45
- executor: static_slice_query_executor_1.executeStaticSliceQuery,
98
+ executor: executeStaticSliceQuery,
46
99
  perQueryResults: true,
47
100
  asciiSummarizer: (formatter, _analyzer, queryResults, result) => (0, slice_query_options_1.summarizeSliceResults)(formatter, 'static-slice', queryResults, result, (key, q) => `Slice ${q === undefined ? `"${key}"` : `for {${q.criteria.join(', ')}}`}`),
48
101
  fromLine: sliceQueryLineParser,
@@ -1,12 +1,15 @@
1
- import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
1
+ import type { BaseQueryFormat, BaseQueryResult, BasicQueryData } from '../../base-query-format';
2
2
  import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
3
3
  import type { FlowrConfig } from '../../../config';
4
4
  import type { ParsedQueryLine } from '../../query';
5
5
  import Joi from 'joi';
6
- import { executeTaintQuery } from './taint-query-executor';
7
- import type { AnyPredefinedTaintAnalysisName } from '../../../taint-analysis/predefined/predefined';
6
+ import type { AnyPredefinedTaintAnalysisName, AllPredefinedTaintAnalysisNames } from '../../../taint-analysis/predefined/predefined';
8
7
  import type { CommandCompletions } from '../../../cli/repl/completion';
9
8
  import type { TaintInferenceResult } from '../../../taint-analysis/builder/taint-analysis';
9
+ /**
10
+ * Executes the given taint queries using the provided analyzer.
11
+ */
12
+ export declare function executeTaintQuery({ analyzer }: BasicQueryData, queries: readonly TaintQuery[]): Promise<TaintQueryResult<AllPredefinedTaintAnalysisNames>>;
10
13
  export interface TaintQuery extends BaseQueryFormat {
11
14
  readonly type: 'taint';
12
15
  readonly defs: AnyPredefinedTaintAnalysisName[];
@@ -4,13 +4,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.TaintQueryDefinition = void 0;
7
+ exports.executeTaintQuery = executeTaintQuery;
7
8
  const joi_1 = __importDefault(require("joi"));
8
- const taint_query_executor_1 = require("./taint-query-executor");
9
9
  const predefined_1 = require("../../../taint-analysis/predefined/predefined");
10
10
  const lattice_1 = require("../../../abstract-interpretation/domains/lattice");
11
11
  const ansi_1 = require("../../../util/text/ansi");
12
12
  const time_1 = require("../../../util/text/time");
13
13
  const retriever_1 = require("../../../r-bridge/retriever");
14
+ const log_1 = require("../../../util/log");
15
+ /**
16
+ * Executes the given taint queries using the provided analyzer.
17
+ */
18
+ async function executeTaintQuery({ analyzer }, queries) {
19
+ const flattened = queries.flatMap(q => q.defs);
20
+ const start = Date.now();
21
+ if (flattened.length === 0) {
22
+ log_1.log.warn('Missing taint query definition');
23
+ return {
24
+ results: new Map(),
25
+ '.meta': {
26
+ timing: Date.now() - start
27
+ },
28
+ };
29
+ }
30
+ const analysis = analyzer
31
+ .taint()
32
+ .addPredefined(...flattened);
33
+ return {
34
+ results: await analysis.run(),
35
+ '.meta': {
36
+ timing: Date.now() - start
37
+ },
38
+ };
39
+ }
14
40
  const prefix = 'definitions:';
15
41
  function taintQueryCompleter(line, startingNewArg, _config) {
16
42
  const prefixNotPresent = line.length == 0 || (line.length == 1 && line[0].length < prefix.length);
@@ -77,7 +103,7 @@ function taintQueryLineParser(output, line, _config) {
77
103
  }
78
104
  exports.TaintQueryDefinition = {
79
105
  title: 'Taint Analysis Query',
80
- executor: taint_query_executor_1.executeTaintQuery,
106
+ executor: executeTaintQuery,
81
107
  asciiSummarizer: (formatter, _analyzer, queryResults, resultStrings) => {
82
108
  const out = queryResults;
83
109
  const state = out.results.entries().toArray();
@@ -33,6 +33,7 @@ import type { CallGraphQuery } from './catalog/call-graph-query/call-graph-query
33
33
  import { type AmbientAccessQuery } from './catalog/ambient-access-query/ambient-access-query-format';
34
34
  import type { InspectRecursionQuery } from './catalog/inspect-recursion-query/inspect-recursion-query-format';
35
35
  import type { InspectFnPropsQuery } from './catalog/inspect-fn-props-query/inspect-fn-props-query-format';
36
+ import type { InspectFnGuardsQuery } from './catalog/inspect-fn-guards-query/inspect-fn-guards-query-format';
36
37
  import type { DoesCallQuery } from './catalog/does-call-query/does-call-query-format';
37
38
  import type { InspectExceptionQuery } from './catalog/inspect-exceptions-query/inspect-exception-query-format';
38
39
  import type { InputSourcesQuery } from './catalog/input-sources-query/input-sources-query-format';
@@ -43,11 +44,12 @@ import { type DiceQuery } from './catalog/dice-query/dice-query-format';
43
44
  import { type GuessDepVersionsQuery } from './catalog/guess-dep-versions-query/guess-dep-versions-query-format';
44
45
  import { type AbsintQuery } from './catalog/absint-query/absint-query-format';
45
46
  import { type CodeClonesQuery } from './catalog/code-clones-query/code-clones-query-format';
47
+ import { type DataColumnsQuery } from './catalog/data-columns-query/data-columns-query-format';
46
48
  import { type FunctionInfoQuery } from './catalog/function-info-query/function-info-query-format';
47
49
  /**
48
50
  * These are all queries that can be executed from within flowR
49
51
  */
50
- export type Query = CallContextQuery | ConfigQuery | SearchQuery | DataflowQuery | DoesCallQuery | CallGraphQuery | ControlFlowQuery | DataflowLensQuery | FilesQuery | AbsintQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | DependenciesQuery | LocationMapQuery | HappensBeforeQuery | InspectExceptionQuery | InspectHigherOrderQuery | InspectRecursionQuery | InspectFnPropsQuery | AmbientAccessQuery | ResolveValueQuery | ProjectQuery | SignatureQuery | OriginQuery | LinterQuery | ProvenanceQuery | InputSourcesQuery | TaintQuery | DiceQuery | GuessDepVersionsQuery | FunctionInfoQuery | CodeClonesQuery;
52
+ export type Query = CallContextQuery | ConfigQuery | SearchQuery | DataflowQuery | DoesCallQuery | CallGraphQuery | ControlFlowQuery | DataflowLensQuery | FilesQuery | AbsintQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | DependenciesQuery | LocationMapQuery | HappensBeforeQuery | InspectExceptionQuery | InspectHigherOrderQuery | InspectRecursionQuery | InspectFnPropsQuery | InspectFnGuardsQuery | AmbientAccessQuery | ResolveValueQuery | ProjectQuery | SignatureQuery | OriginQuery | LinterQuery | ProvenanceQuery | InputSourcesQuery | TaintQuery | DiceQuery | GuessDepVersionsQuery | FunctionInfoQuery | CodeClonesQuery | DataColumnsQuery;
51
53
  export type QueryArgumentsWithType<QueryType extends BaseQueryFormat['type']> = Query & {
52
54
  type: QueryType;
53
55
  };
@@ -97,7 +99,7 @@ export declare const SupportedQueries: {
97
99
  readonly config: {
98
100
  readonly title: "Config Query";
99
101
  readonly syntax: "@config [<path> | <glob>] | @config +<path>=<value> | @config +reset";
100
- readonly executor: typeof import("./catalog/config-query/config-query-executor").executeConfigQuery;
102
+ readonly executor: typeof import("./catalog/config-query/config-query-format").executeConfigQuery;
101
103
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: unknown, queryResults: BaseQueryResult, result: string[], queries: readonly Query[]) => true;
102
104
  readonly completer: (partialLine: readonly string[], startingNewArg: boolean, _config: FlowrConfig) => CommandCompletions;
103
105
  readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"config">;
@@ -105,7 +107,7 @@ export declare const SupportedQueries: {
105
107
  };
106
108
  readonly 'control-flow': {
107
109
  readonly title: "Control-Flow Query";
108
- readonly executor: typeof import("./catalog/control-flow-query/control-flow-query-executor").executeControlFlowQuery;
110
+ readonly executor: typeof import("./catalog/control-flow-query/control-flow-query-format").executeControlFlowQuery;
109
111
  readonly asciiSummarizer: (formatter: OutputFormatter, analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
110
112
  readonly schema: Joi.ObjectSchema<any>;
111
113
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
@@ -119,14 +121,14 @@ export declare const SupportedQueries: {
119
121
  };
120
122
  readonly dataflow: {
121
123
  readonly title: "Dataflow Query";
122
- readonly executor: typeof import("./catalog/dataflow-query/dataflow-query-executor").executeDataflowQuery;
124
+ readonly executor: typeof import("./catalog/dataflow-query/dataflow-query-format").executeDataflowQuery;
123
125
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
124
126
  readonly schema: Joi.ObjectSchema<any>;
125
127
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
126
128
  };
127
129
  readonly 'does-call': {
128
130
  readonly title: "Does-Call Query";
129
- readonly executor: typeof import("./catalog/does-call-query/does-call-query-executor").executeDoesCallQuery;
131
+ readonly executor: typeof import("./catalog/does-call-query/does-call-query-format").executeDoesCallQuery;
130
132
  readonly perQueryResults: true;
131
133
  readonly asciiSummarizer: (formatter: OutputFormatter, processed: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
132
134
  readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"does-call">;
@@ -136,13 +138,13 @@ export declare const SupportedQueries: {
136
138
  };
137
139
  readonly 'dataflow-lens': {
138
140
  readonly title: "Dataflow Lens Query";
139
- readonly executor: typeof import("./catalog/dataflow-lens-query/dataflow-lens-query-executor").executeDataflowLensQuery;
141
+ readonly executor: typeof import("./catalog/dataflow-lens-query/dataflow-lens-query-format").executeDataflowLensQuery;
140
142
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
141
143
  readonly schema: Joi.ObjectSchema<any>;
142
144
  };
143
145
  readonly absint: {
144
146
  readonly title: "Abstract Interpretation Query";
145
- readonly executor: typeof import("./catalog/absint-query/absint-query-executor").executeAbsintQuery;
147
+ readonly executor: typeof import("./catalog/absint-query/absint-query-format").executeAbsintQuery;
146
148
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
147
149
  readonly jsonFormatter: (queryResults: BaseQueryResult) => object;
148
150
  readonly completer: (line: readonly string[], startingNewArg: boolean, _config: FlowrConfig) => CommandCompletions;
@@ -153,7 +155,7 @@ export declare const SupportedQueries: {
153
155
  };
154
156
  readonly taint: {
155
157
  readonly title: "Taint Analysis Query";
156
- readonly executor: typeof import("./catalog/taint-query/taint-query-executor").executeTaintQuery;
158
+ readonly executor: typeof import("./catalog/taint-query/taint-query-format").executeTaintQuery;
157
159
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, resultStrings: string[]) => true;
158
160
  readonly jsonFormatter: (queryResults: BaseQueryResult) => object;
159
161
  readonly completer: (line: readonly string[], startingNewArg: boolean, _config: FlowrConfig) => CommandCompletions;
@@ -163,7 +165,7 @@ export declare const SupportedQueries: {
163
165
  };
164
166
  readonly files: {
165
167
  readonly title: "Files Query";
166
- readonly executor: typeof import("./catalog/files-query/files-query-executor").executeFileQuery;
168
+ readonly executor: typeof import("./catalog/files-query/files-query-format").executeFileQuery;
167
169
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
168
170
  readonly completer: (line: readonly string[], startingNewArg: boolean, _config: FlowrConfig) => CommandCompletions;
169
171
  readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"files">;
@@ -173,26 +175,26 @@ export declare const SupportedQueries: {
173
175
  };
174
176
  readonly 'id-map': {
175
177
  readonly title: "Id-Map Query";
176
- readonly executor: typeof import("./catalog/id-map-query/id-map-query-executor").executeIdMapQuery;
178
+ readonly executor: typeof import("./catalog/id-map-query/id-map-query-format").executeIdMapQuery;
177
179
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
178
180
  readonly schema: Joi.ObjectSchema<any>;
179
181
  };
180
182
  readonly 'normalized-ast': {
181
183
  readonly title: "Normalized AST Query";
182
- readonly executor: typeof import("./catalog/normalized-ast-query/normalized-ast-query-executor").executeNormalizedAstQuery;
184
+ readonly executor: typeof import("./catalog/normalized-ast-query/normalized-ast-query-format").executeNormalizedAstQuery;
183
185
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
184
186
  readonly schema: Joi.ObjectSchema<any>;
185
187
  };
186
188
  readonly 'dataflow-cluster': {
187
189
  readonly title: "Dataflow Cluster Query";
188
- readonly executor: typeof import("./catalog/cluster-query/cluster-query-executor").executeDataflowClusterQuery;
190
+ readonly executor: typeof import("./catalog/cluster-query/cluster-query-format").executeDataflowClusterQuery;
189
191
  readonly asciiSummarizer: (formatter: OutputFormatter, analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
190
192
  readonly schema: Joi.ObjectSchema<any>;
191
193
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
192
194
  };
193
195
  readonly 'static-slice': {
194
196
  readonly title: "Static Slice Query";
195
- readonly executor: typeof import("./catalog/static-slice-query/static-slice-query-executor").executeStaticSliceQuery;
197
+ readonly executor: typeof import("./catalog/static-slice-query/static-slice-query-format").executeStaticSliceQuery;
196
198
  readonly perQueryResults: true;
197
199
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => boolean;
198
200
  readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"static-slice">;
@@ -203,7 +205,7 @@ export declare const SupportedQueries: {
203
205
  };
204
206
  readonly provenance: {
205
207
  readonly title: "Provenance Query";
206
- readonly executor: typeof import("./catalog/provenance-query/provenance-query-executor").executeProvenanceQuery;
208
+ readonly executor: typeof import("./catalog/provenance-query/provenance-query-format").executeProvenanceQuery;
207
209
  readonly perQueryResults: true;
208
210
  readonly asciiSummarizer: (formatter: OutputFormatter, analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
209
211
  readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"provenance">;
@@ -234,7 +236,7 @@ export declare const SupportedQueries: {
234
236
  };
235
237
  readonly 'location-map': {
236
238
  readonly title: "Location Map Query";
237
- readonly executor: typeof import("./catalog/location-map-query/location-map-query-executor").executeLocationMapQuery;
239
+ readonly executor: typeof import("./catalog/location-map-query/location-map-query-format").executeLocationMapQuery;
238
240
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: unknown, queryResults: BaseQueryResult, result: string[]) => true;
239
241
  readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"location-map">;
240
242
  readonly completer: typeof import("../cli/repl/parser/slice-query-parser").criteriaQueryCompleter;
@@ -243,21 +245,21 @@ export declare const SupportedQueries: {
243
245
  };
244
246
  readonly search: {
245
247
  readonly title: "Search Query";
246
- readonly executor: typeof import("./catalog/search-query/search-query-executor").executeSearch;
248
+ readonly executor: typeof import("./catalog/search-query/search-query-format").executeSearch;
247
249
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
248
250
  readonly schema: Joi.ObjectSchema<any>;
249
251
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
250
252
  };
251
253
  readonly 'happens-before': {
252
254
  readonly title: "Happens-Before Query";
253
- readonly executor: typeof import("./catalog/happens-before-query/happens-before-query-executor").executeHappensBefore;
255
+ readonly executor: typeof import("./catalog/happens-before-query/happens-before-query-format").executeHappensBefore;
254
256
  readonly perQueryResults: true;
255
257
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
256
258
  readonly schema: Joi.ObjectSchema<any>;
257
259
  };
258
260
  readonly 'inspect-exception': {
259
261
  readonly title: "Inspect Exceptions of Functions Query";
260
- readonly executor: typeof import("./catalog/inspect-exceptions-query/inspect-exception-query-executor").executeExceptionQuery;
262
+ readonly executor: typeof import("./catalog/inspect-exceptions-query/inspect-exception-query-format").executeExceptionQuery;
261
263
  readonly asciiSummarizer: (formatter: OutputFormatter, processed: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
262
264
  readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"inspect-exception">;
263
265
  readonly completer: typeof import("../cli/repl/parser/slice-query-parser").criteriaQueryCompleter;
@@ -287,16 +289,25 @@ export declare const SupportedQueries: {
287
289
  };
288
290
  readonly 'inspect-fn-props': {
289
291
  readonly title: "Inspect Argument Roles Query";
290
- readonly executor: typeof import("./catalog/inspect-fn-props-query/inspect-fn-props-query-executor").executeFnPropsQuery;
292
+ readonly executor: typeof import("./catalog/inspect-fn-props-query/inspect-fn-props-query-format").executeFnPropsQuery;
291
293
  readonly asciiSummarizer: (formatter: OutputFormatter, processed: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
292
294
  readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"inspect-fn-props">;
293
295
  readonly syntax: "@inspect-fn-props [(<crit>;...)] <code | file://path>";
294
296
  readonly schema: Joi.ObjectSchema<any>;
295
297
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
296
298
  };
299
+ readonly 'inspect-fn-guards': {
300
+ readonly title: "Inspect Function Guards Query";
301
+ readonly executor: typeof import("./catalog/inspect-fn-guards-query/inspect-fn-guards-query-format").executeFnGuardsQuery;
302
+ readonly asciiSummarizer: (formatter: OutputFormatter, processed: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
303
+ readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"inspect-fn-guards">;
304
+ readonly syntax: "@inspect-fn-guards [(<crit>;...)] <code | file://path>";
305
+ readonly schema: Joi.ObjectSchema<any>;
306
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
307
+ };
297
308
  readonly 'ambient-access': {
298
309
  readonly title: "Ambient Access Query";
299
- readonly executor: typeof import("./catalog/ambient-access-query/ambient-access-query-executor").executeAmbientAccessQuery;
310
+ readonly executor: typeof import("./catalog/ambient-access-query/ambient-access-query-format").executeAmbientAccessQuery;
300
311
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
301
312
  readonly completer: typeof import("../cli/repl/parser/slice-query-parser").criteriaQueryCompleter;
302
313
  readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"ambient-access">;
@@ -306,7 +317,7 @@ export declare const SupportedQueries: {
306
317
  };
307
318
  readonly 'resolve-value': {
308
319
  readonly title: "Resolve Value Query";
309
- readonly executor: typeof import("./catalog/resolve-value-query/resolve-value-query-executor").executeResolveValueQuery;
320
+ readonly executor: typeof import("./catalog/resolve-value-query/resolve-value-query-format").executeResolveValueQuery;
310
321
  readonly perQueryResults: true;
311
322
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
312
323
  readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"resolve-value">;
@@ -316,7 +327,7 @@ export declare const SupportedQueries: {
316
327
  };
317
328
  readonly project: {
318
329
  readonly title: "Project Query";
319
- readonly executor: typeof import("./catalog/project-query/project-query-executor").executeProjectQuery;
330
+ readonly executor: typeof import("./catalog/project-query/project-query-format").executeProjectQuery;
320
331
  readonly asciiSummarizer: (formatter: OutputFormatter, analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
321
332
  readonly schema: Joi.ObjectSchema<any>;
322
333
  readonly flattenInvolvedNodes: () => never[];
@@ -333,7 +344,7 @@ export declare const SupportedQueries: {
333
344
  };
334
345
  readonly origin: {
335
346
  readonly title: "Origin Query";
336
- readonly executor: typeof import("./catalog/origin-query/origin-query-executor").executeOriginQuery;
347
+ readonly executor: typeof import("./catalog/origin-query/origin-query-format").executeOriginQuery;
337
348
  readonly perQueryResults: true;
338
349
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
339
350
  readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"origin">;
@@ -344,7 +355,7 @@ export declare const SupportedQueries: {
344
355
  };
345
356
  readonly linter: {
346
357
  readonly title: "Linter Query";
347
- readonly executor: typeof import("./catalog/linter-query/linter-query-executor").executeLinterQuery;
358
+ readonly executor: typeof import("./catalog/linter-query/linter-query-format").executeLinterQuery;
348
359
  readonly asciiSummarizer: (formatter: OutputFormatter, analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
349
360
  readonly completer: (line: readonly string[], startingNewArg: boolean, _config: FlowrConfig) => CommandCompletions;
350
361
  readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"linter">;
@@ -358,7 +369,7 @@ export declare const SupportedQueries: {
358
369
  };
359
370
  readonly dice: {
360
371
  readonly title: "Dice Query";
361
- readonly executor: typeof import("./catalog/dice-query/dice-query-executor").executeDiceQuery;
372
+ readonly executor: typeof import("./catalog/dice-query/dice-query-format").executeDiceQuery;
362
373
  readonly perQueryResults: true;
363
374
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => boolean;
364
375
  readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"dice">;
@@ -369,7 +380,7 @@ export declare const SupportedQueries: {
369
380
  };
370
381
  readonly 'guess-dep-versions': {
371
382
  readonly title: "Guess Dependency Versions Query";
372
- readonly executor: typeof import("./catalog/guess-dep-versions-query/guess-dep-versions-query-executor").executeGuessDepVersionsQuery;
383
+ readonly executor: typeof import("./catalog/guess-dep-versions-query/guess-dep-versions-query-format").executeGuessDepVersionsQuery;
373
384
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[], _query: readonly Query[]) => true;
374
385
  readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"guess-dep-versions">;
375
386
  readonly syntax: "@guess-dep-versions [<pkg> ...] [(clean | <=YYYY.MM.DD)] [--date YYYY.MM.DD] [--max <n>] [--iterations <n>] [--disabled <letters>] [--explode [--oldest] [--limit <n>] [--prefer <pkg>=<ver>]] <code | file://path>";
@@ -385,13 +396,23 @@ export declare const SupportedQueries: {
385
396
  };
386
397
  readonly 'code-clones': {
387
398
  readonly title: "Code Clones Query";
388
- readonly executor: typeof import("./catalog/code-clones-query/code-clones-query-executor").executeCodeClonesQuery;
399
+ readonly executor: typeof import("./catalog/code-clones-query/code-clones-query-format").executeCodeClonesQuery;
389
400
  readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"code-clones">;
390
401
  readonly syntax: "@code-clones [baxter|gst|winnowing ...] [<code>]";
391
402
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => boolean;
392
403
  readonly schema: Joi.ObjectSchema<any>;
393
404
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
394
405
  };
406
+ readonly 'data-columns': {
407
+ readonly title: "Data Columns Query";
408
+ readonly executor: typeof import("./catalog/data-columns-query/data-columns-query-format").executeDataColumnsQuery;
409
+ readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: unknown, queryResults: BaseQueryResult, result: string[]) => true;
410
+ readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"data-columns">;
411
+ readonly completer: typeof import("../cli/repl/parser/slice-query-parser").criteriaQueryCompleter;
412
+ readonly syntax: "@data-columns (<line:col>;...) <code | file://path>";
413
+ readonly schema: Joi.ObjectSchema<any>;
414
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
415
+ };
395
416
  };
396
417
  export type SupportedQueryTypes = keyof typeof SupportedQueries;
397
418
  /** The wiki page documenting a query, derived from its {@link SupportedQuery.title}. */
package/queries/query.js CHANGED
@@ -43,6 +43,7 @@ const call_graph_query_format_1 = require("./catalog/call-graph-query/call-graph
43
43
  const ambient_access_query_format_1 = require("./catalog/ambient-access-query/ambient-access-query-format");
44
44
  const inspect_recursion_query_format_1 = require("./catalog/inspect-recursion-query/inspect-recursion-query-format");
45
45
  const inspect_fn_props_query_format_1 = require("./catalog/inspect-fn-props-query/inspect-fn-props-query-format");
46
+ const inspect_fn_guards_query_format_1 = require("./catalog/inspect-fn-guards-query/inspect-fn-guards-query-format");
46
47
  const does_call_query_format_1 = require("./catalog/does-call-query/does-call-query-format");
47
48
  const inspect_exception_query_format_1 = require("./catalog/inspect-exceptions-query/inspect-exception-query-format");
48
49
  const input_sources_query_format_1 = require("./catalog/input-sources-query/input-sources-query-format");
@@ -52,6 +53,7 @@ const dice_query_format_1 = require("./catalog/dice-query/dice-query-format");
52
53
  const guess_dep_versions_query_format_1 = require("./catalog/guess-dep-versions-query/guess-dep-versions-query-format");
53
54
  const absint_query_format_1 = require("./catalog/absint-query/absint-query-format");
54
55
  const code_clones_query_format_1 = require("./catalog/code-clones-query/code-clones-query-format");
56
+ const data_columns_query_format_1 = require("./catalog/data-columns-query/data-columns-query-format");
55
57
  const function_info_query_format_1 = require("./catalog/function-info-query/function-info-query-format");
56
58
  exports.SupportedQueries = {
57
59
  'call-context': call_context_query_format_1.CallContextQueryDefinition,
@@ -78,6 +80,7 @@ exports.SupportedQueries = {
78
80
  'inspect-higher-order': inspect_higher_order_query_format_1.InspectHigherOrderQueryDefinition,
79
81
  'inspect-recursion': inspect_recursion_query_format_1.InspectRecursionQueryDefinition,
80
82
  'inspect-fn-props': inspect_fn_props_query_format_1.InspectFnPropsQueryDefinition,
83
+ 'inspect-fn-guards': inspect_fn_guards_query_format_1.InspectFnGuardsQueryDefinition,
81
84
  'ambient-access': ambient_access_query_format_1.AmbientAccessQueryDefinition,
82
85
  'resolve-value': resolve_value_query_format_1.ResolveValueQueryDefinition,
83
86
  'project': project_query_format_1.ProjectQueryDefinition,
@@ -87,7 +90,8 @@ exports.SupportedQueries = {
87
90
  'dice': dice_query_format_1.DiceQueryDefinition,
88
91
  'guess-dep-versions': guess_dep_versions_query_format_1.GuessDepVersionsQueryDefinition,
89
92
  'function-info': function_info_query_format_1.FunctionInfoQueryDefinition,
90
- 'code-clones': code_clones_query_format_1.CodeClonesQueryDefinition
93
+ 'code-clones': code_clones_query_format_1.CodeClonesQueryDefinition,
94
+ 'data-columns': data_columns_query_format_1.DataColumnsQueryDefinition
91
95
  };
92
96
  /** The wiki page documenting a query, derived from its {@link SupportedQuery.title}. */
93
97
  function queryWikiPage(title) {
@@ -107,10 +111,8 @@ async function executeQueriesOfSameType(data, queries) {
107
111
  function runExecutor(data, type, queries) {
108
112
  const definition = exports.SupportedQueries[type];
109
113
  (0, assert_1.guard)(definition !== undefined, `Unsupported query type: ${type}`);
110
- /* a query asks for the targets of many calls of a graph it leaves as it is; without an analyzer the executor is the one to fail */
111
- const graph = data.analyzer?.peekDataflow()?.graph;
112
114
  const run = () => definition.executor(data, queries);
113
- return graph === undefined ? run() : graph.sharingTargetWalks(run);
115
+ return run();
114
116
  }
115
117
  /** Groups the queries by type in the order the types first occur, unfolding virtual queries into the queries they stand for. */
116
118
  function groupQueriesByType(queries) {
@@ -92,6 +92,8 @@ export declare const NodeId: {
92
92
  readonly recoverName: (this: void, id: NodeId, idMap?: AstIdMap) => string | undefined;
93
93
  /** The id of the call the dataflow graph makes up for an anonymous function a call runs (`lapply(x, function(v) v)`, a `tryCatch` handler). */
94
94
  readonly anonymousCall: (this: void, functionId: NodeId) => NodeId;
95
+ /** Whether `id` is a made-up {@link NodeId.anonymousCall}. */
96
+ readonly isAnonymousCall: (this: void, id: NodeId) => boolean;
95
97
  /** The node `id` belongs to; for a made-up {@link NodeId.anonymousCall} the anonymous function it calls. */
96
98
  readonly nodeOf: <Info>(this: void, id: NodeId, idMap: AstIdMap<Info> | undefined) => RNode<Info & ParentInformation> | undefined;
97
99
  /**
@@ -131,6 +131,10 @@ exports.NodeId = {
131
131
  anonymousCall(functionId) {
132
132
  return AnonymousCallPrefix + String(functionId);
133
133
  },
134
+ /** Whether `id` is a made-up {@link NodeId.anonymousCall}. */
135
+ isAnonymousCall(id) {
136
+ return typeof id === 'string' && id.startsWith(AnonymousCallPrefix);
137
+ },
134
138
  /** The node `id` belongs to; for a made-up {@link NodeId.anonymousCall} the anonymous function it calls. */
135
139
  nodeOf(id, idMap) {
136
140
  const node = idMap?.get(id);
package/r-bridge/shell.js CHANGED
@@ -298,6 +298,8 @@ class RShellSession {
298
298
  options;
299
299
  collectionTimeout;
300
300
  requestQueue = Promise.resolve();
301
+ /** the last 20 lines R wrote to stderr */
302
+ stderrTail = [];
301
303
  constructor(options, log) {
302
304
  secure_mode_1.SecureMode.guard('starting R', options.pathToRExecutable);
303
305
  this.bareSession = (0, child_process_1.spawn)(options.pathToRExecutable, options.commandLineOptions, {
@@ -323,7 +325,8 @@ class RShellSession {
323
325
  });
324
326
  this.options = options;
325
327
  // initialize the session
326
- this.writeLine((0, init_1.initCommand)(options.eol, options.pipeBind));
328
+ /* since R 4.4 an error in a command no longer ends the session, older versions ignore the option */
329
+ this.writeLine('options(catch.script.errors=TRUE);' + (0, init_1.initCommand)(options.eol, options.pipeBind));
327
330
  if (log.settings.minLevel <= 1 /* LogLevel.Trace */) {
328
331
  this.bareSession.stdout.on('data', (data) => {
329
332
  log.trace(`< ${data.toString()}`);
@@ -334,6 +337,8 @@ class RShellSession {
334
337
  }
335
338
  this.bareSession.stderr.on('data', (data) => {
336
339
  log.warn(`< ${data}`);
340
+ this.stderrTail.push(...String(data).split(/\r?\n/).filter(l => l.length > 0));
341
+ this.stderrTail.splice(0, this.stderrTail.length - 20);
337
342
  });
338
343
  }
339
344
  write(data) {
@@ -379,7 +384,7 @@ class RShellSession {
379
384
  };
380
385
  return new Promise((resolve, reject) => {
381
386
  if (this.bareSession.exitCode !== null || this.bareSession.signalCode !== null) {
382
- reject(new Error(`the R session has exited (${this.bareSession.exitCode ?? this.bareSession.signalCode}), it cannot answer anymore`));
387
+ reject(new Error(`the R session has exited (${this.bareSession.exitCode ?? this.bareSession.signalCode}), it cannot answer anymore${this.stderrTail.length > 0 ? `, stderr:\n${this.stderrTail.join('\n')}` : ''}`));
383
388
  drained = true;
384
389
  onDrained();
385
390
  return;
@@ -79,7 +79,10 @@ function reconstructExpressionList(exprList, _grouping, expressions, config) {
79
79
  }
80
80
  else if (subExpressions.length === 1) {
81
81
  if (!isSelected(config, exprList)) {
82
- return subExpressions[0];
82
+ /* a dropped call keeps its arguments as several expressions, which a body only holds within a block */
83
+ const kept = exprList.children[expressions.findIndex(e => e.length > 0)];
84
+ const several = exprList.info.parent !== undefined && r_function_call_1.RFunctionCall.is(kept) && !isSelected(config, kept) && subExpressions[0].length > 1;
85
+ return several ? [...plain('{'), ...indentBy(subExpressions[0], 1), ...plain('}')] : subExpressions[0];
83
86
  }
84
87
  const [fst] = subExpressions;
85
88
  const g = exprList.grouping;
@@ -195,7 +198,7 @@ function reconstructIfThenElse(ifThenElse, condition, then, otherwise, config) {
195
198
  }
196
199
  else if (then.length === 0) {
197
200
  if (isSelected(config, ifThenElse)) {
198
- return reconstructBodyWithHeader({ line: `if(${reconstructableSource(ifThenElse.condition)}) { } else`, indent: 0 }, then, '{}');
201
+ return reconstructBodyWithHeader({ line: `if(${reconstructableSource(ifThenElse.condition)}) { } else`, indent: 0 }, otherwise, '{}');
199
202
  }
200
203
  else {
201
204
  return otherwise;
@@ -273,6 +276,18 @@ function hasSelectedAncestor(n, config) {
273
276
  function isHandedToACall(definition) {
274
277
  return definition.info.role === "call-arg" /* RoleInParent.FunctionCallArgument */ || definition.info.role === "arg-v" /* RoleInParent.ArgumentValue */;
275
278
  }
279
+ /** a definition handed to a call the slice drops is gone with it, even if the call sits in kept code: `tryCatch(return(1), error = function(e) 2)` */
280
+ function handedToUnselectedCall(definition, config) {
281
+ if (!isHandedToACall(definition)) {
282
+ return false;
283
+ }
284
+ for (const parent of model_1.RNode.iterateParents(definition, config.fullAst.idMap)) {
285
+ if (r_function_call_1.RFunctionCall.is(parent)) {
286
+ return !isSelected(config, parent);
287
+ }
288
+ }
289
+ return false;
290
+ }
276
291
  function reconstructFunctionDefinition(definition, functionParameters, body, config) {
277
292
  // if a definition is not selected, we only use the body - slicing will always select the definition if it is required
278
293
  if (functionParameters.every(p => p.length === 0)) {
@@ -281,7 +296,7 @@ function reconstructFunctionDefinition(definition, functionParameters, body, con
281
296
  if (empty && selected) { // give function stub
282
297
  return plain(`${definition.lexeme}(${reconstructParameters(definition.parameters).join(', ')}) { }`);
283
298
  }
284
- else if (!selected && !hasSelectedAncestor(definition, config)) {
299
+ else if (!selected && (!hasSelectedAncestor(definition, config) || (empty && handedToUnselectedCall(definition, config)))) {
285
300
  return isHandedToACall(definition) ? [] : body;
286
301
  }
287
302
  }