@eagleoutice/flowr 2.0.25 → 2.1.0

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 (381) hide show
  1. package/benchmark/slicer.js +2 -1
  2. package/benchmark/stats/print.js +3 -4
  3. package/benchmark/stats/size-of.js +9 -7
  4. package/benchmark/summarizer/first-phase/input.d.ts +0 -1
  5. package/benchmark/summarizer/first-phase/input.js +2 -3
  6. package/benchmark/summarizer/first-phase/process.js +7 -7
  7. package/benchmark/summarizer/second-phase/graph.js +1 -2
  8. package/benchmark/summarizer/second-phase/process.d.ts +0 -1
  9. package/benchmark/summarizer/second-phase/process.js +4 -5
  10. package/benchmark/summarizer/summarizer.js +7 -1
  11. package/cli/benchmark-app.js +6 -1
  12. package/cli/common/features.js +2 -3
  13. package/cli/common/script.js +2 -3
  14. package/cli/common/scripts-info.d.ts +69 -1
  15. package/cli/common/scripts-info.js +6 -6
  16. package/cli/flowr-main-options.d.ts +4 -0
  17. package/cli/flowr-main-options.js +88 -0
  18. package/cli/flowr.d.ts +3 -3
  19. package/cli/flowr.js +22 -31
  20. package/cli/repl/commands/{cfg.d.ts → repl-cfg.d.ts} +1 -1
  21. package/cli/repl/commands/{cfg.js → repl-cfg.js} +3 -3
  22. package/cli/repl/commands/{commands.d.ts → repl-commands.d.ts} +3 -1
  23. package/cli/repl/commands/{commands.js → repl-commands.js} +56 -35
  24. package/cli/repl/commands/{dataflow.d.ts → repl-dataflow.d.ts} +1 -1
  25. package/cli/repl/commands/{dataflow.js → repl-dataflow.js} +2 -2
  26. package/cli/repl/commands/{execute.d.ts → repl-execute.d.ts} +1 -1
  27. package/cli/repl/commands/{execute.js → repl-execute.js} +3 -3
  28. package/cli/repl/commands/repl-lineage.d.ts +15 -0
  29. package/cli/repl/commands/{lineage.js → repl-lineage.js} +14 -12
  30. package/cli/repl/commands/{main.js → repl-main.js} +1 -1
  31. package/cli/repl/commands/{normalize.d.ts → repl-normalize.d.ts} +1 -1
  32. package/cli/repl/commands/{normalize.js → repl-normalize.js} +3 -3
  33. package/cli/repl/commands/{parse.d.ts → repl-parse.d.ts} +1 -1
  34. package/cli/repl/commands/{parse.js → repl-parse.js} +3 -2
  35. package/cli/repl/commands/repl-query.d.ts +8 -0
  36. package/cli/repl/commands/repl-query.js +155 -0
  37. package/cli/repl/commands/repl-quit.d.ts +2 -0
  38. package/cli/repl/commands/{quit.js → repl-quit.js} +1 -1
  39. package/cli/repl/commands/{version.d.ts → repl-version.d.ts} +1 -1
  40. package/cli/repl/commands/{version.js → repl-version.js} +4 -4
  41. package/cli/repl/core.d.ts +1 -2
  42. package/cli/repl/core.js +13 -13
  43. package/cli/repl/execute.d.ts +1 -2
  44. package/cli/repl/execute.js +2 -3
  45. package/cli/repl/print-version.js +3 -4
  46. package/cli/repl/server/connection.d.ts +1 -0
  47. package/cli/repl/server/connection.js +45 -12
  48. package/cli/repl/server/messages/{messages.d.ts → all-messages.d.ts} +8 -7
  49. package/cli/repl/server/messages/{messages.js → all-messages.js} +1 -1
  50. package/cli/repl/server/messages/{analysis.d.ts → message-analysis.d.ts} +2 -1
  51. package/cli/repl/server/messages/message-analysis.js +39 -0
  52. package/cli/repl/server/messages/{error.d.ts → message-error.d.ts} +1 -1
  53. package/cli/repl/server/messages/{error.js → message-error.js} +1 -1
  54. package/cli/repl/server/messages/{hello.d.ts → message-hello.d.ts} +4 -3
  55. package/cli/repl/server/messages/message-hello.js +20 -0
  56. package/cli/repl/server/messages/{lineage.d.ts → message-lineage.d.ts} +2 -1
  57. package/cli/repl/server/messages/message-lineage.js +25 -0
  58. package/cli/repl/server/messages/message-query.d.ts +16 -0
  59. package/cli/repl/server/messages/message-query.js +26 -0
  60. package/cli/repl/server/messages/{repl.d.ts → message-repl.d.ts} +3 -1
  61. package/cli/repl/server/messages/message-repl.js +53 -0
  62. package/cli/repl/server/messages/{slice.d.ts → message-slice.d.ts} +2 -1
  63. package/cli/repl/server/messages/{slice.js → message-slice.js} +14 -6
  64. package/cli/repl/server/net.d.ts +0 -1
  65. package/cli/repl/server/send.d.ts +1 -1
  66. package/cli/repl/server/send.js +2 -3
  67. package/cli/repl/server/server.js +2 -2
  68. package/cli/repl/server/validate.d.ts +1 -1
  69. package/cli/repl/server/validate.js +5 -6
  70. package/cli/run-script.d.ts +8 -0
  71. package/cli/run-script.js +18 -0
  72. package/cli/script-core/statistics-core.d.ts +2 -0
  73. package/cli/script-core/statistics-core.js +100 -0
  74. package/cli/script-core/statistics-helper-core.d.ts +2 -0
  75. package/cli/script-core/statistics-helper-core.js +81 -0
  76. package/cli/script-core/summarizer-core.d.ts +2 -0
  77. package/cli/script-core/summarizer-core.js +51 -0
  78. package/cli/statistics-app.js +3 -87
  79. package/cli/statistics-helper-app.js +3 -77
  80. package/cli/summarizer-app.js +2 -48
  81. package/config.d.ts +20 -4
  82. package/config.js +62 -36
  83. package/core/pipeline-executor.js +11 -1
  84. package/core/print/dataflow-printer.js +4 -5
  85. package/core/print/normalize-printer.js +4 -5
  86. package/core/print/parse-printer.js +1 -2
  87. package/core/print/print.js +2 -3
  88. package/core/print/slice-diff-ansi.js +1 -2
  89. package/core/steps/pipeline/create-pipeline.js +1 -2
  90. package/core/steps/pipeline/default-pipelines.d.ts +18 -18
  91. package/core/steps/pipeline/pipeline.js +1 -2
  92. package/dataflow/environments/append.js +1 -2
  93. package/dataflow/environments/built-in-config.d.ts +47 -0
  94. package/dataflow/environments/built-in-config.js +83 -0
  95. package/dataflow/environments/built-in.d.ts +49 -6
  96. package/dataflow/environments/built-in.js +29 -97
  97. package/dataflow/environments/clone.js +2 -2
  98. package/dataflow/environments/default-builtin-config.d.ts +5 -0
  99. package/dataflow/environments/default-builtin-config.js +83 -0
  100. package/dataflow/environments/define.js +1 -2
  101. package/dataflow/environments/diff.js +5 -6
  102. package/dataflow/environments/environment.js +8 -7
  103. package/dataflow/environments/identifier.d.ts +39 -8
  104. package/dataflow/environments/identifier.js +33 -0
  105. package/dataflow/environments/overwrite.d.ts +6 -5
  106. package/dataflow/environments/overwrite.js +16 -9
  107. package/dataflow/environments/resolve-by-name.d.ts +3 -1
  108. package/dataflow/environments/resolve-by-name.js +40 -8
  109. package/dataflow/environments/scoping.js +2 -3
  110. package/dataflow/extractor.js +25 -24
  111. package/dataflow/graph/dataflowgraph-builder.d.ts +139 -0
  112. package/dataflow/graph/dataflowgraph-builder.js +247 -0
  113. package/dataflow/graph/diff.js +12 -11
  114. package/dataflow/graph/edge.d.ts +2 -2
  115. package/dataflow/graph/edge.js +46 -20
  116. package/dataflow/graph/graph.d.ts +14 -6
  117. package/dataflow/graph/graph.js +25 -21
  118. package/dataflow/graph/quads.js +1 -2
  119. package/dataflow/graph/resolve-graph.d.ts +7 -0
  120. package/dataflow/graph/resolve-graph.js +51 -0
  121. package/dataflow/graph/vertex.d.ts +12 -4
  122. package/dataflow/graph/vertex.js +19 -11
  123. package/dataflow/info.d.ts +3 -7
  124. package/dataflow/info.js +7 -8
  125. package/dataflow/internal/linker.d.ts +3 -1
  126. package/dataflow/internal/linker.js +77 -32
  127. package/dataflow/internal/process/functions/call/argument/make-argument.js +5 -5
  128. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +1 -2
  129. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +10 -8
  130. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +5 -1
  131. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +27 -10
  132. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +40 -26
  133. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +30 -20
  134. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +10 -9
  135. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +12 -11
  136. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +6 -5
  137. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +7 -6
  138. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +4 -4
  139. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +10 -6
  140. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +7 -3
  141. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -3
  142. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -4
  143. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +6 -6
  144. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -3
  145. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +6 -5
  146. package/dataflow/internal/process/functions/call/common.js +30 -19
  147. package/dataflow/internal/process/functions/call/default-call-handling.js +1 -2
  148. package/dataflow/internal/process/functions/call/known-call-handling.js +8 -6
  149. package/dataflow/internal/process/functions/call/named-call-handling.js +7 -6
  150. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +11 -7
  151. package/dataflow/internal/process/functions/process-argument.js +10 -8
  152. package/dataflow/internal/process/functions/process-parameter.js +8 -6
  153. package/dataflow/internal/process/process-named-call.js +3 -3
  154. package/dataflow/internal/process/process-symbol.js +5 -4
  155. package/dataflow/internal/process/process-uninteresting-leaf.js +1 -2
  156. package/dataflow/internal/process/process-value.js +5 -4
  157. package/dataflow/processor.js +1 -2
  158. package/documentation/data/dfg/doc-data-dfg-util.d.ts +20 -0
  159. package/documentation/data/dfg/doc-data-dfg-util.js +13 -0
  160. package/documentation/data/query/example-query-code.d.ts +1 -0
  161. package/documentation/data/query/example-query-code.js +25 -0
  162. package/documentation/data/server/doc-data-server-messages.d.ts +1 -0
  163. package/documentation/data/server/doc-data-server-messages.js +508 -0
  164. package/documentation/doc-util/doc-auto-gen.d.ts +7 -0
  165. package/documentation/doc-util/doc-auto-gen.js +9 -0
  166. package/documentation/doc-util/doc-cfg.d.ts +7 -0
  167. package/documentation/doc-util/doc-cfg.js +18 -0
  168. package/documentation/doc-util/doc-cli-option.d.ts +8 -0
  169. package/documentation/doc-util/doc-cli-option.js +36 -0
  170. package/documentation/doc-util/doc-code.d.ts +1 -0
  171. package/documentation/doc-util/doc-code.js +7 -0
  172. package/documentation/doc-util/doc-dfg.d.ts +21 -0
  173. package/documentation/doc-util/doc-dfg.js +93 -0
  174. package/documentation/doc-util/doc-docker.d.ts +1 -0
  175. package/documentation/doc-util/doc-docker.js +5 -0
  176. package/documentation/doc-util/doc-env.d.ts +2 -0
  177. package/documentation/doc-util/doc-env.js +20 -0
  178. package/documentation/doc-util/doc-files.d.ts +6 -0
  179. package/documentation/doc-util/doc-files.js +25 -0
  180. package/documentation/doc-util/doc-general.d.ts +2 -0
  181. package/documentation/doc-util/doc-general.js +16 -0
  182. package/documentation/doc-util/doc-hover-over.d.ts +1 -0
  183. package/documentation/doc-util/doc-hover-over.js +7 -0
  184. package/documentation/doc-util/doc-issue.d.ts +1 -0
  185. package/documentation/doc-util/doc-issue.js +6 -0
  186. package/documentation/doc-util/doc-ms.d.ts +1 -0
  187. package/documentation/doc-util/doc-ms.js +8 -0
  188. package/documentation/doc-util/doc-normalized-ast.d.ts +11 -0
  189. package/documentation/doc-util/doc-normalized-ast.js +71 -0
  190. package/documentation/doc-util/doc-query.d.ts +24 -0
  191. package/documentation/doc-util/doc-query.js +113 -0
  192. package/documentation/doc-util/doc-repl.d.ts +13 -0
  193. package/documentation/doc-util/doc-repl.js +79 -0
  194. package/documentation/doc-util/doc-server-message.d.ts +37 -0
  195. package/documentation/doc-util/doc-server-message.js +153 -0
  196. package/documentation/doc-util/doc-structure.d.ts +12 -0
  197. package/documentation/doc-util/doc-structure.js +21 -0
  198. package/documentation/doc-util/doc-types.d.ts +38 -0
  199. package/documentation/doc-util/doc-types.js +276 -0
  200. package/{r-bridge/data/print.js → documentation/print-capabilities-markdown.js} +8 -4
  201. package/documentation/print-dataflow-graph-wiki.d.ts +1 -0
  202. package/documentation/print-dataflow-graph-wiki.js +849 -0
  203. package/documentation/print-interface-wiki.d.ts +1 -0
  204. package/documentation/print-interface-wiki.js +401 -0
  205. package/documentation/print-normalized-ast-wiki.d.ts +1 -0
  206. package/documentation/print-normalized-ast-wiki.js +98 -0
  207. package/documentation/print-query-wiki.d.ts +1 -0
  208. package/documentation/print-query-wiki.js +215 -0
  209. package/package.json +29 -33
  210. package/queries/base-query-format.d.ts +11 -0
  211. package/{cli/repl/server/messages/hello.js → queries/base-query-format.js} +1 -1
  212. package/queries/call-context-query/call-context-query-executor.d.ts +11 -0
  213. package/queries/call-context-query/call-context-query-executor.js +255 -0
  214. package/queries/call-context-query/call-context-query-format.d.ts +72 -0
  215. package/queries/call-context-query/call-context-query-format.js +17 -0
  216. package/queries/query-schema.d.ts +7 -0
  217. package/queries/query-schema.js +31 -0
  218. package/queries/query.d.ts +35 -0
  219. package/queries/query.js +57 -0
  220. package/queries/two-layer-collector.d.ts +8 -0
  221. package/queries/two-layer-collector.js +31 -0
  222. package/queries/virtual-query/compound-query.d.ts +24 -0
  223. package/queries/virtual-query/compound-query.js +18 -0
  224. package/queries/virtual-query/virtual-queries.d.ts +15 -0
  225. package/queries/virtual-query/virtual-queries.js +8 -0
  226. package/r-bridge/data/data.d.ts +5 -0
  227. package/r-bridge/data/data.js +6 -0
  228. package/r-bridge/data/get.js +2 -3
  229. package/r-bridge/init.js +2 -2
  230. package/r-bridge/lang-4.x/ast/model/collect.js +1 -2
  231. package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -2
  232. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -0
  233. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -0
  234. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +3 -0
  235. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +5 -0
  236. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +4 -0
  237. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -1
  238. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +10 -1
  239. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +5 -0
  240. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +3 -0
  241. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +3 -0
  242. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +3 -0
  243. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +3 -0
  244. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -1
  245. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -0
  246. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +3 -0
  247. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -2
  248. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -0
  249. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -2
  250. package/r-bridge/lang-4.x/ast/model/operators.js +27 -26
  251. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +9 -9
  252. package/r-bridge/lang-4.x/ast/model/processing/fold.js +1 -2
  253. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +5 -0
  254. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +26 -3
  255. package/r-bridge/lang-4.x/ast/model/processing/role.js +1 -2
  256. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +23 -23
  257. package/r-bridge/lang-4.x/ast/model/processing/visitor.js +23 -23
  258. package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -2
  259. package/r-bridge/lang-4.x/ast/model/type.js +221 -12
  260. package/r-bridge/lang-4.x/ast/parser/json/format.js +2 -2
  261. package/r-bridge/lang-4.x/ast/parser/json/parser.js +6 -5
  262. package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +3 -3
  263. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then-else.js +4 -4
  264. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then.js +7 -7
  265. package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/normalize-expression.js +4 -4
  266. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-argument.js +10 -10
  267. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-call.js +18 -18
  268. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-definition.js +8 -8
  269. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-parameter.js +9 -9
  270. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-break.js +3 -3
  271. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-for.js +10 -10
  272. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-next.js +3 -3
  273. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-repeat.js +5 -5
  274. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-while.js +7 -7
  275. package/r-bridge/lang-4.x/ast/parser/xml/internal/normalize-access.js +12 -12
  276. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/normalize-binary.js +14 -14
  277. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/normalize-unary.js +4 -4
  278. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/normalize-comment.js +3 -3
  279. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/normalize-line-directive.js +4 -4
  280. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-delimiter.js +3 -3
  281. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-expressions.js +13 -13
  282. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-root.js +6 -6
  283. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-single-node.js +19 -19
  284. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-number.js +5 -5
  285. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-string.js +3 -3
  286. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-symbol.js +2 -3
  287. package/r-bridge/lang-4.x/ast/parser/xml/normalize-meta.js +12 -12
  288. package/r-bridge/lang-4.x/convert-values.js +7 -7
  289. package/r-bridge/retriever.js +12 -11
  290. package/r-bridge/shell.d.ts +0 -1
  291. package/r-bridge/shell.js +6 -1
  292. package/reconstruct/auto-select/auto-select-defaults.js +1 -2
  293. package/reconstruct/auto-select/magic-comments.js +3 -3
  294. package/reconstruct/reconstruct.js +4 -3
  295. package/slicing/criterion/collect-all.js +1 -2
  296. package/slicing/criterion/parse.d.ts +1 -1
  297. package/slicing/criterion/parse.js +6 -5
  298. package/slicing/static/fingerprint.js +2 -3
  299. package/slicing/static/slice-call.js +9 -9
  300. package/slicing/static/static-slicer.js +5 -4
  301. package/statistics/features/common-syntax-probability.js +13 -13
  302. package/statistics/features/feature.d.ts +5 -9
  303. package/statistics/features/feature.js +2 -2
  304. package/statistics/features/post-processing.js +2 -3
  305. package/statistics/features/supported/assignments/assignments.js +3 -2
  306. package/statistics/features/supported/assignments/post-process.js +1 -2
  307. package/statistics/features/supported/comments/post-process.js +1 -2
  308. package/statistics/features/supported/control-flow/control-flow.js +4 -3
  309. package/statistics/features/supported/control-flow/post-process.js +1 -2
  310. package/statistics/features/supported/data-access/data-access.d.ts +2 -2
  311. package/statistics/features/supported/data-access/data-access.js +3 -2
  312. package/statistics/features/supported/data-access/post-process.js +1 -2
  313. package/statistics/features/supported/defined-functions/defined-functions.js +9 -7
  314. package/statistics/features/supported/defined-functions/post-process.d.ts +1 -1
  315. package/statistics/features/supported/defined-functions/post-process.js +2 -3
  316. package/statistics/features/supported/expression-list/post-process.js +1 -2
  317. package/statistics/features/supported/expression-list/{expression-list.js → statistics-expression-list.js} +4 -3
  318. package/statistics/features/supported/loops/loops.js +8 -7
  319. package/statistics/features/supported/loops/post-process.js +1 -2
  320. package/statistics/features/supported/used-functions/post-process.js +2 -3
  321. package/statistics/features/supported/used-functions/used-functions.d.ts +1 -1
  322. package/statistics/features/supported/used-functions/used-functions.js +4 -3
  323. package/statistics/features/supported/used-packages/post-process.js +1 -2
  324. package/statistics/features/supported/values/post-process.js +1 -2
  325. package/statistics/features/supported/variables/post-process.js +2 -3
  326. package/statistics/features/supported/variables/variables.js +2 -1
  327. package/statistics/meta-statistics.js +1 -2
  328. package/statistics/output/print-stats.js +4 -5
  329. package/statistics/output/statistics-file.js +5 -5
  330. package/statistics/statistics.js +2 -3
  331. package/statistics/summarizer/auto-detect.js +1 -2
  332. package/statistics/summarizer/post-process/clusterer.js +1 -2
  333. package/statistics/summarizer/post-process/file-based-count.js +2 -3
  334. package/statistics/summarizer/post-process/histogram.js +3 -4
  335. package/statistics/summarizer/post-process/post-process-output.js +2 -3
  336. package/statistics/summarizer/second-phase/process.d.ts +2 -0
  337. package/statistics/summarizer/second-phase/process.js +2 -2
  338. package/statistics/summarizer/summarizer.js +8 -1
  339. package/util/ansi.d.ts +1 -0
  340. package/util/ansi.js +27 -4
  341. package/util/args.js +2 -3
  342. package/util/arrays.js +8 -9
  343. package/util/assert.js +5 -6
  344. package/util/bimap.d.ts +4 -4
  345. package/util/cfg/cfg.d.ts +1 -0
  346. package/util/cfg/cfg.js +8 -5
  347. package/util/cfg/visitor.d.ts +8 -13
  348. package/util/cfg/visitor.js +22 -56
  349. package/util/diff.js +1 -2
  350. package/util/files.d.ts +0 -1
  351. package/util/files.js +11 -8
  352. package/util/json.js +2 -3
  353. package/util/mermaid/ast.js +7 -7
  354. package/util/mermaid/cfg.js +2 -3
  355. package/util/mermaid/dfg.d.ts +12 -4
  356. package/util/mermaid/dfg.js +28 -16
  357. package/util/mermaid/mermaid.js +5 -4
  358. package/util/numbers.js +1 -2
  359. package/util/objects.d.ts +7 -0
  360. package/util/objects.js +13 -3
  361. package/util/os.js +1 -2
  362. package/util/quads.js +5 -5
  363. package/util/random.js +2 -2
  364. package/util/range.js +8 -9
  365. package/util/schema.d.ts +11 -0
  366. package/util/schema.js +75 -0
  367. package/util/set.js +2 -3
  368. package/util/strings.js +3 -4
  369. package/util/summarizer.js +4 -4
  370. package/util/text.d.ts +1 -0
  371. package/util/text.js +20 -0
  372. package/util/time.js +1 -2
  373. package/util/version.js +2 -3
  374. package/cli/repl/commands/lineage.d.ts +0 -15
  375. package/cli/repl/commands/quit.d.ts +0 -2
  376. package/cli/repl/server/messages/analysis.js +0 -21
  377. package/cli/repl/server/messages/lineage.js +0 -17
  378. package/cli/repl/server/messages/repl.js +0 -37
  379. /package/cli/repl/commands/{main.d.ts → repl-main.d.ts} +0 -0
  380. /package/{r-bridge/data/print.d.ts → documentation/print-capabilities-markdown.d.ts} +0 -0
  381. /package/statistics/features/supported/expression-list/{expression-list.d.ts → statistics-expression-list.d.ts} +0 -0
@@ -0,0 +1,139 @@
1
+ import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
2
+ import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
+ import type { DataflowFunctionFlowInformation, FunctionArgument } from './graph';
4
+ import { DataflowGraph } from './graph';
5
+ import type { REnvironmentInformation } from '../environments/environment';
6
+ import type { DataflowGraphVertexUse } from './vertex';
7
+ import type { ControlDependency } from '../info';
8
+ export declare function emptyGraph(idMap?: AstIdMap): DataflowGraphBuilder;
9
+ export type DataflowGraphEdgeTarget = NodeId | (readonly NodeId[]);
10
+ /**
11
+ * This DataflowGraphBuilder extends {@link DataflowGraph} with builder methods to
12
+ * easily and compactly add vertices and edges to a dataflow graph. Its usage thus
13
+ * simplifies writing tests for dataflow graphs.
14
+ */
15
+ export declare class DataflowGraphBuilder extends DataflowGraph {
16
+ /**
17
+ * Adds a **vertex** for a **function definition** (V1).
18
+ *
19
+ * @param id - AST node ID
20
+ * @param subflow - Subflow data graph for the defined function.
21
+ * @param exitPoints - Node IDs for exit point vertices.
22
+ * @param info - Additional/optional properties.
23
+ * @param asRoot - should the vertex be part of the root vertex set of the graph
24
+ * (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
25
+ */
26
+ defineFunction(id: NodeId, exitPoints: readonly NodeId[], subflow: DataflowFunctionFlowInformation, info?: {
27
+ environment?: REnvironmentInformation;
28
+ controlDependencies?: ControlDependency[];
29
+ }, asRoot?: boolean): this;
30
+ /**
31
+ * Adds a **vertex** for a **function call** (V2).
32
+ *
33
+ * @param id - AST node ID
34
+ * @param name - Function name
35
+ * @param args - Function arguments; may be empty
36
+ * @param info - Additional/optional properties.
37
+ * @param asRoot - should the vertex be part of the root vertex set of the graph
38
+ * (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
39
+ */
40
+ call(id: NodeId, name: string, args: FunctionArgument[], info?: {
41
+ returns?: readonly NodeId[];
42
+ reads?: readonly NodeId[];
43
+ onlyBuiltIn?: boolean;
44
+ environment?: REnvironmentInformation;
45
+ controlDependencies?: ControlDependency[];
46
+ }, asRoot?: boolean): this;
47
+ /** automatically adds argument links if they do not already exist */
48
+ private addArgumentLinks;
49
+ /**
50
+ * Adds a **vertex** for a **variable definition** (V4).
51
+ *
52
+ * @param id - AST node ID
53
+ * @param name - Variable name
54
+ * @param info - Additional/optional properties.
55
+ * @param asRoot - Should the vertex be part of the root vertex set of the graph
56
+ * (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
57
+ */
58
+ defineVariable(id: NodeId, name?: string, info?: {
59
+ controlDependencies?: ControlDependency[];
60
+ definedBy?: NodeId[];
61
+ }, asRoot?: boolean): this;
62
+ /**
63
+ * Adds a **vertex** for **variable use** (V5). Intended for creating dataflow graphs as part of function tests.
64
+ *
65
+ * @param id - AST node id
66
+ * @param name - Variable name
67
+ * @param info - Additional/optional properties; i.e., scope, when, or environment.
68
+ * @param asRoot - should the vertex be part of the root vertex set of the graph
69
+ * (i.e., be a valid entry point) or is it nested (e.g., as part of a function definition)
70
+ */
71
+ use(id: NodeId, name?: string, info?: Partial<DataflowGraphVertexUse>, asRoot?: boolean): this;
72
+ /**
73
+ * Adds a **vertex** for a **constant value** (V6).
74
+ *
75
+ * @param id - AST node ID
76
+ * @param options - Additional/optional properties;
77
+ * @param asRoot - should the vertex be part of the root vertex set of the graph
78
+ * (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
79
+ */
80
+ constant(id: NodeId, options?: {
81
+ controlDependencies?: ControlDependency[];
82
+ }, asRoot?: boolean): this;
83
+ private edgeHelper;
84
+ /**
85
+ * Adds a **read edge** (E1).
86
+ *
87
+ * @param from - Vertex/NodeId
88
+ * @param to - see from
89
+ */
90
+ reads(from: NodeId, to: DataflowGraphEdgeTarget): this;
91
+ /**
92
+ * Adds a **defined-by edge** (E2), with from as defined variable, and to
93
+ * as a variable/function contributing to its definition.
94
+ *
95
+ * @see reads for parameters.
96
+ */
97
+ definedBy(from: NodeId, to: DataflowGraphEdgeTarget): this;
98
+ /**
99
+ * Adds a **call edge** (E5) with from as caller, and to as callee.
100
+ *
101
+ * @see reads for parameters.
102
+ */
103
+ calls(from: NodeId, to: DataflowGraphEdgeTarget): this;
104
+ /**
105
+ * Adds a **return edge** (E6) with from as function, and to as exit point.
106
+ *
107
+ * @see reads for parameters.
108
+ */
109
+ returns(from: NodeId, to: DataflowGraphEdgeTarget): this;
110
+ /**
111
+ * Adds a **defines-on-call edge** (E7) with from as variable, and to as its definition
112
+ *
113
+ * @see reads for parameters.
114
+ */
115
+ definesOnCall(from: NodeId, to: DataflowGraphEdgeTarget): this;
116
+ /**
117
+ * Adds an **argument edge** (E9) with from as function call, and to as argument.
118
+ *
119
+ * @see reads for parameters.
120
+ */
121
+ argument(from: NodeId, to: DataflowGraphEdgeTarget): this;
122
+ /**
123
+ * Adds a **non-standard evaluation edge** with from as vertex, and to as vertex.
124
+ *
125
+ * @see reads for parameters.
126
+ */
127
+ nse(from: NodeId, to: DataflowGraphEdgeTarget): this;
128
+ /**
129
+ * Adds a **side-effect-on-call edge** with from as vertex, and to as vertex.
130
+ *
131
+ * @see reads for parameters.
132
+ */
133
+ sideEffectOnCall(from: NodeId, to: DataflowGraphEdgeTarget): this;
134
+ /**
135
+ * explicitly overwrite the root ids of the graph,
136
+ * this is just an easier variant in case you working with a lot of functions this saves you a lot of `false` flags.
137
+ */
138
+ overwriteRootIds(ids: readonly NodeId[]): this;
139
+ }
@@ -0,0 +1,247 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataflowGraphBuilder = void 0;
4
+ exports.emptyGraph = emptyGraph;
5
+ const objects_1 = require("../../util/objects");
6
+ const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
7
+ const graph_1 = require("./graph");
8
+ const environment_1 = require("../environments/environment");
9
+ const vertex_1 = require("./vertex");
10
+ const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
11
+ const built_in_1 = require("../environments/built-in");
12
+ const edge_1 = require("./edge");
13
+ function emptyGraph(idMap) {
14
+ return new DataflowGraphBuilder(idMap);
15
+ }
16
+ /**
17
+ * This DataflowGraphBuilder extends {@link DataflowGraph} with builder methods to
18
+ * easily and compactly add vertices and edges to a dataflow graph. Its usage thus
19
+ * simplifies writing tests for dataflow graphs.
20
+ */
21
+ class DataflowGraphBuilder extends graph_1.DataflowGraph {
22
+ /**
23
+ * Adds a **vertex** for a **function definition** (V1).
24
+ *
25
+ * @param id - AST node ID
26
+ * @param subflow - Subflow data graph for the defined function.
27
+ * @param exitPoints - Node IDs for exit point vertices.
28
+ * @param info - Additional/optional properties.
29
+ * @param asRoot - should the vertex be part of the root vertex set of the graph
30
+ * (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
31
+ */
32
+ defineFunction(id, exitPoints, subflow, info, asRoot = true) {
33
+ return this.addVertex({
34
+ tag: vertex_1.VertexType.FunctionDefinition,
35
+ id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
36
+ subflow: {
37
+ ...subflow,
38
+ entryPoint: (0, node_id_1.normalizeIdToNumberIfPossible)(subflow.entryPoint),
39
+ graph: new Set([...subflow.graph].map(node_id_1.normalizeIdToNumberIfPossible)),
40
+ out: subflow.out.map(o => ({ ...o, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(o.nodeId), controlDependencies: o.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })) })),
41
+ in: subflow.in.map(o => ({ ...o, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(o.nodeId), controlDependencies: o.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })) })),
42
+ unknownReferences: subflow.unknownReferences.map(o => ({ ...o, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(o.nodeId), controlDependencies: o.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })) }))
43
+ },
44
+ exitPoints: exitPoints.map(node_id_1.normalizeIdToNumberIfPossible),
45
+ controlDependencies: info?.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
46
+ environment: info?.environment
47
+ }, asRoot);
48
+ }
49
+ /**
50
+ * Adds a **vertex** for a **function call** (V2).
51
+ *
52
+ * @param id - AST node ID
53
+ * @param name - Function name
54
+ * @param args - Function arguments; may be empty
55
+ * @param info - Additional/optional properties.
56
+ * @param asRoot - should the vertex be part of the root vertex set of the graph
57
+ * (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
58
+ */
59
+ call(id, name, args, info, asRoot = true) {
60
+ const onlyBuiltInAuto = info?.reads?.length === 1 && info?.reads[0] === built_in_1.BuiltIn;
61
+ this.addVertex({
62
+ tag: vertex_1.VertexType.FunctionCall,
63
+ id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
64
+ name,
65
+ args: args.map(a => a === r_function_call_1.EmptyArgument ? r_function_call_1.EmptyArgument : { ...a, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(a.nodeId), controlDependencies: undefined }),
66
+ environment: (info?.onlyBuiltIn || onlyBuiltInAuto) ? undefined : info?.environment ?? (0, environment_1.initializeCleanEnvironments)(),
67
+ controlDependencies: info?.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
68
+ onlyBuiltin: info?.onlyBuiltIn ?? onlyBuiltInAuto ?? false
69
+ }, asRoot);
70
+ this.addArgumentLinks(id, args);
71
+ if (info?.returns) {
72
+ for (const ret of info.returns) {
73
+ this.returns(id, ret);
74
+ }
75
+ }
76
+ if (info?.reads) {
77
+ for (const call of info.reads) {
78
+ this.reads(id, call);
79
+ }
80
+ }
81
+ return this;
82
+ }
83
+ /** automatically adds argument links if they do not already exist */
84
+ addArgumentLinks(id, args) {
85
+ for (const arg of args) {
86
+ if (arg === r_function_call_1.EmptyArgument) {
87
+ continue;
88
+ }
89
+ if ((0, graph_1.isPositionalArgument)(arg)) {
90
+ this.argument(id, arg.nodeId);
91
+ if (typeof arg.nodeId === 'string' && arg.nodeId.endsWith('-arg')) {
92
+ const withoutSuffix = arg.nodeId.slice(0, -4);
93
+ this.reads(arg.nodeId, withoutSuffix);
94
+ }
95
+ }
96
+ else if (!this.hasVertex(arg.nodeId, true)) {
97
+ this.use(arg.nodeId, arg.name, { controlDependencies: arg.controlDependencies });
98
+ this.argument(id, arg.nodeId);
99
+ }
100
+ }
101
+ }
102
+ /**
103
+ * Adds a **vertex** for a **variable definition** (V4).
104
+ *
105
+ * @param id - AST node ID
106
+ * @param name - Variable name
107
+ * @param info - Additional/optional properties.
108
+ * @param asRoot - Should the vertex be part of the root vertex set of the graph
109
+ * (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
110
+ */
111
+ defineVariable(id, name, info, asRoot = true) {
112
+ this.addVertex({
113
+ tag: vertex_1.VertexType.VariableDefinition,
114
+ id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
115
+ name,
116
+ controlDependencies: info?.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
117
+ }, asRoot);
118
+ if (info?.definedBy) {
119
+ for (const def of info.definedBy) {
120
+ this.definedBy(id, def);
121
+ }
122
+ }
123
+ return this;
124
+ }
125
+ /**
126
+ * Adds a **vertex** for **variable use** (V5). Intended for creating dataflow graphs as part of function tests.
127
+ *
128
+ * @param id - AST node id
129
+ * @param name - Variable name
130
+ * @param info - Additional/optional properties; i.e., scope, when, or environment.
131
+ * @param asRoot - should the vertex be part of the root vertex set of the graph
132
+ * (i.e., be a valid entry point) or is it nested (e.g., as part of a function definition)
133
+ */
134
+ use(id, name, info, asRoot = true) {
135
+ return this.addVertex((0, objects_1.deepMergeObject)({
136
+ tag: vertex_1.VertexType.Use,
137
+ id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
138
+ name,
139
+ controlDependencies: undefined,
140
+ environment: undefined
141
+ }, {
142
+ ...info,
143
+ controlDependencies: info?.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) }))
144
+ }), asRoot);
145
+ }
146
+ /**
147
+ * Adds a **vertex** for a **constant value** (V6).
148
+ *
149
+ * @param id - AST node ID
150
+ * @param options - Additional/optional properties;
151
+ * @param asRoot - should the vertex be part of the root vertex set of the graph
152
+ * (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
153
+ */
154
+ constant(id, options, asRoot = true) {
155
+ return this.addVertex({
156
+ tag: vertex_1.VertexType.Value,
157
+ id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
158
+ controlDependencies: options?.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
159
+ environment: undefined
160
+ }, asRoot);
161
+ }
162
+ edgeHelper(from, to, type) {
163
+ if (Array.isArray(to)) {
164
+ for (const t of to) {
165
+ this.edgeHelper(from, t, type);
166
+ }
167
+ return this;
168
+ }
169
+ return this.addEdge((0, node_id_1.normalizeIdToNumberIfPossible)(from), (0, node_id_1.normalizeIdToNumberIfPossible)(to), type);
170
+ }
171
+ /**
172
+ * Adds a **read edge** (E1).
173
+ *
174
+ * @param from - Vertex/NodeId
175
+ * @param to - see from
176
+ */
177
+ reads(from, to) {
178
+ return this.edgeHelper(from, to, edge_1.EdgeType.Reads);
179
+ }
180
+ /**
181
+ * Adds a **defined-by edge** (E2), with from as defined variable, and to
182
+ * as a variable/function contributing to its definition.
183
+ *
184
+ * @see reads for parameters.
185
+ */
186
+ definedBy(from, to) {
187
+ return this.edgeHelper(from, to, edge_1.EdgeType.DefinedBy);
188
+ }
189
+ /**
190
+ * Adds a **call edge** (E5) with from as caller, and to as callee.
191
+ *
192
+ * @see reads for parameters.
193
+ */
194
+ calls(from, to) {
195
+ return this.edgeHelper(from, to, edge_1.EdgeType.Calls);
196
+ }
197
+ /**
198
+ * Adds a **return edge** (E6) with from as function, and to as exit point.
199
+ *
200
+ * @see reads for parameters.
201
+ */
202
+ returns(from, to) {
203
+ return this.edgeHelper(from, to, edge_1.EdgeType.Returns);
204
+ }
205
+ /**
206
+ * Adds a **defines-on-call edge** (E7) with from as variable, and to as its definition
207
+ *
208
+ * @see reads for parameters.
209
+ */
210
+ definesOnCall(from, to) {
211
+ return this.edgeHelper(from, to, edge_1.EdgeType.DefinesOnCall);
212
+ }
213
+ /**
214
+ * Adds an **argument edge** (E9) with from as function call, and to as argument.
215
+ *
216
+ * @see reads for parameters.
217
+ */
218
+ argument(from, to) {
219
+ return this.edgeHelper(from, to, edge_1.EdgeType.Argument);
220
+ }
221
+ /**
222
+ * Adds a **non-standard evaluation edge** with from as vertex, and to as vertex.
223
+ *
224
+ * @see reads for parameters.
225
+ */
226
+ nse(from, to) {
227
+ return this.edgeHelper(from, to, edge_1.EdgeType.NonStandardEvaluation);
228
+ }
229
+ /**
230
+ * Adds a **side-effect-on-call edge** with from as vertex, and to as vertex.
231
+ *
232
+ * @see reads for parameters.
233
+ */
234
+ sideEffectOnCall(from, to) {
235
+ return this.edgeHelper(from, to, edge_1.EdgeType.SideEffectOnCall);
236
+ }
237
+ /**
238
+ * explicitly overwrite the root ids of the graph,
239
+ * this is just an easier variant in case you working with a lot of functions this saves you a lot of `false` flags.
240
+ */
241
+ overwriteRootIds(ids) {
242
+ this.rootVertices = new Set(ids.map(node_id_1.normalizeIdToNumberIfPossible));
243
+ return this;
244
+ }
245
+ }
246
+ exports.DataflowGraphBuilder = DataflowGraphBuilder;
247
+ //# sourceMappingURL=dataflowgraph-builder.js.map
@@ -1,10 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.diffEdges = exports.diffVertices = exports.diffFunctionArguments = exports.equalFunctionArguments = exports.diffOfDataflowGraphs = exports.DataflowDifferenceReport = void 0;
3
+ exports.DataflowDifferenceReport = void 0;
4
+ exports.diffOfDataflowGraphs = diffOfDataflowGraphs;
5
+ exports.equalFunctionArguments = equalFunctionArguments;
6
+ exports.diffFunctionArguments = diffFunctionArguments;
7
+ exports.diffVertices = diffVertices;
8
+ exports.diffEdges = diffEdges;
4
9
  const graph_1 = require("./graph");
5
10
  const diff_1 = require("../../util/diff");
6
11
  const json_1 = require("../../util/json");
7
12
  const arrays_1 = require("../../util/arrays");
13
+ const vertex_1 = require("./vertex");
8
14
  const edge_1 = require("./edge");
9
15
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
10
16
  const diff_2 = require("../environments/diff");
@@ -73,8 +79,8 @@ function diffOutgoingEdges(ctx) {
73
79
  if (!ctx.left.hasVertex(id)) {
74
80
  if (!ctx.config.leftIsSubgraph) {
75
81
  ctx.report.addComment(`The source ${id} of edges ${JSON.stringify(edge, json_1.jsonReplacer)} is not present in ${ctx.leftname}. This means that the graph contains an edge but not the corresponding vertex.`);
82
+ continue;
76
83
  }
77
- continue;
78
84
  }
79
85
  diffEdges(ctx, id, edge, rEdges.get(id));
80
86
  }
@@ -83,8 +89,8 @@ function diffOutgoingEdges(ctx) {
83
89
  if (!ctx.right.hasVertex(id)) {
84
90
  if (!ctx.config.rightIsSubgraph) {
85
91
  ctx.report.addComment(`The source ${id} of edges ${JSON.stringify(edge, json_1.jsonReplacer)} is not present in ${ctx.rightname}. This means that the graph contains an edge but not the corresponding vertex.`);
92
+ continue;
86
93
  }
87
- continue;
88
94
  }
89
95
  if (!ctx.config.leftIsSubgraph && !lEdges.has(id)) {
90
96
  diffEdges(ctx, id, undefined, edge);
@@ -104,7 +110,6 @@ function diffOfDataflowGraphs(left, right, config) {
104
110
  diff(ctx);
105
111
  return ctx.report;
106
112
  }
107
- exports.diffOfDataflowGraphs = diffOfDataflowGraphs;
108
113
  function diffFunctionArgumentsReferences(fn, a, b, ctx) {
109
114
  if (a === '<value>' || b === '<value>') {
110
115
  if (a !== b) {
@@ -125,7 +130,6 @@ function equalFunctionArguments(fn, a, b) {
125
130
  diffFunctionArguments(fn, a, b, ctx);
126
131
  return ctx.report.isEqual();
127
132
  }
128
- exports.equalFunctionArguments = equalFunctionArguments;
129
133
  function diffFunctionArguments(fn, a, b, ctx) {
130
134
  if (a === false || b === false) {
131
135
  if (a !== b) {
@@ -164,7 +168,6 @@ function diffFunctionArguments(fn, a, b, ctx) {
164
168
  }
165
169
  }
166
170
  }
167
- exports.diffFunctionArguments = diffFunctionArguments;
168
171
  function diffVertices(ctx) {
169
172
  // collect vertices from both sides
170
173
  const lVert = [...ctx.left.vertices(true)].map(([id, info]) => [id, info]);
@@ -205,8 +208,8 @@ function diffVertices(ctx) {
205
208
  position: `${ctx.position}Vertex ${id} differs in environment. `
206
209
  });
207
210
  }
208
- if (lInfo.tag === "function-call" /* VertexType.FunctionCall */) {
209
- if (rInfo.tag !== "function-call" /* VertexType.FunctionCall */) {
211
+ if (lInfo.tag === vertex_1.VertexType.FunctionCall) {
212
+ if (rInfo.tag !== vertex_1.VertexType.FunctionCall) {
210
213
  ctx.report.addComment(`Vertex ${id} differs in tags. ${ctx.leftname}: ${lInfo.tag} vs. ${ctx.rightname}: ${rInfo.tag}`);
211
214
  }
212
215
  else {
@@ -245,11 +248,10 @@ function diffVertices(ctx) {
245
248
  }
246
249
  }
247
250
  }
248
- exports.diffVertices = diffVertices;
249
251
  function diffEdge(edge, otherEdge, ctx, id, target) {
250
252
  const edgeTypes = (0, edge_1.splitEdgeTypes)(edge.types);
251
253
  const otherEdgeTypes = (0, edge_1.splitEdgeTypes)(otherEdge.types);
252
- if (edgeTypes.length !== otherEdgeTypes.length) {
254
+ if ((edgeTypes.length < otherEdgeTypes.length && !ctx.config.leftIsSubgraph) || (edgeTypes.length > otherEdgeTypes.length && !ctx.config.rightIsSubgraph)) {
253
255
  ctx.report.addComment(`Target of ${id}->${target} in ${ctx.leftname} differs in number of edge types: ${JSON.stringify([...edgeTypes])} vs ${JSON.stringify([...otherEdgeTypes])}`, { tag: 'edge', from: id, to: target });
254
256
  }
255
257
  if (edge.types !== otherEdge.types) {
@@ -280,5 +282,4 @@ function diffEdges(ctx, id, lEdges, rEdges) {
280
282
  diffEdge(edge, otherEdge, ctx, id, target);
281
283
  }
282
284
  }
283
- exports.diffEdges = diffEdges;
284
285
  //# sourceMappingURL=diff.js.map
@@ -11,7 +11,7 @@ export interface DataflowGraphEdge {
11
11
  * The actual value is represented as a bitmask so use {@link edgeTypesToNames} to get something more human-readable.
12
12
  * Similarly, you can access {@link EdgeTypeName} to access the name counterpart.
13
13
  */
14
- export declare const enum EdgeType {
14
+ export declare enum EdgeType {
15
15
  /** The edge determines that source reads target */
16
16
  Reads = 1,
17
17
  /** The edge determines that source is defined by target */
@@ -68,7 +68,7 @@ export declare const enum TraverseEdge {
68
68
  * @example
69
69
  *
70
70
  * ```typescript
71
- * hasAnyTypeOf(EdgeType.Reads, EdgeType.Reads | EdgeType.DefinedBy) // true
71
+ * edgeIncludesType(EdgeType.Reads, EdgeType.Reads | EdgeType.DefinedBy) // true
72
72
  *```
73
73
  *
74
74
  * Counterpart of {@link edgeDoesNotIncludeType}.
@@ -1,16 +1,48 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shouldTraverseEdge = exports.edgeDoesNotIncludeType = exports.edgeIncludesType = exports.edgeTypesToNames = exports.splitEdgeTypes = exports.edgeTypeToName = void 0;
3
+ exports.EdgeType = void 0;
4
+ exports.edgeTypeToName = edgeTypeToName;
5
+ exports.splitEdgeTypes = splitEdgeTypes;
6
+ exports.edgeTypesToNames = edgeTypesToNames;
7
+ exports.edgeIncludesType = edgeIncludesType;
8
+ exports.edgeDoesNotIncludeType = edgeDoesNotIncludeType;
9
+ exports.shouldTraverseEdge = shouldTraverseEdge;
10
+ /**
11
+ * Represents the relationship between the source and the target vertex in the dataflow graph.
12
+ * The actual value is represented as a bitmask so use {@link edgeTypesToNames} to get something more human-readable.
13
+ * Similarly, you can access {@link EdgeTypeName} to access the name counterpart.
14
+ */
15
+ var EdgeType;
16
+ (function (EdgeType) {
17
+ /** The edge determines that source reads target */
18
+ EdgeType[EdgeType["Reads"] = 1] = "Reads";
19
+ /** The edge determines that source is defined by target */
20
+ EdgeType[EdgeType["DefinedBy"] = 2] = "DefinedBy";
21
+ /** The edge determines that the source calls the target */
22
+ EdgeType[EdgeType["Calls"] = 4] = "Calls";
23
+ /** The source returns target on call */
24
+ EdgeType[EdgeType["Returns"] = 8] = "Returns";
25
+ /** The edge determines that source (probably argument) defines the target (probably parameter), currently automatically created by `addEdge` */
26
+ EdgeType[EdgeType["DefinesOnCall"] = 16] = "DefinesOnCall";
27
+ /** Inverse of `defines-on-call` currently only needed to get better results when slicing complex function calls */
28
+ EdgeType[EdgeType["DefinedByOnCall"] = 32] = "DefinedByOnCall";
29
+ /** Formal used as argument to a function call */
30
+ EdgeType[EdgeType["Argument"] = 64] = "Argument";
31
+ /** The edge determines that the source is a side effect that happens when the target is called */
32
+ EdgeType[EdgeType["SideEffectOnCall"] = 128] = "SideEffectOnCall";
33
+ /** The Edge determines that the reference is affected by a non-standard evaluation (e.g., a for-loop body or a quotation) */
34
+ EdgeType[EdgeType["NonStandardEvaluation"] = 256] = "NonStandardEvaluation";
35
+ })(EdgeType || (exports.EdgeType = EdgeType = {}));
4
36
  const edgeTypeToHumanReadableName = new Map([
5
- [1 /* EdgeType.Reads */, "reads" /* EdgeTypeName.Reads */],
6
- [2 /* EdgeType.DefinedBy */, "defined-by" /* EdgeTypeName.DefinedBy */],
7
- [4 /* EdgeType.Calls */, "calls" /* EdgeTypeName.Calls */],
8
- [8 /* EdgeType.Returns */, "returns" /* EdgeTypeName.Returns */],
9
- [16 /* EdgeType.DefinesOnCall */, "defines-on-call" /* EdgeTypeName.DefinesOnCall */],
10
- [32 /* EdgeType.DefinedByOnCall */, "defined-by-on-call" /* EdgeTypeName.DefinedByOnCall */],
11
- [64 /* EdgeType.Argument */, "argument" /* EdgeTypeName.Argument */],
12
- [128 /* EdgeType.SideEffectOnCall */, "side-effect-on-call" /* EdgeTypeName.SideEffectOnCall */],
13
- [256 /* EdgeType.NonStandardEvaluation */, "non-standard-evaluation" /* EdgeTypeName.NonStandardEvaluation */]
37
+ [EdgeType.Reads, "reads" /* EdgeTypeName.Reads */],
38
+ [EdgeType.DefinedBy, "defined-by" /* EdgeTypeName.DefinedBy */],
39
+ [EdgeType.Calls, "calls" /* EdgeTypeName.Calls */],
40
+ [EdgeType.Returns, "returns" /* EdgeTypeName.Returns */],
41
+ [EdgeType.DefinesOnCall, "defines-on-call" /* EdgeTypeName.DefinesOnCall */],
42
+ [EdgeType.DefinedByOnCall, "defined-by-on-call" /* EdgeTypeName.DefinedByOnCall */],
43
+ [EdgeType.Argument, "argument" /* EdgeTypeName.Argument */],
44
+ [EdgeType.SideEffectOnCall, "side-effect-on-call" /* EdgeTypeName.SideEffectOnCall */],
45
+ [EdgeType.NonStandardEvaluation, "non-standard-evaluation" /* EdgeTypeName.NonStandardEvaluation */]
14
46
  ]);
15
47
  /**
16
48
  * Only use this function to retrieve a human-readable name if you know that it is a single bitmask.
@@ -19,7 +51,6 @@ const edgeTypeToHumanReadableName = new Map([
19
51
  function edgeTypeToName(type) {
20
52
  return edgeTypeToHumanReadableName.get(type);
21
53
  }
22
- exports.edgeTypeToName = edgeTypeToName;
23
54
  function splitEdgeTypes(types) {
24
55
  const split = [];
25
56
  for (const bit of edgeTypeToHumanReadableName.keys()) {
@@ -29,7 +60,6 @@ function splitEdgeTypes(types) {
29
60
  }
30
61
  return split;
31
62
  }
32
- exports.splitEdgeTypes = splitEdgeTypes;
33
63
  function edgeTypesToNames(bits) {
34
64
  const types = new Set();
35
65
  for (const [bit, name] of edgeTypeToHumanReadableName.entries()) {
@@ -39,13 +69,12 @@ function edgeTypesToNames(bits) {
39
69
  }
40
70
  return types;
41
71
  }
42
- exports.edgeTypesToNames = edgeTypesToNames;
43
72
  /**
44
73
  * Check if the given-edge type has any of the given types.
45
74
  * @example
46
75
  *
47
76
  * ```typescript
48
- * hasAnyTypeOf(EdgeType.Reads, EdgeType.Reads | EdgeType.DefinedBy) // true
77
+ * edgeIncludesType(EdgeType.Reads, EdgeType.Reads | EdgeType.DefinedBy) // true
49
78
  *```
50
79
  *
51
80
  * Counterpart of {@link edgeDoesNotIncludeType}.
@@ -53,7 +82,6 @@ exports.edgeTypesToNames = edgeTypesToNames;
53
82
  function edgeIncludesType(type, types) {
54
83
  return (types & type) !== 0;
55
84
  }
56
- exports.edgeIncludesType = edgeIncludesType;
57
85
  /**
58
86
  * Check if the given-edge type does not include the given type.
59
87
  * Counterpart of {@link edgeIncludesType}.
@@ -61,19 +89,17 @@ exports.edgeIncludesType = edgeIncludesType;
61
89
  function edgeDoesNotIncludeType(type, types) {
62
90
  return (types & type) === 0;
63
91
  }
64
- exports.edgeDoesNotIncludeType = edgeDoesNotIncludeType;
65
- const alwaysTraverseEdgeTypes = 1 /* EdgeType.Reads */ | 2 /* EdgeType.DefinedBy */ | 64 /* EdgeType.Argument */ | 4 /* EdgeType.Calls */ | 16 /* EdgeType.DefinesOnCall */;
92
+ const alwaysTraverseEdgeTypes = EdgeType.Reads | EdgeType.DefinedBy | EdgeType.Argument | EdgeType.Calls | EdgeType.DefinesOnCall;
66
93
  function shouldTraverseEdge(types) {
67
94
  if (edgeIncludesType(types, alwaysTraverseEdgeTypes)) {
68
95
  return 3 /* TraverseEdge.Always */;
69
96
  }
70
- else if (edgeIncludesType(types, 32 /* EdgeType.DefinedByOnCall */)) {
97
+ else if (edgeIncludesType(types, EdgeType.DefinedByOnCall)) {
71
98
  return 2 /* TraverseEdge.DefinedByOnCall */;
72
99
  }
73
- else if (edgeIncludesType(types, 128 /* EdgeType.SideEffectOnCall */)) {
100
+ else if (edgeIncludesType(types, EdgeType.SideEffectOnCall)) {
74
101
  return 1 /* TraverseEdge.SideEffect */;
75
102
  }
76
103
  return 0 /* TraverseEdge.Never */;
77
104
  }
78
- exports.shouldTraverseEdge = shouldTraverseEdge;
79
105
  //# sourceMappingURL=edge.js.map
@@ -9,12 +9,23 @@ import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/deco
9
9
  export type DataflowFunctionFlowInformation = Omit<DataflowInformation, 'graph' | 'exitPoints'> & {
10
10
  graph: Set<NodeId>;
11
11
  };
12
+ /**
13
+ * ```r
14
+ * foo(a = 3, b = 2)
15
+ * ```
16
+ */
12
17
  export interface NamedFunctionArgument extends IdentifierReference {
13
18
  readonly name: string;
14
19
  }
20
+ /**
21
+ * ```r
22
+ * foo(3, 2)
23
+ * ```
24
+ */
15
25
  export interface PositionalFunctionArgument extends Omit<IdentifierReference, 'name'> {
16
26
  readonly name?: undefined;
17
27
  }
28
+ /** Summarizes either named (`foo(a = 3, b = 2)`), unnamed (`foo(3, 2)`), or empty (`foo(,)`) arguments within a function. */
18
29
  export type FunctionArgument = NamedFunctionArgument | PositionalFunctionArgument | typeof EmptyArgument;
19
30
  export declare function isPositionalArgument(arg: FunctionArgument): arg is PositionalFunctionArgument;
20
31
  export declare function isNamedArgument(arg: FunctionArgument): arg is NamedFunctionArgument;
@@ -29,9 +40,6 @@ export type OutgoingEdges<Edge extends DataflowGraphEdge = DataflowGraphEdge> =
29
40
  * In other words, it maps the source to the edge information.
30
41
  */
31
42
  export type IngoingEdges<Edge extends DataflowGraphEdge = DataflowGraphEdge> = Map<NodeId, Edge>;
32
- type EdgeData<Edge extends DataflowGraphEdge> = Omit<Edge, 'from' | 'to' | 'types' | 'attribute'> & {
33
- type: EdgeType;
34
- };
35
43
  export interface DataflowGraphJson {
36
44
  readonly rootVertices: NodeId[];
37
45
  readonly vertexInformation: [NodeId, DataflowGraphVertexInfo][];
@@ -126,11 +134,11 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
126
134
  */
127
135
  addVertex(vertex: DataflowGraphVertexArgument & Omit<Vertex, keyof DataflowGraphVertexArgument>, asRoot?: boolean): this;
128
136
  /** {@inheritDoc} */
129
- addEdge(from: NodeId, to: NodeId, edgeInfo: EdgeData<Edge>): this;
137
+ addEdge(from: NodeId, to: NodeId, type: EdgeType): this;
130
138
  /** {@inheritDoc} */
131
- addEdge(from: ReferenceForEdge, to: ReferenceForEdge, edgeInfo: EdgeData<Edge>): this;
139
+ addEdge(from: ReferenceForEdge, to: ReferenceForEdge, type: EdgeType): this;
132
140
  /** {@inheritDoc} */
133
- addEdge(from: NodeId | ReferenceForEdge, to: NodeId | ReferenceForEdge, edgeInfo: EdgeData<Edge>): this;
141
+ addEdge(from: NodeId | ReferenceForEdge, to: NodeId | ReferenceForEdge, type: EdgeType): this;
134
142
  private installEdge;
135
143
  /**
136
144
  * Merges the other graph into *this* one (in-place). The return value is only for convenience.