@eagleoutice/flowr 2.16.2 → 2.16.3

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 (445) hide show
  1. package/README.md +10 -10
  2. package/abstract-interpretation/data-frame/arguments.js +4 -3
  3. package/abstract-interpretation/data-frame/dataframe-semantics.js +1 -2
  4. package/abstract-interpretation/data-frame/semantics.d.ts +2 -2
  5. package/abstract-interpretation/data-frame/semantics.js +2 -6
  6. package/benchmark/slicer.js +1 -3
  7. package/benchmark/summarizer/first-phase/input.js +1 -12
  8. package/benchmark/summarizer/second-phase/process.d.ts +7 -0
  9. package/benchmark/summarizer/second-phase/process.js +15 -12
  10. package/cli/repl/commands/repl-cfg.js +18 -49
  11. package/cli/repl/commands/repl-clipboard.d.ts +2 -0
  12. package/cli/repl/commands/repl-clipboard.js +5 -0
  13. package/cli/repl/commands/repl-commands.js +2 -2
  14. package/cli/repl/commands/repl-dataflow.js +21 -55
  15. package/cli/repl/commands/repl-normalize.js +15 -28
  16. package/cli/repl/commands/repl-parse.js +2 -2
  17. package/cli/repl/commands/repl-query.js +10 -10
  18. package/cli/repl/commands/repl-signature.js +4 -4
  19. package/cli/repl/server/connection.d.ts +1 -0
  20. package/cli/repl/server/connection.js +8 -30
  21. package/cli/repl/server/messages/message-analysis.js +1 -1
  22. package/config.d.ts +6 -0
  23. package/config.js +7 -4
  24. package/control-flow/cfg-dead-code.js +5 -14
  25. package/control-flow/cfg-to-basic-blocks.js +1 -6
  26. package/control-flow/control-flow-graph.d.ts +2 -16
  27. package/control-flow/control-flow-graph.js +8 -66
  28. package/control-flow/diff-cfg.js +10 -23
  29. package/control-flow/semantic-cfg-guided-visitor.js +5 -11
  30. package/control-flow/simple-visitor.js +2 -2
  31. package/core/steps/pipeline/default-pipelines.d.ts +138 -138
  32. package/data/r-base-packages.generated.js +0 -1
  33. package/data/r-base-primitives.generated.js +0 -1
  34. package/data/r-s3-generics.generated.d.ts +5 -0
  35. package/data/r-s3-generics.generated.js +103 -0
  36. package/dataflow/cluster.js +2 -1
  37. package/dataflow/environments/append.d.ts +1 -0
  38. package/dataflow/environments/built-in-props.d.ts +10 -0
  39. package/dataflow/environments/built-in-props.js +25 -1
  40. package/dataflow/environments/built-in.js +15 -9
  41. package/dataflow/environments/clone.d.ts +1 -0
  42. package/dataflow/environments/clone.js +1 -0
  43. package/dataflow/environments/default-builtin-config.d.ts +188 -14
  44. package/dataflow/environments/default-builtin-config.js +125 -65
  45. package/dataflow/environments/define.d.ts +1 -0
  46. package/dataflow/environments/define.js +1 -0
  47. package/dataflow/environments/environment.d.ts +27 -0
  48. package/dataflow/environments/environment.js +37 -16
  49. package/dataflow/environments/frame-memory.d.ts +9 -1
  50. package/dataflow/environments/frame-memory.js +12 -1
  51. package/dataflow/environments/identifier.d.ts +0 -2
  52. package/dataflow/environments/identifier.js +5 -7
  53. package/dataflow/environments/overwrite.js +1 -0
  54. package/dataflow/environments/query-fn-props.js +2 -3
  55. package/dataflow/environments/scoping.d.ts +3 -0
  56. package/dataflow/environments/scoping.js +3 -0
  57. package/dataflow/eval/resolve/alias-tracking.js +3 -3
  58. package/dataflow/eval/resolve/resolve-argument.d.ts +7 -3
  59. package/dataflow/eval/resolve/resolve-argument.js +16 -11
  60. package/dataflow/eval/resolve/resolve-numbers.js +5 -2
  61. package/dataflow/eval/resolve/resolve-strings.d.ts +1 -1
  62. package/dataflow/eval/resolve/resolve-working-directory.js +2 -2
  63. package/dataflow/eval/resolve/resolve.js +1 -2
  64. package/dataflow/eval/values/intervals/interval-constants.js +1 -6
  65. package/dataflow/eval/values/r-value.js +1 -6
  66. package/dataflow/extractor.js +17 -17
  67. package/dataflow/fn/argument-roles.js +15 -15
  68. package/dataflow/fn/class-declaration.js +7 -7
  69. package/dataflow/fn/frame-reflection.d.ts +1 -23
  70. package/dataflow/fn/frame-reflection.js +8 -95
  71. package/dataflow/fn/function-props.d.ts +0 -3
  72. package/dataflow/fn/function-props.js +9 -11
  73. package/dataflow/fn/function-semantics.d.ts +1 -0
  74. package/dataflow/fn/strict-function.js +15 -14
  75. package/dataflow/graph/call-graph.d.ts +8 -0
  76. package/dataflow/graph/call-graph.js +40 -25
  77. package/dataflow/graph/dataflowgraph-builder.d.ts +0 -60
  78. package/dataflow/graph/dataflowgraph-builder.js +15 -135
  79. package/dataflow/graph/df-helper.d.ts +56 -4
  80. package/dataflow/graph/df-helper.js +116 -1
  81. package/dataflow/graph/diff-dataflow-graph.js +13 -15
  82. package/dataflow/graph/graph-helper.d.ts +20 -0
  83. package/dataflow/graph/graph-helper.js +18 -0
  84. package/dataflow/graph/graph.js +3 -8
  85. package/dataflow/graph/match-args.d.ts +1 -1
  86. package/dataflow/graph/match-args.js +3 -3
  87. package/dataflow/internal/linker.d.ts +4 -10
  88. package/dataflow/internal/linker.js +21 -29
  89. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -8
  90. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +5 -2
  91. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +39 -22
  92. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -21
  93. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +3 -7
  94. package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.js +6 -11
  95. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -8
  96. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -13
  97. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +27 -13
  98. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +6 -8
  99. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +33 -35
  100. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +3 -5
  101. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +6 -7
  102. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +12 -5
  103. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +3 -4
  104. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +7 -8
  105. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -6
  106. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +3 -4
  107. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -3
  108. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -7
  109. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +6 -5
  110. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -2
  111. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -6
  112. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +4 -4
  113. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +7 -7
  114. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +1 -2
  115. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -3
  116. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
  117. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +5 -7
  118. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +1 -1
  119. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +4 -5
  120. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +8 -9
  121. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
  122. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +3 -3
  123. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +36 -38
  124. package/dataflow/internal/process/functions/call/common.d.ts +3 -1
  125. package/dataflow/internal/process/functions/call/common.js +6 -7
  126. package/dataflow/internal/process/functions/call/deferred.js +8 -8
  127. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +11 -4
  128. package/dataflow/internal/process/functions/call/known-call-handling.js +11 -7
  129. package/dataflow/internal/process/functions/call/named-call-handling.js +4 -3
  130. package/dataflow/internal/process/functions/call/nse.js +4 -4
  131. package/dataflow/internal/process/functions/call/quoted.js +16 -14
  132. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
  133. package/dataflow/internal/process/functions/process-parameter.js +2 -2
  134. package/dataflow/internal/process/process-named-call.js +1 -1
  135. package/dataflow/origin/dfg-get-origin.js +2 -2
  136. package/dataflow/origin/dfg-get-symbol-refs.d.ts +1 -0
  137. package/dataflow/origin/dfg-get-symbol-refs.js +3 -8
  138. package/documentation/data/faq/wiki-faq-store.js +2 -2
  139. package/documentation/doc-capabilities.js +2 -1
  140. package/documentation/doc-util/doc-functions.js +2 -2
  141. package/documentation/doc-util/doc-repl.js +4 -4
  142. package/documentation/doc-util/doc-types.js +2 -2
  143. package/documentation/wiki-absint.js +2 -1
  144. package/documentation/wiki-cfg.js +2 -1
  145. package/documentation/wiki-create-linting-rules.js +1 -1
  146. package/documentation/wiki-dataflow-graph.js +6 -6
  147. package/documentation/wiki-interface.js +3 -2
  148. package/documentation/wiki-linter.js +54 -4
  149. package/documentation/wiki-mk/doc-maker.js +1 -2
  150. package/documentation/wiki-query.js +25 -0
  151. package/documentation/wiki-search.js +2 -1
  152. package/documentation/wiki-signature-database.js +0 -2
  153. package/linter/linter-executor.js +4 -0
  154. package/linter/linter-rules.d.ts +518 -1
  155. package/linter/linter-rules.js +39 -1
  156. package/linter/linter-tags.d.ts +6 -0
  157. package/linter/linter-tags.js +6 -0
  158. package/linter/rules/absolute-path.js +4 -3
  159. package/linter/rules/cmd-check/bogus-return.d.ts +29 -0
  160. package/linter/rules/cmd-check/bogus-return.js +63 -0
  161. package/linter/rules/cmd-check/call-arguments.d.ts +63 -0
  162. package/linter/rules/cmd-check/call-arguments.js +211 -0
  163. package/linter/rules/cmd-check/class-string-comparison.d.ts +48 -0
  164. package/linter/rules/cmd-check/class-string-comparison.js +135 -0
  165. package/linter/rules/cmd-check/cmd-check-util.d.ts +67 -0
  166. package/linter/rules/cmd-check/cmd-check-util.js +169 -0
  167. package/linter/rules/cmd-check/compiled-code.d.ts +86 -0
  168. package/linter/rules/cmd-check/compiled-code.js +350 -0
  169. package/linter/rules/cmd-check/conformance.d.ts +47 -0
  170. package/linter/rules/cmd-check/conformance.js +166 -0
  171. package/linter/rules/cmd-check/dependency-declaration.d.ts +95 -0
  172. package/linter/rules/cmd-check/dependency-declaration.js +299 -0
  173. package/linter/rules/cmd-check/description-metadata.d.ts +63 -0
  174. package/linter/rules/cmd-check/description-metadata.js +393 -0
  175. package/linter/rules/cmd-check/documentation-mismatch.d.ts +54 -0
  176. package/linter/rules/cmd-check/documentation-mismatch.js +407 -0
  177. package/linter/rules/cmd-check/file-checks.d.ts +29 -0
  178. package/linter/rules/cmd-check/file-checks.js +34 -0
  179. package/linter/rules/cmd-check/foreign-function-calls.d.ts +54 -0
  180. package/linter/rules/cmd-check/foreign-function-calls.js +115 -0
  181. package/linter/rules/cmd-check/global-environment-modification.d.ts +61 -0
  182. package/linter/rules/cmd-check/global-environment-modification.js +237 -0
  183. package/linter/rules/cmd-check/namespace-tampering.d.ts +52 -0
  184. package/linter/rules/cmd-check/namespace-tampering.js +162 -0
  185. package/linter/rules/cmd-check/non-ascii-code.d.ts +51 -0
  186. package/linter/rules/cmd-check/non-ascii-code.js +112 -0
  187. package/linter/rules/cmd-check/package-code.d.ts +30 -0
  188. package/linter/rules/cmd-check/package-code.js +141 -0
  189. package/linter/rules/cmd-check/package-data.d.ts +49 -0
  190. package/linter/rules/cmd-check/package-data.js +181 -0
  191. package/linter/rules/cmd-check/package-files.d.ts +41 -0
  192. package/linter/rules/cmd-check/package-files.js +157 -0
  193. package/linter/rules/cmd-check/package-hooks.d.ts +57 -0
  194. package/linter/rules/cmd-check/package-hooks.js +165 -0
  195. package/linter/rules/cmd-check/package-metafiles.d.ts +49 -0
  196. package/linter/rules/cmd-check/package-metafiles.js +292 -0
  197. package/linter/rules/cmd-check/package-runtime.d.ts +67 -0
  198. package/linter/rules/cmd-check/package-runtime.js +284 -0
  199. package/linter/rules/cmd-check/package-structure.d.ts +85 -0
  200. package/linter/rules/cmd-check/package-structure.js +320 -0
  201. package/linter/rules/cmd-check/rd-files.d.ts +67 -0
  202. package/linter/rules/cmd-check/rd-files.js +621 -0
  203. package/linter/rules/cmd-check/s-three-method-consistency.d.ts +72 -0
  204. package/linter/rules/cmd-check/s-three-method-consistency.js +206 -0
  205. package/linter/rules/cmd-check/true-false-abbreviation.d.ts +45 -0
  206. package/linter/rules/cmd-check/true-false-abbreviation.js +121 -0
  207. package/linter/rules/deprecated-functions.js +4 -4
  208. package/linter/rules/naming-convention.d.ts +1 -1
  209. package/linter/rules/naming-convention.js +13 -14
  210. package/linter/rules/no-leaked-credentials.js +4 -4
  211. package/linter/rules/problematic-inputs.js +2 -1
  212. package/linter/rules/seeded-randomness.js +5 -5
  213. package/linter/rules/software-has-license.d.ts +1 -1
  214. package/linter/rules/software-has-license.js +1 -1
  215. package/linter/rules/unclosed-connection.js +3 -3
  216. package/linter/rules/undefined-symbol-util.js +16 -32
  217. package/linter/rules/undefined-symbol.d.ts +2 -0
  218. package/linter/rules/undefined-symbol.js +33 -3
  219. package/linter/rules/unescaped-arguments.js +10 -9
  220. package/linter/rules/unused-definition.js +13 -19
  221. package/package.json +1 -1
  222. package/project/cache/flowr-analyzer-cache.js +1 -1
  223. package/project/context/flowr-analyzer-context.js +1 -1
  224. package/project/context/flowr-analyzer-environment-context.d.ts +1 -1
  225. package/project/context/flowr-analyzer-files-context.d.ts +6 -0
  226. package/project/context/flowr-analyzer-files-context.js +3 -0
  227. package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +0 -2
  228. package/project/context/flowr-analyzer-incremental-analysis-context.js +0 -4
  229. package/project/context/flowr-file.d.ts +4 -0
  230. package/project/context/flowr-file.js +4 -0
  231. package/project/flowr-analyzer-builder.js +1 -1
  232. package/project/plugins/file-plugins/files/flowr-description-file.js +2 -2
  233. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -0
  234. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +4 -0
  235. package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +2 -0
  236. package/project/plugins/file-plugins/files/flowr-manifest-files.js +11 -14
  237. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +3 -0
  238. package/project/plugins/file-plugins/files/flowr-namespace-file.js +25 -15
  239. package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +44 -0
  240. package/project/plugins/file-plugins/files/flowr-rd-file.js +130 -61
  241. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +0 -1
  242. package/project/plugins/file-plugins/files/flowr-rda-file.js +4 -16
  243. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +2 -0
  244. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +4 -0
  245. package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +2 -0
  246. package/project/plugins/file-plugins/files/flowr-sweave-file.js +4 -0
  247. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +0 -1
  248. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -5
  249. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +2 -0
  250. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -0
  251. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +3 -7
  252. package/project/sigdb/build.js +16 -30
  253. package/project/sigdb/dict.d.ts +4 -6
  254. package/project/sigdb/dict.js +125 -31
  255. package/project/sigdb/reader.js +2 -18
  256. package/project/sigdb/sigdb-download.js +14 -23
  257. package/queries/base-query-format.d.ts +2 -0
  258. package/queries/base-query-format.js +10 -2
  259. package/queries/catalog/absint-query/absint-query-format.d.ts +1 -1
  260. package/queries/catalog/absint-query/absint-query-format.js +5 -7
  261. package/queries/catalog/call-context-query/call-context-query-executor.js +24 -32
  262. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
  263. package/queries/catalog/call-context-query/call-context-query-format.js +1 -3
  264. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -4
  265. package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +1 -4
  266. package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -3
  267. package/queries/catalog/config-query/config-query-format.js +3 -3
  268. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -3
  269. package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -3
  270. package/queries/catalog/dependencies-query/data-flow.d.ts +43 -0
  271. package/queries/catalog/dependencies-query/data-flow.js +173 -0
  272. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +18 -0
  273. package/queries/catalog/dependencies-query/dependencies-query-executor.js +108 -12
  274. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +17 -1
  275. package/queries/catalog/dependencies-query/dependencies-query-format.js +14 -11
  276. package/queries/catalog/dependencies-query/function-info/derived-functions.js +2 -1
  277. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +2 -0
  278. package/queries/catalog/dependencies-query/function-info/library-functions.js +13 -13
  279. package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
  280. package/queries/catalog/dependencies-query/function-info/remote-functions.js +3 -3
  281. package/queries/catalog/dependencies-query/function-info/source-functions.js +2 -2
  282. package/queries/catalog/dependencies-query/function-info/test-functions.js +8 -8
  283. package/queries/catalog/dependencies-query/function-info/transform-functions.d.ts +8 -0
  284. package/queries/catalog/dependencies-query/function-info/transform-functions.js +17 -0
  285. package/queries/catalog/dependencies-query/function-info/write-functions.js +4 -0
  286. package/queries/catalog/dependencies-query/implicit-echo.d.ts +5 -3
  287. package/queries/catalog/dependencies-query/implicit-echo.js +33 -34
  288. package/queries/catalog/dependencies-query/link-devices.d.ts +3 -2
  289. package/queries/catalog/dependencies-query/link-devices.js +9 -6
  290. package/queries/catalog/dependencies-query/plot-description.d.ts +10 -0
  291. package/queries/catalog/dependencies-query/plot-description.js +119 -0
  292. package/queries/catalog/dependencies-query/plot-objects.d.ts +13 -0
  293. package/queries/catalog/dependencies-query/plot-objects.js +61 -0
  294. package/queries/catalog/dice-query/dice-query-format.d.ts +2 -2
  295. package/queries/catalog/dice-query/dice-query-format.js +3 -40
  296. package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -1
  297. package/queries/catalog/does-call-query/does-call-query-format.js +2 -2
  298. package/queries/catalog/function-info-query/function-info-query-format.js +2 -2
  299. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +2 -1
  300. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +2 -2
  301. package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -2
  302. package/queries/catalog/id-map-query/id-map-query-format.js +1 -3
  303. package/queries/catalog/input-sources-query/input-sources-query-executor.js +2 -2
  304. package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -3
  305. package/queries/catalog/input-sources-query/simple-input-classifier.js +28 -29
  306. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +4 -7
  307. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +1 -1
  308. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +3 -2
  309. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +2 -2
  310. package/queries/catalog/linter-query/linter-query-executor.js +10 -3
  311. package/queries/catalog/linter-query/linter-query-format.d.ts +4 -1
  312. package/queries/catalog/linter-query/linter-query-format.js +32 -21
  313. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  314. package/queries/catalog/location-map-query/location-map-query-format.js +1 -3
  315. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -3
  316. package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
  317. package/queries/catalog/origin-query/origin-query-executor.js +3 -3
  318. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
  319. package/queries/catalog/origin-query/origin-query-format.js +4 -5
  320. package/queries/catalog/project-query/project-query-format.js +2 -2
  321. package/queries/catalog/provenance-query/provenance-query-format.js +2 -3
  322. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  323. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -4
  324. package/queries/catalog/search-query/search-query-format.js +1 -3
  325. package/queries/catalog/signature-query/signature-query-executor.js +3 -3
  326. package/queries/catalog/signature-query/signature-query-format.js +2 -2
  327. package/queries/catalog/slice-query-options.d.ts +16 -0
  328. package/queries/catalog/slice-query-options.js +28 -0
  329. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -2
  330. package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -42
  331. package/queries/query-print.d.ts +4 -0
  332. package/queries/query-print.js +17 -1
  333. package/queries/query.d.ts +3 -3
  334. package/queries/query.js +3 -4
  335. package/r-bridge/lang-4.x/ast/model/model.d.ts +27 -3
  336. package/r-bridge/lang-4.x/ast/model/model.js +28 -1
  337. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
  338. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
  339. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -0
  340. package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +1 -0
  341. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +20 -1
  342. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +25 -1
  343. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -0
  344. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +1 -0
  345. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -0
  346. package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +1 -0
  347. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -0
  348. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +1 -0
  349. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -0
  350. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +1 -0
  351. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -0
  352. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +1 -0
  353. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +18 -2
  354. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +15 -6
  355. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -0
  356. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +1 -0
  357. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -0
  358. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +1 -0
  359. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -0
  360. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +1 -0
  361. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -0
  362. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +1 -0
  363. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -0
  364. package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +1 -0
  365. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -0
  366. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +1 -0
  367. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -0
  368. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +1 -0
  369. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -0
  370. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +1 -0
  371. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -0
  372. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +1 -0
  373. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +17 -0
  374. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +20 -0
  375. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -0
  376. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -0
  377. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -0
  378. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +1 -0
  379. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -0
  380. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +1 -0
  381. package/r-bridge/lang-4.x/ast/model/operators.js +0 -2
  382. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -6
  383. package/r-bridge/lang-4.x/ast/model/processing/fold.js +1 -6
  384. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +4 -3
  385. package/r-bridge/lang-4.x/ast/parser/json/format.js +2 -2
  386. package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +1 -5
  387. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -2
  388. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +4 -20
  389. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -5
  390. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-next.js +1 -5
  391. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +1 -5
  392. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +2 -9
  393. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -5
  394. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +2 -10
  395. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -11
  396. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +3 -11
  397. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -5
  398. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -5
  399. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -5
  400. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +6 -1
  401. package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +7 -0
  402. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +0 -10
  403. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +30 -82
  404. package/r-bridge/retriever.d.ts +0 -4
  405. package/r-bridge/retriever.js +0 -13
  406. package/r-bridge/roxygen2/documentation-provider.js +3 -7
  407. package/r-bridge/shell.js +3 -8
  408. package/reconstruct/auto-select/magic-comments.js +8 -7
  409. package/reconstruct/inline/source-inline-map.d.ts +3 -0
  410. package/reconstruct/inline/source-inline-map.js +8 -7
  411. package/reconstruct/reconstruct.d.ts +1 -1
  412. package/reconstruct/reconstruct.js +33 -109
  413. package/search/flowr-search-printer.js +4 -15
  414. package/search/search-executor/search-generators.js +1 -1
  415. package/slicing/criterion/filters/all-variables.js +1 -2
  416. package/slicing/static/fingerprint.js +11 -2
  417. package/slicing/static/slice-call.d.ts +2 -8
  418. package/slicing/static/slice-call.js +8 -18
  419. package/slicing/static/static-slicer.js +81 -6
  420. package/util/collections/arrays.js +1 -1
  421. package/util/collections/set.js +1 -1
  422. package/util/diff-graph.d.ts +4 -0
  423. package/util/diff-graph.js +12 -0
  424. package/util/files.js +2 -6
  425. package/util/json.js +1 -15
  426. package/util/mermaid/cfg.js +10 -17
  427. package/util/mermaid/dfg.js +6 -8
  428. package/util/objects.d.ts +1 -1
  429. package/util/quads.js +4 -13
  430. package/util/r-author.js +5 -5
  431. package/util/range.d.ts +9 -0
  432. package/util/range.js +11 -0
  433. package/util/schema.js +3 -3
  434. package/util/simple-df/dfg-view.js +2 -1
  435. package/util/text/ansi.js +1 -2
  436. package/util/text/playground-link.js +2 -1
  437. package/util/text/r-highlight.js +2 -1
  438. package/util/text/strings.d.ts +2 -0
  439. package/util/text/strings.js +5 -0
  440. package/util/text/time.js +1 -2
  441. package/util/version.js +4 -3
  442. package/dataflow/fn/recursive-function.d.ts +0 -6
  443. package/dataflow/fn/recursive-function.js +0 -32
  444. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +0 -16
  445. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +0 -27
@@ -1,14 +1,25 @@
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 });
6
+ exports.queryHeader = queryHeader;
3
7
  exports.asciiCallContext = asciiCallContext;
4
8
  exports.summarizeIdsIfTooLong = summarizeIdsIfTooLong;
5
9
  exports.asciiSummaryOfQueryResult = asciiSummaryOfQueryResult;
10
+ exports.missingRootsWithoutRequests = missingRootsWithoutRequests;
11
+ const range_1 = require("../util/range");
6
12
  const ansi_1 = require("../util/text/ansi");
7
13
  const query_1 = require("./query");
8
14
  const node_id_1 = require("../r-bridge/lang-4.x/ast/model/processing/node-id");
9
15
  const html_hover_over_1 = require("../util/html-hover-over");
10
16
  const time_1 = require("../util/text/time");
11
17
  const model_1 = require("../r-bridge/lang-4.x/ast/model/model");
18
+ const fs_1 = __importDefault(require("fs"));
19
+ /** The first line of a query's ascii summary: its name and how long it took. */
20
+ function queryHeader(name, formatter, timing) {
21
+ return `Query: ${(0, ansi_1.bold)(name, formatter)} (${(0, time_1.printAsMs)(timing, 0)})`;
22
+ }
12
23
  function nodeString(nodeId, formatter, idMap) {
13
24
  const isObj = typeof nodeId === 'object' && nodeId !== null && 'id' in nodeId;
14
25
  const id = isObj ? nodeId?.id : nodeId;
@@ -20,7 +31,7 @@ function nodeString(nodeId, formatter, idMap) {
20
31
  if (node === undefined) {
21
32
  return `UNKNOWN: ${id} (info: ${JSON.stringify(info)})`;
22
33
  }
23
- return `${(0, ansi_1.italic)('`' + (model_1.RNode.lexeme(node) ?? 'UNKNOWN') + '`', formatter)} (L.${node.location?.[0]}${info ? ', ' + JSON.stringify(info) : ''})`;
34
+ return `${(0, ansi_1.italic)('`' + (model_1.RNode.lexeme(node) ?? 'UNKNOWN') + '`', formatter)} (L.${range_1.SourceRange.getStartLine(node.location)}${info ? ', ' + JSON.stringify(info) : ''})`;
24
35
  }
25
36
  function asciiCallContextSubHit(formatter, results, idMap) {
26
37
  const result = [];
@@ -123,4 +134,9 @@ async function asciiSummaryOfQueryResult(formatter, totalInMs, results, analyzer
123
134
  }
124
135
  return formatter.format(result.join('\n'));
125
136
  }
137
+ /** The requested roots that do not exist, if the analyzer found no requests to analyze at all (`undefined` otherwise). */
138
+ function missingRootsWithoutRequests(analyzer) {
139
+ const files = analyzer.inspectContext().files;
140
+ return !files.hasRequests() ? files.getRequestedRoots().filter(p => !fs_1.default.existsSync(p)) : undefined;
141
+ }
126
142
  //# sourceMappingURL=query-print.js.map
@@ -181,7 +181,7 @@ export declare const SupportedQueries: {
181
181
  readonly 'static-slice': {
182
182
  readonly title: "Static Slice Query";
183
183
  readonly executor: typeof import("./catalog/static-slice-query/static-slice-query-executor").executeStaticSliceQuery;
184
- readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
184
+ readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => boolean;
185
185
  readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"static-slice">;
186
186
  readonly completer: typeof import("../cli/repl/parser/slice-query-parser").criteriaQueryCompleter;
187
187
  readonly syntax: "@static-slice (<crit>;...)[fiIcB] <code | file://path>";
@@ -320,7 +320,7 @@ export declare const SupportedQueries: {
320
320
  readonly asciiSummarizer: (formatter: OutputFormatter, analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
321
321
  readonly completer: (line: readonly string[], startingNewArg: boolean, _config: FlowrConfig) => CommandCompletions;
322
322
  readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"linter">;
323
- readonly syntax: "@linter [rules:<r1>,<r2>,...] [format:<fmt>] <code | file://path>";
323
+ readonly syntax: "@linter [rules:<r1>,<r2>,...] [tags:<t1>,...] [format:<fmt>] <code | file://path>";
324
324
  readonly schema: Joi.ObjectSchema<any>;
325
325
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult, _queries: readonly Query[], certainty: LintingResultCertainty | undefined) => ((string & {
326
326
  __brand?: "node-id";
@@ -331,7 +331,7 @@ export declare const SupportedQueries: {
331
331
  readonly dice: {
332
332
  readonly title: "Dice Query";
333
333
  readonly executor: typeof import("./catalog/dice-query/dice-query-executor").executeDiceQuery;
334
- readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
334
+ readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("..").KnownParser>, queryResults: BaseQueryResult, result: string[]) => boolean;
335
335
  readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"dice">;
336
336
  readonly completer: (line: readonly string[], startingNewArg: boolean, _config: FlowrConfig) => CommandCompletions;
337
337
  readonly syntax: "@dice (<crit>;...->crit;...)[iIcB] <code | file://path>";
package/queries/query.js CHANGED
@@ -37,7 +37,7 @@ const control_flow_query_format_1 = require("./catalog/control-flow-query/contro
37
37
  const objects_1 = require("../util/objects");
38
38
  const inspect_higher_order_query_format_1 = require("./catalog/inspect-higher-order-query/inspect-higher-order-query-format");
39
39
  const log_1 = require("../util/log");
40
- const fs_1 = __importDefault(require("fs"));
40
+ const query_print_1 = require("./query-print");
41
41
  const files_query_format_1 = require("./catalog/files-query/files-query-format");
42
42
  const call_graph_query_format_1 = require("./catalog/call-graph-query/call-graph-query-format");
43
43
  const inspect_recursion_query_format_1 = require("./catalog/inspect-recursion-query/inspect-recursion-query-format");
@@ -213,9 +213,8 @@ async function genericWrapReplFailIfNoRequest(fn, output, analyzer) {
213
213
  return await fn();
214
214
  }
215
215
  catch (e) {
216
- const files = analyzer.inspectContext().files;
217
- if (files.loadingOrder.getUnorderedRequests().length === 0) {
218
- const missing = files.getRequestedRoots().filter(p => !fs_1.default.existsSync(p));
216
+ const missing = (0, query_print_1.missingRootsWithoutRequests)(analyzer);
217
+ if (missing !== undefined) {
219
218
  if (missing.length > 0) {
220
219
  output.stderr(output.formatter.format(`Path does not exist: ${missing.map(p => `'${p}'`).join(', ')}`, { color: 1 /* Colors.Red */, style: 1 /* FontStyles.Bold */, effect: ansi_1.ColorEffect.Foreground }));
221
220
  return;
@@ -81,8 +81,7 @@ export interface WithChildren<Info, Children extends RAstNodeBase<Info, string |
81
81
  * as it is equivalent to the {@link RAstNodeBase} interface.
82
82
  * It is intended to help humans understand the code.
83
83
  */
84
- export interface Leaf<Info = NoInfo, LexemeType = string> extends RAstNodeBase<Info, LexemeType> {
85
- }
84
+ export type Leaf<Info = NoInfo, LexemeType = string> = RAstNodeBase<Info, LexemeType>;
86
85
  /**
87
86
  * Indicates, that the respective {@link RAstNodeBase} node has known source code
88
87
  * location information.
@@ -107,6 +106,7 @@ export type NamespaceIdentifier = string;
107
106
  export type RConstant<Info> = RNumber<Info> | RString<Info> | RLogical<Info>;
108
107
  /**
109
108
  * Helper object to provide helper functions for {@link RConstant|RConstants}.
109
+ * @helper ast
110
110
  * @see {@link RNode} - for more general helper functions for all nodes
111
111
  */
112
112
  export declare const RConstant: {
@@ -128,6 +128,7 @@ export declare const RConstant: {
128
128
  export type RSingleNode<Info> = RComment<Info> | RSymbol<Info> | RConstant<Info> | RBreak<Info> | RNext<Info> | RLineDirective<Info>;
129
129
  /**
130
130
  * Represents a leaf node in the normalized AST, i.e. a node that does not have any children. This includes comment, symbol, constant, break, next, and line directive nodes.
131
+ * @helper ast
131
132
  */
132
133
  export declare const RSingleNode: {
133
134
  readonly name: "RSingleNode";
@@ -145,6 +146,10 @@ export declare const RSingleNode: {
145
146
  * This subtype of {@link RNode} represents all looping constructs in the normalized AST.
146
147
  */
147
148
  export type RLoopConstructs<Info> = RForLoop<Info> | RRepeatLoop<Info> | RWhileLoop<Info>;
149
+ /**
150
+ * Helper for working with {@link RLoopConstructs} AST nodes.
151
+ * @helper ast
152
+ */
148
153
  export declare const RLoopConstructs: {
149
154
  readonly name: "RLoopConstructs";
150
155
  /**
@@ -162,6 +167,10 @@ export declare const RLoopConstructs: {
162
167
  * the {@link RIfThenElse} construct as well.
163
168
  */
164
169
  export type RConstructs<Info> = RLoopConstructs<Info> | RIfThenElse<Info>;
170
+ /**
171
+ * Helper for working with {@link RConstructs} AST nodes.
172
+ * @helper ast
173
+ */
165
174
  export declare const RConstructs: {
166
175
  readonly name: "RConstructs";
167
176
  /**
@@ -179,6 +188,10 @@ export declare const RConstructs: {
179
188
  * (calls and definitions) in the normalized AST.
180
189
  */
181
190
  export type RFunctions<Info> = RFunctionDefinition<Info> | RFunctionCall<Info> | RParameter<Info> | RArgument<Info>;
191
+ /**
192
+ * Helper for working with {@link RFunctions} AST nodes.
193
+ * @helper ast
194
+ */
182
195
  export declare const RFunctions: {
183
196
  readonly name: "RFunctions";
184
197
  /**
@@ -196,6 +209,10 @@ export declare const RFunctions: {
196
209
  * nodes in the normalized AST. At the moment these are the comment-like nodes.
197
210
  */
198
211
  export type ROther<Info> = RComment<Info> | RLineDirective<Info>;
212
+ /**
213
+ * Helper for working with {@link ROther} AST nodes.
214
+ * @helper ast
215
+ */
199
216
  export declare const ROther: {
200
217
  readonly name: "ROther";
201
218
  /**
@@ -315,12 +332,19 @@ export declare const RNode: {
315
332
  */
316
333
  readonly collectAllIdsWithStop: <OtherInfo>(this: void, nodes: SingleOrArrayOrNothing<RNode<OtherInfo & ParentInformation>>, stop: (node: RNode<OtherInfo & ParentInformation>) => boolean) => Set<NodeId>;
317
334
  /**
318
- * A helper function to retrieve the lexeme of a given node, if available.
335
+ * The code a given node spans, if available.
319
336
  * If the `fullLexeme` is available, it will be returned, otherwise the `lexeme` will be returned.
337
+ * @see {@link RNode.ownLexeme} - for the token the node is made of
320
338
  */
321
339
  readonly lexeme: <R extends RNode<ParentInformation>>(this: void, node: R | undefined) => R extends {
322
340
  lexeme: string;
323
341
  } ? string : string | undefined;
342
+ /**
343
+ * The lexeme of the token the node is made of, e.g., the name of a call rather than the call as a whole.
344
+ * Only if the node has none of its own, the `fullLexeme` is used.
345
+ * @see {@link RNode.lexeme} - for the code the node spans
346
+ */
347
+ readonly ownLexeme: (this: void, node: RNode<ParentInformation> | undefined) => string | undefined;
324
348
  /**
325
349
  * Return the (roxygen) documentation associated with the given node, if available.
326
350
  * @see {@link getDocumentationOf}
@@ -10,6 +10,7 @@ const assert_1 = require("../../../../util/assert");
10
10
  const documentation_provider_1 = require("../../../roxygen2/documentation-provider");
11
11
  /**
12
12
  * Helper object to provide helper functions for {@link RConstant|RConstants}.
13
+ * @helper ast
13
14
  * @see {@link RNode} - for more general helper functions for all nodes
14
15
  */
15
16
  exports.RConstant = {
@@ -28,6 +29,7 @@ exports.RConstant = {
28
29
  };
29
30
  /**
30
31
  * Represents a leaf node in the normalized AST, i.e. a node that does not have any children. This includes comment, symbol, constant, break, next, and line directive nodes.
32
+ * @helper ast
31
33
  */
32
34
  exports.RSingleNode = {
33
35
  name: 'RSingleNode',
@@ -43,6 +45,10 @@ exports.RSingleNode = {
43
45
  */
44
46
  singleNodeTypes: new Set([type_1.RType.Comment, type_1.RType.Symbol, type_1.RType.Break, type_1.RType.Next, type_1.RType.LineDirective, ...exports.RConstant.constantTypes])
45
47
  };
48
+ /**
49
+ * Helper for working with {@link RLoopConstructs} AST nodes.
50
+ * @helper ast
51
+ */
46
52
  exports.RLoopConstructs = {
47
53
  name: 'RLoopConstructs',
48
54
  /**
@@ -57,6 +63,10 @@ exports.RLoopConstructs = {
57
63
  */
58
64
  loopConstructTypes: new Set([type_1.RType.ForLoop, type_1.RType.RepeatLoop, type_1.RType.WhileLoop])
59
65
  };
66
+ /**
67
+ * Helper for working with {@link RConstructs} AST nodes.
68
+ * @helper ast
69
+ */
60
70
  exports.RConstructs = {
61
71
  name: 'RConstructs',
62
72
  /**
@@ -71,6 +81,10 @@ exports.RConstructs = {
71
81
  */
72
82
  constructTypes: new Set([...exports.RLoopConstructs.loopConstructTypes, type_1.RType.IfThenElse])
73
83
  };
84
+ /**
85
+ * Helper for working with {@link RFunctions} AST nodes.
86
+ * @helper ast
87
+ */
74
88
  exports.RFunctions = {
75
89
  name: 'RFunctions',
76
90
  /**
@@ -85,6 +99,10 @@ exports.RFunctions = {
85
99
  */
86
100
  functionTypes: new Set([type_1.RType.FunctionDefinition, type_1.RType.FunctionCall, type_1.RType.Parameter, type_1.RType.Argument])
87
101
  };
102
+ /**
103
+ * Helper for working with {@link ROther} AST nodes.
104
+ * @helper ast
105
+ */
88
106
  exports.ROther = {
89
107
  name: 'ROther',
90
108
  /**
@@ -291,12 +309,21 @@ exports.RNode = {
291
309
  return ids;
292
310
  },
293
311
  /**
294
- * A helper function to retrieve the lexeme of a given node, if available.
312
+ * The code a given node spans, if available.
295
313
  * If the `fullLexeme` is available, it will be returned, otherwise the `lexeme` will be returned.
314
+ * @see {@link RNode.ownLexeme} - for the token the node is made of
296
315
  */
297
316
  lexeme(node) {
298
317
  return node?.info.fullLexeme ?? node?.lexeme;
299
318
  },
319
+ /**
320
+ * The lexeme of the token the node is made of, e.g., the name of a call rather than the call as a whole.
321
+ * Only if the node has none of its own, the `fullLexeme` is used.
322
+ * @see {@link RNode.lexeme} - for the code the node spans
323
+ */
324
+ ownLexeme(node) {
325
+ return node?.lexeme ?? node?.info.fullLexeme;
326
+ },
300
327
  /**
301
328
  * Return the (roxygen) documentation associated with the given node, if available.
302
329
  * @see {@link getDocumentationOf}
@@ -13,6 +13,7 @@ export interface RDelimiter extends MergeableRecord, Location {
13
13
  }
14
14
  /**
15
15
  * Helper for working with {@link RDelimiter} AST nodes.
16
+ * @helper ast
16
17
  */
17
18
  export declare const RDelimiter: {
18
19
  readonly name: "RDelimiter";
@@ -4,6 +4,7 @@ exports.RDelimiter = void 0;
4
4
  const type_1 = require("../../type");
5
5
  /**
6
6
  * Helper for working with {@link RDelimiter} AST nodes.
7
+ * @helper ast
7
8
  */
8
9
  exports.RDelimiter = {
9
10
  name: 'RDelimiter',
@@ -28,6 +28,7 @@ export interface RIndexAccess<Info = NoInfo> extends RAccessBase<Info> {
28
28
  export type RAccess<Info = NoInfo> = RNamedAccess<Info> | RIndexAccess<Info>;
29
29
  /**
30
30
  * Helper for working with {@link RAccess} AST nodes.
31
+ * @helper ast
31
32
  */
32
33
  export declare const RAccess: {
33
34
  readonly name: "RAccess";
@@ -62,6 +63,7 @@ export declare const RAccess: {
62
63
  readonly lexeme: <R extends RNode<import("../processing/decorate").ParentInformation>>(this: void, node: R | undefined) => R extends {
63
64
  lexeme: string;
64
65
  } ? string : string | undefined;
66
+ readonly ownLexeme: (this: void, node: RNode<import("../processing/decorate").ParentInformation> | undefined) => string | undefined;
65
67
  readonly documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf;
66
68
  };
67
69
  export {};
@@ -5,6 +5,7 @@ const model_1 = require("../model");
5
5
  const type_1 = require("../type");
6
6
  /**
7
7
  * Helper for working with {@link RAccess} AST nodes.
8
+ * @helper ast
8
9
  */
9
10
  exports.RAccess = {
10
11
  ...model_1.RNode,
@@ -25,6 +25,7 @@ export interface RUnnamedArgument<Info = NoInfo> extends RArgument<Info> {
25
25
  }
26
26
  /**
27
27
  * Helper for working with {@link RArgument} AST nodes.
28
+ * @helper ast
28
29
  */
29
30
  export declare const RArgument: {
30
31
  readonly name: "RArgument";
@@ -54,8 +55,25 @@ export declare const RArgument: {
54
55
  * Type guard for unnamed arguments, i.e. arguments without a name.
55
56
  */
56
57
  readonly isUnnamed: <Info = object>(this: void, node: RNode<Info> | typeof EmptyArgument | undefined) => node is RUnnamedArgument<Info>;
57
- /** The value of an argument, the node itself for anything else, `undefined` for an empty argument. */
58
+ /**
59
+ * The value of an argument, the node itself for anything else, `undefined` for an empty argument.
60
+ * @see {@link RArgument.unnamedValueOf} - to only accept unnamed arguments
61
+ */
58
62
  readonly valueOf: <Info = object>(this: void, node: RNode<Info> | typeof EmptyArgument | undefined) => RNode<Info> | undefined;
63
+ /**
64
+ * The value of an unnamed argument, `undefined` if the argument is named, empty, or absent.
65
+ * @see {@link RArgument.valueOf} - to also accept named arguments
66
+ */
67
+ readonly unnamedValueOf: <Info = object>(this: void, arg: PotentiallyEmptyRArgument<Info> | undefined) => RNode<Info> | undefined;
68
+ /**
69
+ * The value of an unnamed argument, or the argument itself if it is named or empty.
70
+ * @see {@link RArgument.unnamedValueOf}
71
+ */
72
+ readonly unnamedValueOrArg: <Info = object>(this: void, arg: PotentiallyEmptyRArgument<Info>) => RNode<Info> | PotentiallyEmptyRArgument<Info>;
73
+ /**
74
+ * The non-empty argument with exactly the given `name`, `undefined` if there is none.
75
+ */
76
+ readonly findNamed: <Info = object>(this: void, args: readonly PotentiallyEmptyRArgument<Info>[], name: string) => RArgument<Info> | undefined;
59
77
  /**
60
78
  * Type guard for arguments with a value, i.e. arguments that are not just placeholders without a value.
61
79
  */
@@ -85,5 +103,6 @@ export declare const RArgument: {
85
103
  readonly lexeme: <R extends RNode<ParentInformation>>(this: void, node: R | undefined) => R extends {
86
104
  lexeme: string;
87
105
  } ? string : string | undefined;
106
+ readonly ownLexeme: (this: void, node: RNode<ParentInformation> | undefined) => string | undefined;
88
107
  readonly documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf;
89
108
  };
@@ -6,6 +6,7 @@ const type_1 = require("../type");
6
6
  const r_function_call_1 = require("./r-function-call");
7
7
  /**
8
8
  * Helper for working with {@link RArgument} AST nodes.
9
+ * @helper ast
9
10
  */
10
11
  exports.RArgument = {
11
12
  ...model_1.RNode,
@@ -44,10 +45,33 @@ exports.RArgument = {
44
45
  isUnnamed(node) {
45
46
  return node !== r_function_call_1.EmptyArgument && exports.RArgument.is(node) && node.name === undefined && node.value !== undefined;
46
47
  },
47
- /** The value of an argument, the node itself for anything else, `undefined` for an empty argument. */
48
+ /**
49
+ * The value of an argument, the node itself for anything else, `undefined` for an empty argument.
50
+ * @see {@link RArgument.unnamedValueOf} - to only accept unnamed arguments
51
+ */
48
52
  valueOf(node) {
49
53
  return node === r_function_call_1.EmptyArgument ? undefined : exports.RArgument.is(node) ? node.value : node;
50
54
  },
55
+ /**
56
+ * The value of an unnamed argument, `undefined` if the argument is named, empty, or absent.
57
+ * @see {@link RArgument.valueOf} - to also accept named arguments
58
+ */
59
+ unnamedValueOf(arg) {
60
+ return arg === r_function_call_1.EmptyArgument || arg?.name !== undefined ? undefined : arg?.value;
61
+ },
62
+ /**
63
+ * The value of an unnamed argument, or the argument itself if it is named or empty.
64
+ * @see {@link RArgument.unnamedValueOf}
65
+ */
66
+ unnamedValueOrArg(arg) {
67
+ return exports.RArgument.unnamedValueOf(arg) ?? arg;
68
+ },
69
+ /**
70
+ * The non-empty argument with exactly the given `name`, `undefined` if there is none.
71
+ */
72
+ findNamed(args, name) {
73
+ return args.find((a) => a !== r_function_call_1.EmptyArgument && a.name?.content === name);
74
+ },
51
75
  /**
52
76
  * Type guard for arguments with a value, i.e. arguments that are not just placeholders without a value.
53
77
  */
@@ -13,6 +13,7 @@ export interface RBinaryOp<Info = NoInfo> extends RAstNodeBase<Info>, Location {
13
13
  }
14
14
  /**
15
15
  * Helper for working with {@link RBinaryOp} AST nodes.
16
+ * @helper ast
16
17
  */
17
18
  export declare const RBinaryOp: {
18
19
  readonly name: "RBinaryOp";
@@ -43,5 +44,6 @@ export declare const RBinaryOp: {
43
44
  readonly lexeme: <R extends RNode<import("../processing/decorate").ParentInformation>>(this: void, node: R | undefined) => R extends {
44
45
  lexeme: string;
45
46
  } ? string : string | undefined;
47
+ readonly ownLexeme: (this: void, node: RNode<import("../processing/decorate").ParentInformation> | undefined) => string | undefined;
46
48
  readonly documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf;
47
49
  };
@@ -6,6 +6,7 @@ const type_1 = require("../type");
6
6
  const operators_1 = require("../operators");
7
7
  /**
8
8
  * Helper for working with {@link RBinaryOp} AST nodes.
9
+ * @helper ast
9
10
  */
10
11
  exports.RBinaryOp = {
11
12
  ...model_1.RNode,
@@ -9,6 +9,7 @@ export interface RBreak<Info = NoInfo> extends Location, Leaf<Info> {
9
9
  }
10
10
  /**
11
11
  * Helper for working with {@link RBreak} AST nodes.
12
+ * @helper ast
12
13
  */
13
14
  export declare const RBreak: {
14
15
  readonly name: "RBreak";
@@ -35,5 +36,6 @@ export declare const RBreak: {
35
36
  readonly lexeme: <R extends RNode<import("../processing/decorate").ParentInformation>>(this: void, node: R | undefined) => R extends {
36
37
  lexeme: string;
37
38
  } ? string : string | undefined;
39
+ readonly ownLexeme: (this: void, node: RNode<import("../processing/decorate").ParentInformation> | undefined) => string | undefined;
38
40
  readonly documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf;
39
41
  };
@@ -5,6 +5,7 @@ const model_1 = require("../model");
5
5
  const type_1 = require("../type");
6
6
  /**
7
7
  * Helper for working with {@link RBreak} AST nodes.
8
+ * @helper ast
8
9
  */
9
10
  exports.RBreak = {
10
11
  ...model_1.RNode,
@@ -11,6 +11,7 @@ export interface RComment<Info = NoInfo> extends Location, Leaf<Info> {
11
11
  }
12
12
  /**
13
13
  * Helper for working with {@link RComment} AST nodes.
14
+ * @helper ast
14
15
  */
15
16
  export declare const RComment: {
16
17
  readonly name: "RComment";
@@ -37,5 +38,6 @@ export declare const RComment: {
37
38
  readonly lexeme: <R extends RNode<import("../processing/decorate").ParentInformation>>(this: void, node: R | undefined) => R extends {
38
39
  lexeme: string;
39
40
  } ? string : string | undefined;
41
+ readonly ownLexeme: (this: void, node: RNode<import("../processing/decorate").ParentInformation> | undefined) => string | undefined;
40
42
  readonly documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf;
41
43
  };
@@ -5,6 +5,7 @@ const model_1 = require("../model");
5
5
  const type_1 = require("../type");
6
6
  /**
7
7
  * Helper for working with {@link RComment} AST nodes.
8
+ * @helper ast
8
9
  */
9
10
  exports.RComment = {
10
11
  ...model_1.RNode,
@@ -13,6 +13,7 @@ export interface RExpressionList<Info = NoInfo> extends WithChildren<Info, RNode
13
13
  }
14
14
  /**
15
15
  * Helper for working with {@link RExpressionList} AST nodes.
16
+ * @helper ast
16
17
  */
17
18
  export declare const RExpressionList: {
18
19
  readonly name: "RExpressionList";
@@ -51,5 +52,6 @@ export declare const RExpressionList: {
51
52
  readonly lexeme: <R extends RNode<import("../processing/decorate").ParentInformation>>(this: void, node: R | undefined) => R extends {
52
53
  lexeme: string;
53
54
  } ? string : string | undefined;
55
+ readonly ownLexeme: (this: void, node: RNode<import("../processing/decorate").ParentInformation> | undefined) => string | undefined;
54
56
  readonly documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf;
55
57
  };
@@ -5,6 +5,7 @@ const model_1 = require("../model");
5
5
  const type_1 = require("../type");
6
6
  /**
7
7
  * Helper for working with {@link RExpressionList} AST nodes.
8
+ * @helper ast
8
9
  */
9
10
  exports.RExpressionList = {
10
11
  ...model_1.RNode,
@@ -19,6 +19,7 @@ export interface RForLoop<Info = NoInfo> extends RAstNodeBase<Info>, Location {
19
19
  }
20
20
  /**
21
21
  * Helper for working with {@link RForLoop} AST nodes.
22
+ * @helper ast
22
23
  */
23
24
  export declare const RForLoop: {
24
25
  readonly name: "RForLoop";
@@ -45,5 +46,6 @@ export declare const RForLoop: {
45
46
  readonly lexeme: <R extends RNode<import("../processing/decorate").ParentInformation>>(this: void, node: R | undefined) => R extends {
46
47
  lexeme: string;
47
48
  } ? string : string | undefined;
49
+ readonly ownLexeme: (this: void, node: RNode<import("../processing/decorate").ParentInformation> | undefined) => string | undefined;
48
50
  readonly documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf;
49
51
  };
@@ -5,6 +5,7 @@ const model_1 = require("../model");
5
5
  const type_1 = require("../type");
6
6
  /**
7
7
  * Helper for working with {@link RForLoop} AST nodes.
8
+ * @helper ast
8
9
  */
9
10
  exports.RForLoop = {
10
11
  ...model_1.RNode,
@@ -1,3 +1,4 @@
1
+ import { Identifier } from '../../../../../dataflow/environments/identifier';
1
2
  import type { RAstNodeBase, Location, NoInfo } from '../model';
2
3
  import { RNode } from '../model';
3
4
  import { RType } from '../type';
@@ -33,6 +34,18 @@ export type RFunctionCall<Info = NoInfo> = RNamedFunctionCall<Info> | RUnnamedFu
33
34
  /**
34
35
  * Helper for working with {@link RFunctionCall} AST nodes.
35
36
  */
37
+ declare const calledNameChecked: unique symbol;
38
+ /** A named call that also passed a check of its name, which says nothing about the named calls that did not. */
39
+ export type RNamedFunctionCallOf<Info = NoInfo> = RNamedFunctionCall<Info> & {
40
+ readonly [calledNameChecked]: true;
41
+ };
42
+ /**
43
+ * Type guard for {@link RNamedFunctionCall} nodes, optionally only for calls of the given function name.
44
+ * A name is matched like {@link Identifier.matches} does: a plain `'foo'` holds for `foo()` and `pkg::foo()` alike,
45
+ * a namespaced `Identifier.make('foo', 'pkg')` only for `pkg::foo()`. A set holds plain names, compared without namespace.
46
+ */
47
+ declare function isNamed<Info = NoInfo>(this: void, node: RNode<Info> | undefined): node is RNamedFunctionCall<Info>;
48
+ declare function isNamed<Info = NoInfo>(this: void, node: RNode<Info> | undefined, name: Identifier | ReadonlySet<string>): node is RNamedFunctionCallOf<Info>;
36
49
  export declare const RFunctionCall: {
37
50
  readonly name: "RFunctionCall";
38
51
  /**
@@ -40,10 +53,11 @@ export declare const RFunctionCall: {
40
53
  * @lintIgnore node-is node-is-optional
41
54
  */
42
55
  readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RFunctionCall<Info>;
56
+ readonly isNamed: typeof isNamed;
43
57
  /**
44
- * Type guard for {@link RNamedFunctionCall} nodes.
58
+ * The name of the function a named call calls, `undefined` for anything else.
45
59
  */
46
- readonly isNamed: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RNamedFunctionCall<Info>;
60
+ readonly calledName: <Info = object>(this: void, node: RNode<Info> | undefined) => Identifier | undefined;
47
61
  /**
48
62
  * Type guard for {@link RUnnamedFunctionCall} nodes.
49
63
  */
@@ -76,5 +90,7 @@ export declare const RFunctionCall: {
76
90
  readonly lexeme: <R extends RNode<import("../processing/decorate").ParentInformation>>(this: void, node: R | undefined) => R extends {
77
91
  lexeme: string;
78
92
  } ? string : string | undefined;
93
+ readonly ownLexeme: (this: void, node: RNode<import("../processing/decorate").ParentInformation> | undefined) => string | undefined;
79
94
  readonly documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf;
80
95
  };
96
+ export {};
@@ -1,13 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RFunctionCall = exports.EmptyArgument = void 0;
4
+ const identifier_1 = require("../../../../../dataflow/environments/identifier");
4
5
  const model_1 = require("../model");
5
6
  const type_1 = require("../type");
6
7
  const arg_matching_1 = require("../../../../../util/arg-matching");
7
8
  exports.EmptyArgument = '<>';
8
- /**
9
- * Helper for working with {@link RFunctionCall} AST nodes.
10
- */
9
+ function isNamed(node, name) {
10
+ if (!exports.RFunctionCall.is(node) || node.named !== true) {
11
+ return false;
12
+ }
13
+ else if (name === undefined) {
14
+ return true;
15
+ }
16
+ const called = node.functionName.content;
17
+ return identifier_1.Identifier.is(name) ? identifier_1.Identifier.matches(name, called) : name.has(identifier_1.Identifier.getName(called));
18
+ }
11
19
  exports.RFunctionCall = {
12
20
  ...model_1.RNode,
13
21
  name: 'RFunctionCall',
@@ -18,11 +26,12 @@ exports.RFunctionCall = {
18
26
  is(node) {
19
27
  return node?.type === type_1.RType.FunctionCall;
20
28
  },
29
+ isNamed,
21
30
  /**
22
- * Type guard for {@link RNamedFunctionCall} nodes.
31
+ * The name of the function a named call calls, `undefined` for anything else.
23
32
  */
24
- isNamed(node) {
25
- return exports.RFunctionCall.is(node) && node.named === true;
33
+ calledName(node) {
34
+ return exports.RFunctionCall.isNamed(node) ? node.functionName.content : undefined;
26
35
  },
27
36
  /**
28
37
  * Type guard for {@link RUnnamedFunctionCall} nodes.
@@ -20,6 +20,7 @@ export interface RFunctionDefinition<Info = NoInfo> extends RAstNodeBase<Info>,
20
20
  }
21
21
  /**
22
22
  * Helper for working with {@link RFunctionDefinition} AST nodes.
23
+ * @helper ast
23
24
  */
24
25
  export declare const RFunctionDefinition: {
25
26
  readonly name: "RFunctionDefinition";
@@ -58,5 +59,6 @@ export declare const RFunctionDefinition: {
58
59
  readonly lexeme: <R extends RNode<ParentInformation>>(this: void, node: R | undefined) => R extends {
59
60
  lexeme: string;
60
61
  } ? string : string | undefined;
62
+ readonly ownLexeme: (this: void, node: RNode<ParentInformation> | undefined) => string | undefined;
61
63
  readonly documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf;
62
64
  };
@@ -5,6 +5,7 @@ const model_1 = require("../model");
5
5
  const type_1 = require("../type");
6
6
  /**
7
7
  * Helper for working with {@link RFunctionDefinition} AST nodes.
8
+ * @helper ast
8
9
  */
9
10
  exports.RFunctionDefinition = {
10
11
  ...model_1.RNode,
@@ -15,6 +15,7 @@ export interface RIfThenElse<Info = NoInfo> extends RAstNodeBase<Info>, Location
15
15
  }
16
16
  /**
17
17
  * Helper for working with {@link RIfThenElse} AST nodes.
18
+ * @helper ast
18
19
  */
19
20
  export declare const RIfThenElse: {
20
21
  readonly name: "RIfThenElse";
@@ -41,5 +42,6 @@ export declare const RIfThenElse: {
41
42
  readonly lexeme: <R extends RNode<import("../processing/decorate").ParentInformation>>(this: void, node: R | undefined) => R extends {
42
43
  lexeme: string;
43
44
  } ? string : string | undefined;
45
+ readonly ownLexeme: (this: void, node: RNode<import("../processing/decorate").ParentInformation> | undefined) => string | undefined;
44
46
  readonly documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf;
45
47
  };