@eagleoutice/flowr 2.14.4 → 2.15.1

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 (384) hide show
  1. package/README.md +77 -64
  2. package/abstract-interpretation/absint-inference.d.ts +347 -0
  3. package/abstract-interpretation/{absint-visitor.js → absint-inference.js} +327 -97
  4. package/abstract-interpretation/abstract-semantics.d.ts +246 -0
  5. package/abstract-interpretation/abstract-semantics.js +3 -0
  6. package/abstract-interpretation/data-frame/{mappers/arguments.d.ts → arguments.d.ts} +18 -16
  7. package/abstract-interpretation/data-frame/{mappers/arguments.js → arguments.js} +20 -21
  8. package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +52 -0
  9. package/abstract-interpretation/data-frame/dataframe-semantics.js +1665 -0
  10. package/abstract-interpretation/data-frame/resolve-args.js +4 -4
  11. package/abstract-interpretation/data-frame/semantics.d.ts +15 -21
  12. package/abstract-interpretation/data-frame/semantics.js +27 -29
  13. package/abstract-interpretation/data-frame/shape-inference.d.ts +28 -24
  14. package/abstract-interpretation/data-frame/shape-inference.js +14 -79
  15. package/abstract-interpretation/domains/interval-domain.d.ts +5 -1
  16. package/abstract-interpretation/domains/interval-domain.js +25 -33
  17. package/abstract-interpretation/domains/multi-value-state-domain.d.ts +6 -3
  18. package/abstract-interpretation/domains/multi-value-state-domain.js +24 -4
  19. package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -6
  20. package/abstract-interpretation/domains/partial-product-domain.js +26 -43
  21. package/abstract-interpretation/domains/positive-interval-domain.d.ts +1 -6
  22. package/abstract-interpretation/domains/positive-interval-domain.js +3 -29
  23. package/abstract-interpretation/domains/product-domain.d.ts +1 -1
  24. package/abstract-interpretation/domains/set-range-domain.d.ts +6 -0
  25. package/abstract-interpretation/domains/set-range-domain.js +29 -62
  26. package/abstract-interpretation/domains/state-abstract-domain.d.ts +9 -2
  27. package/abstract-interpretation/domains/state-abstract-domain.js +26 -37
  28. package/abstract-interpretation/domains/{state-domain-like.d.ts → state-domain.d.ts} +10 -6
  29. package/abstract-interpretation/domains/{state-domain-like.js → state-domain.js} +1 -1
  30. package/abstract-interpretation/value-semantics.d.ts +113 -0
  31. package/abstract-interpretation/value-semantics.js +115 -0
  32. package/benchmark/slicer.js +12 -6
  33. package/benchmark/stats/feature-counts.d.ts +2 -1
  34. package/benchmark/stats/feature-counts.js +25 -1
  35. package/benchmark/stats/stats.d.ts +4 -0
  36. package/benchmark/summarizer/second-phase/graph.js +7 -0
  37. package/cli/repl/commands/repl-parse.js +11 -22
  38. package/cli/repl/parser/slice-query-parser.d.ts +2 -0
  39. package/cli/repl/parser/slice-query-parser.js +1 -0
  40. package/config.d.ts +30 -205
  41. package/config.js +37 -3
  42. package/control-flow/cfg-properties.d.ts +5 -0
  43. package/control-flow/cfg-properties.js +25 -7
  44. package/control-flow/control-flow-graph.d.ts +11 -37
  45. package/control-flow/control-flow-graph.js +33 -77
  46. package/control-flow/semantic-cfg-guided-visitor.d.ts +63 -320
  47. package/control-flow/semantic-cfg-guided-visitor.js +65 -320
  48. package/dataflow/environments/built-in-config.d.ts +2 -0
  49. package/dataflow/environments/built-in-proc-name.d.ts +4 -0
  50. package/dataflow/environments/built-in-proc-name.js +4 -0
  51. package/dataflow/environments/built-in-props.d.ts +192 -82
  52. package/dataflow/environments/built-in-props.js +336 -106
  53. package/dataflow/environments/built-in.d.ts +21 -9
  54. package/dataflow/environments/built-in.js +43 -12
  55. package/dataflow/environments/default-builtin-config.d.ts +3219 -313
  56. package/dataflow/environments/default-builtin-config.js +803 -1012
  57. package/dataflow/environments/environment.d.ts +26 -49
  58. package/dataflow/environments/environment.js +34 -47
  59. package/dataflow/environments/group-generics.d.ts +11 -2
  60. package/dataflow/environments/group-generics.js +22 -3
  61. package/dataflow/environments/identifier.d.ts +106 -6
  62. package/dataflow/environments/identifier.js +19 -1
  63. package/dataflow/environments/query-fn-props.d.ts +16 -8
  64. package/dataflow/environments/query-fn-props.js +45 -21
  65. package/dataflow/environments/resolve-by-name.js +9 -2
  66. package/dataflow/environments/scoping.d.ts +5 -0
  67. package/dataflow/environments/scoping.js +11 -0
  68. package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
  69. package/dataflow/eval/resolve/alias-tracking.js +24 -6
  70. package/dataflow/eval/resolve/resolve-numbers.d.ts +182 -7
  71. package/dataflow/eval/resolve/resolve-numbers.js +44 -9
  72. package/dataflow/eval/resolve/resolve-strings.d.ts +79 -2
  73. package/dataflow/eval/resolve/resolve-strings.js +16 -7
  74. package/dataflow/eval/resolve/resolve.d.ts +5 -22
  75. package/dataflow/eval/resolve/resolve.js +34 -34
  76. package/dataflow/eval/values/general.d.ts +9 -1
  77. package/dataflow/eval/values/general.js +22 -3
  78. package/dataflow/eval/values/sets/set-constants.d.ts +5 -0
  79. package/dataflow/eval/values/sets/set-constants.js +9 -1
  80. package/dataflow/eval/values/string/string-constants.d.ts +16 -15
  81. package/dataflow/eval/values/string/string-constants.js +59 -27
  82. package/dataflow/extractor.d.ts +2 -1
  83. package/dataflow/extractor.js +16 -4
  84. package/dataflow/fn/argument-roles.d.ts +35 -0
  85. package/dataflow/fn/argument-roles.js +252 -0
  86. package/dataflow/fn/class-declaration.d.ts +148 -0
  87. package/dataflow/fn/class-declaration.js +317 -0
  88. package/dataflow/fn/condition-handlers.d.ts +5 -0
  89. package/dataflow/fn/condition-handlers.js +13 -0
  90. package/dataflow/fn/exceptions-of-function.d.ts +21 -7
  91. package/dataflow/fn/exceptions-of-function.js +74 -43
  92. package/dataflow/fn/frame-reflection.d.ts +46 -0
  93. package/dataflow/fn/frame-reflection.js +169 -0
  94. package/dataflow/fn/function-props.d.ts +32 -0
  95. package/dataflow/fn/function-props.js +160 -0
  96. package/dataflow/fn/higher-order-function.d.ts +23 -5
  97. package/dataflow/fn/higher-order-function.js +64 -18
  98. package/dataflow/fn/strict-function.d.ts +24 -2
  99. package/dataflow/fn/strict-function.js +49 -19
  100. package/dataflow/graph/call-graph.js +10 -2
  101. package/dataflow/graph/df-helper.d.ts +1 -12
  102. package/dataflow/graph/df-helper.js +2 -19
  103. package/dataflow/graph/diff-dataflow-graph.d.ts +1 -1
  104. package/dataflow/graph/diff-dataflow-graph.js +2 -2
  105. package/dataflow/graph/graph.d.ts +39 -188
  106. package/dataflow/graph/graph.js +46 -163
  107. package/dataflow/graph/match-args.d.ts +34 -2
  108. package/dataflow/graph/match-args.js +45 -12
  109. package/dataflow/graph/vertex.d.ts +8 -0
  110. package/dataflow/info.d.ts +7 -5
  111. package/dataflow/info.js +1 -5
  112. package/dataflow/internal/control-flow.js +20 -17
  113. package/dataflow/internal/linker.d.ts +8 -37
  114. package/dataflow/internal/linker.js +22 -55
  115. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -2
  116. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -8
  117. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +3 -4
  118. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +8 -14
  119. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +43 -50
  120. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +4 -1
  121. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +5 -2
  122. package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.d.ts +23 -0
  123. package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.js +24 -0
  124. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -2
  125. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -1
  126. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +0 -4
  127. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +73 -27
  128. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -11
  129. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +131 -92
  130. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +17 -12
  131. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +187 -99
  132. package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +4 -0
  133. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -0
  134. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +2 -3
  135. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +4 -3
  136. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -1
  137. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -2
  138. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +0 -1
  139. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -1
  140. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +31 -0
  141. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +101 -0
  142. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +2 -1
  143. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +7 -0
  144. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +23 -21
  145. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +1 -2
  146. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +2 -2
  147. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +2 -1
  148. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +22 -1
  149. package/dataflow/internal/process/functions/call/common.d.ts +4 -6
  150. package/dataflow/internal/process/functions/call/common.js +2 -2
  151. package/dataflow/internal/process/functions/call/deferred.d.ts +1 -1
  152. package/dataflow/internal/process/functions/call/deferred.js +2 -2
  153. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +5 -3
  154. package/dataflow/internal/process/functions/call/known-call-handling.js +6 -4
  155. package/dataflow/internal/process/functions/call/named-call-handling.js +19 -13
  156. package/dataflow/internal/process/functions/call/quoted.d.ts +2 -2
  157. package/dataflow/internal/process/functions/call/quoted.js +144 -28
  158. package/dataflow/origin/dfg-get-origin.js +23 -10
  159. package/dataflow/processor.d.ts +2 -1
  160. package/dataflow/processor.js +6 -0
  161. package/documentation/data/interface/doc-writing-code.js +2 -0
  162. package/documentation/doc-util/doc-search.js +1 -1
  163. package/documentation/wiki-absint.d.ts +11 -14
  164. package/documentation/wiki-absint.js +73 -59
  165. package/documentation/wiki-core.js +64 -24
  166. package/documentation/wiki-linter.js +1 -0
  167. package/documentation/wiki-query.js +82 -264
  168. package/documentation/wiki-signature-database.js +17 -5
  169. package/gas.d.ts +91 -47
  170. package/gas.js +97 -13
  171. package/index.d.ts +31 -0
  172. package/index.js +52 -0
  173. package/linter/linter-rules.d.ts +87 -23
  174. package/linter/linter-rules.js +3 -1
  175. package/linter/rules/absolute-path.d.ts +1 -1
  176. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  177. package/linter/rules/dataframe-access-validation.js +10 -8
  178. package/linter/rules/dead-code.d.ts +1 -1
  179. package/linter/rules/deprecated-functions.js +14 -5
  180. package/linter/rules/file-path-validity.d.ts +1 -1
  181. package/linter/rules/naming-convention.d.ts +1 -1
  182. package/linter/rules/naming-convention.js +13 -2
  183. package/linter/rules/network-functions.d.ts +10 -5
  184. package/linter/rules/network-functions.js +48 -36
  185. package/linter/rules/no-leaked-credentials.d.ts +1 -1
  186. package/linter/rules/problematic-inputs.d.ts +1 -1
  187. package/linter/rules/problematic-inputs.js +1 -1
  188. package/linter/rules/seeded-randomness.d.ts +3 -2
  189. package/linter/rules/seeded-randomness.js +7 -3
  190. package/linter/rules/software-has-license.d.ts +1 -1
  191. package/linter/rules/software-has-tests.d.ts +1 -1
  192. package/linter/rules/stop-with-call-arg.d.ts +1 -1
  193. package/linter/rules/syntactically-valid.d.ts +1 -1
  194. package/linter/rules/unclosed-connection.d.ts +3 -3
  195. package/linter/rules/unclosed-connection.js +3 -4
  196. package/linter/rules/undefined-symbol.d.ts +1 -1
  197. package/linter/rules/unescaped-arguments.d.ts +161 -0
  198. package/linter/rules/unescaped-arguments.js +293 -0
  199. package/linter/rules/unused-definition.d.ts +1 -1
  200. package/linter/rules/unused-definition.js +49 -4
  201. package/linter/rules/unused-import.d.ts +1 -1
  202. package/linter/rules/useless-loop.d.ts +1 -1
  203. package/package.json +3 -198
  204. package/project/context/flowr-analyzer-environment-context.d.ts +12 -1
  205. package/project/context/flowr-analyzer-environment-context.js +33 -1
  206. package/project/context/flowr-analyzer-files-context.d.ts +24 -1
  207. package/project/context/flowr-analyzer-files-context.js +42 -21
  208. package/project/context/flowr-analyzer-functions-context.d.ts +8 -0
  209. package/project/context/flowr-analyzer-functions-context.js +2 -0
  210. package/project/context/flowr-analyzer-gas-context.d.ts +9 -1
  211. package/project/context/flowr-analyzer-gas-context.js +21 -0
  212. package/project/context/flowr-file.d.ts +16 -1
  213. package/project/context/flowr-file.js +26 -2
  214. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +19 -20
  215. package/project/plugins/file-plugins/files/flowr-description-file.js +55 -41
  216. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +9 -4
  217. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +11 -3
  218. package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +6 -9
  219. package/project/plugins/file-plugins/files/flowr-manifest-files.js +5 -21
  220. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +11 -12
  221. package/project/plugins/file-plugins/files/flowr-namespace-file.js +48 -61
  222. package/project/plugins/file-plugins/files/flowr-news-file.d.ts +3 -12
  223. package/project/plugins/file-plugins/files/flowr-news-file.js +2 -19
  224. package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +145 -0
  225. package/project/plugins/file-plugins/files/flowr-rd-file.js +676 -0
  226. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +122 -422
  227. package/project/plugins/file-plugins/files/flowr-rda-file.js +517 -1005
  228. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +8 -2
  229. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +10 -1
  230. package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +7 -2
  231. package/project/plugins/file-plugins/files/flowr-sweave-file.js +9 -1
  232. package/project/plugins/file-plugins/files/flowr-sysdata-file.d.ts +17 -0
  233. package/project/plugins/file-plugins/files/flowr-sysdata-file.js +40 -0
  234. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +2 -0
  235. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +3 -1
  236. package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.d.ts +58 -0
  237. package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.js +95 -0
  238. package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.d.ts +23 -0
  239. package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.js +33 -0
  240. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +33 -72
  241. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +17 -15
  242. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +20 -37
  243. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +29 -53
  244. package/project/plugins/package-version-plugins/package.js +2 -1
  245. package/project/plugins/plugin-registry.d.ts +3 -1
  246. package/project/plugins/plugin-registry.js +11 -0
  247. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +20 -4
  248. package/project/sigdb/build.d.ts +9 -15
  249. package/project/sigdb/build.js +101 -42
  250. package/project/sigdb/decode.d.ts +10 -4
  251. package/project/sigdb/decode.js +60 -21
  252. package/project/sigdb/memory-source.d.ts +4 -0
  253. package/project/sigdb/memory-source.js +8 -0
  254. package/project/sigdb/reader.d.ts +57 -100
  255. package/project/sigdb/reader.js +157 -108
  256. package/project/sigdb/schema.d.ts +90 -26
  257. package/project/sigdb/schema.js +12 -6
  258. package/queries/base-query-format.d.ts +7 -0
  259. package/queries/base-query-format.js +29 -0
  260. package/queries/catalog/absint-query/absint-query-executor.js +8 -6
  261. package/queries/catalog/absint-query/absint-query-format.d.ts +20 -9
  262. package/queries/catalog/absint-query/absint-query-format.js +32 -19
  263. package/queries/catalog/call-context-query/call-context-query-executor.js +3 -3
  264. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
  265. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
  266. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
  267. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +1 -1
  268. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
  269. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
  270. package/queries/catalog/dependencies-query/dependencies-query-executor.js +33 -7
  271. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
  272. package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +2 -2
  273. package/queries/catalog/dependencies-query/function-info/derived-functions.js +14 -4
  274. package/queries/catalog/dependencies-query/function-info/read-functions.js +7 -121
  275. package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +1 -1
  276. package/queries/catalog/dependencies-query/function-info/statistics-functions.js +2 -2
  277. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +4 -46
  278. package/queries/catalog/dependencies-query/function-info/write-functions.js +3 -76
  279. package/queries/catalog/dependencies-query/implicit-echo.js +2 -2
  280. package/queries/catalog/dependencies-query/link-devices.d.ts +2 -2
  281. package/queries/catalog/dependencies-query/link-devices.js +6 -7
  282. package/queries/catalog/dice-query/dice-query-executor.js +1 -1
  283. package/queries/catalog/dice-query/dice-query-format.d.ts +1 -1
  284. package/queries/catalog/does-call-query/does-call-query-executor.js +4 -0
  285. package/queries/catalog/does-call-query/does-call-query-format.d.ts +7 -1
  286. package/queries/catalog/files-query/files-query-format.d.ts +1 -1
  287. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +1 -1
  288. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
  289. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
  290. package/queries/catalog/input-sources-query/input-source-functions.d.ts +1 -1
  291. package/queries/catalog/input-sources-query/input-source-functions.js +2 -2
  292. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +7 -17
  293. package/queries/catalog/input-sources-query/input-sources-query-format.js +11 -27
  294. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
  295. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +3 -8
  296. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -11
  297. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.d.ts +4 -0
  298. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +60 -0
  299. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.d.ts +35 -0
  300. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +63 -0
  301. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -6
  302. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +3 -8
  303. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -11
  304. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +3 -8
  305. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -12
  306. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
  307. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
  308. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
  309. package/queries/catalog/project-query/project-query-format.d.ts +1 -1
  310. package/queries/catalog/provenance-query/provenance-query-format.d.ts +3 -8
  311. package/queries/catalog/provenance-query/provenance-query-format.js +2 -14
  312. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  313. package/queries/catalog/search-query/search-query-format.d.ts +1 -1
  314. package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -10
  315. package/queries/catalog/signature-query/signature-query-executor.js +87 -93
  316. package/queries/catalog/signature-query/signature-query-format.d.ts +20 -5
  317. package/queries/catalog/signature-query/signature-query-format.js +16 -4
  318. package/queries/catalog/signature-query/signature-query-render.js +18 -4
  319. package/queries/catalog/slice-query-options.d.ts +14 -0
  320. package/queries/catalog/slice-query-options.js +15 -0
  321. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +2 -1
  322. package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -2
  323. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -3
  324. package/queries/catalog/static-slice-query/static-slice-query-format.js +7 -5
  325. package/queries/query-function-filter.d.ts +8 -3
  326. package/queries/query-function-filter.js +16 -6
  327. package/queries/query.d.ts +38 -38
  328. package/queries/query.js +30 -4
  329. package/r-bridge/lang-4.x/ast/model/model.d.ts +5 -0
  330. package/r-bridge/lang-4.x/ast/model/model.js +14 -0
  331. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
  332. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +1 -0
  333. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
  334. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
  335. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
  336. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
  337. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
  338. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
  339. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
  340. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
  341. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
  342. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
  343. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
  344. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
  345. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
  346. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
  347. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
  348. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
  349. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
  350. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
  351. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
  352. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +17 -9
  353. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +35 -27
  354. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +33 -22
  355. package/reconstruct/reconstruct.d.ts +9 -20
  356. package/reconstruct/reconstruct.js +66 -28
  357. package/search/flowr-search-filters.d.ts +7 -6
  358. package/search/flowr-search-filters.js +6 -4
  359. package/search/search-executor/search-enrichers.d.ts +10 -10
  360. package/search/search-executor/search-enrichers.js +32 -3
  361. package/search/search-executor/search-transformer.js +15 -23
  362. package/slicing/criterion/parse.js +2 -12
  363. package/slicing/static/slice-call.js +1 -8
  364. package/slicing/static/static-slicer.js +1 -1
  365. package/util/collections/bimap.js +14 -6
  366. package/util/objects.js +16 -17
  367. package/util/r-value.d.ts +5 -4
  368. package/util/record.d.ts +38 -3
  369. package/util/record.js +48 -1
  370. package/util/simple-df/dfg-ascii.js +1 -1
  371. package/util/text/strings.d.ts +5 -0
  372. package/util/text/strings.js +10 -0
  373. package/util/version.js +2 -2
  374. package/abstract-interpretation/absint-visitor.d.ts +0 -223
  375. package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +0 -19
  376. package/abstract-interpretation/data-frame/mappers/access-mapper.js +0 -151
  377. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +0 -287
  378. package/abstract-interpretation/data-frame/mappers/function-mapper.js +0 -1096
  379. package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +0 -15
  380. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +0 -207
  381. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +0 -6
  382. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +0 -25
  383. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +0 -31
  384. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +0 -56
@@ -31,6 +31,7 @@ export declare const RString: {
31
31
  stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
32
32
  span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
33
33
  topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
34
+ findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
34
35
  getType: (this: void, node: RNode) => RType;
35
36
  visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
36
37
  collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -36,6 +36,7 @@ export declare const RSymbol: {
36
36
  readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
37
37
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
38
38
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
39
+ readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
39
40
  readonly getType: (this: void, node: RNode) => RType;
40
41
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
41
42
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -29,6 +29,7 @@ export declare const RUnaryOp: {
29
29
  readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
30
30
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
31
31
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
32
+ readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
32
33
  readonly getType: (this: void, node: RNode) => RType;
33
34
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
34
35
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -27,6 +27,7 @@ export declare const RWhileLoop: {
27
27
  readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
28
28
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
29
29
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
30
+ readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
30
31
  readonly getType: (this: void, node: RNode) => RType;
31
32
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
32
33
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -20,6 +20,12 @@ export declare const NodeId: {
20
20
  * This allows us to use numeric ids without storing them as strings, while still allowing custom string ids if needed.
21
21
  */
22
22
  readonly normalize: (this: void, id: NodeId) => NodeId;
23
+ /**
24
+ * Whether the id belongs to a node the analyzed code writes. flowR wraps a deferred expression
25
+ * (`on.exit` and its relatives) in a definition of its own, and that definition carries an id no node
26
+ * of the ast does.
27
+ */
28
+ readonly isWritten: (this: void, id: NodeId) => boolean;
23
29
  /**
24
30
  * The prefix used for built-in function or operator ids.
25
31
  */
@@ -63,13 +69,15 @@ export declare const NodeId: {
63
69
  * @see {@link toBuiltIn} - to convert a built-in function or operator name to a built-in id
64
70
  */
65
71
  readonly fromBuiltIn: <T extends string>(this: void, id: BuiltIn<T>) => T;
72
+ /**
73
+ * The lexeme of the {@link RNode|node} the id belongs to, as the analyzed code writes it.
74
+ * @see {@link NodeId.recoverContent} - for what a call or a use stands for rather than how it is written
75
+ */
76
+ readonly recoverName: (this: void, id: NodeId, idMap?: AstIdMap) => string | undefined;
77
+ /**
78
+ * What the node the id belongs to stands for: the name a call resolved to, the unquoted name of a use, and
79
+ * the lexeme of anything else.
80
+ * @see {@link NodeId.recoverName} - for the lexeme alone, which needs no graph
81
+ */
82
+ readonly recoverContent: (this: void, id: NodeId, graph: DataflowGraph) => string | undefined;
66
83
  };
67
- /**
68
- * Recovers the lexeme of a {@link RNode|node} from its id in the {@link AstIdMap|id map}.
69
- * @see {@link recoverContent} - to recover the content of a node
70
- */
71
- export declare function recoverName(id: NodeId, idMap?: AstIdMap): string | undefined;
72
- /**
73
- * Recovers the content of a {@link RNode|node} from its id in the {@link DataflowGraph|dataflow graph}.
74
- */
75
- export declare function recoverContent(id: NodeId, graph: DataflowGraph): string | undefined;
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NodeId = void 0;
4
- exports.recoverName = recoverName;
5
- exports.recoverContent = recoverContent;
6
4
  const vertex_1 = require("../../../../../dataflow/graph/vertex");
7
5
  const retriever_1 = require("../../../../retriever");
8
6
  const identifier_1 = require("../../../../../dataflow/environments/identifier");
@@ -26,6 +24,14 @@ exports.NodeId = {
26
24
  }
27
25
  return id;
28
26
  },
27
+ /**
28
+ * Whether the id belongs to a node the analyzed code writes. flowR wraps a deferred expression
29
+ * (`on.exit` and its relatives) in a definition of its own, and that definition carries an id no node
30
+ * of the ast does.
31
+ */
32
+ isWritten(id) {
33
+ return typeof exports.NodeId.normalize(id) === 'number';
34
+ },
29
35
  /**
30
36
  * The prefix used for built-in function or operator ids.
31
37
  */
@@ -88,32 +94,34 @@ exports.NodeId = {
88
94
  */
89
95
  fromBuiltIn(id) {
90
96
  return id.slice(builtInPrefixLength);
97
+ },
98
+ /**
99
+ * The lexeme of the {@link RNode|node} the id belongs to, as the analyzed code writes it.
100
+ * @see {@link NodeId.recoverContent} - for what a call or a use stands for rather than how it is written
101
+ */
102
+ recoverName(id, idMap) {
103
+ return idMap?.get(id)?.lexeme;
104
+ },
105
+ /**
106
+ * What the node the id belongs to stands for: the name a call resolved to, the unquoted name of a use, and
107
+ * the lexeme of anything else.
108
+ * @see {@link NodeId.recoverName} - for the lexeme alone, which needs no graph
109
+ */
110
+ recoverContent(id, graph) {
111
+ const vertex = graph.getVertex(id);
112
+ if (vertex && vertex_1.FunctionCallVertex.is(vertex) && vertex.name) {
113
+ return identifier_1.Identifier.toString(vertex.name);
114
+ }
115
+ const node = graph.idMap?.get(id);
116
+ if (node === undefined) {
117
+ return undefined;
118
+ }
119
+ const lexeme = node.lexeme ?? node.info.fullLexeme ?? '';
120
+ if (vertex_1.UseVertex.is(vertex)) {
121
+ return (0, retriever_1.removeRQuotes)(lexeme);
122
+ }
123
+ return lexeme;
91
124
  }
92
125
  };
93
126
  const builtInPrefixLength = exports.NodeId.builtInPrefix.length;
94
- /**
95
- * Recovers the lexeme of a {@link RNode|node} from its id in the {@link AstIdMap|id map}.
96
- * @see {@link recoverContent} - to recover the content of a node
97
- */
98
- function recoverName(id, idMap) {
99
- return idMap?.get(id)?.lexeme;
100
- }
101
- /**
102
- * Recovers the content of a {@link RNode|node} from its id in the {@link DataflowGraph|dataflow graph}.
103
- */
104
- function recoverContent(id, graph) {
105
- const vertex = graph.getVertex(id);
106
- if (vertex && vertex_1.FunctionCallVertex.is(vertex) && vertex.name) {
107
- return identifier_1.Identifier.toString(vertex.name);
108
- }
109
- const node = graph.idMap?.get(id);
110
- if (node === undefined) {
111
- return undefined;
112
- }
113
- const lexeme = node.lexeme ?? node.info.fullLexeme ?? '';
114
- if (vertex_1.UseVertex.is(vertex)) {
115
- return (0, retriever_1.removeRQuotes)(lexeme);
116
- }
117
- return lexeme;
118
- }
119
127
  //# sourceMappingURL=node-id.js.map
@@ -131,6 +131,8 @@ function convertTreeNode(node) {
131
131
  const body = children.slice(1, -1).map(n => [n, convertTreeNode(n)]);
132
132
  const remainingComments = linkCommentsToNextNodes(body, comments);
133
133
  const closing = children[children.length - 1];
134
+ const openText = opening.text;
135
+ const closeText = closing.text;
134
136
  return {
135
137
  type: type_1.RType.ExpressionList,
136
138
  location: undefined,
@@ -140,14 +142,14 @@ function convertTreeNode(node) {
140
142
  {
141
143
  type: type_1.RType.Symbol,
142
144
  location: makeSourceRange(opening),
143
- content: (0, retriever_1.removeRQuotes)(opening.text),
144
- lexeme: opening.text,
145
+ content: (0, retriever_1.removeRQuotes)(openText),
146
+ lexeme: openText,
145
147
  ...defaultInfo()
146
148
  }, {
147
149
  type: type_1.RType.Symbol,
148
150
  location: makeSourceRange(closing),
149
- content: (0, retriever_1.removeRQuotes)(closing.text),
150
- lexeme: closing.text,
151
+ content: (0, retriever_1.removeRQuotes)(closeText),
152
+ lexeme: closeText,
151
153
  ...defaultInfo()
152
154
  }
153
155
  ],
@@ -243,12 +245,13 @@ function convertTreeNode(node) {
243
245
  case tree_sitter_types_1.TreeSitterType.UnaryOperator: {
244
246
  const [comments, children] = splitComments(nonErrorChildren(node));
245
247
  const [op, operand] = children;
248
+ const opText = op.text;
246
249
  return {
247
250
  type: type_1.RType.UnaryOp,
248
251
  operand: convertTreeNode(operand),
249
252
  location: makeSourceRange(op),
250
- operator: op.text,
251
- lexeme: op.text,
253
+ operator: opText,
254
+ lexeme: opText,
252
255
  info: {
253
256
  ...defaultInfo().info,
254
257
  adToks: comments.map(c => c[1]),
@@ -261,11 +264,12 @@ function convertTreeNode(node) {
261
264
  break;
262
265
  }
263
266
  const [lhs, int, rhs] = children;
267
+ const rhsText = rhs.text;
264
268
  return {
265
269
  type: type_1.RType.Symbol,
266
270
  location: makeSourceRange(rhs),
267
- content: identifier_1.Identifier.make(rhs.text, lhs.text, int.text === ':::'),
268
- lexeme: rhs.text,
271
+ content: identifier_1.Identifier.make(rhsText, lhs.text, int.text === ':::'),
272
+ lexeme: rhsText,
269
273
  ...defaultInfo(),
270
274
  info: {
271
275
  ...defaultInfo().info,
@@ -313,13 +317,14 @@ function convertTreeNode(node) {
313
317
  const body = children[2 + variable.length + 1 + sequence.length + 1];
314
318
  const [variableComments, [variableNode]] = splitComments(variable);
315
319
  const [sequenceComments, [sequenceNode]] = splitComments(sequence);
320
+ const variableText = variableNode.text;
316
321
  return {
317
322
  type: type_1.RType.ForLoop,
318
323
  variable: {
319
324
  type: type_1.RType.Symbol,
320
325
  location: makeSourceRange(variableNode),
321
- content: (0, retriever_1.removeRQuotes)(variableNode.text),
322
- lexeme: variableNode.text,
326
+ content: (0, retriever_1.removeRQuotes)(variableText),
327
+ lexeme: variableText,
323
328
  info: {
324
329
  fullRange: undefined,
325
330
  adToks: [],
@@ -380,11 +385,12 @@ function convertTreeNode(node) {
380
385
  const [comments, noCommentrawArgs] = splitComments(rawArgs);
381
386
  const args = (0, arrays_1.splitArrayOn)(noCommentrawArgs.slice(1, -1), x => x.type === 'comma');
382
387
  const funcRange = makeSourceRange(func);
388
+ const funcText = func.text;
383
389
  const mappedArgs = args.map(n => n.length === 0 ? r_function_call_1.EmptyArgument : convertTreeNode(n[0]));
384
390
  const call = {
385
391
  arguments: mappedArgs,
386
392
  location: funcRange,
387
- lexeme: func.text,
393
+ lexeme: funcText,
388
394
  ...defaultInfo(),
389
395
  info: {
390
396
  ...defaultInfo().info,
@@ -397,7 +403,7 @@ function convertTreeNode(node) {
397
403
  funcNode = {
398
404
  ...funcNode,
399
405
  type: type_1.RType.Symbol,
400
- content: (0, retriever_1.removeRQuotes)(func.text)
406
+ content: (0, retriever_1.removeRQuotes)(funcText)
401
407
  };
402
408
  }
403
409
  return {
@@ -491,13 +497,14 @@ function convertTreeNode(node) {
491
497
  const [bracket, ...argsClosing] = nonErrorChildren(content);
492
498
  const [argsComments, argsNoComments] = splitComments(argsClosing.slice(0, -1));
493
499
  const args = (0, arrays_1.splitArrayOn)(argsNoComments, x => x.type === 'comma');
500
+ const bracketText = bracket.text;
494
501
  return {
495
502
  type: type_1.RType.Access,
496
- operator: bracket.text,
503
+ operator: bracketText,
497
504
  accessed: convertTreeNode(func),
498
505
  access: args.map(n => n.length === 0 ? r_function_call_1.EmptyArgument : convertTreeNode(n[0])),
499
506
  location: makeSourceRange(bracket),
500
- lexeme: bracket.text,
507
+ lexeme: bracketText,
501
508
  info: {
502
509
  ...defaultInfo().info,
503
510
  adToks: argsComments.map(c => c[1]),
@@ -507,25 +514,27 @@ function convertTreeNode(node) {
507
514
  case tree_sitter_types_1.TreeSitterType.ExtractOperator: {
508
515
  const [lhs, operator, rhs] = nonErrorChildren(node);
509
516
  const rhsRange = makeSourceRange(rhs);
517
+ const rhsText = rhs?.text;
518
+ const operatorText = operator.text;
510
519
  return {
511
520
  type: type_1.RType.Access,
512
- operator: operator.text,
521
+ operator: operatorText,
513
522
  accessed: convertTreeNode(lhs),
514
523
  access: [{
515
524
  type: type_1.RType.Argument,
516
525
  name: undefined,
517
526
  value: convertTreeNode(rhs),
518
527
  location: rhsRange,
519
- lexeme: rhs?.text,
528
+ lexeme: rhsText,
520
529
  info: {
521
530
  fullRange: rhsRange,
522
531
  adToks: [],
523
- fullLexeme: rhs?.text,
532
+ fullLexeme: rhsText,
524
533
  tsId: rhs?.id
525
534
  }
526
535
  }],
527
536
  location: makeSourceRange(operator),
528
- lexeme: operator.text,
537
+ lexeme: operatorText,
529
538
  ...defaultInfo()
530
539
  };
531
540
  }
@@ -595,16 +604,17 @@ function convertTreeNode(node) {
595
604
  name.content = name.content.slice(1, -1);
596
605
  }
597
606
  const nameRange = makeSourceRange(nameNode);
607
+ const nameLexeme = nameNode.text;
598
608
  return {
599
609
  type: type_1.RType.Argument,
600
610
  name,
601
611
  value: valueNode ? convertTreeNode(valueNode) : undefined,
602
612
  location: nameRange,
603
- lexeme: nameNode.text,
613
+ lexeme: nameLexeme,
604
614
  info: {
605
615
  fullRange: nameRange,
606
616
  adToks: commentChildren.map(c => c[1]),
607
- fullLexeme: nameNode.text,
617
+ fullLexeme: nameLexeme,
608
618
  tsId: nameNode.id
609
619
  }
610
620
  };
@@ -662,13 +672,14 @@ function splitComments(nodes) {
662
672
  const others = [];
663
673
  for (const node of nodes) {
664
674
  if (node.type === tree_sitter_types_1.TreeSitterType.Comment) {
675
+ const commentText = node.text;
665
676
  comments.push([node, {
666
677
  type: type_1.RType.Comment,
667
678
  location: makeSourceRange(node),
668
- lexeme: node.text,
679
+ lexeme: commentText,
669
680
  info: {
670
681
  adToks: [],
671
- fullLexeme: node.text,
682
+ fullLexeme: commentText,
672
683
  tsId: node.id
673
684
  }
674
685
  }]);
@@ -1,6 +1,6 @@
1
1
  /**
2
- * This module has one goal (and is to be rewritten soon to achieve that goal,
3
- * as the file itself is way too long). See {@link reconstructToCode}.
2
+ * This module has one goal (and is to be rewritten soon to achieve that goal, as the file itself is way too long).
3
+ * See {@link reconstructToCode}.
4
4
  * @module
5
5
  */
6
6
  import type { NormalizedAst } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
@@ -14,28 +14,18 @@ import type { InlineWarning } from './inline/source-inline-map';
14
14
  */
15
15
  export type InlineFull = boolean | 'banner';
16
16
  interface Selection {
17
- /**
18
- * The set of node ids to be reconstructed.
19
- */
17
+ /** The set of node ids to be reconstructed. */
20
18
  nodes: ReadonlySet<NodeId>;
21
- /**
22
- * @see {@link ReconstructRequiredInput#reconstructFiles}
23
- */
19
+ /** @see {@link ReconstructRequiredInput#reconstructFiles} */
24
20
  reconstructFiles?: 'all' | number[];
25
21
  /**
26
- * If set, selected `source()` calls are replaced by the (spliced) reconstruction of the sourced file,
27
- * producing a single self-contained reconstruction (`code` will be a `string` for the main file, index 0).
28
- * Requires {@link Selection#sourceMap} to be provided. Overrides {@link Selection#reconstructFiles}.
29
- * @see {@link SourceInlineMap.build}
22
+ * If set, selected `source()` calls are replaced by the (spliced) reconstruction of the sourced file, producing a
23
+ * single self-contained reconstruction. Requires {@link Selection#sourceMap}; overrides {@link Selection#reconstructFiles}.
30
24
  */
31
25
  inlineSources?: boolean;
32
26
  /**
33
- * If set, every file is reconstructed into a single self-contained text, in the loading order flowR
34
- * determined (which respects implicit sources), independent of whether it is sourced explicitly. Files that
35
- * _are_ sourced explicitly are spliced into their `source()` call instead of being repeated at the top level.
36
- * Pass `'banner'` to precede every inlined file with a banner comment naming it.
37
- * Requires {@link Selection#sourceMap} to be provided. Overrides {@link Selection#inlineSources} and
38
- * {@link Selection#reconstructFiles}.
27
+ * If set, every file is reconstructed into a single self-contained text, in flowR's loading order; files sourced
28
+ * explicitly are spliced into their `source()` call instead of repeated at the top level (`'banner'` names each).
39
29
  */
40
30
  inlineFull?: InlineFull;
41
31
  /**
@@ -53,8 +43,7 @@ export interface ReconstructionResult {
53
43
  /** warnings raised while inlining `source()` calls (only set when {@link Selection#inlineSources} is active) */
54
44
  inlineWarnings?: InlineWarning[];
55
45
  /**
56
- * The reconstructed files, in loading order, each with the path it came from (absent for inline code).
57
- * `code` holds the same parts, joined into one string when only a single file was reconstructed.
46
+ * The reconstructed files, in loading order, each with the path it came from (absent for inline code); `code` holds the same parts joined into one string.
58
47
  * Not set by the inlinings, whose whole purpose is to produce one self-contained text.
59
48
  */
60
49
  files?: readonly {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
- * This module has one goal (and is to be rewritten soon to achieve that goal,
4
- * as the file itself is way too long). See {@link reconstructToCode}.
3
+ * This module has one goal (and is to be rewritten soon to achieve that goal, as the file itself is way too long).
4
+ * See {@link reconstructToCode}.
5
5
  * @module
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -9,7 +9,10 @@ exports.reconstructLogger = void 0;
9
9
  exports.reconstructToCode = reconstructToCode;
10
10
  const log_1 = require("../util/log");
11
11
  const assert_1 = require("../util/assert");
12
+ const r_expression_list_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-expression-list");
13
+ const r_comment_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-comment");
12
14
  const model_1 = require("../r-bridge/lang-4.x/ast/model/model");
15
+ const r_binary_op_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
13
16
  const r_pipe_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-pipe");
14
17
  const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
15
18
  const r_argument_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-argument");
@@ -17,12 +20,32 @@ const stateful_fold_1 = require("../r-bridge/lang-4.x/ast/model/processing/state
17
20
  const auto_select_defaults_1 = require("./auto-select/auto-select-defaults");
18
21
  const identifier_1 = require("../dataflow/environments/identifier");
19
22
  const r_string_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-string");
23
+ const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
20
24
  function plain(text) {
21
25
  return [{ line: Array.isArray(text) ? identifier_1.Identifier.toString(text) : text, indent: 0 }];
22
26
  }
23
27
  exports.reconstructLogger = log_1.log.getSubLogger({ name: 'reconstruct' });
24
28
  function getLexeme(n) {
25
- return model_1.RNode.lexeme(n) ?? '';
29
+ const lexeme = model_1.RNode.lexeme(n);
30
+ if (lexeme !== undefined) {
31
+ return lexeme;
32
+ }
33
+ // only expression lists may lack a lexeme of their own, so we synthesize equivalent source from their children
34
+ return r_expression_list_1.RExpressionList.is(n) ? synthesizeExpressionListLexeme(n) : '';
35
+ }
36
+ /** rebuilds the source of a lexeme-less expression list (e.g., a `(` or `{` wrapper) so that it still parses */
37
+ function synthesizeExpressionListLexeme(n) {
38
+ const inner = n.children
39
+ .filter(c => !r_comment_1.RComment.is(c))
40
+ .map(c => getLexeme(c))
41
+ .filter(c => c.length > 0)
42
+ .join('; ');
43
+ const start = r_expression_list_1.RExpressionList.groupStart(n);
44
+ const end = r_expression_list_1.RExpressionList.groupEnd(n);
45
+ if (start === undefined || end === undefined) {
46
+ return inner;
47
+ }
48
+ return `${identifier_1.Identifier.toString(start.content)}${inner}${identifier_1.Identifier.toString(end.content)}`;
26
49
  }
27
50
  function codeToText(code) {
28
51
  return code.map(l => `${getIndentString(l.indent)}${l.line}`).join('\n');
@@ -35,8 +58,7 @@ function getArgumentLexeme(n) {
35
58
  return n.info.fullLexeme ?? (n.value !== undefined ? getLexeme(n.value) : getLexeme(n));
36
59
  }
37
60
  function reconstructAsLeaf(leaf, configuration) {
38
- const selectionHasLeaf = configuration.selection.has(leaf.info.id) || configuration.autoSelectIf(leaf, configuration.fullAst);
39
- return selectionHasLeaf ? foldToConst(leaf) : [];
61
+ return isSelected(configuration, leaf) ? foldToConst(leaf) : [];
40
62
  }
41
63
  function foldToConst(n) {
42
64
  return plain(getLexeme(n));
@@ -93,6 +115,14 @@ function reconstructUnaryOp(leaf, operand, configuration) {
93
115
  }
94
116
  return foldToConst(leaf);
95
117
  }
118
+ /** whether the value of `n` is the value of its rhs alone, i.e. the lhs may be dropped without changing the result */
119
+ function evaluatesToRhs(n) {
120
+ if (r_pipe_1.RPipe.is(n)) {
121
+ return false;
122
+ }
123
+ const info = r_binary_op_1.RBinaryOp.getOperatorInfo(n);
124
+ return info?.usedAs === 'assignment' && info.stringUsedInRAst !== type_1.RawRType.RightAssign;
125
+ }
96
126
  function reconstructBinaryOp(n, lhs, rhs, config) {
97
127
  if (lhs.length === 0 && rhs.length === 0) {
98
128
  if (isSelected(config, n)) {
@@ -102,7 +132,11 @@ function reconstructBinaryOp(n, lhs, rhs, config) {
102
132
  return [];
103
133
  }
104
134
  }
105
- else if (lhs.length === 0) { // if we have no lhs, only return rhs
135
+ else if (lhs.length === 0) {
136
+ // dropping the lhs is only sound if the operator evaluates to its rhs, otherwise we have to keep the operation
137
+ if (isSelected(config, n) && !evaluatesToRhs(n)) {
138
+ return plain(getLexeme(n));
139
+ }
106
140
  return rhs;
107
141
  }
108
142
  else if (rhs.length === 0) {
@@ -169,8 +203,7 @@ function reconstructBodyWithHeader(header, body, onEmpty) {
169
203
  }
170
204
  }
171
205
  function reconstructRepeatLoop(loop, body, configuration) {
172
- const sel = isSelected(configuration, loop);
173
- if (!sel) {
206
+ if (!isSelected(configuration, loop)) {
174
207
  return body;
175
208
  }
176
209
  return reconstructBodyWithHeader({ line: 'repeat', indent: 0 }, body, '{}');
@@ -220,8 +253,7 @@ function reconstructIfThenElse(ifThenElse, condition, then, otherwise, config) {
220
253
  }
221
254
  }
222
255
  function reconstructWhileLoop(loop, condition, body, configuration) {
223
- const sel = isSelected(configuration, loop);
224
- if (!sel && condition.length === 0) {
256
+ if (!isSelected(configuration, loop) && condition.length === 0) {
225
257
  return body;
226
258
  }
227
259
  else if (body.length === 0 && condition.length === 0) {
@@ -248,7 +280,6 @@ function reconstructWhileLoop(loop, condition, body, configuration) {
248
280
  }
249
281
  }
250
282
  function reconstructParameters(parameters) {
251
- // const baseParameters = parameters.flatMap(p => plain(getLexeme(p)))
252
283
  return parameters.map(p => {
253
284
  if (p.defaultValue !== undefined) {
254
285
  return `${getLexeme(p.name)}=${getLexeme(p.defaultValue)}`;
@@ -292,6 +323,22 @@ function reconstructParameter(parameter, name, defaultValue, configuration) {
292
323
  return name;
293
324
  }
294
325
  }
326
+ /** whether any ancestor of `n` is part of the reconstruction and hence may consume the value of `n` */
327
+ function hasSelectedAncestor(n, config) {
328
+ const { idMap } = config.fullAst;
329
+ let parentId = n.info.parent;
330
+ while (parentId !== undefined) {
331
+ const parent = idMap.get(parentId);
332
+ if (parent === undefined) {
333
+ return false;
334
+ }
335
+ else if (isSelected(config, parent)) {
336
+ return true;
337
+ }
338
+ parentId = parent.info.parent;
339
+ }
340
+ return false;
341
+ }
295
342
  function reconstructFunctionDefinition(definition, functionParameters, body, config) {
296
343
  // if a definition is not selected, we only use the body - slicing will always select the definition if it is required
297
344
  if (functionParameters.every(p => p.length === 0)) {
@@ -300,7 +347,7 @@ function reconstructFunctionDefinition(definition, functionParameters, body, con
300
347
  if (empty && selected) { // give function stub
301
348
  return plain(`${definition.lexeme}(${reconstructParameters(definition.parameters).join(', ')}) { }`);
302
349
  }
303
- else if (!selected) { // do not require function
350
+ else if (!selected && !hasSelectedAncestor(definition, config)) { // do not require function
304
351
  return body;
305
352
  }
306
353
  }
@@ -345,9 +392,8 @@ function reconstructSpecialInfixFunctionCall(args, call) {
345
392
  return plain(`${lhsLexeme} ${identifier_1.Identifier.toString(call.functionName.content)} ${rhsLexeme}`);
346
393
  }
347
394
  /**
348
- * If `inlineSources` is active and this call is a selected `source()` that we can resolve, this returns the
349
- * reconstruction to splice in place of the call (or the literal call at a cycle edge). It returns `undefined`
350
- * to signal that the call should be reconstructed as usual (e.g., an unresolvable `source()`).
395
+ * If `inlineSources` is active and this is a selected, resolvable `source()` call, returns the reconstruction to
396
+ * splice in its place (or the literal call at a cycle edge); `undefined` means reconstruct as usual.
351
397
  */
352
398
  function tryInlineSourceCall(call, config) {
353
399
  const id = call.info.id;
@@ -365,7 +411,7 @@ function tryInlineSourceCall(call, config) {
365
411
  }
366
412
  const childConfig = {
367
413
  ...config,
368
- visited: new Set([...visited, config.currentFile ?? 0, targetFile]),
414
+ visited: visited.union(new Set([config.currentFile ?? 0, targetFile])),
369
415
  currentFile: targetFile
370
416
  };
371
417
  return stripOuterExpressionList(reconstructFileCode(config.fullAst, targetFile, childConfig));
@@ -402,8 +448,7 @@ function reconstructFunctionCall(call, functionName, args, configuration) {
402
448
  if (call.named && selected) {
403
449
  return plain(getLexeme(call));
404
450
  }
405
- const filteredArgs = args.filter(a => a !== undefined && a.length > 0);
406
- if (functionName.length === 0 && filteredArgs.length === 0) {
451
+ if (functionName.length === 0 && args.every(a => a === undefined || a.length === 0)) {
407
452
  return [];
408
453
  }
409
454
  if (args.length === 0) {
@@ -421,10 +466,7 @@ function reconstructFunctionCall(call, functionName, args, configuration) {
421
466
  return plain(getLexeme(call));
422
467
  }
423
468
  }
424
- /**
425
- * The fold functions used to reconstruct the ast in {@link reconstructToCode}.
426
- */
427
- // escalates with undefined if all are undefined
469
+ /** The fold functions used to reconstruct the ast in {@link reconstructToCode}. */
428
470
  const reconstructAstFolds = {
429
471
  // we just pass down the state information so everyone has them
430
472
  down: (_n, c) => c,
@@ -480,11 +522,8 @@ function reconstructFileCode(ast, fileIndex, config) {
480
522
  return (0, stateful_fold_1.foldAstStateful)(ast.ast.files[fileIndex].root, config, reconstructAstFolds);
481
523
  }
482
524
  /**
483
- * Reconstructs parts of a normalized R ast into R code on an expression basis.
484
- * @param ast - The {@link NormalizedAst|normalized ast} to be used as a basis for reconstruction
485
- * @param selection - The selection of nodes to be reconstructed (probably the {@link NodeId|NodeIds} identified by the slicer)
486
- * @param autoSelectIf - A predicate that can be used to force the reconstruction of a node
487
- * @returns The number of lines for which `autoSelectIf` triggered, as well as the reconstructed code itself.
525
+ * Reconstructs parts of a normalized R ast into R code on an expression basis; `selection` gives the node ids to reconstruct (probably identified by the slicer), `autoSelectIf` can force additional ones.
526
+ * @returns the reconstructed code, plus the number of lines for which `autoSelectIf` triggered.
488
527
  */
489
528
  function reconstructToCode(ast, selection, autoSelectIf = auto_select_defaults_1.doNotAutoSelect) {
490
529
  if (exports.reconstructLogger.settings.minLevel <= 1 /* LogLevel.Trace */) {
@@ -533,7 +572,6 @@ function reconstructToCode(ast, selection, autoSelectIf = auto_select_defaults_1
533
572
  const indices = selection.reconstructFiles === 'all' ? ast.ast.files.map((_, i) => i) : (selection.reconstructFiles ?? [0]);
534
573
  (0, assert_1.guard)(indices.every(i => i >= 0 && i < ast.ast.files.length), `reconstructToCode: reconstructFiles contains invalid file indices: ${JSON.stringify(indices)} for ast with ${ast.ast.files.length} files`);
535
574
  const results = [];
536
- // fold of the normalized ast
537
575
  for (const i of indices) {
538
576
  results.push(removeOuterExpressionListIfApplicable(reconstructFileCode(ast, i, {
539
577
  selection: selection.nodes, autoSelectIf: autoSelectIfWrapper, fullAst: ast, currentFile: i
@@ -6,7 +6,7 @@ import type { Enrichment } from './search-executor/search-enrichers';
6
6
  import type { DataflowInformation } from '../dataflow/info';
7
7
  import type { BuiltInProcName } from '../dataflow/environments/built-in-proc-name';
8
8
  import type { RoleInParent } from '../r-bridge/lang-4.x/ast/model/processing/role';
9
- import type { CallProps } from '../dataflow/environments/built-in-props';
9
+ import type { PropSelector } from '../dataflow/environments/built-in-props';
10
10
  export type FlowrFilterName = keyof typeof FlowrFilters;
11
11
  interface FlowrFilterWithArgs<Filter extends FlowrFilterName, Args extends FlowrFilterArgs<Filter>> {
12
12
  name: Filter;
@@ -40,8 +40,9 @@ export declare enum FlowrFilter {
40
40
  */
41
41
  FilePathFilter = "file-path-filter",
42
42
  /**
43
- * Only returns function calls whose {@link CallProp} bits match the given mask, so that _every call that asks
44
- * the user_ or _every call that closes a device_ can be searched for without naming a single function.
43
+ * Only returns function calls carrying the given {@link CallProp}/{@link SemanticCallTag} properties, so that
44
+ * _every call that asks the user_ or _every call that closes a device_ can be searched for without naming a
45
+ * single function.
45
46
  * This filter accepts {@link CallPropsArgs}.
46
47
  */
47
48
  CallProps = "call-props"
@@ -88,9 +89,9 @@ export interface FilePathFilterArgs {
88
89
  filePathRegex: string | RegExp;
89
90
  }
90
91
  export interface CallPropsArgs {
91
- /** the {@link CallProp} bits to look for, e.g. `CallProp.User | CallProp.Closes` */
92
- props: CallProps;
93
- /** whether a call has to carry every bit of {@link props} or just one of them (the default) */
92
+ /** the properties to look for, e.g. `[SemanticCallTag.User, CallProp.Pure]` */
93
+ props: PropSelector;
94
+ /** whether a call has to carry every one of {@link props} or just one of them (the default) */
94
95
  matchType?: 'some' | 'every';
95
96
  }
96
97
  type ValidFilterTypes<F extends FlowrFilter = FlowrFilter> = FlowrFilterName | FlowrFilterWithArgs<F, FlowrFilterArgs<F>> | RType | VertexType;