@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,45 +1,68 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.linkCircularRedefinitionsWithinALoop = exports.linkInputs = exports.getAllLinkedFunctionDefinitions = exports.linkFunctionCalls = exports.linkFunctionCallWithSingleTarget = exports.linkArgumentsOnCall = exports.produceNameSharedIdMap = exports.findNonLocalReads = void 0;
3
+ exports.findNonLocalReads = findNonLocalReads;
4
+ exports.produceNameSharedIdMap = produceNameSharedIdMap;
5
+ exports.linkArgumentsOnCall = linkArgumentsOnCall;
6
+ exports.linkFunctionCallWithSingleTarget = linkFunctionCallWithSingleTarget;
7
+ exports.linkFunctionCalls = linkFunctionCalls;
8
+ exports.getAllFunctionCallTargets = getAllFunctionCallTargets;
9
+ exports.getAllLinkedFunctionDefinitions = getAllLinkedFunctionDefinitions;
10
+ exports.linkInputs = linkInputs;
11
+ exports.linkCircularRedefinitionsWithinALoop = linkCircularRedefinitionsWithinALoop;
4
12
  const defaultmap_1 = require("../../util/defaultmap");
5
13
  const assert_1 = require("../../util/assert");
6
14
  const log_1 = require("../../util/log");
7
15
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
16
+ const identifier_1 = require("../environments/identifier");
8
17
  const graph_1 = require("../graph/graph");
9
18
  const logger_1 = require("../logger");
10
19
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
11
20
  const edge_1 = require("../graph/edge");
21
+ const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
22
+ const vertex_1 = require("../graph/vertex");
12
23
  const resolve_by_name_1 = require("../environments/resolve-by-name");
13
24
  const built_in_1 = require("../environments/built-in");
14
25
  const static_slicer_1 = require("../../slicing/static/static-slicer");
15
- function findNonLocalReads(graph) {
26
+ function findNonLocalReads(graph, ignore) {
27
+ const ignores = new Set(ignore.map(i => i.nodeId));
16
28
  const ids = new Set([...graph.vertices(true)]
17
- .filter(([_, info]) => info.tag === "use" /* VertexType.Use */ || info.tag === "function-call" /* VertexType.FunctionCall */)
29
+ .filter(([_, info]) => info.tag === vertex_1.VertexType.Use || info.tag === vertex_1.VertexType.FunctionCall)
18
30
  .map(([id, _]) => id));
19
31
  /* find all variable use ids which do not link to a given id */
20
32
  const nonLocalReads = [];
21
33
  for (const id of ids) {
34
+ if (ignores.has(id)) {
35
+ continue;
36
+ }
22
37
  const outgoing = graph.outgoingEdges(id);
38
+ const name = (0, node_id_1.recoverName)(id, graph.idMap);
39
+ const origin = graph.getVertex(id, true);
23
40
  if (outgoing === undefined) {
41
+ nonLocalReads.push({
42
+ name: (0, node_id_1.recoverName)(id, graph.idMap),
43
+ nodeId: id,
44
+ controlDependencies: undefined,
45
+ type: origin?.tag === vertex_1.VertexType.FunctionCall ? identifier_1.ReferenceType.Function : identifier_1.ReferenceType.Variable
46
+ });
24
47
  continue;
25
48
  }
26
49
  for (const [target, { types }] of outgoing) {
27
- if ((0, edge_1.edgeIncludesType)(types, 1 /* EdgeType.Reads */) && !ids.has(target)) {
28
- const name = (0, node_id_1.recoverName)(id, graph.idMap);
50
+ if ((0, edge_1.edgeIncludesType)(types, edge_1.EdgeType.Reads) && !ids.has(target)) {
29
51
  if (!name) {
30
52
  logger_1.dataflowLogger.warn('found non-local read without name for id ' + id);
31
53
  }
32
54
  nonLocalReads.push({
33
55
  name: (0, node_id_1.recoverName)(id, graph.idMap),
34
56
  nodeId: id,
35
- controlDependencies: undefined
57
+ controlDependencies: undefined,
58
+ type: origin?.tag === vertex_1.VertexType.FunctionCall ? identifier_1.ReferenceType.Function : identifier_1.ReferenceType.Variable
36
59
  });
60
+ break;
37
61
  }
38
62
  }
39
63
  }
40
64
  return nonLocalReads;
41
65
  }
42
- exports.findNonLocalReads = findNonLocalReads;
43
66
  function produceNameSharedIdMap(references) {
44
67
  const nameIdShares = new defaultmap_1.DefaultMap(() => []);
45
68
  for (const reference of references) {
@@ -49,7 +72,6 @@ function produceNameSharedIdMap(references) {
49
72
  }
50
73
  return nameIdShares;
51
74
  }
52
- exports.produceNameSharedIdMap = produceNameSharedIdMap;
53
75
  function linkArgumentsOnCall(args, params, graph) {
54
76
  const nameArgMap = new Map(args.filter(graph_1.isNamedArgument).map(a => [a.name, a]));
55
77
  const nameParamMap = new Map(params.map(p => [p.name.content, p]));
@@ -61,12 +83,12 @@ function linkArgumentsOnCall(args, params, graph) {
61
83
  const param = nameParamMap.get(name);
62
84
  if (param !== undefined) {
63
85
  logger_1.dataflowLogger.trace(`mapping named argument "${name}" to parameter "${param.name.content}"`);
64
- graph.addEdge(arg.nodeId, param.name.info.id, { type: 16 /* EdgeType.DefinesOnCall */ });
86
+ graph.addEdge(arg.nodeId, param.name.info.id, edge_1.EdgeType.DefinesOnCall);
65
87
  matchedParameters.add(name);
66
88
  }
67
89
  else if (specialDotParameter !== undefined) {
68
90
  logger_1.dataflowLogger.trace(`mapping named argument "${name}" to dot-dot-dot parameter`);
69
- graph.addEdge(arg.nodeId, specialDotParameter.name.info.id, { type: 16 /* EdgeType.DefinesOnCall */ });
91
+ graph.addEdge(arg.nodeId, specialDotParameter.name.info.id, edge_1.EdgeType.DefinesOnCall);
70
92
  }
71
93
  }
72
94
  const remainingParameter = params.filter(p => !matchedParameters.has(p.name.content));
@@ -80,7 +102,7 @@ function linkArgumentsOnCall(args, params, graph) {
80
102
  if (remainingParameter.length <= i) {
81
103
  if (specialDotParameter !== undefined) {
82
104
  logger_1.dataflowLogger.trace(`mapping unnamed argument ${i} (id: ${arg.nodeId}) to dot-dot-dot parameter`);
83
- graph.addEdge(arg.nodeId, specialDotParameter.name.info.id, { type: 16 /* EdgeType.DefinesOnCall */ });
105
+ graph.addEdge(arg.nodeId, specialDotParameter.name.info.id, edge_1.EdgeType.DefinesOnCall);
84
106
  }
85
107
  else {
86
108
  logger_1.dataflowLogger.warn(`skipping argument ${i} as there is no corresponding parameter - R should block that`);
@@ -89,10 +111,9 @@ function linkArgumentsOnCall(args, params, graph) {
89
111
  }
90
112
  const param = remainingParameter[i];
91
113
  logger_1.dataflowLogger.trace(`mapping unnamed argument ${i} (id: ${arg.nodeId}) to parameter "${param.name.content}"`);
92
- graph.addEdge(arg.nodeId, param.name.info.id, { type: 16 /* EdgeType.DefinesOnCall */ });
114
+ graph.addEdge(arg.nodeId, param.name.info.id, edge_1.EdgeType.DefinesOnCall);
93
115
  }
94
116
  }
95
- exports.linkArgumentsOnCall = linkArgumentsOnCall;
96
117
  function linkFunctionCallArguments(targetId, idMap, functionCallName, functionRootId, callArgs, finalGraph) {
97
118
  // we get them by just choosing the rhs of the definition
98
119
  const linkedFunction = idMap.get(targetId);
@@ -100,7 +121,7 @@ function linkFunctionCallArguments(targetId, idMap, functionCallName, functionRo
100
121
  logger_1.dataflowLogger.trace(`no function definition found for ${functionCallName} (${functionRootId})`);
101
122
  return;
102
123
  }
103
- if (linkedFunction.type !== "RFunctionDefinition" /* RType.FunctionDefinition */) {
124
+ if (linkedFunction.type !== type_1.RType.FunctionDefinition) {
104
125
  logger_1.dataflowLogger.trace(`function call definition base ${functionCallName} does not lead to a function definition (${functionRootId}) but got ${linkedFunction.type}`);
105
126
  return;
106
127
  }
@@ -112,37 +133,37 @@ function linkFunctionCallWithSingleTarget(graph, def, info, idMap) {
112
133
  if (info.environment !== undefined) {
113
134
  // for each open ingoing reference, try to resolve it here, and if so, add a read edge from the call to signal that it reads it
114
135
  for (const ingoing of def.subflow.in) {
115
- const defs = ingoing.name ? (0, resolve_by_name_1.resolveByName)(ingoing.name, info.environment) : undefined;
136
+ const defs = ingoing.name ? (0, resolve_by_name_1.resolveByName)(ingoing.name, info.environment, ingoing.type) : undefined;
116
137
  if (defs === undefined) {
117
138
  continue;
118
139
  }
119
140
  for (const def of defs) {
120
- graph.addEdge(id, def, { type: 1 /* EdgeType.Reads */ });
141
+ graph.addEdge(id, def, edge_1.EdgeType.Reads);
121
142
  }
122
143
  }
123
144
  }
124
145
  const exitPoints = def.exitPoints;
125
146
  for (const exitPoint of exitPoints) {
126
- graph.addEdge(id, exitPoint, { type: 8 /* EdgeType.Returns */ });
147
+ graph.addEdge(id, exitPoint, edge_1.EdgeType.Returns);
127
148
  }
128
149
  const defName = (0, node_id_1.recoverName)(def.id, idMap);
129
150
  (0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `recording expression-list-level call from ${(0, node_id_1.recoverName)(info.id, idMap)} to ${defName}`);
130
- graph.addEdge(id, def.id, { type: 4 /* EdgeType.Calls */ });
151
+ graph.addEdge(id, def.id, edge_1.EdgeType.Calls);
131
152
  linkFunctionCallArguments(def.id, idMap, defName, id, info.args, graph);
132
153
  }
133
- exports.linkFunctionCallWithSingleTarget = linkFunctionCallWithSingleTarget;
154
+ /* there is _a lot_ potential for optimization here */
134
155
  function linkFunctionCall(graph, id, info, idMap, thisGraph, calledFunctionDefinitions) {
135
156
  const edges = graph.outgoingEdges(id);
136
157
  if (edges === undefined) {
137
158
  /* no outgoing edges */
138
159
  return;
139
160
  }
140
- const readBits = 1 /* EdgeType.Reads */ | 4 /* EdgeType.Calls */;
141
- const functionDefinitionReadIds = [...edges].filter(([_, e]) => (0, edge_1.edgeDoesNotIncludeType)(e.types, 64 /* EdgeType.Argument */)
161
+ const readBits = edge_1.EdgeType.Reads | edge_1.EdgeType.Calls;
162
+ const functionDefinitionReadIds = [...edges].filter(([_, e]) => (0, edge_1.edgeDoesNotIncludeType)(e.types, edge_1.EdgeType.Argument)
142
163
  && (0, edge_1.edgeIncludesType)(e.types, readBits)).map(([target, _]) => target);
143
164
  const functionDefs = getAllLinkedFunctionDefinitions(new Set(functionDefinitionReadIds), graph);
144
165
  for (const def of functionDefs.values()) {
145
- (0, assert_1.guard)(def.tag === "function-definition" /* VertexType.FunctionDefinition */, () => `expected function definition, but got ${def.tag}`);
166
+ (0, assert_1.guard)(def.tag === vertex_1.VertexType.FunctionDefinition, () => `expected function definition, but got ${def.tag}`);
146
167
  linkFunctionCallWithSingleTarget(graph, def, info, idMap);
147
168
  }
148
169
  if (thisGraph.isRoot(id)) {
@@ -159,14 +180,41 @@ function linkFunctionCall(graph, id, info, idMap, thisGraph, calledFunctionDefin
159
180
  */
160
181
  function linkFunctionCalls(graph, idMap, thisGraph) {
161
182
  const functionCalls = [...thisGraph.vertices(true)]
162
- .filter(([_, info]) => info.tag === "function-call" /* VertexType.FunctionCall */);
183
+ .filter(([_, info]) => info.tag === vertex_1.VertexType.FunctionCall);
163
184
  const calledFunctionDefinitions = [];
164
185
  for (const [id, info] of functionCalls) {
165
186
  linkFunctionCall(graph, id, info, idMap, thisGraph, calledFunctionDefinitions);
166
187
  }
167
188
  return calledFunctionDefinitions;
168
189
  }
169
- exports.linkFunctionCalls = linkFunctionCalls;
190
+ /** convenience function returning all known call targets */
191
+ function getAllFunctionCallTargets(call, graph) {
192
+ const found = [];
193
+ const callVertex = graph.get(call, true);
194
+ if (callVertex === undefined) {
195
+ return [];
196
+ }
197
+ const [info, outgoingEdges] = callVertex;
198
+ if (info.tag !== vertex_1.VertexType.FunctionCall) {
199
+ return [];
200
+ }
201
+ if (info.name !== undefined && info.environment !== undefined) {
202
+ const functionCallDefs = (0, resolve_by_name_1.resolveByName)(info.name, info.environment, identifier_1.ReferenceType.Function)?.map(d => d.nodeId) ?? [];
203
+ for (const [target, outgoingEdge] of outgoingEdges.entries()) {
204
+ if ((0, edge_1.edgeIncludesType)(outgoingEdge.types, edge_1.EdgeType.Calls)) {
205
+ functionCallDefs.push(target);
206
+ }
207
+ }
208
+ const functionCallTargets = getAllLinkedFunctionDefinitions(new Set(functionCallDefs), graph);
209
+ for (const target of functionCallTargets) {
210
+ found.push(target.id);
211
+ }
212
+ for (const def of functionCallDefs) {
213
+ found.push(def);
214
+ }
215
+ }
216
+ return found;
217
+ }
170
218
  function getAllLinkedFunctionDefinitions(functionDefinitionReadIds, dataflowGraph) {
171
219
  const potential = [...functionDefinitionReadIds];
172
220
  const visited = new Set();
@@ -184,13 +232,13 @@ function getAllLinkedFunctionDefinitions(functionDefinitionReadIds, dataflowGrap
184
232
  }
185
233
  visited.add(currentId);
186
234
  const outgoingEdges = [...currentInfo[1]];
187
- const returnEdges = outgoingEdges.filter(([_, e]) => (0, edge_1.edgeIncludesType)(e.types, 8 /* EdgeType.Returns */));
235
+ const returnEdges = outgoingEdges.filter(([_, e]) => (0, edge_1.edgeIncludesType)(e.types, edge_1.EdgeType.Returns));
188
236
  if (returnEdges.length > 0) {
189
237
  // only traverse return edges and do not follow `calls` etc. as this indicates that we have a function call which returns a result, and not the function calls itself
190
238
  potential.push(...returnEdges.map(([target]) => target).filter(id => !visited.has(id)));
191
239
  continue;
192
240
  }
193
- const followBits = 1 /* EdgeType.Reads */ | 2 /* EdgeType.DefinedBy */ | 32 /* EdgeType.DefinedByOnCall */;
241
+ const followBits = edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedBy | edge_1.EdgeType.DefinedByOnCall;
194
242
  const followEdges = outgoingEdges.filter(([_, e]) => (0, edge_1.edgeIncludesType)(e.types, followBits));
195
243
  if (currentInfo[0].subflow !== undefined) {
196
244
  result.add(currentInfo[0]);
@@ -200,7 +248,6 @@ function getAllLinkedFunctionDefinitions(functionDefinitionReadIds, dataflowGrap
200
248
  }
201
249
  return result;
202
250
  }
203
- exports.getAllLinkedFunctionDefinitions = getAllLinkedFunctionDefinitions;
204
251
  /**
205
252
  * This method links a set of read variables to definitions in an environment.
206
253
  *
@@ -214,7 +261,7 @@ exports.getAllLinkedFunctionDefinitions = getAllLinkedFunctionDefinitions;
214
261
  */
215
262
  function linkInputs(referencesToLinkAgainstEnvironment, environmentInformation, givenInputs, graph, maybeForRemaining) {
216
263
  for (const bodyInput of referencesToLinkAgainstEnvironment) {
217
- const probableTarget = bodyInput.name ? (0, resolve_by_name_1.resolveByName)(bodyInput.name, environmentInformation) : undefined;
264
+ const probableTarget = bodyInput.name ? (0, resolve_by_name_1.resolveByName)(bodyInput.name, environmentInformation, bodyInput.type) : undefined;
218
265
  if (probableTarget === undefined) {
219
266
  log_1.log.trace(`found no target for ${bodyInput.name}`);
220
267
  if (maybeForRemaining) {
@@ -225,14 +272,13 @@ function linkInputs(referencesToLinkAgainstEnvironment, environmentInformation,
225
272
  else {
226
273
  for (const target of probableTarget) {
227
274
  // we can stick with maybe even if readId.attribute is always
228
- graph.addEdge(bodyInput, target, { type: 1 /* EdgeType.Reads */ });
275
+ graph.addEdge(bodyInput, target, edge_1.EdgeType.Reads);
229
276
  }
230
277
  }
231
278
  }
232
279
  // data.graph.get(node.id).definedAtPosition = false
233
280
  return givenInputs;
234
281
  }
235
- exports.linkInputs = linkInputs;
236
282
  /** all loops variables which are open read (not already bound by a redefinition within the loop) get a maybe read marker to their last definition within the loop
237
283
  * e.g. with:
238
284
  * ```R
@@ -255,11 +301,10 @@ function linkCircularRedefinitionsWithinALoop(graph, openIns, outgoing) {
255
301
  for (const out of lastOutgoing.values()) {
256
302
  if (out.name === name) {
257
303
  for (const target of targets) {
258
- graph.addEdge(target.nodeId, out.nodeId, { type: 1 /* EdgeType.Reads */ });
304
+ graph.addEdge(target.nodeId, out.nodeId, edge_1.EdgeType.Reads);
259
305
  }
260
306
  }
261
307
  }
262
308
  }
263
309
  }
264
- exports.linkCircularRedefinitionsWithinALoop = linkCircularRedefinitionsWithinALoop;
265
310
  //# sourceMappingURL=linker.js.map
@@ -1,15 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wrapArgumentsUnnamed = exports.toUnnamedArgument = void 0;
3
+ exports.toUnnamedArgument = toUnnamedArgument;
4
+ exports.wrapArgumentsUnnamed = wrapArgumentsUnnamed;
4
5
  const range_1 = require("../../../../../../util/range");
5
6
  const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
7
+ const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
6
8
  const voidRange = (0, range_1.rangeFrom)(-1, -1, -1, -1);
7
9
  function toUnnamedArgument(node, idMap) {
8
10
  if (node === undefined) {
9
11
  return r_function_call_1.EmptyArgument;
10
12
  }
11
13
  const arg = {
12
- type: "RArgument" /* RType.Argument */,
14
+ type: type_1.RType.Argument,
13
15
  lexeme: node.lexeme ?? '',
14
16
  // is this correct?
15
17
  location: node.location ?? voidRange,
@@ -23,9 +25,7 @@ function toUnnamedArgument(node, idMap) {
23
25
  idMap.set(arg.info.id, node);
24
26
  return arg;
25
27
  }
26
- exports.toUnnamedArgument = toUnnamedArgument;
27
28
  function wrapArgumentsUnnamed(nodes, idMap) {
28
- return nodes.map(n => n === r_function_call_1.EmptyArgument || n?.type === "RArgument" /* RType.Argument */ ? n : toUnnamedArgument(n, idMap));
29
+ return nodes.map(n => n === r_function_call_1.EmptyArgument || n?.type === type_1.RType.Argument ? n : toUnnamedArgument(n, idMap));
29
30
  }
30
- exports.wrapArgumentsUnnamed = wrapArgumentsUnnamed;
31
31
  //# sourceMappingURL=make-argument.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.unpackArgument = void 0;
3
+ exports.unpackArgument = unpackArgument;
4
4
  const log_1 = require("../../../../../../util/log");
5
5
  const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
6
6
  function unpackArgument(arg) {
@@ -14,5 +14,4 @@ function unpackArgument(arg) {
14
14
  }
15
15
  return arg.value;
16
16
  }
17
- exports.unpackArgument = unpackArgument;
18
17
  //# sourceMappingURL=unpack-argument.js.map
@@ -1,13 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processAccess = void 0;
3
+ exports.processAccess = processAccess;
4
4
  const assert_1 = require("../../../../../../util/assert");
5
5
  const known_call_handling_1 = require("../known-call-handling");
6
6
  const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
7
7
  const logger_1 = require("../../../../../logger");
8
+ const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
9
+ const edge_1 = require("../../../../../graph/edge");
8
10
  const environment_1 = require("../../../../../environments/environment");
9
11
  const built_in_1 = require("../../../../../environments/built-in");
10
12
  const built_in_assignment_1 = require("./built-in-assignment");
13
+ const identifier_1 = require("../../../../../environments/identifier");
11
14
  function tableAssignmentProcessor(name, args, rootId, data, outInfo) {
12
15
  outInfo.definitionRootNodes.push(rootId);
13
16
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data }).information;
@@ -26,7 +29,7 @@ function processAccess(name, args, rootId, data, config) {
26
29
  const existing = data.environment.current.memory.get(':=');
27
30
  const outInfo = { definitionRootNodes: [] };
28
31
  data.environment.current.memory.set(':=', [{
29
- kind: 'built-in-function',
32
+ type: identifier_1.ReferenceType.BuiltInFunction,
30
33
  definedAt: built_in_1.BuiltIn,
31
34
  controlDependencies: undefined,
32
35
  processor: (name, args, rootId, data) => tableAssignmentProcessor(name, args, rootId, data, outInfo),
@@ -39,7 +42,7 @@ function processAccess(name, args, rootId, data, config) {
39
42
  data.environment.current.memory.set(':=', existing);
40
43
  }
41
44
  if (head.value && outInfo.definitionRootNodes.length > 0) {
42
- (0, built_in_assignment_1.markAsAssignment)(fnCall.information, { kind: 'variable', name: head.value.lexeme ?? '', nodeId: head.value.info.id, definedAt: rootId, controlDependencies: [] }, outInfo.definitionRootNodes, rootId);
45
+ (0, built_in_assignment_1.markAsAssignment)(fnCall.information, { type: identifier_1.ReferenceType.Variable, name: head.value.lexeme ?? '', nodeId: head.value.info.id, definedAt: rootId, controlDependencies: [] }, outInfo.definitionRootNodes, rootId);
43
46
  }
44
47
  }
45
48
  else {
@@ -47,11 +50,11 @@ function processAccess(name, args, rootId, data, config) {
47
50
  // if the argument is a symbol, we convert it to a string for this perspective
48
51
  for (let i = 1; i < newArgs.length; i++) {
49
52
  const arg = newArgs[i];
50
- if (arg !== r_function_call_1.EmptyArgument && arg.value?.type === "RSymbol" /* RType.Symbol */) {
53
+ if (arg !== r_function_call_1.EmptyArgument && arg.value?.type === type_1.RType.Symbol) {
51
54
  newArgs[i] = {
52
55
  ...arg,
53
56
  value: {
54
- type: "RString" /* RType.String */,
57
+ type: type_1.RType.String,
55
58
  info: arg.value.info,
56
59
  lexeme: arg.value.lexeme,
57
60
  location: arg.value.location,
@@ -66,11 +69,11 @@ function processAccess(name, args, rootId, data, config) {
66
69
  fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args: newArgs, rootId, data, forceArgs: config.forceArgs });
67
70
  }
68
71
  const info = fnCall.information;
69
- info.graph.addEdge(name.info.id, fnCall.processedArguments[0]?.entryPoint ?? head.info.id, { type: 8 /* EdgeType.Returns */ });
72
+ info.graph.addEdge(name.info.id, fnCall.processedArguments[0]?.entryPoint ?? head.info.id, edge_1.EdgeType.Returns);
70
73
  /* access always reads all of its indices */
71
74
  for (const arg of fnCall.processedArguments) {
72
75
  if (arg !== undefined) {
73
- info.graph.addEdge(name.info.id, arg.entryPoint, { type: 1 /* EdgeType.Reads */ });
76
+ info.graph.addEdge(name.info.id, arg.entryPoint, edge_1.EdgeType.Reads);
74
77
  }
75
78
  /* we include the read edges to the constant arguments as well so that they are included if necessary */
76
79
  }
@@ -100,5 +103,4 @@ function processAccess(name, args, rootId, data, config) {
100
103
  })
101
104
  };
102
105
  }
103
- exports.processAccess = processAccess;
104
106
  //# sourceMappingURL=built-in-access.js.map
@@ -10,5 +10,9 @@ export interface BuiltInApplyConfiguration extends MergeableRecord {
10
10
  readonly indexOfFunction?: number;
11
11
  /** does the argument have a name that it can be given by as well? */
12
12
  readonly nameOfFunctionArgument?: string;
13
+ /**
14
+ * Should we unquote the function if it is given as a string?
15
+ */
16
+ readonly unquoteFunction?: boolean;
13
17
  }
14
- export declare function processApply<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { indexOfFunction, nameOfFunctionArgument }: BuiltInApplyConfiguration): DataflowInformation;
18
+ export declare function processApply<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { indexOfFunction, nameOfFunctionArgument, unquoteFunction }: BuiltInApplyConfiguration): DataflowInformation;
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processApply = void 0;
3
+ exports.processApply = processApply;
4
4
  const known_call_handling_1 = require("../known-call-handling");
5
5
  const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
6
6
  const logger_1 = require("../../../../../logger");
7
- function processApply(name, args, rootId, data, { indexOfFunction = 1, nameOfFunctionArgument }) {
7
+ const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
8
+ const vertex_1 = require("../../../../../graph/vertex");
9
+ const edge_1 = require("../../../../../graph/edge");
10
+ const identifier_1 = require("../../../../../environments/identifier");
11
+ function processApply(name, args, rootId, data, { indexOfFunction = 1, nameOfFunctionArgument, unquoteFunction }) {
8
12
  /* as the length is one-based and the argument filter mapping is zero-based, we do not have to subtract 1 */
9
13
  const forceArgsMask = new Array(indexOfFunction).fill(false);
10
14
  forceArgsMask.push(true);
@@ -25,17 +29,32 @@ function processApply(name, args, rootId, data, { indexOfFunction = 1, nameOfFun
25
29
  return information;
26
30
  }
27
31
  const arg = args[index];
28
- if (arg === r_function_call_1.EmptyArgument || arg?.value?.type !== "RSymbol" /* RType.Symbol */) {
32
+ if (arg === r_function_call_1.EmptyArgument || !arg.value || (!unquoteFunction && arg.value.type !== type_1.RType.Symbol)) {
29
33
  logger_1.dataflowLogger.warn(`Expected symbol as argument at index ${index}, but got ${JSON.stringify(arg)} instead.`);
30
34
  return information;
31
35
  }
32
- const functionSymbol = arg.value;
36
+ let functionId;
37
+ let functionName;
38
+ const val = arg.value;
39
+ if (unquoteFunction && val.type === type_1.RType.String) {
40
+ functionId = val.info.id;
41
+ functionName = val.content.str;
42
+ }
43
+ else if (val.type === type_1.RType.Symbol) {
44
+ functionId = val.info.id;
45
+ functionName = val.content;
46
+ }
47
+ else {
48
+ logger_1.dataflowLogger.warn(`Expected symbol or string as function argument at index ${index}, but got ${JSON.stringify(val)} instead.`);
49
+ return information;
50
+ }
33
51
  const allOtherArguments = processedArguments.filter((_, i) => i !== index).map((arg, i) => {
34
52
  const counterpart = args[i];
35
53
  if (arg && counterpart !== r_function_call_1.EmptyArgument && counterpart.name) {
36
54
  return {
37
55
  name: counterpart.name.content,
38
56
  controlDependencies: data.controlDependencies,
57
+ type: identifier_1.ReferenceType.Argument,
39
58
  nodeId: arg.entryPoint
40
59
  };
41
60
  }
@@ -43,12 +62,11 @@ function processApply(name, args, rootId, data, { indexOfFunction = 1, nameOfFun
43
62
  return r_function_call_1.EmptyArgument;
44
63
  }
45
64
  });
46
- const applyCallId = functionSymbol.info.id;
47
65
  /* identify it as a full-blown function call :) */
48
66
  information.graph.updateToFunctionCall({
49
- tag: "function-call" /* VertexType.FunctionCall */,
50
- id: applyCallId,
51
- name: functionSymbol.content,
67
+ tag: vertex_1.VertexType.FunctionCall,
68
+ id: functionId,
69
+ name: functionName,
52
70
  args: allOtherArguments,
53
71
  environment: data.environment,
54
72
  onlyBuiltin: false,
@@ -56,10 +74,9 @@ function processApply(name, args, rootId, data, { indexOfFunction = 1, nameOfFun
56
74
  });
57
75
  for (const arg of processedArguments) {
58
76
  if (arg) {
59
- information.graph.addEdge(applyCallId, arg.entryPoint, { type: 64 /* EdgeType.Argument */ });
77
+ information.graph.addEdge(functionId, arg.entryPoint, edge_1.EdgeType.Argument);
60
78
  }
61
79
  }
62
80
  return information;
63
81
  }
64
- exports.processApply = processApply;
65
82
  //# sourceMappingURL=built-in-apply.js.map