@eagleoutice/flowr 2.16.6 → 2.16.8

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 (321) hide show
  1. package/README.md +21 -15
  2. package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +2 -0
  3. package/abstract-interpretation/data-frame/dataframe-semantics.js +3 -1
  4. package/abstract-interpretation/data-frame/resolve-args.d.ts +1 -7
  5. package/abstract-interpretation/data-frame/resolve-args.js +2 -11
  6. package/cli/repl/commands/repl-cfg.js +5 -19
  7. package/cli/repl/commands/repl-code-command.d.ts +10 -0
  8. package/cli/repl/commands/repl-code-command.js +18 -0
  9. package/cli/repl/commands/repl-dataflow.js +34 -59
  10. package/cli/repl/commands/repl-normalize.js +24 -41
  11. package/cli/repl/commands/repl-query.js +10 -17
  12. package/config.js +3 -3
  13. package/control-flow/cfg-dead-code.js +15 -2
  14. package/control-flow/useless-loop.js +1 -2
  15. package/data/r-base-packages.generated.d.ts +1 -1
  16. package/data/r-base-packages.generated.js +3 -3
  17. package/dataflow/environments/ambient-state-name.d.ts +80 -0
  18. package/dataflow/environments/ambient-state-name.js +113 -0
  19. package/dataflow/environments/built-in-eval-name.d.ts +3 -1
  20. package/dataflow/environments/built-in-eval-name.js +2 -0
  21. package/dataflow/environments/built-in-props.d.ts +27 -7
  22. package/dataflow/environments/built-in-props.js +59 -44
  23. package/dataflow/environments/built-in.d.ts +5 -2
  24. package/dataflow/environments/built-in.js +22 -5
  25. package/dataflow/environments/default-builtin-config.d.ts +538 -14
  26. package/dataflow/environments/default-builtin-config.js +189 -123
  27. package/dataflow/environments/environment.d.ts +7 -1
  28. package/dataflow/environments/environment.js +19 -1
  29. package/dataflow/environments/identifier.d.ts +12 -1
  30. package/dataflow/environments/reference-to-maybe.js +1 -6
  31. package/dataflow/eval/resolve/alias-tracking.d.ts +13 -3
  32. package/dataflow/eval/resolve/alias-tracking.js +66 -37
  33. package/dataflow/eval/resolve/resolve-argument.d.ts +4 -2
  34. package/dataflow/eval/resolve/resolve-argument.js +23 -11
  35. package/dataflow/eval/resolve/resolve.d.ts +5 -0
  36. package/dataflow/eval/resolve/resolve.js +25 -3
  37. package/dataflow/eval/values/r-value.d.ts +4 -2
  38. package/dataflow/eval/values/r-value.js +3 -1
  39. package/dataflow/eval/values/string/string-constants.d.ts +7 -1
  40. package/dataflow/eval/values/string/string-constants.js +38 -36
  41. package/dataflow/extractor.js +105 -2
  42. package/dataflow/fn/argument-roles.js +22 -8
  43. package/dataflow/fn/function-semantics.d.ts +3 -2
  44. package/dataflow/fn/strict-function.js +13 -2
  45. package/dataflow/graph/dataflowgraph-builder.d.ts +4 -4
  46. package/dataflow/graph/df-helper.d.ts +14 -1
  47. package/dataflow/graph/df-helper.js +37 -4
  48. package/dataflow/graph/graph.d.ts +6 -0
  49. package/dataflow/graph/graph.js +9 -10
  50. package/dataflow/graph/vertex.d.ts +1 -1
  51. package/dataflow/hooks.d.ts +1 -1
  52. package/dataflow/info.d.ts +3 -3
  53. package/dataflow/internal/linker.d.ts +4 -1
  54. package/dataflow/internal/linker.js +12 -8
  55. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +41 -0
  56. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +88 -0
  57. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +21 -46
  58. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +125 -158
  59. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +6 -1
  60. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +35 -9
  61. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +10 -1
  62. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +4 -1
  63. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +6 -1
  64. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +1 -1
  65. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +3 -2
  66. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +7 -0
  67. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +21 -12
  68. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
  69. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +8 -1
  70. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +4 -1
  71. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +5 -0
  72. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -2
  73. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +11 -12
  74. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
  75. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +6 -0
  76. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +1 -1
  77. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +7 -0
  78. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +43 -7
  79. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +11 -0
  80. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +29 -4
  81. package/dataflow/internal/process/functions/call/common.js +3 -4
  82. package/dataflow/internal/process/functions/call/deferred.d.ts +3 -2
  83. package/dataflow/internal/process/functions/call/deferred.js +17 -9
  84. package/dataflow/internal/process/functions/call/quoted.js +1 -1
  85. package/dataflow/processor.d.ts +1 -1
  86. package/documentation/doc-capabilities.js +3 -2
  87. package/documentation/doc-readme.js +1 -2
  88. package/documentation/doc-util/doc-dfg.js +2 -2
  89. package/documentation/doc-util/doc-query.d.ts +3 -1
  90. package/documentation/doc-util/doc-query.js +4 -4
  91. package/documentation/wiki-create-linting-rules.js +1 -1
  92. package/documentation/wiki-linter.js +16 -206
  93. package/documentation/wiki-linting-and-testing.js +31 -64
  94. package/documentation/wiki-query.js +41 -0
  95. package/index.d.ts +1 -0
  96. package/index.js +5 -1
  97. package/linter/linter-format.d.ts +6 -0
  98. package/linter/linter-format.js +10 -0
  99. package/linter/linter-rules.d.ts +155 -103
  100. package/linter/linter-rules.js +2 -0
  101. package/linter/linter-util.d.ts +23 -0
  102. package/linter/linter-util.js +58 -0
  103. package/linter/rules/absolute-path.d.ts +2 -2
  104. package/linter/rules/absolute-path.js +1 -4
  105. package/linter/rules/cmd-check/bogus-return.d.ts +2 -2
  106. package/linter/rules/cmd-check/bogus-return.js +3 -7
  107. package/linter/rules/cmd-check/call-arguments.d.ts +2 -2
  108. package/linter/rules/cmd-check/class-string-comparison.d.ts +2 -2
  109. package/linter/rules/cmd-check/class-string-comparison.js +3 -7
  110. package/linter/rules/cmd-check/cmd-check-util.d.ts +8 -9
  111. package/linter/rules/cmd-check/cmd-check-util.js +14 -26
  112. package/linter/rules/cmd-check/compiled-code.d.ts +8 -3
  113. package/linter/rules/cmd-check/compiled-code.js +3 -13
  114. package/linter/rules/cmd-check/dependency-declaration.d.ts +2 -2
  115. package/linter/rules/cmd-check/dependency-declaration.js +6 -7
  116. package/linter/rules/cmd-check/description-metadata.d.ts +4 -4
  117. package/linter/rules/cmd-check/documentation-mismatch.d.ts +2 -2
  118. package/linter/rules/cmd-check/documentation-mismatch.js +4 -11
  119. package/linter/rules/cmd-check/file-checks.d.ts +19 -6
  120. package/linter/rules/cmd-check/file-checks.js +13 -5
  121. package/linter/rules/cmd-check/foreign-function-calls.d.ts +2 -2
  122. package/linter/rules/cmd-check/global-environment-modification.d.ts +2 -2
  123. package/linter/rules/cmd-check/global-environment-modification.js +3 -2
  124. package/linter/rules/cmd-check/namespace-tampering.d.ts +2 -2
  125. package/linter/rules/cmd-check/namespace-tampering.js +9 -9
  126. package/linter/rules/cmd-check/non-ascii-code.d.ts +2 -2
  127. package/linter/rules/cmd-check/package-data.d.ts +11 -5
  128. package/linter/rules/cmd-check/package-data.js +5 -12
  129. package/linter/rules/cmd-check/package-files.js +4 -10
  130. package/linter/rules/cmd-check/package-hooks.d.ts +2 -2
  131. package/linter/rules/cmd-check/package-hooks.js +10 -8
  132. package/linter/rules/cmd-check/package-metafiles.d.ts +8 -3
  133. package/linter/rules/cmd-check/package-metafiles.js +3 -12
  134. package/linter/rules/cmd-check/package-runtime.d.ts +18 -5
  135. package/linter/rules/cmd-check/package-runtime.js +64 -20
  136. package/linter/rules/cmd-check/package-structure.d.ts +11 -5
  137. package/linter/rules/cmd-check/package-structure.js +4 -12
  138. package/linter/rules/cmd-check/rd-files.d.ts +8 -3
  139. package/linter/rules/cmd-check/rd-files.js +4 -14
  140. package/linter/rules/cmd-check/s-three-method-consistency.d.ts +2 -2
  141. package/linter/rules/cmd-check/s-three-method-consistency.js +3 -4
  142. package/linter/rules/cmd-check/true-false-abbreviation.d.ts +2 -2
  143. package/linter/rules/dataframe-access-validation.d.ts +2 -2
  144. package/linter/rules/dataframe-access-validation.js +5 -8
  145. package/linter/rules/dead-code.d.ts +5 -4
  146. package/linter/rules/dead-code.js +25 -14
  147. package/linter/rules/deprecated-functions.d.ts +3 -3
  148. package/linter/rules/deprecated-functions.js +16 -23
  149. package/linter/rules/file-path-validity.d.ts +2 -2
  150. package/linter/rules/file-path-validity.js +3 -6
  151. package/linter/rules/function-finder-util.d.ts +3 -3
  152. package/linter/rules/function-finder-util.js +7 -14
  153. package/linter/rules/namespace-access.d.ts +2 -2
  154. package/linter/rules/namespace-access.js +6 -9
  155. package/linter/rules/naming-convention.d.ts +2 -2
  156. package/linter/rules/naming-convention.js +1 -4
  157. package/linter/rules/network-functions.d.ts +3 -3
  158. package/linter/rules/no-leaked-credentials.d.ts +2 -2
  159. package/linter/rules/no-leaked-credentials.js +1 -4
  160. package/linter/rules/overwritten-file.d.ts +38 -0
  161. package/linter/rules/overwritten-file.js +102 -0
  162. package/linter/rules/problematic-inputs.d.ts +16 -6
  163. package/linter/rules/problematic-inputs.js +78 -34
  164. package/linter/rules/roxygen-arguments.d.ts +2 -2
  165. package/linter/rules/roxygen-arguments.js +1 -4
  166. package/linter/rules/seeded-randomness.d.ts +3 -3
  167. package/linter/rules/seeded-randomness.js +6 -23
  168. package/linter/rules/software-has-license.d.ts +2 -2
  169. package/linter/rules/software-has-license.js +1 -4
  170. package/linter/rules/software-has-tests.d.ts +2 -2
  171. package/linter/rules/software-has-tests.js +1 -4
  172. package/linter/rules/stop-with-call-arg.d.ts +2 -2
  173. package/linter/rules/stop-with-call-arg.js +4 -11
  174. package/linter/rules/syntactically-valid.d.ts +4 -2
  175. package/linter/rules/syntactically-valid.js +29 -10
  176. package/linter/rules/unclosed-connection.d.ts +2 -2
  177. package/linter/rules/unclosed-connection.js +1 -4
  178. package/linter/rules/undefined-symbol.d.ts +2 -2
  179. package/linter/rules/undefined-symbol.js +25 -22
  180. package/linter/rules/unescaped-arguments.d.ts +2 -2
  181. package/linter/rules/unescaped-arguments.js +1 -4
  182. package/linter/rules/unused-definition.d.ts +2 -2
  183. package/linter/rules/unused-definition.js +37 -25
  184. package/linter/rules/unused-import.d.ts +2 -2
  185. package/linter/rules/unused-import.js +9 -14
  186. package/linter/rules/useless-loop.d.ts +7 -6
  187. package/linter/rules/useless-loop.js +4 -8
  188. package/package.json +5 -3
  189. package/project/cache/flowr-analyzer-cache.d.ts +2 -0
  190. package/project/cache/flowr-analyzer-cache.js +15 -11
  191. package/project/context/flowr-analyzer-files-context.d.ts +3 -0
  192. package/project/context/flowr-analyzer-files-context.js +6 -0
  193. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +6 -1
  194. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +35 -0
  195. package/project/plugins/file-plugins/files/flowr-namespace-file.js +2 -1
  196. package/project/plugins/file-plugins/files/flowr-rsession-file.d.ts +26 -0
  197. package/project/plugins/file-plugins/files/flowr-rsession-file.js +44 -0
  198. package/project/plugins/file-plugins/files/r-session.d.ts +20 -0
  199. package/project/plugins/file-plugins/files/r-session.js +58 -0
  200. package/project/plugins/file-plugins/files/recorded-runs.d.ts +18 -0
  201. package/project/plugins/file-plugins/files/recorded-runs.js +8 -0
  202. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.d.ts +20 -0
  203. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.js +28 -0
  204. package/project/plugins/plugin-registry.d.ts +2 -1
  205. package/project/plugins/plugin-registry.js +2 -0
  206. package/project/sigdb/spec-query.d.ts +73 -0
  207. package/project/sigdb/spec-query.js +339 -0
  208. package/queries/base-query-format.d.ts +1 -1
  209. package/queries/base-query-format.js +2 -2
  210. package/queries/catalog/absint-query/absint-query-executor.js +3 -6
  211. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -0
  212. package/queries/catalog/call-context-query/call-context-query-executor.js +113 -73
  213. package/queries/catalog/call-graph-query/call-graph-query-executor.js +2 -3
  214. package/queries/catalog/cluster-query/cluster-query-executor.js +2 -3
  215. package/queries/catalog/config-query/config-query-format.d.ts +0 -1
  216. package/queries/catalog/config-query/config-query-format.js +1 -2
  217. package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -3
  218. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -4
  219. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +0 -1
  220. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -2
  221. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -3
  222. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +7 -0
  223. package/queries/catalog/dependencies-query/dependencies-query-executor.js +72 -42
  224. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +24 -6
  225. package/queries/catalog/dependencies-query/dependencies-query-format.js +108 -3
  226. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +6 -1
  227. package/queries/catalog/dependencies-query/function-info/read-functions.js +6 -6
  228. package/queries/catalog/dependencies-query/function-info/write-functions.js +13 -7
  229. package/queries/catalog/dependencies-query/implicit-echo.js +21 -7
  230. package/queries/catalog/dice-query/dice-query-executor.js +2 -3
  231. package/queries/catalog/does-call-query/does-call-query-executor.js +2 -3
  232. package/queries/catalog/files-query/files-query-executor.js +2 -3
  233. package/queries/catalog/function-info-query/function-info-query-executor.js +2 -1
  234. package/queries/catalog/function-info-query/function-info-query-format.d.ts +0 -2
  235. package/queries/catalog/function-info-query/function-info-query-format.js +1 -2
  236. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +3 -2
  237. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +0 -2
  238. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +1 -2
  239. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -3
  240. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +0 -1
  241. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -2
  242. package/queries/catalog/id-map-query/id-map-query-executor.js +2 -3
  243. package/queries/catalog/id-map-query/id-map-query-format.d.ts +0 -1
  244. package/queries/catalog/id-map-query/id-map-query-format.js +1 -2
  245. package/queries/catalog/input-sources-query/input-sources-query-executor.js +3 -4
  246. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +2 -1
  247. package/queries/catalog/input-sources-query/simple-input-classifier.js +60 -13
  248. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -3
  249. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +2 -3
  250. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +2 -1
  251. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +3 -2
  252. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -7
  253. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +6 -9
  254. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +8 -33
  255. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.d.ts +3 -2
  256. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +1 -7
  257. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +6 -7
  258. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +8 -31
  259. package/queries/catalog/linter-query/linter-query-executor.js +2 -3
  260. package/queries/catalog/location-map-query/location-map-query-executor.js +2 -3
  261. package/queries/catalog/location-map-query/location-map-query-format.d.ts +0 -1
  262. package/queries/catalog/location-map-query/location-map-query-format.js +1 -2
  263. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -3
  264. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +0 -1
  265. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -2
  266. package/queries/catalog/origin-query/origin-query-executor.d.ts +0 -5
  267. package/queries/catalog/origin-query/origin-query-executor.js +3 -11
  268. package/queries/catalog/project-query/project-query-executor.js +23 -7
  269. package/queries/catalog/project-query/project-query-format.d.ts +5 -0
  270. package/queries/catalog/project-query/project-query-format.js +20 -2
  271. package/queries/catalog/provenance-query/provenance-query-executor.js +2 -3
  272. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -3
  273. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +0 -1
  274. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -2
  275. package/queries/catalog/search-query/search-query-executor.js +2 -3
  276. package/queries/catalog/signature-query/signature-query-executor.js +39 -0
  277. package/queries/catalog/signature-query/signature-query-format.d.ts +7 -1
  278. package/queries/catalog/signature-query/signature-query-format.js +15 -1
  279. package/queries/catalog/signature-query/signature-query-render.js +2 -1
  280. package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -3
  281. package/queries/query-function-property.d.ts +28 -0
  282. package/queries/query-function-property.js +48 -0
  283. package/queries/query-meta.d.ts +3 -0
  284. package/queries/query-meta.js +8 -0
  285. package/queries/query.d.ts +13 -18
  286. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -2
  287. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +4 -3
  288. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +6 -0
  289. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +9 -0
  290. package/r-bridge/lang-4.x/ast/model/syntax-version.d.ts +8 -0
  291. package/r-bridge/lang-4.x/ast/model/syntax-version.js +49 -0
  292. package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -0
  293. package/r-bridge/lang-4.x/ast/model/type.js +3 -0
  294. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +4 -1
  295. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-single-node.js +1 -0
  296. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +1 -1
  297. package/reconstruct/reconstruct.js +35 -1
  298. package/search/search-executor/search-generators.js +1 -1
  299. package/slicing/static/fingerprint.js +7 -3
  300. package/slicing/static/static-slicer.js +6 -0
  301. package/util/assert.js +2 -2
  302. package/util/collections/arrays.d.ts +4 -0
  303. package/util/collections/arrays.js +11 -0
  304. package/util/collections/defaultmap.d.ts +5 -1
  305. package/util/collections/defaultmap.js +6 -1
  306. package/util/files.js +26 -5
  307. package/util/flowr-version.d.ts +10 -0
  308. package/util/flowr-version.js +20 -0
  309. package/util/glob.js +6 -4
  310. package/util/r-regex.d.ts +6 -0
  311. package/util/r-regex.js +17 -0
  312. package/util/text/args.d.ts +5 -0
  313. package/util/text/args.js +28 -22
  314. package/util/text/name-rank.d.ts +2 -0
  315. package/util/text/name-rank.js +3 -1
  316. package/util/text/regex.d.ts +10 -0
  317. package/util/text/regex.js +29 -0
  318. package/util/version.d.ts +1 -6
  319. package/util/version.js +6 -14
  320. package/documentation/doc-util/doc-functions.d.ts +0 -24
  321. package/documentation/doc-util/doc-functions.js +0 -65
@@ -7,17 +7,11 @@ const query_function_filter_1 = require("../../query-function-filter");
7
7
  * Execute recursion function inspection queries on the given analyzer.
8
8
  */
9
9
  async function executeRecursionQuery({ analyzer }, queries) {
10
- const start = Date.now();
11
10
  const { cg, fns } = await query_function_filter_1.QueryFunctionFilter.inCallGraph(queries, analyzer);
12
11
  const result = {};
13
12
  for (const [id] of fns) {
14
13
  result[id] = call_graph_1.CallGraph.isRecursive(id, cg);
15
14
  }
16
- return {
17
- '.meta': {
18
- timing: Date.now() - start
19
- },
20
- recursive: result
21
- };
15
+ return result;
22
16
  }
23
17
  //# sourceMappingURL=inspect-recursion-query-executor.js.map
@@ -1,7 +1,5 @@
1
- import { type BaseQueryFormat, type BaseQueryResult } from '../../base-query-format';
2
- import Joi from 'joi';
3
- import { executeRecursionQuery } from './inspect-recursion-query-executor';
4
- import { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
1
+ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
2
+ import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
5
3
  import type { SlicingCriterion } from '../../../slicing/criterion/parse';
6
4
  /**
7
5
  * Either returns all function definitions alongside whether they are recursive,
@@ -15,11 +13,12 @@ export interface InspectRecursionQueryResult extends BaseQueryResult {
15
13
  readonly recursive: Record<NodeId, boolean>;
16
14
  }
17
15
  export declare const InspectRecursionQueryDefinition: {
18
- readonly title: "Inspect Recursive Functions Query";
19
- readonly executor: typeof executeRecursionQuery;
16
+ readonly title: string;
17
+ readonly executor: (data: import("../../base-query-format").BasicQueryData, queries: readonly InspectRecursionQuery[]) => Promise<BaseQueryResult & Record<"recursive", Record<NodeId, boolean>>>;
20
18
  readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, processed: import("../../..").ReadonlyFlowrAnalysisProvider<import("../../..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
19
+ readonly completer: typeof import("../../../cli/repl/parser/slice-query-parser").criteriaQueryCompleter;
21
20
  readonly fromLine: (_output: import("../../../cli/repl/commands/repl-main").ReplOutput, line: readonly string[], _config: import("../../..").FlowrConfig) => import("../../query").ParsedQueryLine<"inspect-recursion">;
22
21
  readonly syntax: "@inspect-recursion [(<crit>;...)] <code | file://path>";
23
- readonly schema: Joi.ObjectSchema<any>;
22
+ readonly schema: import("joi").ObjectSchema<any>;
24
23
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
25
24
  };
@@ -1,37 +1,14 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.InspectRecursionQueryDefinition = void 0;
7
- const base_query_format_1 = require("../../base-query-format");
8
- const ansi_1 = require("../../../util/text/ansi");
9
- const joi_1 = __importDefault(require("joi"));
10
4
  const inspect_recursion_query_executor_1 = require("./inspect-recursion-query-executor");
11
- const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
12
- const range_1 = require("../../../util/range");
13
- exports.InspectRecursionQueryDefinition = {
5
+ const query_function_property_1 = require("../../query-function-property");
6
+ exports.InspectRecursionQueryDefinition = (0, query_function_property_1.functionPropertyQuery)({
7
+ type: 'inspect-recursion',
14
8
  title: 'Inspect Recursive Functions Query',
15
- executor: inspect_recursion_query_executor_1.executeRecursionQuery,
16
- asciiSummarizer: async (formatter, processed, queryResults, result) => {
17
- const out = queryResults;
18
- result.push(`Query: ${(0, ansi_1.bold)('inspect-recursion', formatter)} (${out['.meta'].timing.toFixed(0)}ms)`);
19
- for (const [r, v] of Object.entries(out.recursive)) {
20
- const node = (await processed.normalize()).idMap.get(node_id_1.NodeId.normalize(r));
21
- const loc = node ? range_1.SourceLocation.fromNode(node) : undefined;
22
- result.push(` - Function ${(0, ansi_1.bold)(r, formatter)} (${range_1.SourceLocation.format(loc)}) is ${v ? '' : 'not '}recursive`);
23
- }
24
- return true;
25
- },
26
- fromLine: (0, base_query_format_1.filterLineParser)('inspect-recursion'),
27
- syntax: '@inspect-recursion [(<crit>;...)] <code | file://path>',
28
- schema: joi_1.default.object({
29
- type: joi_1.default.string().valid('inspect-recursion').required().description('The type of the query.'),
30
- filter: joi_1.default.array().items(joi_1.default.string().required()).optional().description('If given, only function definitions that match one of the given slicing criteria are considered. Each criterion can be either `line:column`, `line@variable-name`, or `$id`, where the latter directly specifies the node id of the function definition to be considered.')
31
- }).description('Either returns all function definitions alongside whether they are recursive, or just those matching the filters.'),
32
- flattenInvolvedNodes: (queryResults) => {
33
- const out = queryResults;
34
- return Object.keys(out.recursive).filter(id => out.recursive[id]);
35
- }
36
- };
9
+ noun: 'recursive',
10
+ resultKey: 'recursive',
11
+ phrase: 'recursive',
12
+ compute: inspect_recursion_query_executor_1.executeRecursionQuery
13
+ });
37
14
  //# sourceMappingURL=inspect-recursion-query-format.js.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeLinterQuery = executeLinterQuery;
4
+ const query_meta_1 = require("../../query-meta");
4
5
  const linter_rules_1 = require("../../../linter/linter-rules");
5
6
  const log_1 = require("../../../util/log");
6
7
  const linter_executor_1 = require("../../../linter/linter-executor");
@@ -52,9 +53,7 @@ async function executeLinterQuery({ analyzer }, queries) {
52
53
  return {
53
54
  ...results,
54
55
  ...(formatted ? { formatted } : {}),
55
- '.meta': {
56
- timing: Date.now() - start
57
- }
56
+ ...(0, query_meta_1.metaSince)(start)
58
57
  };
59
58
  }
60
59
  //# sourceMappingURL=linter-query-executor.js.map
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeLocationMapQuery = executeLocationMapQuery;
4
4
  const location_map_query_format_1 = require("./location-map-query-format");
5
5
  const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
6
+ const query_meta_1 = require("../../query-meta");
6
7
  const assert_1 = require("../../../util/assert");
7
8
  const parse_1 = require("../../../slicing/criterion/parse");
8
9
  const fileIdRegex = /^(?<file>.*(\.[rR]))-/;
@@ -65,9 +66,7 @@ async function executeLocationMapQuery({ analyzer }, queries) {
65
66
  }
66
67
  }
67
68
  return {
68
- '.meta': {
69
- timing: Date.now() - start
70
- },
69
+ ...(0, query_meta_1.metaSince)(start),
71
70
  map: locationMap
72
71
  };
73
72
  }
@@ -49,6 +49,5 @@ export declare const LocationMapQueryDefinition: {
49
49
  readonly completer: typeof criteriaQueryCompleter;
50
50
  readonly syntax: "@location-map [(<crit>;...)] [token|full|statement] <code | file://path>";
51
51
  readonly schema: Joi.ObjectSchema<any>;
52
- readonly flattenInvolvedNodes: () => never[];
53
52
  };
54
53
  export {};
@@ -54,7 +54,6 @@ exports.LocationMapQueryDefinition = {
54
54
  type: joi_1.default.string().valid('location-map').required().description('The type of the query.'),
55
55
  ids: joi_1.default.array().items(joi_1.default.string()).optional().description('Optional list of ids to filter the results by.'),
56
56
  span: joi_1.default.string().valid(...Object.values(LocationMapSpan)).optional().description('How much of the source the reported range covers: the token itself (default), the whole subtree of the node, or the top-level statement it belongs to.')
57
- }).description('The location map query retrieves the location of every id in the ast.'),
58
- flattenInvolvedNodes: () => []
57
+ }).description('The location map query retrieves the location of every id in the ast.')
59
58
  };
60
59
  //# sourceMappingURL=location-map-query-format.js.map
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeNormalizedAstQuery = executeNormalizedAstQuery;
4
4
  const log_1 = require("../../../util/log");
5
+ const query_meta_1 = require("../../query-meta");
5
6
  /**
6
7
  * Executes the normalized-AST query.
7
8
  */
@@ -12,9 +13,7 @@ async function executeNormalizedAstQuery({ analyzer }, queries) {
12
13
  const startTime = Date.now();
13
14
  const normalized = await analyzer.normalize();
14
15
  return {
15
- '.meta': {
16
- timing: Date.now() - startTime
17
- },
16
+ ...(0, query_meta_1.metaSince)(startTime),
18
17
  normalized
19
18
  };
20
19
  }
@@ -16,5 +16,4 @@ export declare const NormalizedAstQueryDefinition: {
16
16
  readonly executor: typeof executeNormalizedAstQuery;
17
17
  readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../..").ReadonlyFlowrAnalysisProvider<import("../../..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
18
18
  readonly schema: Joi.ObjectSchema<any>;
19
- readonly flattenInvolvedNodes: () => never[];
20
19
  };
@@ -19,7 +19,6 @@ exports.NormalizedAstQueryDefinition = {
19
19
  },
20
20
  schema: joi_1.default.object({
21
21
  type: joi_1.default.string().valid('normalized-ast').required().description('The type of the query.'),
22
- }).description('The normalized AST query simply returns the normalized AST, there is no need to pass it multiple times!'),
23
- flattenInvolvedNodes: () => []
22
+ }).description('The normalized AST query simply returns the normalized AST, there is no need to pass it multiple times!')
24
23
  };
25
24
  //# sourceMappingURL=normalized-ast-query-format.js.map
@@ -1,10 +1,5 @@
1
1
  import type { BasicQueryData } from '../../base-query-format';
2
- import { SlicingCriterion } from '../../../slicing/criterion/parse';
3
2
  import type { OriginQuery, OriginQueryResult } from './origin-query-format';
4
- /**
5
- * Produce a fingerprint string for an origin query
6
- */
7
- export declare function criterionOfQuery(query: OriginQuery): SlicingCriterion;
8
3
  /**
9
4
  * Execute origin queries, catching duplicates with the same fingerprint
10
5
  */
@@ -1,16 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.criterionOfQuery = criterionOfQuery;
4
3
  exports.executeOriginQuery = executeOriginQuery;
5
4
  const log_1 = require("../../../util/log");
5
+ const query_meta_1 = require("../../query-meta");
6
6
  const parse_1 = require("../../../slicing/criterion/parse");
7
7
  const df_helper_1 = require("../../../dataflow/graph/df-helper");
8
- /**
9
- * Produce a fingerprint string for an origin query
10
- */
11
- function criterionOfQuery(query) {
12
- return query.criterion;
13
- }
14
8
  /**
15
9
  * Execute origin queries, catching duplicates with the same fingerprint
16
10
  */
@@ -18,7 +12,7 @@ async function executeOriginQuery({ analyzer }, queries) {
18
12
  const start = Date.now();
19
13
  const results = {};
20
14
  for (const query of queries) {
21
- const key = criterionOfQuery(query);
15
+ const key = query.criterion;
22
16
  if (results[key]) {
23
17
  log_1.log.warn(`Duplicate Key for origin-query: ${key}, skipping...`);
24
18
  }
@@ -30,9 +24,7 @@ async function executeOriginQuery({ analyzer }, queries) {
30
24
  results[key] = df_helper_1.Dataflow.origin((await analyzer.dataflow()).graph, astId);
31
25
  }
32
26
  return {
33
- '.meta': {
34
- timing: Date.now() - start
35
- },
27
+ ...(0, query_meta_1.metaSince)(start),
36
28
  results
37
29
  };
38
30
  }
@@ -1,7 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.executeProjectQuery = executeProjectQuery;
4
7
  const log_1 = require("../../../util/log");
8
+ const path_1 = __importDefault(require("path"));
9
+ const query_meta_1 = require("../../query-meta");
5
10
  const flowr_file_1 = require("../../../project/context/flowr-file");
6
11
  const r_base_packages_1 = require("../../../util/r-base-packages");
7
12
  /**
@@ -54,24 +59,33 @@ async function executeProjectQuery({ analyzer }, queries) {
54
59
  }
55
60
  const startTime = Date.now();
56
61
  const withDf = queries.some(q => q.withDf);
62
+ const showFiles = queries.some(q => q.showFiles);
57
63
  // we need to know what is considered by the analyzer
58
64
  if (withDf) {
59
65
  await analyzer.dataflow();
60
66
  }
61
67
  const ctx = analyzer.inspectContext();
62
68
  const basePackages = new Set(ctx.config.project.basePackages ?? (0, r_base_packages_1.baseRPackages)(ctx.resolvedRVersion));
63
- const roleCounts = {};
64
- for (const file of Object.values(flowr_file_1.FileRole)) {
65
- roleCounts[file] = ctx.files.getFilesByRole(file).length;
69
+ let roleCounts;
70
+ let roleFiles;
71
+ if (showFiles) {
72
+ roleFiles = {};
73
+ for (const file of Object.values(flowr_file_1.FileRole)) {
74
+ roleFiles[file] = ctx.files.getFilesByRole(file).map(r => path_1.default.basename(r.path()));
75
+ }
76
+ }
77
+ else {
78
+ roleCounts = {};
79
+ for (const file of Object.values(flowr_file_1.FileRole)) {
80
+ roleCounts[file] = ctx.files.getFilesByRole(file).length;
81
+ }
66
82
  }
67
83
  // whichever plugin read the metadata (DESCRIPTION, rproject.toml, a lockfile) contributed it to the context,
68
84
  // so nothing here has to know which file the project happens to use
69
85
  const declared = ctx.meta.getDeclaredPackages();
70
86
  const hasDeclarations = Object.values(declared).some(g => g !== undefined);
71
87
  return {
72
- '.meta': {
73
- timing: Date.now() - startTime
74
- },
88
+ ...(0, query_meta_1.metaSince)(startTime),
75
89
  name: ctx.meta.getProjectName() ?? ctx.meta.getProjectTitle(),
76
90
  files: Array.from(ctx.files.consideredFilesList()),
77
91
  authors: ctx.meta.getAuthors(),
@@ -80,8 +94,10 @@ async function executeProjectQuery({ analyzer }, queries) {
80
94
  rVersion: ctx.meta.getRVersion(),
81
95
  licenses: ctx.meta.getLicenses(),
82
96
  roleCounts: roleCounts,
97
+ roleFiles: roleFiles,
83
98
  kind: ctx.projectKind(),
84
- dependencies: hasDeclarations ? collectDependencyStats(declared, ctx.deps, basePackages) : undefined
99
+ dependencies: hasDeclarations ? collectDependencyStats(declared, ctx.deps, basePackages) : undefined,
100
+ dfaPerformed: analyzer.peekDataflow() !== undefined
85
101
  };
86
102
  }
87
103
  //# sourceMappingURL=project-query-executor.js.map
@@ -9,6 +9,7 @@ export interface ProjectQuery extends BaseQueryFormat {
9
9
  readonly type: 'project';
10
10
  /** Whether to include Dataflow information in the result. */
11
11
  readonly withDf?: boolean;
12
+ readonly showFiles?: boolean;
12
13
  }
13
14
  /** Statistics on the project's declared dependencies, cross-referenced with the signature database. */
14
15
  export interface ProjectDependencyStats {
@@ -44,6 +45,8 @@ export interface ProjectQueryResult extends BaseQueryResult {
44
45
  readonly files: (string | '<inline>')[];
45
46
  /** The counts of files by their role in the project. */
46
47
  readonly roleCounts?: Record<FileRole, number>;
48
+ /** The lists of files by their role in the project. */
49
+ readonly roleFiles?: Record<FileRole, readonly string[]>;
47
50
  /** The licenses of the project. */
48
51
  readonly licenses?: RLicenseElementInfo[];
49
52
  /** The encoding of the project files. */
@@ -56,6 +59,8 @@ export interface ProjectQueryResult extends BaseQueryResult {
56
59
  readonly kind?: ProjectKind;
57
60
  /** Statistics on the project's declared dependencies, if a `DESCRIPTION` file is available. */
58
61
  readonly dependencies?: ProjectDependencyStats;
62
+ /** Determines whether dataflow analysis already happened. */
63
+ readonly dfaPerformed: boolean;
59
64
  }
60
65
  export declare const ProjectQueryDefinition: {
61
66
  readonly title: "Project Query";
@@ -57,6 +57,23 @@ exports.ProjectQueryDefinition = {
57
57
  }
58
58
  }
59
59
  }
60
+ else if (out.roleFiles) {
61
+ const entries = Object.entries(out.roleFiles).filter(([, files]) => files.length > 0);
62
+ if (entries.length > 0) {
63
+ result.push(' ╰ File Role Counts:');
64
+ const longestRole = Math.max(...entries.map(([r]) => r.length));
65
+ const longestCount = Math.max(...entries.map(([, f]) => String(f.length).length));
66
+ for (const [role, files] of entries) {
67
+ const limit = 2;
68
+ const displayedFiles = files.slice(0, limit).join(', ');
69
+ const fileList = '[' + displayedFiles + (files.length > limit ? ', ...' : '') + ']';
70
+ result.push(` ╰ ${(role + ':').padEnd(longestRole + 1, ' ')} ${formatter.format(String(files.length).padStart(longestCount, ' '), {
71
+ effect: ansi_1.ColorEffect.Foreground,
72
+ color: 6 /* Colors.Cyan */
73
+ })} ${fileList}`);
74
+ }
75
+ }
76
+ }
60
77
  if (out.dependencies) {
61
78
  const d = out.dependencies;
62
79
  result.push(` ╰ Dependencies: ${d.runtime} runtime (${d.imports} imports, ${d.depends} depends, ${d.linkingTo} linkingTo), ${d.suggests} suggested`);
@@ -69,7 +86,7 @@ exports.ProjectQueryDefinition = {
69
86
  result.push(` ╰ Requires R ${d.rVersion}`);
70
87
  }
71
88
  }
72
- if (analyzer.peekDataflow() === undefined) {
89
+ if (!out.dfaPerformed) {
73
90
  result.push(formatter.format(' ╰ Dataflow not performed (run `:df#`, then re-run this query, or pass "withDf": true)', { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground }));
74
91
  }
75
92
  else {
@@ -85,7 +102,8 @@ exports.ProjectQueryDefinition = {
85
102
  },
86
103
  schema: joi_1.default.object({
87
104
  type: joi_1.default.string().valid('project').required().description('The type of the query.'),
88
- withDf: joi_1.default.boolean().optional().default(false).description('Whether to include Dataflow information in the result.')
105
+ withDf: joi_1.default.boolean().optional().default(false).description('Whether to include Dataflow information in the result.'),
106
+ showFiles: joi_1.default.boolean().optional().default(false).description('Whether to include the list of files in the result.')
89
107
  }).description('The project query provides information on the analyzed project.'),
90
108
  flattenInvolvedNodes: () => []
91
109
  };
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeProvenanceQuery = executeProvenanceQuery;
4
4
  const log_1 = require("../../../util/log");
5
+ const query_meta_1 = require("../../query-meta");
5
6
  const r_function_definition_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
6
7
  const parse_1 = require("../../../slicing/criterion/parse");
7
8
  const df_helper_1 = require("../../../dataflow/graph/df-helper");
@@ -25,9 +26,7 @@ async function executeProvenanceQuery({ analyzer }, queries) {
25
26
  results[key] = Array.from(df_helper_1.Dataflow.provenance(criterionId, df.graph, fdef ? model_1.RNode.collectAllIds(fdef) : undefined));
26
27
  }
27
28
  return {
28
- '.meta': {
29
- timing: Date.now() - start
30
- },
29
+ ...(0, query_meta_1.metaSince)(start),
31
30
  results
32
31
  };
33
32
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fingerPrintOfQuery = fingerPrintOfQuery;
4
4
  exports.executeResolveValueQuery = executeResolveValueQuery;
5
5
  const log_1 = require("../../../util/log");
6
+ const query_meta_1 = require("../../query-meta");
6
7
  const parse_1 = require("../../../slicing/criterion/parse");
7
8
  const resolve_helper_1 = require("../../../dataflow/environments/resolve-helper");
8
9
  /**
@@ -32,9 +33,7 @@ async function executeResolveValueQuery({ analyzer }, queries) {
32
33
  };
33
34
  }
34
35
  return {
35
- '.meta': {
36
- timing: Date.now() - start
37
- },
36
+ ...(0, query_meta_1.metaSince)(start),
38
37
  results
39
38
  };
40
39
  }
@@ -26,6 +26,5 @@ export declare const ResolveValueQueryDefinition: {
26
26
  readonly completer: typeof criteriaQueryCompleter;
27
27
  readonly syntax: "@resolve-value (<crit>;...) <code | file://path>";
28
28
  readonly schema: Joi.ObjectSchema<any>;
29
- readonly flattenInvolvedNodes: () => never[];
30
29
  };
31
30
  export {};
@@ -49,7 +49,6 @@ exports.ResolveValueQueryDefinition = {
49
49
  schema: joi_1.default.object({
50
50
  type: joi_1.default.string().valid('resolve-value').required().description('The type of the query.'),
51
51
  criteria: joi_1.default.array().items(joi_1.default.string()).min(1).required().description('The slicing criteria to use.'),
52
- }).description('The resolve value query used to get definitions of an identifier'),
53
- flattenInvolvedNodes: () => []
52
+ }).description('The resolve value query used to get definitions of an identifier')
54
53
  };
55
54
  //# sourceMappingURL=resolve-value-query-format.js.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeSearch = executeSearch;
4
+ const query_meta_1 = require("../../query-meta");
4
5
  const flowr_search_executor_1 = require("../../../search/flowr-search-executor");
5
6
  /**
6
7
  * Executes the given search queries using the provided analyzer.
@@ -17,9 +18,7 @@ async function executeSearch({ analyzer }, queries) {
17
18
  });
18
19
  }
19
20
  return {
20
- '.meta': {
21
- timing: Date.now() - start
22
- },
21
+ ...(0, query_meta_1.metaSince)(start),
23
22
  results
24
23
  };
25
24
  }
@@ -17,6 +17,7 @@ const manifest_1 = require("../../../project/sigdb/manifest");
17
17
  const query_fn_props_1 = require("../../../dataflow/environments/query-fn-props");
18
18
  const built_in_props_1 = require("../../../dataflow/environments/built-in-props");
19
19
  const identifier_1 = require("../../../dataflow/environments/identifier");
20
+ const spec_query_1 = require("../../../project/sigdb/spec-query");
20
21
  const r_version_1 = require("../../../util/r-version");
21
22
  const r_base_packages_1 = require("../../../util/r-base-packages");
22
23
  const mermaid_1 = require("../../../util/mermaid/mermaid");
@@ -614,6 +615,41 @@ function withBuiltInFallback(found, env, q, literalFunction, index) {
614
615
  const matches = [...found.matches, ...extra];
615
616
  return { ...found, matches, matchCount: matches.length };
616
617
  }
618
+ /**
619
+ * The functions flowR's built-in configuration states a match for, for a spec like `p*([alias]) [invisible]`:
620
+ * the name (glob, `/regex/`, or a part of it), the roles of the arguments in order, and the call properties.
621
+ * The databases record none of the roles or properties, so only the built-ins can answer.
622
+ */
623
+ function searchBuiltInSpec(spec, index) {
624
+ const { rest, nameRegex, args, props } = (0, spec_query_1.parseSpec)(spec);
625
+ const qualified = /^([\w.]+):::?(.*)$/.exec(rest);
626
+ const named = (qualified?.[2] ?? rest).trim();
627
+ const glob = nameRegex ?? (0, spec_query_1.globOf)(named);
628
+ const needle = glob === undefined ? named.toLowerCase() : '';
629
+ const matches = [];
630
+ let truncated = false;
631
+ for (const entry of index.entries) {
632
+ const name = String(identifier_1.Identifier.getName(entry.name));
633
+ const pkg = String(identifier_1.Identifier.getNamespace(entry.name) ?? "base" /* PkgName.Base */);
634
+ if ((qualified && qualified[1] !== pkg) || (glob ? !glob.test(name) : !name.toLowerCase().includes(needle))) {
635
+ continue;
636
+ }
637
+ const have = function_semantics_1.FunctionSemantics.call.props.names([entry.props ?? 0, ...entry.tags ?? []]).map(spec_query_1.norm);
638
+ if (!props.every(p => have.includes(p))) {
639
+ continue;
640
+ }
641
+ const sig = (entry.sig ?? []).map(([n, p]) => [n, function_semantics_1.FunctionSemantics.call.argument.words(p)]);
642
+ if (args !== undefined && (entry.sig === undefined || !(0, spec_query_1.matchArgs)(args, sig))) {
643
+ continue;
644
+ }
645
+ if (matches.length >= MaxMatches) {
646
+ truncated = true;
647
+ break;
648
+ }
649
+ matches.push({ package: pkg, name, exported: true, flowrOnly: true, ...(sig.length > 0 ? { parameters: sig.map(([n]) => n) } : {}) });
650
+ }
651
+ return { matches, matchCount: matches.length, searched: index.entries.length, truncated };
652
+ }
617
653
  /** run a wildcard search across the loaded sources: matching packages (no function), or matching functions */
618
654
  function searchSources(sources, allNames, q, literalFunction = false) {
619
655
  const cap = MaxMatches;
@@ -826,6 +862,9 @@ async function executeSignatureQuery({ analyzer }, queries) {
826
862
  const env = () => cleanEnv ??= ctx.env.makeCleanEnv();
827
863
  /* the built-in environment answers for the primitives no package's sources contain, see flowrOnlyFunctionInfo */
828
864
  const builtIn = (pkg, name) => flowrOnlyFunctionInfo(env(), pkg, name);
865
+ if (q.flowr !== undefined) {
866
+ return { ...meta(), ...searchBuiltInSpec(q.flowr, builtIns) };
867
+ }
829
868
  if (!q.package) {
830
869
  // shard load-state is only shown in the summary, so it is only worth its filesystem probes here
831
870
  return { ...meta(), shards: collectShardStatus(sources), builtInCount: builtIns.entries.length };
@@ -39,6 +39,12 @@ export interface SignatureQuery extends BaseQueryFormat {
39
39
  readonly parameters?: readonly string[];
40
40
  /** keep only functions with exactly this many required (no-default) parameters, excluding `...` */
41
41
  readonly requiredParameters?: number;
42
+ /**
43
+ * flowR's own view of a function as a spec, `name(arg, [role], name[role], *) [prop]`, like `p*([alias]) [invisible]`:
44
+ * keeps the functions flowR's built-in configuration states a matching name, argument roles (a `...` formal only
45
+ * counts when named), and call properties for. The same language as the signature database page.
46
+ */
47
+ readonly flowr?: string;
42
48
  /** for a single function, also render its transitive call graph as a mermaid.live link (`--cg`) */
43
49
  readonly callGraph?: boolean;
44
50
  /**
@@ -244,7 +250,7 @@ export declare const SignatureQueryDefinition: {
244
250
  readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../..").ReadonlyFlowrAnalysisProvider<import("../../..").KnownParser>, queryResults: BaseQueryResult, result: string[], _query: readonly import("../../query").Query[]) => true;
245
251
  readonly fromLine: typeof signatureQueryLineParser;
246
252
  readonly completer: typeof signatureQueryCompleter;
247
- readonly syntax: "@signature [<pkg>[@<version>]] [<pkg>::<fn> | <fn>] [--param <name>[,...]] [--required <n>] [--cg] [--cg-max <n>] [--help]";
253
+ readonly syntax: "@signature [<pkg>[@<version>]] [<pkg>::<fn> | <fn>] [--param <name>[,...]] [--required <n>] [<name>(<arg>, [<role>], *) [<prop>]] [--cg] [--cg-max <n>] [--help]";
248
254
  readonly schema: Joi.ObjectSchema<any>;
249
255
  readonly flattenInvolvedNodes: () => NodeId[];
250
256
  };
@@ -7,6 +7,7 @@ exports.SignatureQueryDefinition = exports.DefaultCallGraphMaxNodes = void 0;
7
7
  const query_print_1 = require("../../query-print");
8
8
  const joi_1 = __importDefault(require("joi"));
9
9
  const ansi_1 = require("../../../util/text/ansi");
10
+ const spec_query_1 = require("../../../project/sigdb/spec-query");
10
11
  const signature_query_executor_1 = require("./signature-query-executor");
11
12
  const signature_query_render_1 = require("./signature-query-render");
12
13
  /**
@@ -55,6 +56,18 @@ function signatureQueryLineParser(output, line, _config) {
55
56
  ...(callGraph ? { callGraph: true } : {}),
56
57
  ...(callGraphMaxNodes !== undefined && Number.isFinite(callGraphMaxNodes) ? { callGraphMaxNodes } : {})
57
58
  };
59
+ // a name with `(args)` and/or `[props]` constraints is the page's spec language, which spaces may split
60
+ const joined = positional.join(' ');
61
+ const spec = (0, spec_query_1.parseSpec)(joined);
62
+ const specLike = spec.args !== undefined || spec.props.length > 0 || /\(\s*\[|[\w*)]\s*\[[a-z]/i.test(joined);
63
+ const problems = specLike ? (0, spec_query_1.problemsOf)(joined) : [];
64
+ if (problems.length > 0) {
65
+ problems.forEach(p => output.stderr(`Invalid search: ${p}`));
66
+ return { query: [] };
67
+ }
68
+ if (spec.args !== undefined || spec.props.length > 0) {
69
+ return { query: [{ type: 'signature', package: '*', flowr: joined, ...paramFilters }] };
70
+ }
58
71
  const hasParamFilter = parameters.length > 0 || (requiredParameters !== undefined && !Number.isNaN(requiredParameters));
59
72
  const [first, second] = positional;
60
73
  if (!first) {
@@ -112,7 +125,7 @@ exports.SignatureQueryDefinition = {
112
125
  },
113
126
  fromLine: signatureQueryLineParser,
114
127
  completer: signature_query_executor_1.signatureQueryCompleter,
115
- syntax: '@signature [<pkg>[@<version>]] [<pkg>::<fn> | <fn>] [--param <name>[,...]] [--required <n>] [--cg] [--cg-max <n>] [--help]',
128
+ syntax: '@signature [<pkg>[@<version>]] [<pkg>::<fn> | <fn>] [--param <name>[,...]] [--required <n>] [<name>(<arg>, [<role>], *) [<prop>]] [--cg] [--cg-max <n>] [--help]',
116
129
  schema: joi_1.default.object({
117
130
  type: joi_1.default.string().valid('signature').required().description('The type of the query.'),
118
131
  package: joi_1.default.string().optional().description('The package to inspect (glob wildcards allowed); omit for a summary of the loaded databases.'),
@@ -120,6 +133,7 @@ exports.SignatureQueryDefinition = {
120
133
  version: joi_1.default.string().optional().description('A version spec: an exact version, a glob (3.*), a semver range (>=3.0.0, 3.x), or a release-date bound (<=2026, >=2021.05 in YYYY.MM.DD).'),
121
134
  parameters: joi_1.default.array().items(joi_1.default.string()).optional().description('Keep only functions that have a parameter matching every one of these names (glob wildcards allowed, position-independent).'),
122
135
  requiredParameters: joi_1.default.number().integer().min(0).optional().description('Keep only functions with exactly this many required (no-default) parameters, excluding `...`.'),
136
+ flowr: joi_1.default.string().optional().description('A spec over flowR\'s own built-in view: name(arg, [role], name[role], *) [prop], e.g. p*([alias]) [invisible].'),
123
137
  callGraph: joi_1.default.boolean().optional().description('For a single function, also render its transitive call graph as a mermaid.live link (`--cg`).'),
124
138
  callGraphMaxNodes: joi_1.default.number().min(1).optional().description(`How many nodes the rendered call graph may hold before the expansion stops (default ${exports.DefaultCallGraphMaxNodes}, \`--cg-max <n>\`).`)
125
139
  }).description('Inspects the loaded signature database(s): loaded databases, a package, a function, or wildcard matches (optionally filtered by parameter name or required-parameter count). Names no database records are answered from flowR\'s own built-in configuration instead and marked as such.'),
@@ -18,7 +18,7 @@ function printSignatureHelp(output) {
18
18
  const ex = (cmd, desc) => output.stdout(` ${(0, ansi_1.bold)(cmd, f)}\n ${(0, ansi_1.italic)(desc, f)}`);
19
19
  output.stdout((0, ansi_1.bold)('Signature Database Query', f) + (0, ansi_1.italic)(' (inspects the databases that resolve library()/`::` calls)', f));
20
20
  output.stdout('');
21
- output.stdout(`${(0, ansi_1.bold)('Usage', f)} :query @signature [<package>[@<version>][::<function>] [<function>]] [--param <name>]... [--required <n>] [--cg] [--cg-max <n>]`);
21
+ output.stdout(`${(0, ansi_1.bold)('Usage', f)} :query @signature [<package>[@<version>][::<function>] [<function>]] [--param <name>]... [--required <n>] [<name>(<arg>, [<role>], *) [<prop>]] [--cg] [--cg-max <n>]`);
22
22
  output.stdout('');
23
23
  output.stdout((0, ansi_1.bold)('Examples', f));
24
24
  ex(':query @signature', 'summarize the loaded databases');
@@ -28,6 +28,7 @@ function printSignatureHelp(output) {
28
28
  ex(':query @signature gg*@* geom_*', 'search every release in the history, not just the latest');
29
29
  ex(':query @signature ggplot2@<=2021.05', 'select releases by date (YYYY.MM.DD: <=2026, >=2021.05)');
30
30
  ex(':query @signature ggplot2 * --param data --param mapping', 'functions with both parameters (repeat/comma-separate --param; alone it searches all packages)');
31
+ ex(':query @signature p*([alias]) [invisible]', 'flowR\'s own view by argument roles and call properties: name(arg, [role], name[role], *) [prop]; `...` only counts when named');
31
32
  ex(':query @signature stats * --required 3', 'functions with exactly 3 required parameters');
32
33
  ex(':query @signature dplyr::lead --cg', 'a function plus its transitive call graph as a mermaid.live link');
33
34
  ex(':query @signature dplyr::lead --cg-max 80', 'the same, capped at 80 nodes instead of the default');
@@ -5,6 +5,7 @@ exports.executeStaticSliceQuery = executeStaticSliceQuery;
5
5
  const static_slicer_1 = require("../../../slicing/static/static-slicer");
6
6
  const slice_query_options_1 = require("../slice-query-options");
7
7
  const log_1 = require("../../../util/log");
8
+ const query_meta_1 = require("../../query-meta");
8
9
  const slice_direction_1 = require("../../../util/slice-direction");
9
10
  const df_helper_1 = require("../../../dataflow/graph/df-helper");
10
11
  const removal_slice_1 = require("../../../slicing/static/removal-slice");
@@ -51,9 +52,7 @@ async function executeStaticSliceQuery({ analyzer }, queries) {
51
52
  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)) };
52
53
  }
53
54
  return {
54
- '.meta': {
55
- timing: Date.now() - start
56
- },
55
+ ...(0, query_meta_1.metaSince)(start),
57
56
  results
58
57
  };
59
58
  }