@eagleoutice/flowr 2.2.12 → 2.2.13

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 (256) hide show
  1. package/README.md +82 -20
  2. package/benchmark/slicer.js +2 -2
  3. package/benchmark/summarizer/first-phase/input.js +1 -1
  4. package/benchmark/summarizer/first-phase/process.js +3 -3
  5. package/benchmark/summarizer/second-phase/process.js +1 -1
  6. package/benchmark/summarizer/summarizer.js +1 -1
  7. package/cli/common/options.js +4 -4
  8. package/cli/common/script.js +1 -1
  9. package/cli/flowr.js +1 -1
  10. package/cli/repl/commands/repl-cfg.d.ts +2 -0
  11. package/cli/repl/commands/repl-cfg.js +38 -24
  12. package/cli/repl/commands/repl-commands.js +4 -2
  13. package/cli/repl/commands/repl-dataflow.js +3 -3
  14. package/cli/repl/commands/repl-execute.js +1 -1
  15. package/cli/repl/commands/repl-main.d.ts +1 -1
  16. package/cli/repl/commands/repl-main.js +1 -1
  17. package/cli/repl/commands/repl-normalize.js +1 -1
  18. package/cli/repl/commands/repl-query.js +2 -2
  19. package/cli/repl/core.js +1 -1
  20. package/cli/repl/prompt.js +1 -1
  21. package/cli/repl/server/connection.js +4 -4
  22. package/cli/repl/server/messages/message-analysis.d.ts +1 -1
  23. package/cli/script-core/statistics-core.js +1 -1
  24. package/cli/script-core/statistics-helper-core.js +4 -4
  25. package/config.d.ts +47 -24
  26. package/config.js +3 -3
  27. package/control-flow/basic-cfg-guided-visitor.d.ts +39 -0
  28. package/control-flow/basic-cfg-guided-visitor.js +114 -0
  29. package/control-flow/cfg-properties.d.ts +26 -0
  30. package/control-flow/cfg-properties.js +100 -0
  31. package/control-flow/cfg-simplification.d.ts +18 -0
  32. package/control-flow/cfg-simplification.js +55 -0
  33. package/control-flow/cfg-to-basic-blocks.d.ts +5 -0
  34. package/control-flow/cfg-to-basic-blocks.js +81 -0
  35. package/control-flow/control-flow-graph.d.ts +247 -0
  36. package/control-flow/control-flow-graph.js +290 -0
  37. package/control-flow/dfg-cfg-guided-visitor.d.ts +32 -0
  38. package/control-flow/dfg-cfg-guided-visitor.js +71 -0
  39. package/control-flow/diff-cfg.d.ts +11 -0
  40. package/control-flow/diff-cfg.js +161 -0
  41. package/control-flow/extract-cfg.d.ts +30 -0
  42. package/control-flow/extract-cfg.js +475 -0
  43. package/control-flow/happens-before.d.ts +7 -0
  44. package/{util/cfg → control-flow}/happens-before.js +3 -3
  45. package/control-flow/semantic-cfg-guided-visitor.d.ts +452 -0
  46. package/control-flow/semantic-cfg-guided-visitor.js +492 -0
  47. package/control-flow/simple-visitor.d.ts +25 -0
  48. package/control-flow/simple-visitor.js +80 -0
  49. package/control-flow/syntax-cfg-guided-visitor.d.ts +128 -0
  50. package/control-flow/syntax-cfg-guided-visitor.js +166 -0
  51. package/core/print/print.d.ts +1 -1
  52. package/core/print/slice-diff-ansi.js +1 -1
  53. package/core/steps/pipeline/create-pipeline.js +1 -1
  54. package/dataflow/environments/built-in-config.js +9 -6
  55. package/dataflow/environments/built-in.d.ts +8 -4
  56. package/dataflow/environments/built-in.js +47 -5
  57. package/dataflow/environments/default-builtin-config.d.ts +2 -0
  58. package/dataflow/environments/default-builtin-config.js +81 -14
  59. package/dataflow/environments/resolve-by-name.js +15 -4
  60. package/dataflow/extractor.js +2 -2
  61. package/dataflow/graph/dataflowgraph-builder.d.ts +3 -1
  62. package/dataflow/graph/dataflowgraph-builder.js +4 -2
  63. package/dataflow/graph/diff-dataflow-graph.d.ts +16 -0
  64. package/dataflow/graph/{diff.js → diff-dataflow-graph.js} +30 -56
  65. package/dataflow/graph/graph.d.ts +11 -3
  66. package/dataflow/graph/graph.js +27 -12
  67. package/dataflow/graph/vertex.d.ts +17 -2
  68. package/dataflow/internal/linker.d.ts +3 -2
  69. package/dataflow/internal/linker.js +33 -24
  70. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
  71. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +1 -1
  72. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +12 -9
  73. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
  74. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +84 -16
  75. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +23 -16
  76. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +5 -5
  77. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -4
  78. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +3 -2
  79. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +15 -4
  80. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +4 -3
  81. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -3
  82. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +4 -3
  83. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +1 -1
  84. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +1 -1
  85. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -7
  86. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +3 -2
  87. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -0
  88. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +19 -4
  89. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
  90. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +19 -4
  91. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +4 -3
  92. package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +3 -3
  93. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +3 -3
  94. package/dataflow/internal/process/functions/call/common.d.ts +4 -1
  95. package/dataflow/internal/process/functions/call/common.js +5 -3
  96. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -2
  97. package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
  98. package/dataflow/internal/process/functions/call/named-call-handling.js +1 -1
  99. package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +1 -0
  100. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +6 -4
  101. package/dataflow/internal/process/process-named-call.d.ts +1 -1
  102. package/dataflow/internal/process/process-named-call.js +5 -5
  103. package/dataflow/origin/dfg-get-origin.d.ts +82 -0
  104. package/dataflow/origin/dfg-get-origin.js +116 -0
  105. package/documentation/doc-util/doc-cfg.d.ts +13 -6
  106. package/documentation/doc-util/doc-cfg.js +19 -14
  107. package/documentation/doc-util/doc-cli-option.js +4 -2
  108. package/documentation/doc-util/doc-dfg.js +3 -3
  109. package/documentation/doc-util/doc-escape.d.ts +7 -0
  110. package/documentation/doc-util/doc-escape.js +19 -0
  111. package/documentation/doc-util/doc-files.d.ts +1 -0
  112. package/documentation/doc-util/doc-files.js +2 -1
  113. package/documentation/doc-util/doc-normalized-ast.js +3 -3
  114. package/documentation/doc-util/doc-query.js +2 -2
  115. package/documentation/doc-util/doc-repl.js +1 -1
  116. package/documentation/doc-util/doc-search.js +1 -1
  117. package/documentation/doc-util/doc-server-message.js +2 -2
  118. package/documentation/doc-util/doc-structure.d.ts +1 -0
  119. package/documentation/doc-util/doc-structure.js +5 -0
  120. package/documentation/doc-util/doc-types.d.ts +7 -1
  121. package/documentation/doc-util/doc-types.js +13 -2
  122. package/documentation/print-capabilities-markdown.js +27 -1
  123. package/documentation/print-cfg-wiki.js +505 -17
  124. package/documentation/print-dataflow-graph-wiki.js +180 -25
  125. package/documentation/print-engines-wiki.js +1 -1
  126. package/documentation/print-faq-wiki.d.ts +1 -0
  127. package/documentation/print-faq-wiki.js +75 -0
  128. package/documentation/print-interface-wiki.js +1 -1
  129. package/documentation/print-linting-and-testing-wiki.js +52 -36
  130. package/documentation/print-normalized-ast-wiki.js +1 -1
  131. package/documentation/print-onboarding-wiki.d.ts +1 -0
  132. package/documentation/print-onboarding-wiki.js +42 -0
  133. package/documentation/print-query-wiki.js +21 -1
  134. package/documentation/print-readme.js +10 -3
  135. package/package.json +9 -6
  136. package/queries/catalog/call-context-query/call-context-query-executor.js +5 -5
  137. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
  138. package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
  139. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +2 -2
  140. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +24 -21
  141. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
  142. package/queries/catalog/cluster-query/cluster-query-format.js +1 -1
  143. package/queries/catalog/config-query/config-query-format.d.ts +1 -1
  144. package/queries/catalog/config-query/config-query-format.js +2 -2
  145. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
  146. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -2
  147. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
  148. package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -2
  149. package/queries/catalog/dependencies-query/dependencies-query-executor.js +4 -2
  150. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
  151. package/queries/catalog/dependencies-query/dependencies-query-format.js +2 -2
  152. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
  153. package/queries/catalog/happens-before-query/happens-before-query-executor.js +4 -4
  154. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
  155. package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -2
  156. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
  157. package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
  158. package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -1
  159. package/queries/catalog/lineage-query/lineage-query-format.js +2 -2
  160. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  161. package/queries/catalog/location-map-query/location-map-query-format.js +2 -2
  162. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
  163. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -2
  164. package/queries/catalog/origin-query/origin-query-executor.d.ts +5 -0
  165. package/queries/catalog/origin-query/origin-query-executor.js +33 -0
  166. package/queries/catalog/origin-query/origin-query-format.d.ts +71 -0
  167. package/queries/catalog/origin-query/origin-query-format.js +27 -0
  168. package/queries/catalog/project-query/project-query-format.d.ts +1 -1
  169. package/queries/catalog/project-query/project-query-format.js +2 -2
  170. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  171. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -2
  172. package/queries/catalog/search-query/search-query-format.d.ts +1 -1
  173. package/queries/catalog/search-query/search-query-format.js +2 -2
  174. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
  175. package/queries/catalog/static-slice-query/static-slice-query-format.js +2 -2
  176. package/queries/query-print.d.ts +1 -1
  177. package/queries/query-print.js +4 -4
  178. package/queries/query.d.ts +61 -2
  179. package/queries/query.js +3 -1
  180. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -2
  181. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +5 -0
  182. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -2
  183. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +5 -0
  184. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +1 -1
  185. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -1
  186. package/r-bridge/lang-4.x/ast/model/processing/fold.js +3 -1
  187. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
  188. package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
  189. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +1 -1
  190. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
  191. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
  192. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -1
  193. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +1 -1
  194. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +1 -1
  195. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -1
  196. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
  197. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +4 -4
  198. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +26 -8
  199. package/r-bridge/retriever.js +1 -1
  200. package/search/search-executor/search-generators.d.ts +1 -1
  201. package/search/search-executor/search-transformer.d.ts +1 -1
  202. package/slicing/criterion/collect-all.js +1 -1
  203. package/slicing/static/slice-call.js +13 -3
  204. package/statistics/features/supported/assignments/post-process.js +1 -1
  205. package/statistics/features/supported/defined-functions/post-process.js +2 -2
  206. package/statistics/features/supported/used-functions/post-process.js +1 -1
  207. package/statistics/features/supported/used-packages/post-process.js +2 -2
  208. package/statistics/features/supported/values/post-process.js +2 -2
  209. package/statistics/output/print-stats.js +2 -2
  210. package/statistics/summarizer/post-process/clusterer.d.ts +1 -1
  211. package/statistics/summarizer/post-process/clusterer.js +1 -1
  212. package/statistics/summarizer/post-process/histogram.js +3 -3
  213. package/statistics/summarizer/post-process/post-process-output.js +3 -3
  214. package/statistics/summarizer/second-phase/process.js +2 -2
  215. package/statistics/summarizer/summarizer.js +2 -2
  216. package/util/assert.js +36 -1
  217. package/util/cfg/cfg.d.ts +0 -80
  218. package/util/cfg/cfg.js +0 -549
  219. package/util/{arrays.d.ts → collections/arrays.d.ts} +1 -1
  220. package/util/{arrays.js → collections/arrays.js} +3 -3
  221. package/util/collections/set.js +17 -0
  222. package/util/diff-graph.d.ts +47 -0
  223. package/util/diff-graph.js +61 -0
  224. package/util/diff.d.ts +6 -6
  225. package/util/diff.js +1 -1
  226. package/util/mermaid/cfg.d.ts +9 -2
  227. package/util/mermaid/cfg.js +64 -12
  228. package/util/mermaid/dfg.d.ts +2 -1
  229. package/util/mermaid/dfg.js +26 -10
  230. package/util/mermaid/mermaid.d.ts +2 -0
  231. package/util/mermaid/mermaid.js +6 -0
  232. package/util/quads.js +1 -1
  233. package/util/schema.d.ts +1 -1
  234. package/util/schema.js +1 -1
  235. package/util/summarizer.js +1 -1
  236. package/util/{text.js → text/text.js} +1 -1
  237. package/util/{time.js → text/time.js} +1 -1
  238. package/util/version.js +1 -1
  239. package/dataflow/graph/diff.d.ts +0 -36
  240. package/util/cfg/happens-before.d.ts +0 -7
  241. package/util/cfg/visitor.d.ts +0 -9
  242. package/util/cfg/visitor.js +0 -30
  243. package/util/set.js +0 -31
  244. /package/util/{bimap.d.ts → collections/bimap.d.ts} +0 -0
  245. /package/util/{bimap.js → collections/bimap.js} +0 -0
  246. /package/util/{defaultmap.d.ts → collections/defaultmap.d.ts} +0 -0
  247. /package/util/{defaultmap.js → collections/defaultmap.js} +0 -0
  248. /package/util/{set.d.ts → collections/set.d.ts} +0 -0
  249. /package/util/{ansi.d.ts → text/ansi.d.ts} +0 -0
  250. /package/util/{ansi.js → text/ansi.js} +0 -0
  251. /package/util/{args.d.ts → text/args.d.ts} +0 -0
  252. /package/util/{args.js → text/args.js} +0 -0
  253. /package/util/{strings.d.ts → text/strings.d.ts} +0 -0
  254. /package/util/{strings.js → text/strings.js} +0 -0
  255. /package/util/{text.d.ts → text/text.d.ts} +0 -0
  256. /package/util/{time.d.ts → text/time.d.ts} +0 -0
@@ -1,20 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DefaultBuiltinConfig = void 0;
4
+ exports.getDefaultProcessor = getDefaultProcessor;
4
5
  const identify_link_to_last_call_relation_1 = require("../../queries/catalog/call-context-query/identify-link-to-last-call-relation");
5
6
  const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
6
7
  const cascade_action_1 = require("../../queries/catalog/call-context-query/cascade-action");
8
+ const unnamed_call_handling_1 = require("../internal/process/functions/call/unnamed-call-handling");
7
9
  const GgPlotCreate = [
8
- 'ggplot', 'ggplotly'
10
+ 'ggplot', 'ggplotly', 'ggMarginal', 'ggcorrplot', 'ggseasonplot', 'ggdendrogram', 'qmap', 'qplot', 'quickplot', 'autoplot', 'grid.arrange',
11
+ 'fviz_pca_biplot', 'fviz_pca', 'fviz_pca_ind', 'fviz_pca_var', 'fviz_screeplot', 'fviz_mca_biplot', 'fviz_mca', 'fviz_mca_ind', 'fviz_mca_var', 'fviz_cluster', 'fviz_dend',
12
+ 'ggsurvplot',
9
13
  ];
10
14
  const TinyPlotCrate = [
11
15
  'tinyplot', 'plt'
12
16
  ];
13
17
  const PlotCreate = [
14
18
  'plot', 'plot.new', 'xspline', 'map', 'curve', 'image', 'boxplot', 'dotchart', 'sunflowerplot', 'barplot', 'matplot', 'hist', 'stem',
15
- 'density', 'smoothScatter', 'contour', 'persp', 'XYPlot', 'xyplot', 'stripplot', 'bwplot', 'dotPlot', 'dotplot', 'histPlot', 'densityPlot', 'qPlot', 'qqPlot', 'boxPlot',
16
- 'bxp', 'assocplot', 'mosaicplot', 'stripchart', 'fourfoldplot', 'mosaicplot', 'plot.xy', 'plot.formula', 'plot.default', 'plot.design', 'stars',
17
- 'spineplot', 'Plotranges', 'regressogram', 'bootcurve', 'meanplot', 'vioplot', 'pairs', 'copolot', 'histogram', 'splom', 'leaflet', 'tm_shape', 'plot_ly',
19
+ 'density', 'smoothScatter', 'contour', 'persp', 'XYPlot', 'xyplot', 'stripplot', 'bwplot', 'dotPlot', 'dotplot', 'histPlot', 'densityPlot', 'qPlot', 'qqplot', 'qqPlot', 'boxPlot',
20
+ 'bxp', 'assocplot', 'mosaicplot', 'stripchart', 'fourfoldplot', 'plot.xy', 'plot.formula', 'plot.default', 'plot.design', 'stars', 'cotabplot', 'pheatmap',
21
+ 'spineplot', 'Plotranges', 'regressogram', 'bootcurve', 'meanplot', 'vioplot', 'pairs', 'copolot', 'histogram', 'splom', 'leaflet', 'tm_shape', 'plot_ly', 'plotProfLik', 'plotSimulatedResiduals', 'plotmeans',
22
+ 'overplot', 'residplot', 'heatmap.2', 'lmplot2', 'sinkplot', 'textplot', 'boxplot2', 'profLikCI',
18
23
  ...TinyPlotCrate,
19
24
  ...GgPlotCreate
20
25
  ];
@@ -25,9 +30,58 @@ const GraphicDeviceOpen = [
25
30
  const TinyPlotAddons = [
26
31
  'tinyplot_add', 'plt_add'
27
32
  ];
33
+ const GgPlotImplicitAddons = [
34
+ 'geom_count', 'geom_bin_2d', 'geom_spoke', 'geom_tile', 'geom_rect',
35
+ 'geom_function', 'geom_crossbar', 'geom_density2d', 'geom_abline', 'geom_errorbar', 'geom_errorbarh',
36
+ 'geom_jitter', 'geom_line', 'geom_density', 'geom_quantile', 'geom_qq', 'geom_qq_line', 'geom_segment', 'geom_label', 'geom_density_2d',
37
+ 'geom_violin', 'geom_contour', 'geom_boxplot', 'geom_col', 'geom_blank', 'geom_histogram', 'geom_hline', 'geom_area', 'geom_sf_text', 'geom_smooth', 'geom_text',
38
+ 'geom_density2d_filled', 'geom_ribbon', 'geom_sf', 'geom_dotplot', 'geom_freqpoly', 'geom_step', 'geom_map', 'geom_bin2d', 'geom_rug', 'geom_raster', 'geom_pointrange', 'geom_point',
39
+ 'geom_hex', 'geom_contour_filled', 'geom_bar', 'geom_vline', 'geom_linerange', 'geom_curve', 'geom_path', 'geom_polygon', 'geom_sf_label', 'geom_density_2d_filled', 'geom_dumbbell',
40
+ 'geom_encircle', 'stat_count', 'stat_density', 'stat_bin_hex', 'stat_bin_2d', 'stat_summary_bin', 'stat_identity', 'stat_qq', 'stat_binhex', 'stat_boxplot', 'stat_function',
41
+ 'stat_align', 'stat_contour_filled', 'stat_summary_2d', 'stat_qq_line', 'stat_contour', 'stat_ydensity', 'stat_summary_hex', 'stat_summary2d', 'stat_sf_coordinates',
42
+ 'stat_density_2d_filled', 'stat_smooth', 'stat_density2d', 'stat_ecdf', 'stat_sf', 'stat_quantile', 'stat_unique', 'stat_density_2d', 'stat_ellipse', 'stat_summary',
43
+ 'stat_density2d_filled', 'stat_bin', 'stat_sum', 'stat_spoke', 'stat_bin2d',
44
+ 'labs', 'theme_void', 'theme_test', 'theme_minimal', 'theme_light', 'theme', 'theme_get', 'theme_gray', 'theme_dark', 'theme_classic', 'theme_linedraw', 'theme_update',
45
+ 'theme_replace', 'theme_grey', 'theme_bw', 'theme_tufte', 'theme_survminer', 'facet_null', 'facet_grid', 'facet_wrap', 'xlab', 'xlim', 'ylab', 'ylim',
46
+ 'scale_linewidth_ordinal', 'scale_fill_steps', 'scale_color_gradient2', 'scale_size_manual', 'scale_colour_discrete', 'scale_color_identity',
47
+ 'scale_fill_fermenter', 'scale_alpha_manual', 'scale_fill_gradient', 'scale_size_date', 'scale_fill_viridis_b', 'scale_x_time', 'scale_linetype_manual',
48
+ 'scale_alpha_binned', 'scale_color_grey', 'scale_colour_gradient', 'scale_linewidth_date', 'scale_color_steps2', 'scale_color_viridis_b', 'scale_size_binned',
49
+ 'scale_colour_gradientn', 'scale_linewidth_manual', 'scale_fill_viridis_c', 'scale_fill_manual', 'scale_color_viridis_c', 'scale_fill_discrete', 'scale_size_discrete',
50
+ 'scale_fill_binned', 'scale_fill_viridis_d', 'scale_colour_fermenter', 'scale_color_viridis_d', 'scale_x_datetime', 'scale_size_identity', 'scale_linewidth_identity',
51
+ 'scale_shape_ordinal', 'scale_linewidth_discrete', 'scale_fill_ordinal', 'scale_y_time', 'scale_color_ordinal', 'scale_size_ordinal', 'scale_colour_distiller',
52
+ 'scale_linewidth_datetime', 'scale_alpha_identity', 'scale_color_steps', 'scale_alpha_discrete', 'scale_fill_date', 'scale_x_reverse', 'scale_fill_gradientn', 'scale_size_datetime',
53
+ 'scale_y_continuous', 'scale_colour_steps', 'scale_color_distiller', 'scale_colour_ordinal', 'scale_y_datetime', 'scale_linetype_discrete', 'scale_colour_viridis_b',
54
+ 'scale_alpha_datetime', 'scale_continuous_identity', 'scale_fill_brewer', 'scale_shape_identity', 'scale_color_discrete', 'scale_colour_viridis_c', 'scale_linetype_identity',
55
+ 'scale_colour_hue', 'scale_linewidth_binned', 'scale_color_hue', 'scale_shape_continuous', 'scale_colour_viridis_d', 'scale_size_continuous', 'scale_color_manual', 'scale_alpha_date',
56
+ 'scale_y_sqrt', 'scale_shape_binned', 'scale_size', 'scale_color_fermenter', 'scale_color_stepsn', 'scale_size_area', 'scale_y_binned', 'scale_y_discrete', 'scale_alpha_continuous',
57
+ 'scale_fill_continuous', 'scale_linetype_continuous', 'scale_colour_steps2', 'scale_colour_datetime', 'scale_colour_grey', 'scale_x_log10', 'scale_x_discrete', 'scale_color_continuous',
58
+ 'scale_type', 'scale_y_reverse', 'scale_colour_gradient2', 'scale_color_datetime', 'scale_color_date', 'scale_x_continuous', 'scale_colour_manual', 'scale_fill_gradient2',
59
+ 'scale_fill_grey', 'scale_colour_stepsn', 'scale_colour_binned', 'scale_color_binned', 'scale_color_gradientn', 'scale_colour_date', 'scale_fill_distiller', 'scale_color_gradient',
60
+ 'scale_linewidth_continuous', 'scale_shape', 'scale_fill_hue', 'scale_linetype', 'scale_colour_identity', 'scale_discrete_manual', 'scale_fill_identity', 'scale_y_log10',
61
+ 'scale_linetype_binned', 'scale_size_binned_area', 'scale_y_date', 'scale_x_binned', 'scale_shape_discrete', 'scale_colour_brewer', 'scale_x_date', 'scale_discrete_identity',
62
+ 'scale_alpha', 'scale_fill_steps2', 'scale_color_brewer', 'scale_fill_datetime', 'scale_shape_manual', 'scale_colour_continuous', 'scale_alpha_ordinal', 'scale_linewidth', 'scale_x_sqrt',
63
+ 'scale_fill_stepsn', 'scale_radius', 'rotateTextX', 'removeGridX', 'removeGridY', 'removeGrid',
64
+ 'coord_trans', 'coord_sf', 'coord_cartesian', 'coord_fixed', 'coord_flip', 'coord_quickmap', 'coord_equal', 'coord_map', 'coord_polar', 'coord_munch', 'coord_radial',
65
+ 'annotate', 'annotation_custom', 'annotation_raster', 'annotation_map', 'annotation_logticks', 'borders', 'ggtitle', 'expansion', 'expand_limits', 'expand_scale', 'guides',
66
+ 'wrap_by',
67
+ 'theme_solid', 'theme_hc', 'theme_excel_new', 'theme_few', 'theme_clean', 'theme_wsj', 'theme_calc', 'theme_par', 'theme_tufte', 'theme_igray', 'theme_solarized_2', 'theme_excel',
68
+ 'theme_economist', 'theme_stata', 'theme_map', 'theme_fivethirtyeight', 'theme_economist_white', 'theme_base', 'theme_foundation', 'theme_gdocs', 'theme_pander', 'theme_solarized',
69
+ 'scale_shape_tableau', 'scale_fill_pander', 'scale_shape_few', 'scale_colour_excel_new', 'scale_colour_hc', 'scale_fill_ptol', 'scale_fill_gradient2_tableau', 'scale_shape_calc', 'scale_fill_stata',
70
+ 'scale_colour_tableau', 'scale_colour_colorblind', 'scale_color_stata', 'scale_colour_economist', 'scale_fill_calc', 'scale_fill_gradient_tableau', 'scale_shape_cleveland', 'scale_color_pander',
71
+ 'scale_colour_pander', 'scale_color_fivethirtyeight', 'scale_color_wsj', 'scale_shape_stata', 'scale_colour_gdocs', 'scale_color_continuous_tableau', 'scale_fill_excel', 'scale_color_few', 'scale_linetype_stata',
72
+ 'scale_shape_tremmel', 'scale_color_tableau', 'scale_color_colorblind', 'scale_fill_colorblind', 'scale_colour_stata', 'scale_fill_wsj', 'scale_colour_calc', 'scale_colour_fivethirtyeight', 'scale_fill_hc',
73
+ 'scale_shape_circlefill', 'scale_fill_excel_new', 'scale_color_solarized', 'scale_color_excel', 'scale_colour_excel', 'scale_fill_tableau', 'scale_colour_ptol', 'scale_colour_canva', 'scale_color_gradient2_tableau',
74
+ 'scale_colour_solarized', 'scale_colour_gradient2_tableau', 'scale_fill_canva', 'scale_color_ptol', 'scale_color_excel_new', 'scale_color_economist', 'scale_fill_economist', 'scale_fill_fivethirtyeight',
75
+ 'scale_colour_gradient_tableau', 'scale_colour_few', 'scale_color_calc', 'scale_fill_few', 'scale_fill_gdocs', 'scale_color_hc', 'scale_color_gdocs', 'scale_color_canva', 'scale_color_gradient_tableau',
76
+ 'scale_fill_solarized', 'scale_fill_continuous_tableau', 'scale_colour_wsj', 'gradient_color', 'ggsurvplot_add_all'
77
+ ];
78
+ const PlotFunctionsWithAddParam = new Set([
79
+ 'map', 'matplot', 'barplot', 'boxplot', 'curve', 'image', 'plotCI', 'bandplot', 'barplot2', 'bubbleplot'
80
+ ]);
28
81
  const PlotAddons = [
29
- 'points', 'abline', 'map', 'mtext', 'lines', 'text', 'legend', 'title', 'axis', 'polygon', 'polypath', 'pie', 'rect', 'segments', 'arrows', 'symbols',
30
- 'tiplabels', 'rug', 'grid', 'box', 'clip'
82
+ 'points', 'abline', 'mtext', 'lines', 'text', 'legend', 'title', 'axis', 'polygon', 'polypath', 'pie', 'rect', 'segments', 'arrows', 'symbols',
83
+ 'qqline', 'qqnorm', 'rasterImage',
84
+ 'tiplabels', 'rug', 'grid', 'box', 'clip', 'matpoints', 'matlines', ...GgPlotImplicitAddons, ...PlotFunctionsWithAddParam
31
85
  ];
32
86
  const GgPlotAddons = [
33
87
  'ggdraw', 'last_plot'
@@ -83,8 +137,8 @@ exports.DefaultBuiltinConfig = [
83
137
  type: 'link-to-last-call',
84
138
  ignoreIf: (source, graph) => {
85
139
  /* map with add = true appends to an existing plot */
86
- return (source.name === 'map' && (0, identify_link_to_last_call_relation_1.getValueOfArgument)(graph, source, {
87
- index: 11,
140
+ return (PlotFunctionsWithAddParam.has(source.name) && (0, identify_link_to_last_call_relation_1.getValueOfArgument)(graph, source, {
141
+ index: -1,
88
142
  name: 'add'
89
143
  }, [type_1.RType.Logical])?.content === true);
90
144
  },
@@ -95,14 +149,17 @@ exports.DefaultBuiltinConfig = [
95
149
  { type: 'function', names: PlotAddons,
96
150
  processor: 'builtin:default', config: {
97
151
  forceArgs: 'all',
152
+ treatAsFnCall: {
153
+ 'facet_grid': ['labeller']
154
+ },
98
155
  hasUnknownSideEffects: {
99
156
  type: 'link-to-last-call',
100
- callName: toRegex(PlotCreate),
157
+ callName: toRegex([...PlotCreate, ...PlotAddons]),
101
158
  ignoreIf: (source, graph) => {
102
159
  const sourceVertex = graph.getVertex(source);
103
160
  /* map with add = true appends to an existing plot */
104
- return (sourceVertex?.name === 'map' && (0, identify_link_to_last_call_relation_1.getValueOfArgument)(graph, sourceVertex, {
105
- index: 11,
161
+ return (PlotFunctionsWithAddParam.has(sourceVertex.name ?? '') && (0, identify_link_to_last_call_relation_1.getValueOfArgument)(graph, sourceVertex, {
162
+ index: -1,
106
163
  name: 'add'
107
164
  }, [type_1.RType.Logical])?.content !== true);
108
165
  },
@@ -124,7 +181,7 @@ exports.DefaultBuiltinConfig = [
124
181
  forceArgs: 'all',
125
182
  hasUnknownSideEffects: {
126
183
  type: 'link-to-last-call',
127
- callName: toRegex(GgPlotCreate)
184
+ callName: toRegex([...GgPlotCreate, ...GgPlotAddons])
128
185
  }
129
186
  }, assumePrimitive: true
130
187
  },
@@ -136,7 +193,7 @@ exports.DefaultBuiltinConfig = [
136
193
  forceArgs: 'all',
137
194
  hasUnknownSideEffects: {
138
195
  type: 'link-to-last-call',
139
- callName: toRegex(TinyPlotCrate)
196
+ callName: toRegex([...TinyPlotCrate, ...TinyPlotAddons])
140
197
  }
141
198
  }, assumePrimitive: true
142
199
  },
@@ -185,6 +242,8 @@ exports.DefaultBuiltinConfig = [
185
242
  { type: 'function', names: ['while'], processor: 'builtin:while-loop', config: {}, assumePrimitive: true },
186
243
  { type: 'function', names: ['do.call'], processor: 'builtin:apply', config: { indexOfFunction: 0, unquoteFunction: true }, assumePrimitive: true },
187
244
  { type: 'function', names: ['.Primitive', '.Internal'], processor: 'builtin:apply', config: { indexOfFunction: 0, unquoteFunction: true, resolveInEnvironment: 'global' }, assumePrimitive: true },
245
+ { type: 'function', names: ['interference'], processor: 'builtin:apply', config: { unquoteFunction: true, nameOfFunctionArgument: 'propensity_integrand' }, assumePrimitive: false },
246
+ { type: 'function', names: ['ddply'], processor: 'builtin:apply', config: { unquoteFunction: true, indexOfFunction: 2, nameOfFunctionArgument: '.fun' }, assumePrimitive: false },
188
247
  { type: 'function', names: ['list'], processor: 'builtin:list', config: {}, assumePrimitive: true },
189
248
  { type: 'function', names: ['c'], processor: 'builtin:vector', config: {}, assumePrimitive: true },
190
249
  {
@@ -201,7 +260,7 @@ exports.DefaultBuiltinConfig = [
201
260
  {
202
261
  type: 'function',
203
262
  names: [
204
- 'on.exit', 'sys.on.exit', 'par', 'tpar', 'sink', 'tinytheme',
263
+ 'on.exit', 'sys.on.exit', 'par', 'tpar', 'sink', 'tinytheme', 'theme_set',
205
264
  /* library and require is handled above */
206
265
  'requireNamespace', 'loadNamespace', 'attachNamespace', 'asNamespace',
207
266
  /* downloader and installer functions (R, devtools, BiocManager) */
@@ -233,4 +292,12 @@ exports.DefaultBuiltinConfig = [
233
292
  }
234
293
  }
235
294
  ];
295
+ function getDefaultProcessor(name) {
296
+ if (name.startsWith(unnamed_call_handling_1.UnnamedFunctionCallPrefix)) {
297
+ return 'unnamed';
298
+ }
299
+ const fn = exports.DefaultBuiltinConfig.find(def => (def.names.includes(name) && def.type !== 'constant')
300
+ || (def.type === 'replacement' && def.suffixes.flatMap(d => def.names.map(n => `${n}${d}`)).includes(name)));
301
+ return fn?.type === 'replacement' ? 'builtin:replacement' : fn?.processor;
302
+ }
236
303
  //# sourceMappingURL=default-builtin-config.js.map
@@ -52,7 +52,7 @@ function resolveByName(name, environment, target = identifier_1.ReferenceType.Un
52
52
  do {
53
53
  const definition = current.memory.get(name);
54
54
  if (definition !== undefined) {
55
- const filtered = definition.filter(wantedType);
55
+ const filtered = target === identifier_1.ReferenceType.Unknown ? definition : definition.filter(wantedType);
56
56
  if (filtered.length === definition.length && definition.every(d => (0, info_1.happensInEveryBranch)(d.controlDependencies))) {
57
57
  return definition;
58
58
  }
@@ -65,7 +65,7 @@ function resolveByName(name, environment, target = identifier_1.ReferenceType.Un
65
65
  } while (current.id !== environment_1.BuiltInEnvironment.id);
66
66
  const builtIns = current.memory.get(name);
67
67
  if (definitions) {
68
- return builtIns === undefined ? definitions : [...definitions, ...builtIns];
68
+ return builtIns === undefined ? definitions : definitions.concat(builtIns);
69
69
  }
70
70
  else {
71
71
  return builtIns;
@@ -112,7 +112,7 @@ const AliasHandler = {
112
112
  [vertex_1.VertexType.VariableDefinition]: () => undefined
113
113
  };
114
114
  function getUseAlias(sourceId, dataflow, environment) {
115
- const definitions = [];
115
+ let definitions = [];
116
116
  // Source is Symbol -> resolve definitions of symbol
117
117
  const identifier = (0, node_id_1.recoverName)(sourceId, dataflow.idMap);
118
118
  if (identifier === undefined) {
@@ -129,7 +129,7 @@ function getUseAlias(sourceId, dataflow, environment) {
129
129
  if (def.value === undefined) {
130
130
  return undefined;
131
131
  }
132
- definitions.push(...def.value);
132
+ definitions = definitions.concat(def.value);
133
133
  }
134
134
  else if (def.type === identifier_1.ReferenceType.Constant || def.type === identifier_1.ReferenceType.BuiltInConstant) {
135
135
  definitions.push(def.nodeId);
@@ -242,8 +242,19 @@ function trackAliasesInGraph(id, graph, idMap) {
242
242
  resultIds.push(id);
243
243
  continue;
244
244
  }
245
+ else if (vertex.tag === vertex_1.VertexType.FunctionDefinition) {
246
+ resultIds.push(id);
247
+ continue;
248
+ }
249
+ const isFn = vertex.tag === vertex_1.VertexType.FunctionCall;
245
250
  // travel all read and defined-by edges
246
251
  for (const [targetId, edge] of outgoingEdges) {
252
+ if (isFn) {
253
+ if (edge.types === edge_1.EdgeType.Returns || edge.types === edge_1.EdgeType.DefinedByOnCall || edge.types === edge_1.EdgeType.DefinedBy) {
254
+ queue.add(targetId, baseEnvironment, cleanFingerprint, false);
255
+ }
256
+ continue;
257
+ }
247
258
  // currently, they have to be exact!
248
259
  if (edge.types === edge_1.EdgeType.Reads || edge.types === edge_1.EdgeType.DefinedBy || edge.types === edge_1.EdgeType.DefinedByOnCall) {
249
260
  queue.add(targetId, baseEnvironment, cleanFingerprint, false);
@@ -16,7 +16,7 @@ const range_1 = require("../util/range");
16
16
  const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
17
17
  const environment_1 = require("./environments/environment");
18
18
  const built_in_source_1 = require("./internal/process/functions/call/built-in/built-in-source");
19
- const cfg_1 = require("../util/cfg/cfg");
19
+ const extract_cfg_1 = require("../control-flow/extract-cfg");
20
20
  const edge_1 = require("./graph/edge");
21
21
  const identify_link_to_last_call_relation_1 = require("../queries/catalog/call-context-query/identify-link-to-last-call-relation");
22
22
  const built_in_function_definition_1 = require("./internal/process/functions/call/built-in/built-in-function-definition");
@@ -63,7 +63,7 @@ function resolveLinkToSideEffects(ast, graph) {
63
63
  if (typeof s !== 'object') {
64
64
  continue;
65
65
  }
66
- cfg ??= (0, cfg_1.extractCFG)(ast, graph).graph;
66
+ cfg ??= (0, extract_cfg_1.extractSimpleCfg)(ast).graph;
67
67
  /* this has to change whenever we add a new link to relations because we currently offer no abstraction for the type */
68
68
  const potentials = (0, identify_link_to_last_call_relation_1.identifyLinkToLastCallRelation)(s.id, cfg, graph, s.linkTo);
69
69
  for (const pot of potentials) {
@@ -3,7 +3,7 @@ import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/deco
3
3
  import type { DataflowFunctionFlowInformation, FunctionArgument } from './graph';
4
4
  import { DataflowGraph } from './graph';
5
5
  import type { REnvironmentInformation } from '../environments/environment';
6
- import type { DataflowGraphVertexUse } from './vertex';
6
+ import type { DataflowGraphVertexAstLink, DataflowGraphVertexUse, FunctionOriginInformation } from './vertex';
7
7
  import type { ControlDependency } from '../info';
8
8
  import type { LinkTo } from '../../queries/catalog/call-context-query/call-context-query-format';
9
9
  import type { FlowrSearchLike } from '../../search/flowr-search-builder';
@@ -47,6 +47,8 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
47
47
  onlyBuiltIn?: boolean;
48
48
  environment?: REnvironmentInformation;
49
49
  controlDependencies?: ControlDependency[];
50
+ origin?: FunctionOriginInformation[];
51
+ link?: DataflowGraphVertexAstLink;
50
52
  }, asRoot?: boolean): this;
51
53
  /** automatically adds argument links if they do not already exist */
52
54
  private addArgumentLinks;
@@ -61,7 +61,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
61
61
  * (i.e., be a valid entry point), or is it nested (e.g., as part of a function definition)
62
62
  */
63
63
  call(id, name, args, info, asRoot = true) {
64
- const onlyBuiltInAuto = info?.reads?.length === 1 && info?.reads[0] === built_in_1.BuiltIn;
64
+ const onlyBuiltInAuto = info?.reads?.length === 1 && (0, built_in_1.isBuiltIn)(info?.reads[0]);
65
65
  this.addVertex({
66
66
  tag: vertex_1.VertexType.FunctionCall,
67
67
  id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
@@ -69,7 +69,9 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
69
69
  args: args.map(a => a === r_function_call_1.EmptyArgument ? r_function_call_1.EmptyArgument : { ...a, nodeId: (0, node_id_1.normalizeIdToNumberIfPossible)(a.nodeId), controlDependencies: undefined }),
70
70
  environment: (info?.onlyBuiltIn || onlyBuiltInAuto) ? undefined : info?.environment ?? (0, environment_1.initializeCleanEnvironments)(),
71
71
  cds: info?.controlDependencies?.map(c => ({ ...c, id: (0, node_id_1.normalizeIdToNumberIfPossible)(c.id) })),
72
- onlyBuiltin: info?.onlyBuiltIn ?? onlyBuiltInAuto ?? false
72
+ onlyBuiltin: info?.onlyBuiltIn ?? onlyBuiltInAuto ?? false,
73
+ origin: info?.origin ?? [(0, default_builtin_config_1.getDefaultProcessor)(name) ?? 'function'],
74
+ link: info?.link
73
75
  }, asRoot);
74
76
  this.addArgumentLinks(id, args);
75
77
  if (info?.returns) {
@@ -0,0 +1,16 @@
1
+ import type { FunctionArgument, OutgoingEdges } from './graph';
2
+ import type { GenericDiffConfiguration, GenericDifferenceInformation } from '../../util/diff';
3
+ import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
4
+ import type { GraphDiffContext, NamedGraph } from '../../util/diff-graph';
5
+ import { GraphDifferenceReport } from '../../util/diff-graph';
6
+ /**
7
+ * Compare two dataflow graphs and return a report on the differences.
8
+ * If you simply want to check whether they equal, use {@link GraphDifferenceReport#isEqual|`<result>.isEqual()`}.
9
+ *
10
+ * @see {@link diffOfControlFlowGraphs} - for control flow graphs
11
+ */
12
+ export declare function diffOfDataflowGraphs(left: NamedGraph, right: NamedGraph, config?: Partial<GenericDiffConfiguration>): GraphDifferenceReport;
13
+ export declare function equalFunctionArguments(fn: NodeId, a: false | readonly FunctionArgument[], b: false | readonly FunctionArgument[]): boolean;
14
+ export declare function diffFunctionArguments(fn: NodeId, a: false | readonly FunctionArgument[], b: false | readonly FunctionArgument[], ctx: GenericDifferenceInformation<GraphDifferenceReport>): void;
15
+ export declare function diffVertices(ctx: GraphDiffContext): void;
16
+ export declare function diffEdges(ctx: GraphDiffContext, id: NodeId, lEdges: OutgoingEdges | undefined, rEdges: OutgoingEdges | undefined): void;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DataflowDifferenceReport = void 0;
4
3
  exports.diffOfDataflowGraphs = diffOfDataflowGraphs;
5
4
  exports.equalFunctionArguments = equalFunctionArguments;
6
5
  exports.diffFunctionArguments = diffFunctionArguments;
@@ -9,59 +8,29 @@ exports.diffEdges = diffEdges;
9
8
  const graph_1 = require("./graph");
10
9
  const diff_1 = require("../../util/diff");
11
10
  const json_1 = require("../../util/json");
12
- const arrays_1 = require("../../util/arrays");
11
+ const arrays_1 = require("../../util/collections/arrays");
13
12
  const vertex_1 = require("./vertex");
14
13
  const edge_1 = require("./edge");
15
14
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
16
15
  const diff_2 = require("../environments/diff");
17
16
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
18
17
  const info_1 = require("../info");
19
- class DataflowDifferenceReport {
20
- _comments = undefined;
21
- _problematic = undefined;
22
- addComment(comment, ...related) {
23
- if (this._comments === undefined) {
24
- this._comments = [comment];
25
- }
26
- else {
27
- this._comments.push(comment);
28
- }
29
- if (related.length > 0) {
30
- if (this._problematic === undefined) {
31
- this._problematic = [...related];
32
- }
33
- else {
34
- this._problematic.push(...related);
35
- }
36
- }
37
- }
38
- comments() {
39
- return this._comments;
40
- }
41
- problematic() {
42
- return this._problematic;
43
- }
44
- isEqual() {
45
- return this._comments === undefined;
18
+ const diff_graph_1 = require("../../util/diff-graph");
19
+ /**
20
+ * Compare two dataflow graphs and return a report on the differences.
21
+ * If you simply want to check whether they equal, use {@link GraphDifferenceReport#isEqual|`<result>.isEqual()`}.
22
+ *
23
+ * @see {@link diffOfControlFlowGraphs} - for control flow graphs
24
+ */
25
+ function diffOfDataflowGraphs(left, right, config) {
26
+ if (left.graph === right.graph) {
27
+ return new diff_graph_1.GraphDifferenceReport();
46
28
  }
29
+ const ctx = (0, diff_graph_1.initDiffContext)(left, right, config);
30
+ diffDataflowGraph(ctx);
31
+ return ctx.report;
47
32
  }
48
- exports.DataflowDifferenceReport = DataflowDifferenceReport;
49
- function initDiffContext(left, right, config) {
50
- return {
51
- left: left.graph,
52
- leftname: left.name,
53
- right: right.graph,
54
- rightname: right.name,
55
- report: new DataflowDifferenceReport(),
56
- position: '',
57
- config: {
58
- rightIsSubgraph: false,
59
- leftIsSubgraph: false,
60
- ...config
61
- }
62
- };
63
- }
64
- function diff(ctx) {
33
+ function diffDataflowGraph(ctx) {
65
34
  diffRootVertices(ctx);
66
35
  diffVertices(ctx);
67
36
  diffOutgoingEdges(ctx);
@@ -102,14 +71,6 @@ function diffRootVertices(ctx) {
102
71
  (0, diff_1.setDifference)(ctx.left.rootIds(), ctx.right.rootIds(), { ...ctx, position: `${ctx.position}Root vertices differ in graphs. ` });
103
72
  (0, diff_1.setDifference)(new Set([...ctx.left.unknownSideEffects].map(n => typeof n === 'object' ? n.id : n)), new Set([...ctx.right.unknownSideEffects].map(n => typeof n === 'object' ? n.id : n)), { ...ctx, position: `${ctx.position}Unknown side effects differ in graphs. ` });
104
73
  }
105
- function diffOfDataflowGraphs(left, right, config) {
106
- if (left.graph === right.graph) {
107
- return new DataflowDifferenceReport();
108
- }
109
- const ctx = initDiffContext(left, right, config);
110
- diff(ctx);
111
- return ctx.report;
112
- }
113
74
  function diffFunctionArgumentsReferences(fn, a, b, ctx) {
114
75
  if (a === '<value>' || b === '<value>') {
115
76
  if (a !== b) {
@@ -121,7 +82,7 @@ function diffFunctionArgumentsReferences(fn, a, b, ctx) {
121
82
  }
122
83
  function equalFunctionArguments(fn, a, b) {
123
84
  const ctx = {
124
- report: new DataflowDifferenceReport(),
85
+ report: new diff_graph_1.GraphDifferenceReport(),
125
86
  leftname: 'left',
126
87
  rightname: 'right',
127
88
  position: '',
@@ -200,6 +161,19 @@ function diffVertices(ctx) {
200
161
  }
201
162
  }
202
163
  (0, info_1.diffControlDependencies)(lInfo.cds, rInfo.cds, { ...ctx, position: `Vertex ${id} differs in controlDependencies. ` });
164
+ if (lInfo.origin !== undefined || rInfo.origin !== undefined) {
165
+ // compare arrays
166
+ const equalArrays = lInfo.origin && rInfo.origin && (0, arrays_1.arrayEqual)(lInfo.origin, rInfo.origin);
167
+ if (!equalArrays) {
168
+ ctx.report.addComment(`Vertex ${id} differs in origin. ${ctx.leftname}: ${JSON.stringify(lInfo.origin, json_1.jsonReplacer)} vs ${ctx.rightname}: ${JSON.stringify(rInfo.origin, json_1.jsonReplacer)}`, { tag: 'vertex', id });
169
+ }
170
+ }
171
+ if (lInfo.link !== undefined || rInfo.link !== undefined) {
172
+ const equal = lInfo.link && rInfo.link && (0, arrays_1.arrayEqual)(lInfo.link.origin, rInfo.link.origin);
173
+ if (!equal) {
174
+ ctx.report.addComment(`Vertex ${id} differs in link. ${ctx.leftname}: ${JSON.stringify(lInfo.link, json_1.jsonReplacer)} vs ${ctx.rightname}: ${JSON.stringify(rInfo.link, json_1.jsonReplacer)}`, { tag: 'vertex', id });
175
+ }
176
+ }
203
177
  if ((lInfo.environment === undefined && rInfo.environment !== undefined && !ctx.config.leftIsSubgraph)
204
178
  || (lInfo.environment !== undefined && rInfo.environment === undefined && !ctx.config.rightIsSubgraph)) {
205
179
  /* only diff them if specified at all */
@@ -282,4 +256,4 @@ function diffEdges(ctx, id, lEdges, rEdges) {
282
256
  diffEdge(edge, otherEdge, ctx, id, target);
283
257
  }
284
258
  }
285
- //# sourceMappingURL=diff.js.map
259
+ //# sourceMappingURL=diff-dataflow-graph.js.map
@@ -99,7 +99,7 @@ export type UnknownSidEffect = NodeId | {
99
99
  * @see {@link DataflowGraph#addEdge|`addEdge`} - to add an edge to the graph
100
100
  * @see {@link DataflowGraph#addVertex|`addVertex`} - to add a vertex to the graph
101
101
  * @see {@link DataflowGraph#fromJson|`fromJson`} - to construct a dataflow graph object from a deserialized JSON object.
102
- * @see {@link emptyGraph} - to create an empty graph (useful in tests)
102
+ * @see {@link emptyGraph|`emptyGraph`} - to create an empty graph (useful in tests)
103
103
  */
104
104
  export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = DataflowGraphVertexInfo, Edge extends DataflowGraphEdge = DataflowGraphEdge> {
105
105
  private static DEFAULT_ENVIRONMENT;
@@ -136,6 +136,13 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
136
136
  getVertex(id: NodeId, includeDefinedFunctions?: boolean): Vertex | undefined;
137
137
  outgoingEdges(id: NodeId): OutgoingEdges | undefined;
138
138
  ingoingEdges(id: NodeId): IngoingEdges | undefined;
139
+ /**
140
+ * Given a node in the normalized AST this either:
141
+ * * returns the id if the node directly exists in the DFG
142
+ * * returns the ids of all vertices in the DFG that are linked to this
143
+ * * returns undefined if the node is not part of the DFG and not linked to any node
144
+ */
145
+ getLinked(nodeId: NodeId): NodeId[] | undefined;
139
146
  /** Retrieves the id-map to the normalized AST attached to the dataflow graph */
140
147
  get idMap(): AstIdMap | undefined;
141
148
  get sourced(): (string | '<inline>')[];
@@ -178,11 +185,12 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
178
185
  * @param vertex - The vertex to add
179
186
  * @param asRoot - If false, this will only add the vertex but do not add it to the {@link rootIds|root vertices} of the graph.
180
187
  * This is probably only of use, when you construct dataflow graphs for tests.
188
+ * @param overwrite - If true, this will overwrite the vertex if it already exists in the graph (based on the id).
181
189
  *
182
190
  * @see DataflowGraphVertexInfo
183
191
  * @see DataflowGraphVertexArgument
184
192
  */
185
- addVertex(vertex: DataflowGraphVertexArgument & Omit<Vertex, keyof DataflowGraphVertexArgument>, asRoot?: boolean): this;
193
+ addVertex(vertex: DataflowGraphVertexArgument & Omit<Vertex, keyof DataflowGraphVertexArgument>, asRoot?: boolean, overwrite?: boolean): this;
186
194
  /** {@inheritDoc} */
187
195
  addEdge(from: NodeId, to: NodeId, type: EdgeType | number): this;
188
196
  /** {@inheritDoc} */
@@ -211,7 +219,7 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
211
219
  /** If you do not pass the `to` node, this will just mark the node as maybe */
212
220
  addControlDependency(from: NodeId, to?: NodeId, when?: boolean): this;
213
221
  /** Marks the given node as having unknown side effects */
214
- markIdForUnknownSideEffects(id: NodeId, target?: LinkTo<RegExp | string>): this;
222
+ markIdForUnknownSideEffects(id: NodeId, target?: LinkTo): this;
215
223
  /**
216
224
  * Constructs a dataflow graph instance from the given JSON data and returns the result.
217
225
  * This can be useful for data sent by the flowR server when analyzing it further.
@@ -5,15 +5,14 @@ exports.isPositionalArgument = isPositionalArgument;
5
5
  exports.isNamedArgument = isNamedArgument;
6
6
  exports.getReferenceOfArgument = getReferenceOfArgument;
7
7
  const assert_1 = require("../../util/assert");
8
- const diff_1 = require("./diff");
8
+ const diff_dataflow_graph_1 = require("./diff-dataflow-graph");
9
9
  const vertex_1 = require("./vertex");
10
- const arrays_1 = require("../../util/arrays");
10
+ const arrays_1 = require("../../util/collections/arrays");
11
11
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
12
12
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
13
13
  const environment_1 = require("../environments/environment");
14
14
  const clone_1 = require("../environments/clone");
15
15
  const json_1 = require("../../util/json");
16
- const built_in_1 = require("../environments/built-in");
17
16
  const logger_1 = require("../logger");
18
17
  /**
19
18
  * Check if the given argument is a {@link PositionalFunctionArgument}.
@@ -50,7 +49,7 @@ function getReferenceOfArgument(arg) {
50
49
  * @see {@link DataflowGraph#addEdge|`addEdge`} - to add an edge to the graph
51
50
  * @see {@link DataflowGraph#addVertex|`addVertex`} - to add a vertex to the graph
52
51
  * @see {@link DataflowGraph#fromJson|`fromJson`} - to construct a dataflow graph object from a deserialized JSON object.
53
- * @see {@link emptyGraph} - to create an empty graph (useful in tests)
52
+ * @see {@link emptyGraph|`emptyGraph`} - to create an empty graph (useful in tests)
54
53
  */
55
54
  class DataflowGraph {
56
55
  static DEFAULT_ENVIRONMENT = undefined;
@@ -111,6 +110,24 @@ class DataflowGraph {
111
110
  }
112
111
  return edges;
113
112
  }
113
+ /**
114
+ * Given a node in the normalized AST this either:
115
+ * * returns the id if the node directly exists in the DFG
116
+ * * returns the ids of all vertices in the DFG that are linked to this
117
+ * * returns undefined if the node is not part of the DFG and not linked to any node
118
+ */
119
+ getLinked(nodeId) {
120
+ if (this.vertexInformation.has(nodeId)) {
121
+ return [nodeId];
122
+ }
123
+ const linked = [];
124
+ for (const [id, vtx] of this.vertexInformation) {
125
+ if (vtx.link?.origin.includes(nodeId)) {
126
+ linked.push(id);
127
+ }
128
+ }
129
+ return linked.length > 0 ? linked : undefined;
130
+ }
114
131
  /** Retrieves the id-map to the normalized AST attached to the dataflow graph */
115
132
  get idMap() {
116
133
  return this._idMap;
@@ -180,13 +197,14 @@ class DataflowGraph {
180
197
  * @param vertex - The vertex to add
181
198
  * @param asRoot - If false, this will only add the vertex but do not add it to the {@link rootIds|root vertices} of the graph.
182
199
  * This is probably only of use, when you construct dataflow graphs for tests.
200
+ * @param overwrite - If true, this will overwrite the vertex if it already exists in the graph (based on the id).
183
201
  *
184
202
  * @see DataflowGraphVertexInfo
185
203
  * @see DataflowGraphVertexArgument
186
204
  */
187
- addVertex(vertex, asRoot = true) {
205
+ addVertex(vertex, asRoot = true, overwrite = false) {
188
206
  const oldVertex = this.vertexInformation.get(vertex.id);
189
- if (oldVertex !== undefined) {
207
+ if (oldVertex !== undefined && !overwrite) {
190
208
  return this;
191
209
  }
192
210
  const fallback = vertex.tag === vertex_1.VertexType.VariableDefinition || vertex.tag === vertex_1.VertexType.Use || vertex.tag === vertex_1.VertexType.Value || (vertex.tag === vertex_1.VertexType.FunctionCall && vertex.onlyBuiltin) ? undefined : DataflowGraph.DEFAULT_ENVIRONMENT;
@@ -201,12 +219,9 @@ class DataflowGraph {
201
219
  }
202
220
  return this;
203
221
  }
204
- /**
205
- * Please note that this will never make edges to {@link BuiltIn} as they are not part of the graph.
206
- */
207
222
  addEdge(from, to, type) {
208
223
  const [fromId, toId] = extractEdgeIds(from, to);
209
- if (fromId === toId || toId === built_in_1.BuiltIn) {
224
+ if (fromId === toId) {
210
225
  return this;
211
226
  }
212
227
  /* we now that we pass all required arguments */
@@ -244,7 +259,7 @@ class DataflowGraph {
244
259
  this.rootVertices.add(root);
245
260
  }
246
261
  }
247
- this.sourced.push(...otherGraph.sourced);
262
+ this._sourced = this._sourced.concat(otherGraph.sourced);
248
263
  for (const unknown of otherGraph.unknownSideEffects) {
249
264
  this._unknownSideEffects.add(unknown);
250
265
  }
@@ -357,7 +372,7 @@ function mergeNodeInfos(current, next) {
357
372
  (0, assert_1.guard)(current.scope === next.scope, 'nodes to be joined for the same id must have the same scope');
358
373
  }
359
374
  else if (current.tag === vertex_1.VertexType.FunctionCall) {
360
- (0, assert_1.guard)((0, diff_1.equalFunctionArguments)(current.id, current.args, next.args), 'nodes to be joined for the same id must have the same function call information');
375
+ (0, assert_1.guard)((0, diff_dataflow_graph_1.equalFunctionArguments)(current.id, current.args, next.args), 'nodes to be joined for the same id must have the same function call information');
361
376
  }
362
377
  else if (current.tag === vertex_1.VertexType.FunctionDefinition) {
363
378
  (0, assert_1.guard)(current.scope === next.scope, 'nodes to be joined for the same id must have the same scope');