@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
@@ -1,19 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.markAsAssignment = exports.processAssignment = void 0;
3
+ exports.processAssignment = processAssignment;
4
+ exports.markAsAssignment = markAsAssignment;
4
5
  const known_call_handling_1 = require("../known-call-handling");
5
6
  const assert_1 = require("../../../../../../util/assert");
6
7
  const log_1 = require("../../../../../../util/log");
7
8
  const unpack_argument_1 = require("../argument/unpack-argument");
8
9
  const process_named_call_1 = require("../../../process-named-call");
9
10
  const make_argument_1 = require("../argument/make-argument");
11
+ const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
10
12
  const logger_1 = require("../../../../../logger");
13
+ const identifier_1 = require("../../../../../environments/identifier");
11
14
  const overwrite_1 = require("../../../../../environments/overwrite");
12
15
  const retriever_1 = require("../../../../../../r-bridge/retriever");
16
+ const vertex_1 = require("../../../../../graph/vertex");
13
17
  const define_1 = require("../../../../../environments/define");
18
+ const edge_1 = require("../../../../../graph/edge");
14
19
  function toReplacementSymbol(target, prefix, superAssignment) {
15
20
  return {
16
- type: "RSymbol" /* RType.Symbol */,
21
+ type: type_1.RType.Symbol,
17
22
  info: target.info,
18
23
  /* they are all mapped to `<-` in R, but we mark super as well */
19
24
  content: `${prefix}${superAssignment ? '<<-' : '<-'}`,
@@ -27,10 +32,10 @@ function getEffectiveOrder(config, args) {
27
32
  }
28
33
  function findRootAccess(node) {
29
34
  let current = node;
30
- while (current.type === "RAccess" /* RType.Access */) {
35
+ while (current.type === type_1.RType.Access) {
31
36
  current = current.accessed;
32
37
  }
33
- if (current.type === "RSymbol" /* RType.Symbol */) {
38
+ if (current.type === type_1.RType.Symbol) {
34
39
  return current;
35
40
  }
36
41
  else {
@@ -52,7 +57,7 @@ args, rootId, data, config) {
52
57
  const effectiveArgs = getEffectiveOrder(config, args);
53
58
  const { target, source } = extractSourceAndTarget(effectiveArgs, name);
54
59
  const { type, named } = target;
55
- if (type === "RSymbol" /* RType.Symbol */) {
60
+ if (type === type_1.RType.Symbol) {
56
61
  const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, reverseOrder: !config.swapSourceAndTarget, forceArgs: config.forceArgs });
57
62
  return processAssignmentToSymbol({
58
63
  ...config,
@@ -65,18 +70,18 @@ args, rootId, data, config) {
65
70
  information: res.information,
66
71
  });
67
72
  }
68
- else if (config.canBeReplacement && type === "RFunctionCall" /* RType.FunctionCall */ && named) {
73
+ else if (config.canBeReplacement && type === type_1.RType.FunctionCall && named) {
69
74
  /* as replacement functions take precedence over the lhs fn-call (i.e., `names(x) <- ...` is independent from the definition of `names`), we do not have to process the call */
70
75
  logger_1.dataflowLogger.debug(`Assignment ${name.content} has a function call as target => replacement function ${target.lexeme}`);
71
76
  const replacement = toReplacementSymbol(target, target.functionName.content, config.superAssignment ?? false);
72
77
  return (0, process_named_call_1.processAsNamedCall)(replacement, data, replacement.content, [...target.arguments, source]);
73
78
  }
74
- else if (config.canBeReplacement && type === "RAccess" /* RType.Access */) {
79
+ else if (config.canBeReplacement && type === type_1.RType.Access) {
75
80
  logger_1.dataflowLogger.debug(`Assignment ${name.content} has an access as target => replacement function ${target.lexeme}`);
76
81
  const replacement = toReplacementSymbol(target, target.operator, config.superAssignment ?? false);
77
82
  return (0, process_named_call_1.processAsNamedCall)(replacement, data, replacement.content, [(0, make_argument_1.toUnnamedArgument)(target.accessed, data.completeAst.idMap), ...target.access, source]);
78
83
  }
79
- else if (type === "RAccess" /* RType.Access */) {
84
+ else if (type === type_1.RType.Access) {
80
85
  const rootArg = findRootAccess(target);
81
86
  if (rootArg) {
82
87
  const res = (0, known_call_handling_1.processKnownFunctionCall)({
@@ -99,13 +104,12 @@ args, rootId, data, config) {
99
104
  });
100
105
  }
101
106
  }
102
- else if (type === "RString" /* RType.String */) {
107
+ else if (type === type_1.RType.String) {
103
108
  return processAssignmentToString(target, args, name, rootId, data, config, source);
104
109
  }
105
110
  logger_1.dataflowLogger.warn(`Assignment ${name.content} has an unknown target type ${target.type}, skipping`);
106
111
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args: effectiveArgs, rootId, data, forceArgs: config.forceArgs }).information;
107
112
  }
108
- exports.processAssignment = processAssignment;
109
113
  function extractSourceAndTarget(args, name) {
110
114
  const source = (0, unpack_argument_1.unpackArgument)(args[1]);
111
115
  const target = (0, unpack_argument_1.unpackArgument)(args[0]);
@@ -113,17 +117,17 @@ function extractSourceAndTarget(args, name) {
113
117
  (0, assert_1.guard)(target !== undefined, () => `Assignment ${name.content} has no target, impossible!`);
114
118
  return { source, target };
115
119
  }
116
- function produceWrittenNodes(rootId, target, isFunctionDef, data, makeMaybe) {
120
+ function produceWrittenNodes(rootId, target, referenceType, data, makeMaybe) {
117
121
  return [...target.in, ...target.unknownReferences].map(ref => ({
118
122
  ...ref,
119
- kind: isFunctionDef ? 'function' : 'variable',
123
+ type: referenceType,
120
124
  definedAt: rootId,
121
125
  controlDependencies: data.controlDependencies ?? (makeMaybe ? [] : undefined)
122
126
  }));
123
127
  }
124
128
  function processAssignmentToString(target, args, name, rootId, data, config, source) {
125
129
  const symbol = {
126
- type: "RSymbol" /* RType.Symbol */,
130
+ type: type_1.RType.Symbol,
127
131
  info: target.info,
128
132
  content: (0, retriever_1.removeRQuotes)(target.lexeme),
129
133
  lexeme: target.lexeme,
@@ -154,8 +158,17 @@ function processAssignmentToString(target, args, name, rootId, data, config, sou
154
158
  information: res.information
155
159
  });
156
160
  }
157
- function checkFunctionDef(source, sourceInfo) {
158
- return sourceInfo.graph.getVertex(source.info.id)?.tag === "function-definition" /* VertexType.FunctionDefinition */;
161
+ function checkTargetReferenceType(source, sourceInfo) {
162
+ const vert = sourceInfo.graph.getVertex(source.info.id, true);
163
+ switch (vert?.tag) {
164
+ case vertex_1.VertexType.FunctionDefinition:
165
+ return identifier_1.ReferenceType.Function;
166
+ case vertex_1.VertexType.Use:
167
+ case vertex_1.VertexType.FunctionCall:
168
+ return identifier_1.ReferenceType.Unknown;
169
+ default:
170
+ return identifier_1.ReferenceType.Variable;
171
+ }
159
172
  }
160
173
  /**
161
174
  * Consider a call like `x <- v`
@@ -171,48 +184,49 @@ function markAsAssignment(information, nodeToDefine, sourceIds, rootIdOfAssignme
171
184
  information.graph.setDefinitionOfVertex(nodeToDefine);
172
185
  if (!quoteSource) {
173
186
  for (const sourceId of sourceIds) {
174
- information.graph.addEdge(nodeToDefine, sourceId, { type: 2 /* EdgeType.DefinedBy */ });
187
+ information.graph.addEdge(nodeToDefine, sourceId, edge_1.EdgeType.DefinedBy);
175
188
  }
176
189
  }
177
- information.graph.addEdge(nodeToDefine, rootIdOfAssignment, { type: 2 /* EdgeType.DefinedBy */ });
190
+ information.graph.addEdge(nodeToDefine, rootIdOfAssignment, edge_1.EdgeType.DefinedBy);
178
191
  // kinda dirty, but we have to remove existing read edges for the symbol, added by the child
179
192
  const out = information.graph.outgoingEdges(nodeToDefine.nodeId);
180
193
  for (const [id, edge] of (out ?? [])) {
181
- edge.types &= ~1 /* EdgeType.Reads */;
194
+ edge.types &= ~edge_1.EdgeType.Reads;
182
195
  if (edge.types == 0) {
183
196
  out?.delete(id);
184
197
  }
185
198
  }
186
199
  }
187
- exports.markAsAssignment = markAsAssignment;
188
200
  /**
189
201
  * Helper function whenever it is known that the _target_ of an assignment is a (single) symbol (i.e. `x <- ...`, but not `names(x) <- ...`).
190
202
  */
191
203
  function processAssignmentToSymbol({ nameOfAssignmentFunction, source, args: [targetArg, sourceArg], target, rootId, data, information, superAssignment, makeMaybe, quoteSource }) {
192
- const isFunctionDef = checkFunctionDef(source, sourceArg);
193
- const writeNodes = produceWrittenNodes(rootId, targetArg, isFunctionDef, data, makeMaybe ?? false);
204
+ const referenceType = checkTargetReferenceType(source, sourceArg);
205
+ const writeNodes = produceWrittenNodes(rootId, targetArg, referenceType, data, makeMaybe ?? false);
194
206
  if (writeNodes.length !== 1 && log_1.log.settings.minLevel <= 4 /* LogLevel.Warn */) {
195
207
  log_1.log.warn(`Unexpected write number in assignment: ${JSON.stringify(writeNodes)}`);
196
208
  }
197
209
  // we drop the first arg which we use to pass along arguments :D
198
210
  const readFromSourceWritten = sourceArg.out.slice(1);
199
- const readTargets = [{ nodeId: rootId, name: nameOfAssignmentFunction, controlDependencies: data.controlDependencies }, ...sourceArg.unknownReferences, ...sourceArg.in, ...targetArg.in.filter(i => i.nodeId !== target.info.id), ...readFromSourceWritten];
200
- const writeTargets = [...writeNodes, ...writeNodes, ...readFromSourceWritten];
211
+ const readTargets = [
212
+ { nodeId: rootId, name: nameOfAssignmentFunction, controlDependencies: data.controlDependencies, type: identifier_1.ReferenceType.Function },
213
+ ...sourceArg.unknownReferences, ...sourceArg.in, ...targetArg.in.filter(i => i.nodeId !== target.info.id), ...readFromSourceWritten
214
+ ];
201
215
  information.environment = (0, overwrite_1.overwriteEnvironment)(targetArg.environment, sourceArg.environment);
202
216
  // install assigned variables in environment
203
217
  for (const write of writeNodes) {
204
218
  markAsAssignment(information, write, [source.info.id], rootId, quoteSource, superAssignment);
205
219
  }
206
- information.graph.addEdge(rootId, targetArg.entryPoint, { type: 8 /* EdgeType.Returns */ });
220
+ information.graph.addEdge(rootId, targetArg.entryPoint, edge_1.EdgeType.Returns);
207
221
  if (quoteSource) {
208
- information.graph.addEdge(rootId, source.info.id, { type: 256 /* EdgeType.NonStandardEvaluation */ });
222
+ information.graph.addEdge(rootId, source.info.id, edge_1.EdgeType.NonStandardEvaluation);
209
223
  }
210
224
  return {
211
225
  ...information,
212
226
  unknownReferences: [],
213
227
  entryPoint: rootId,
214
228
  in: readTargets,
215
- out: writeTargets
229
+ out: [...writeNodes, ...readFromSourceWritten]
216
230
  };
217
231
  }
218
232
  //# sourceMappingURL=built-in-assignment.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processExpressionList = void 0;
3
+ exports.processExpressionList = processExpressionList;
4
4
  const info_1 = require("../../../../../info");
5
5
  const processor_1 = require("../../../../../processor");
6
6
  const linker_1 = require("../../../../linker");
@@ -9,19 +9,25 @@ const unpack_argument_1 = require("../argument/unpack-argument");
9
9
  const common_1 = require("../common");
10
10
  const environment_1 = require("../../../../../environments/environment");
11
11
  const graph_1 = require("../../../../../graph/graph");
12
+ const identifier_1 = require("../../../../../environments/identifier");
12
13
  const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
14
+ const edge_1 = require("../../../../../graph/edge");
15
+ const vertex_1 = require("../../../../../graph/vertex");
13
16
  const scoping_1 = require("../../../../../environments/scoping");
14
17
  const built_in_1 = require("../../../../../environments/built-in");
15
18
  const overwrite_1 = require("../../../../../environments/overwrite");
16
19
  const logger_1 = require("../../../../../logger");
17
- const dotDotDotAccess = /\.\.\d+/;
20
+ const dotDotDotAccess = /^\.\.\d+$/;
18
21
  function linkReadNameToWriteIfPossible(read, environments, listEnvironments, remainingRead, nextGraph) {
19
22
  const readName = read.name && dotDotDotAccess.test(read.name) ? '...' : read.name;
20
- const probableTarget = readName ? (0, resolve_by_name_1.resolveByName)(readName, environments) : undefined;
23
+ const probableTarget = readName ? (0, resolve_by_name_1.resolveByName)(readName, environments, read.type) : undefined;
21
24
  // record if at least one has not been defined
22
- if (probableTarget === undefined || probableTarget.some(t => !listEnvironments.has(t.nodeId))) {
23
- if (remainingRead.has(readName)) {
24
- remainingRead.get(readName)?.push(read);
25
+ if (probableTarget === undefined || probableTarget.some(t => !listEnvironments.has(t.nodeId) || !(0, info_1.happensInEveryBranch)(t.controlDependencies))) {
26
+ const has = remainingRead.get(readName);
27
+ if (has) {
28
+ if (!has?.some(h => h.nodeId === read.nodeId && h.name === read.name && h.controlDependencies === read.controlDependencies)) {
29
+ has.push(read);
30
+ }
25
31
  }
26
32
  else {
27
33
  remainingRead.set(readName, [read]);
@@ -34,19 +40,20 @@ function linkReadNameToWriteIfPossible(read, environments, listEnvironments, rem
34
40
  }
35
41
  for (const target of probableTarget) {
36
42
  // we can stick with maybe even if readId.attribute is always
37
- nextGraph.addEdge(read, target, { type: 1 /* EdgeType.Reads */ });
43
+ nextGraph.addEdge(read, target, edge_1.EdgeType.Reads);
38
44
  }
39
45
  }
40
46
  function processNextExpression(currentElement, environment, listEnvironments, remainingRead, nextGraph) {
41
- // all inputs that have not been written until now, are read!
47
+ // all inputs that have not been written until now are read!
42
48
  for (const read of [...currentElement.in, ...currentElement.unknownReferences]) {
43
49
  linkReadNameToWriteIfPossible(read, environment, listEnvironments, remainingRead, nextGraph);
44
50
  }
45
51
  }
46
52
  function updateSideEffectsForCalledFunctions(calledEnvs, inputEnvironment, nextGraph) {
47
53
  for (const { functionCall, called } of calledEnvs) {
54
+ const callDependencies = nextGraph.getVertex(functionCall, true)?.controlDependencies;
48
55
  for (const calledFn of called) {
49
- (0, assert_1.guard)(calledFn.tag === 'function-definition', 'called function must call a function definition');
56
+ (0, assert_1.guard)(calledFn.tag === vertex_1.VertexType.FunctionDefinition, 'called function must call a function definition');
50
57
  // only merge the environments they have in common
51
58
  let environment = calledFn.environment;
52
59
  while (environment.level > inputEnvironment.level) {
@@ -54,26 +61,30 @@ function updateSideEffectsForCalledFunctions(calledEnvs, inputEnvironment, nextG
54
61
  }
55
62
  // update alle definitions to be defined at this function call
56
63
  let current = environment.current;
57
- while (current !== undefined) {
64
+ let hasUpdate = false;
65
+ while (current !== undefined && current.id !== environment_1.BuiltInEnvironment.id) {
58
66
  for (const definitions of current.memory.values()) {
59
67
  for (const def of definitions) {
60
68
  if (def.definedAt !== built_in_1.BuiltIn) {
61
- nextGraph.addEdge(def.nodeId, functionCall, { type: 128 /* EdgeType.SideEffectOnCall */ });
69
+ hasUpdate = true;
70
+ nextGraph.addEdge(def.nodeId, functionCall, edge_1.EdgeType.SideEffectOnCall);
62
71
  }
63
72
  }
64
73
  }
65
74
  current = current.parent;
66
75
  }
67
- // we update all definitions to be linked with the corresponding function call
68
- inputEnvironment = (0, overwrite_1.overwriteEnvironment)(inputEnvironment, environment);
76
+ if (hasUpdate) {
77
+ // we update all definitions to be linked with the corresponding function call
78
+ inputEnvironment = (0, overwrite_1.overwriteEnvironment)(inputEnvironment, environment, callDependencies);
79
+ }
69
80
  }
70
81
  }
71
82
  return inputEnvironment;
72
83
  }
73
84
  function processExpressionList(name, args, rootId, data) {
74
85
  const expressions = args.map(unpack_argument_1.unpackArgument);
75
- logger_1.dataflowLogger.trace(`processing expression list with ${expressions.length} expressions`);
76
- let environment = data.environment;
86
+ logger_1.dataflowLogger.trace(() => `[expr list] with ${expressions.length} expressions`);
87
+ let { environment } = data;
77
88
  // used to detect if a "write" happens within the same expression list
78
89
  const listEnvironments = new Set();
79
90
  const remainingRead = new Map();
@@ -95,7 +106,7 @@ function processExpressionList(name, args, rootId, data) {
95
106
  processedExpressions.push(processed);
96
107
  nextGraph.mergeWith(processed.graph);
97
108
  defaultReturnExpr = processed;
98
- // if the expression contained next or break anywhere before the next loop, the overwrite should be an append because we do not know if the rest is executed
109
+ // if the expression contained next or break anywhere before the next loop, the "overwrite" should be an "append", because we do not know if the rest is executed
99
110
  // update the environments for the next iteration with the previous writes
100
111
  if (exitPoints.length > 0) {
101
112
  processed.out = (0, environment_1.makeAllMaybe)(processed.out, nextGraph, processed.environment, true);
@@ -106,8 +117,8 @@ function processExpressionList(name, args, rootId, data) {
106
117
  out.push(...processed.out);
107
118
  logger_1.dataflowLogger.trace(`expression ${expressionCounter} of ${expressions.length} has ${processed.unknownReferences.length} unknown nodes`);
108
119
  processNextExpression(processed, environment, listEnvironments, remainingRead, nextGraph);
109
- const calledEnvs = (0, linker_1.linkFunctionCalls)(nextGraph, data.completeAst.idMap, processed.graph);
110
120
  environment = exitPoints.length > 0 ? (0, overwrite_1.overwriteEnvironment)(environment, processed.environment) : processed.environment;
121
+ const calledEnvs = (0, linker_1.linkFunctionCalls)(nextGraph, data.completeAst.idMap, processed.graph);
111
122
  // if the called function has global redefinitions, we have to keep them within our environment
112
123
  environment = updateSideEffectsForCalledFunctions(calledEnvs, environment, nextGraph);
113
124
  for (const { nodeId } of processed.out) {
@@ -132,7 +143,7 @@ function processExpressionList(name, args, rootId, data) {
132
143
  const rootNode = data.completeAst.idMap.get(rootId);
133
144
  const withGroup = rootNode?.grouping;
134
145
  if (withGroup) {
135
- ingoing.push({ nodeId: rootId, name: name.content, controlDependencies: data.controlDependencies });
146
+ ingoing.push({ nodeId: rootId, name: name.content, controlDependencies: data.controlDependencies, type: identifier_1.ReferenceType.Function });
136
147
  (0, common_1.patchFunctionCall)({
137
148
  nextGraph,
138
149
  rootId,
@@ -143,7 +154,7 @@ function processExpressionList(name, args, rootId, data) {
143
154
  // process all exit points as potential returns:
144
155
  for (const exit of exitPoints) {
145
156
  if (exit.type === 1 /* ExitPointType.Return */ || exit.type === 0 /* ExitPointType.Default */) {
146
- nextGraph.addEdge(rootId, exit.nodeId, { type: 8 /* EdgeType.Returns */ });
157
+ nextGraph.addEdge(rootId, exit.nodeId, edge_1.EdgeType.Returns);
147
158
  }
148
159
  }
149
160
  }
@@ -161,5 +172,4 @@ function processExpressionList(name, args, rootId, data) {
161
172
  : exitPoints
162
173
  };
163
174
  }
164
- exports.processExpressionList = processExpressionList;
165
175
  //# sourceMappingURL=built-in-expression-list.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processForLoop = void 0;
3
+ exports.processForLoop = processForLoop;
4
4
  const processor_1 = require("../../../../../processor");
5
5
  const info_1 = require("../../../../../info");
6
6
  const linker_1 = require("../../../../linker");
@@ -13,6 +13,8 @@ const overwrite_1 = require("../../../../../environments/overwrite");
13
13
  const define_1 = require("../../../../../environments/define");
14
14
  const append_1 = require("../../../../../environments/append");
15
15
  const environment_1 = require("../../../../../environments/environment");
16
+ const edge_1 = require("../../../../../graph/edge");
17
+ const identifier_1 = require("../../../../../environments/identifier");
16
18
  function processForLoop(name, args, rootId, data) {
17
19
  if (args.length !== 3) {
18
20
  logger_1.dataflowLogger.warn(`For-Loop ${name.content} does not have three arguments, skipping`);
@@ -33,7 +35,7 @@ function processForLoop(name, args, rootId, data) {
33
35
  const headGraph = variable.graph.mergeWith(vector.graph);
34
36
  const writtenVariable = [...variable.unknownReferences, ...variable.in];
35
37
  for (const write of writtenVariable) {
36
- headEnvironments = (0, define_1.define)({ ...write, definedAt: name.info.id, kind: 'variable' }, false, headEnvironments);
38
+ headEnvironments = (0, define_1.define)({ ...write, definedAt: name.info.id, type: identifier_1.ReferenceType.Variable }, false, headEnvironments);
37
39
  }
38
40
  data = { ...data, environment: headEnvironments };
39
41
  const body = (0, processor_1.processDataflowFor)(bodyArg, data);
@@ -41,9 +43,9 @@ function processForLoop(name, args, rootId, data) {
41
43
  const outEnvironment = (0, append_1.appendEnvironment)(headEnvironments, body.environment);
42
44
  // now we have to identify all reads that may be effected by a circular redefinition
43
45
  // for this, we search for all reads with a non-local read resolve!
44
- const nameIdShares = (0, linker_1.produceNameSharedIdMap)((0, linker_1.findNonLocalReads)(nextGraph));
46
+ const nameIdShares = (0, linker_1.produceNameSharedIdMap)((0, linker_1.findNonLocalReads)(nextGraph, writtenVariable));
45
47
  for (const write of writtenVariable) {
46
- nextGraph.addEdge(write.nodeId, vector.entryPoint, { type: 2 /* EdgeType.DefinedBy */ });
48
+ nextGraph.addEdge(write.nodeId, vector.entryPoint, edge_1.EdgeType.DefinedBy);
47
49
  nextGraph.setDefinitionOfVertex(write);
48
50
  }
49
51
  const outgoing = [...variable.out, ...writtenVariable, ...(0, environment_1.makeAllMaybe)(body.out, nextGraph, outEnvironment, true)];
@@ -56,14 +58,14 @@ function processForLoop(name, args, rootId, data) {
56
58
  argumentProcessResult: [variable, vector, body]
57
59
  });
58
60
  /* mark the last argument as nse */
59
- nextGraph.addEdge(rootId, body.entryPoint, { type: 256 /* EdgeType.NonStandardEvaluation */ });
61
+ nextGraph.addEdge(rootId, body.entryPoint, edge_1.EdgeType.NonStandardEvaluation);
60
62
  // as the for-loop always evaluates its variable and condition
61
- nextGraph.addEdge(name.info.id, variable.entryPoint, { type: 1 /* EdgeType.Reads */ });
62
- nextGraph.addEdge(name.info.id, vector.entryPoint, { type: 1 /* EdgeType.Reads */ });
63
+ nextGraph.addEdge(name.info.id, variable.entryPoint, edge_1.EdgeType.Reads);
64
+ nextGraph.addEdge(name.info.id, vector.entryPoint, edge_1.EdgeType.Reads);
63
65
  return {
64
66
  unknownReferences: [],
65
67
  // we only want those not bound by a local variable
66
- in: [{ nodeId: rootId, name: name.content, controlDependencies: originalDependency }, ...variable.in, ...vector.in, ...vector.unknownReferences, ...[...nameIdShares.values()].flat()],
68
+ in: [{ nodeId: rootId, name: name.content, controlDependencies: originalDependency, type: identifier_1.ReferenceType.Function }, ...vector.unknownReferences, ...[...nameIdShares.values()].flat()],
67
69
  out: outgoing,
68
70
  graph: nextGraph,
69
71
  entryPoint: name.info.id,
@@ -71,5 +73,4 @@ function processForLoop(name, args, rootId, data) {
71
73
  environment: outEnvironment
72
74
  };
73
75
  }
74
- exports.processForLoop = processForLoop;
75
76
  //# sourceMappingURL=built-in-for-loop.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processFunctionDefinition = void 0;
3
+ exports.processFunctionDefinition = processFunctionDefinition;
4
4
  const processor_1 = require("../../../../../processor");
5
5
  const linker_1 = require("../../../../linker");
6
6
  const known_call_handling_1 = require("../known-call-handling");
@@ -10,9 +10,11 @@ const logger_1 = require("../../../../../logger");
10
10
  const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
11
11
  const graph_1 = require("../../../../../graph/graph");
12
12
  const overwrite_1 = require("../../../../../environments/overwrite");
13
+ const vertex_1 = require("../../../../../graph/vertex");
13
14
  const scoping_1 = require("../../../../../environments/scoping");
14
15
  const environment_1 = require("../../../../../environments/environment");
15
16
  const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
17
+ const edge_1 = require("../../../../../graph/edge");
16
18
  const log_1 = require("../../../../../../util/log");
17
19
  function processFunctionDefinition(name, args, rootId, data) {
18
20
  if (args.length < 1) {
@@ -60,7 +62,7 @@ function processFunctionDefinition(name, args, rootId, data) {
60
62
  for (const read of remainingRead) {
61
63
  if (read.name) {
62
64
  subgraph.addVertex({
63
- tag: "use" /* VertexType.Use */,
65
+ tag: vertex_1.VertexType.Use,
64
66
  id: read.nodeId,
65
67
  environment: undefined,
66
68
  controlDependencies: undefined
@@ -79,7 +81,7 @@ function processFunctionDefinition(name, args, rootId, data) {
79
81
  const exitPoints = body.exitPoints;
80
82
  const graph = new graph_1.DataflowGraph(data.completeAst.idMap).mergeWith(subgraph, false);
81
83
  graph.addVertex({
82
- tag: "function-definition" /* VertexType.FunctionDefinition */,
84
+ tag: vertex_1.VertexType.FunctionDefinition,
83
85
  id: name.info.id,
84
86
  environment: (0, scoping_1.popLocalEnvironment)(outEnvironment),
85
87
  controlDependencies: data.controlDependencies,
@@ -97,25 +99,24 @@ function processFunctionDefinition(name, args, rootId, data) {
97
99
  environment: originalEnvironment
98
100
  };
99
101
  }
100
- exports.processFunctionDefinition = processFunctionDefinition;
101
102
  function updateNestedFunctionClosures(subgraph, outEnvironment, name) {
102
103
  // track *all* function definitions - including those nested within the current graph,
103
104
  // try to resolve their 'in' by only using the lowest scope which will be popped after this definition
104
105
  for (const [id, { subflow, tag }] of subgraph.vertices(true)) {
105
- if (tag !== "function-definition" /* VertexType.FunctionDefinition */) {
106
+ if (tag !== vertex_1.VertexType.FunctionDefinition) {
106
107
  continue;
107
108
  }
108
109
  const ingoingRefs = subflow.in;
109
110
  const remainingIn = [];
110
111
  for (const ingoing of ingoingRefs) {
111
- const resolved = ingoing.name ? (0, resolve_by_name_1.resolveByName)(ingoing.name, outEnvironment) : undefined;
112
+ const resolved = ingoing.name ? (0, resolve_by_name_1.resolveByName)(ingoing.name, outEnvironment, ingoing.type) : undefined;
112
113
  if (resolved === undefined) {
113
114
  remainingIn.push(ingoing);
114
115
  continue;
115
116
  }
116
117
  (0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Found ${resolved.length} references to open ref ${id} in closure of function definition ${name.info.id}`);
117
118
  for (const ref of resolved) {
118
- subgraph.addEdge(ingoing, ref, { type: 1 /* EdgeType.Reads */ });
119
+ subgraph.addEdge(ingoing, ref, edge_1.EdgeType.Reads);
119
120
  }
120
121
  }
121
122
  (0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Keeping ${remainingIn.length} references to open ref ${id} in closure of function definition ${name.info.id}`);
@@ -142,10 +143,10 @@ function findPromiseLinkagesForParameters(parameters, readInParameters, paramete
142
143
  // first, we try to bind again within parameters - if we have it, fine
143
144
  const remainingRead = [];
144
145
  for (const read of readInParameters) {
145
- const resolved = read.name ? (0, resolve_by_name_1.resolveByName)(read.name, parameterEnvs) : undefined;
146
+ const resolved = read.name ? (0, resolve_by_name_1.resolveByName)(read.name, parameterEnvs, read.type) : undefined;
146
147
  if (resolved !== undefined) {
147
148
  for (const ref of resolved) {
148
- parameters.addEdge(read, ref, { type: 1 /* EdgeType.Reads */ });
149
+ parameters.addEdge(read, ref, edge_1.EdgeType.Reads);
149
150
  }
150
151
  continue;
151
152
  }
@@ -158,11 +159,11 @@ function findPromiseLinkagesForParameters(parameters, readInParameters, paramete
158
159
  continue;
159
160
  }
160
161
  if (writingOuts[0].controlDependencies === undefined) {
161
- parameters.addEdge(read, writingOuts[0], { type: 1 /* EdgeType.Reads */ });
162
+ parameters.addEdge(read, writingOuts[0], edge_1.EdgeType.Reads);
162
163
  continue;
163
164
  }
164
165
  for (const out of writingOuts) {
165
- parameters.addEdge(read, out, { type: 1 /* EdgeType.Reads */ });
166
+ parameters.addEdge(read, out, edge_1.EdgeType.Reads);
166
167
  }
167
168
  }
168
169
  return remainingRead;
@@ -1,23 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processGet = void 0;
3
+ exports.processGet = processGet;
4
4
  const known_call_handling_1 = require("../known-call-handling");
5
5
  const unpack_argument_1 = require("../argument/unpack-argument");
6
6
  const make_argument_1 = require("../argument/make-argument");
7
7
  const logger_1 = require("../../../../../logger");
8
8
  const retriever_1 = require("../../../../../../r-bridge/retriever");
9
+ const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
10
+ const edge_1 = require("../../../../../graph/edge");
9
11
  function processGet(name, args, rootId, data) {
10
12
  if (args.length !== 1) {
11
13
  logger_1.dataflowLogger.warn(`symbol access with ${name.content} has not 1 argument, skipping`);
12
14
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data }).information;
13
15
  }
14
16
  const retrieve = (0, unpack_argument_1.unpackArgument)(args[0]);
15
- if (retrieve === undefined || retrieve.type !== "RString" /* RType.String */) {
17
+ if (retrieve === undefined || retrieve.type !== type_1.RType.String) {
16
18
  logger_1.dataflowLogger.warn(`symbol access with ${name.content} has not 1 argument, skipping`);
17
19
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data }).information;
18
20
  }
19
21
  const treatTargetAsSymbol = {
20
- type: "RSymbol" /* RType.Symbol */,
22
+ type: type_1.RType.Symbol,
21
23
  info: retrieve.info,
22
24
  content: (0, retriever_1.removeRQuotes)(retrieve.lexeme),
23
25
  lexeme: retrieve.lexeme,
@@ -33,9 +35,8 @@ function processGet(name, args, rootId, data) {
33
35
  const firstArg = processedArguments[0];
34
36
  if (firstArg) {
35
37
  // get 'reads' its first argument
36
- information.graph.addEdge(rootId, firstArg.entryPoint, { type: 1 /* EdgeType.Reads */ });
38
+ information.graph.addEdge(rootId, firstArg.entryPoint, edge_1.EdgeType.Reads);
37
39
  }
38
40
  return information;
39
41
  }
40
- exports.processGet = processGet;
41
42
  //# sourceMappingURL=built-in-get.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processIfThenElse = void 0;
3
+ exports.processIfThenElse = processIfThenElse;
4
4
  const processor_1 = require("../../../../../processor");
5
5
  const info_1 = require("../../../../../info");
6
6
  const known_call_handling_1 = require("../known-call-handling");
@@ -8,7 +8,9 @@ const common_1 = require("../common");
8
8
  const unpack_argument_1 = require("../argument/unpack-argument");
9
9
  const logger_1 = require("../../../../../logger");
10
10
  const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
11
+ const edge_1 = require("../../../../../graph/edge");
11
12
  const append_1 = require("../../../../../environments/append");
13
+ const identifier_1 = require("../../../../../environments/identifier");
12
14
  const environment_1 = require("../../../../../environments/environment");
13
15
  function processIfThenElse(name, args, rootId, data) {
14
16
  if (args.length !== 2 && args.length !== 3) {
@@ -36,7 +38,7 @@ function processIfThenElse(name, args, rootId, data) {
36
38
  if (conditionIsFalse !== 0 /* Ternary.Always */) {
37
39
  then = (0, processor_1.processDataflowFor)(thenArg, data);
38
40
  if (then.entryPoint) {
39
- then.graph.addEdge(name.info.id, then.entryPoint, { type: 8 /* EdgeType.Returns */ });
41
+ then.graph.addEdge(name.info.id, then.entryPoint, edge_1.EdgeType.Returns);
40
42
  }
41
43
  if (conditionIsTrue !== 0 /* Ternary.Always */) {
42
44
  makeThenMaybe = true;
@@ -47,7 +49,7 @@ function processIfThenElse(name, args, rootId, data) {
47
49
  if (otherwiseArg !== undefined && conditionIsTrue !== 0 /* Ternary.Always */) {
48
50
  otherwise = (0, processor_1.processDataflowFor)(otherwiseArg, data);
49
51
  if (otherwise.entryPoint) {
50
- otherwise.graph.addEdge(name.info.id, otherwise.entryPoint, { type: 8 /* EdgeType.Returns */ });
52
+ otherwise.graph.addEdge(name.info.id, otherwise.entryPoint, edge_1.EdgeType.Returns);
51
53
  }
52
54
  if (conditionIsFalse !== 0 /* Ternary.Always */) {
53
55
  makeOtherwiseMaybe = true;
@@ -83,14 +85,14 @@ function processIfThenElse(name, args, rootId, data) {
83
85
  argumentProcessResult: [cond, then, otherwise]
84
86
  });
85
87
  // as an if always evaluates its condition, we add a 'reads'-edge
86
- nextGraph.addEdge(name.info.id, cond.entryPoint, { type: 1 /* EdgeType.Reads */ });
88
+ nextGraph.addEdge(name.info.id, cond.entryPoint, edge_1.EdgeType.Reads);
87
89
  const exitPoints = [
88
90
  ...(then?.exitPoints ?? []).map(e => ({ ...e, controlDependencies: makeThenMaybe ? [...data.controlDependencies ?? [], { id: rootId, when: true }] : e.controlDependencies })),
89
91
  ...(otherwise?.exitPoints ?? []).map(e => ({ ...e, controlDependencies: makeOtherwiseMaybe ? [...data.controlDependencies ?? [], { id: rootId, when: false }] : e.controlDependencies }))
90
92
  ];
91
93
  return {
92
94
  unknownReferences: [],
93
- in: [{ nodeId: rootId, name: name.content, controlDependencies: originalDependency }, ...ingoing],
95
+ in: [{ nodeId: rootId, name: name.content, controlDependencies: originalDependency, type: identifier_1.ReferenceType.Function }, ...ingoing],
94
96
  out: outgoing,
95
97
  exitPoints,
96
98
  entryPoint: rootId,
@@ -98,5 +100,4 @@ function processIfThenElse(name, args, rootId, data) {
98
100
  graph: nextGraph
99
101
  };
100
102
  }
101
- exports.processIfThenElse = processIfThenElse;
102
103
  //# sourceMappingURL=built-in-if-then-else.js.map
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processLibrary = void 0;
3
+ exports.processLibrary = processLibrary;
4
4
  const known_call_handling_1 = require("../known-call-handling");
5
5
  const logger_1 = require("../../../../../logger");
6
6
  const unpack_argument_1 = require("../argument/unpack-argument");
7
+ const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
7
8
  const make_argument_1 = require("../argument/make-argument");
8
9
  function processLibrary(name, args, rootId, data) {
9
10
  /* we do not really know what loading the library does and what side effects it causes, hence we mark it as an unknown side effect */
@@ -12,13 +13,13 @@ function processLibrary(name, args, rootId, data) {
12
13
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, hasUnknownSideEffect: true }).information;
13
14
  }
14
15
  const nameToLoad = (0, unpack_argument_1.unpackArgument)(args[0]);
15
- if (nameToLoad === undefined || nameToLoad.type !== "RSymbol" /* RType.Symbol */) {
16
+ if (nameToLoad === undefined || nameToLoad.type !== type_1.RType.Symbol) {
16
17
  logger_1.dataflowLogger.warn('No library name provided, skipping');
17
18
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, hasUnknownSideEffect: true }).information;
18
19
  }
19
20
  // treat as a function call but convert the first argument to a string
20
21
  const newArg = {
21
- type: "RString" /* RType.String */,
22
+ type: type_1.RType.String,
22
23
  info: nameToLoad.info,
23
24
  lexeme: nameToLoad.lexeme,
24
25
  location: nameToLoad.location,
@@ -32,5 +33,4 @@ function processLibrary(name, args, rootId, data) {
32
33
  hasUnknownSideEffect: true
33
34
  }).information;
34
35
  }
35
- exports.processLibrary = processLibrary;
36
36
  //# sourceMappingURL=built-in-library.js.map