@eagleoutice/flowr 2.2.11 → 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 (301) hide show
  1. package/README.md +82 -20
  2. package/benchmark/slicer.d.ts +49 -22
  3. package/benchmark/slicer.js +89 -29
  4. package/benchmark/stats/print.js +16 -10
  5. package/benchmark/stats/size-of.js +18 -1
  6. package/benchmark/stats/stats.d.ts +3 -0
  7. package/benchmark/summarizer/first-phase/input.js +1 -1
  8. package/benchmark/summarizer/first-phase/process.js +3 -3
  9. package/benchmark/summarizer/second-phase/process.js +9 -3
  10. package/benchmark/summarizer/summarizer.js +1 -1
  11. package/cli/benchmark-app.d.ts +5 -0
  12. package/cli/benchmark-app.js +49 -6
  13. package/cli/benchmark-helper-app.d.ts +4 -0
  14. package/cli/benchmark-helper-app.js +20 -4
  15. package/cli/common/options.js +15 -6
  16. package/cli/common/script.js +1 -1
  17. package/cli/flowr.js +1 -1
  18. package/cli/repl/commands/repl-cfg.d.ts +2 -0
  19. package/cli/repl/commands/repl-cfg.js +38 -24
  20. package/cli/repl/commands/repl-commands.js +6 -2
  21. package/cli/repl/commands/repl-dataflow.d.ts +2 -0
  22. package/cli/repl/commands/repl-dataflow.js +37 -3
  23. package/cli/repl/commands/repl-execute.js +1 -1
  24. package/cli/repl/commands/repl-main.d.ts +1 -1
  25. package/cli/repl/commands/repl-main.js +1 -1
  26. package/cli/repl/commands/repl-normalize.js +1 -1
  27. package/cli/repl/commands/repl-query.js +2 -2
  28. package/cli/repl/core.js +1 -1
  29. package/cli/repl/prompt.js +1 -1
  30. package/cli/repl/server/connection.js +4 -4
  31. package/cli/repl/server/messages/message-analysis.d.ts +1 -1
  32. package/cli/script-core/statistics-core.js +1 -1
  33. package/cli/script-core/statistics-helper-core.js +4 -4
  34. package/config.d.ts +60 -21
  35. package/config.js +24 -4
  36. package/control-flow/basic-cfg-guided-visitor.d.ts +39 -0
  37. package/control-flow/basic-cfg-guided-visitor.js +114 -0
  38. package/control-flow/cfg-properties.d.ts +26 -0
  39. package/control-flow/cfg-properties.js +100 -0
  40. package/control-flow/cfg-simplification.d.ts +18 -0
  41. package/control-flow/cfg-simplification.js +55 -0
  42. package/control-flow/cfg-to-basic-blocks.d.ts +5 -0
  43. package/control-flow/cfg-to-basic-blocks.js +81 -0
  44. package/control-flow/control-flow-graph.d.ts +247 -0
  45. package/control-flow/control-flow-graph.js +290 -0
  46. package/control-flow/dfg-cfg-guided-visitor.d.ts +32 -0
  47. package/control-flow/dfg-cfg-guided-visitor.js +71 -0
  48. package/control-flow/diff-cfg.d.ts +11 -0
  49. package/control-flow/diff-cfg.js +161 -0
  50. package/control-flow/extract-cfg.d.ts +30 -0
  51. package/control-flow/extract-cfg.js +475 -0
  52. package/control-flow/happens-before.d.ts +7 -0
  53. package/{util/cfg → control-flow}/happens-before.js +3 -3
  54. package/control-flow/semantic-cfg-guided-visitor.d.ts +452 -0
  55. package/control-flow/semantic-cfg-guided-visitor.js +492 -0
  56. package/control-flow/simple-visitor.d.ts +25 -0
  57. package/control-flow/simple-visitor.js +80 -0
  58. package/control-flow/syntax-cfg-guided-visitor.d.ts +128 -0
  59. package/control-flow/syntax-cfg-guided-visitor.js +166 -0
  60. package/core/print/print.d.ts +1 -1
  61. package/core/print/slice-diff-ansi.js +1 -1
  62. package/core/steps/pipeline/create-pipeline.js +1 -1
  63. package/dataflow/environments/built-in-config.d.ts +5 -2
  64. package/dataflow/environments/built-in-config.js +17 -8
  65. package/dataflow/environments/built-in.d.ts +16 -5
  66. package/dataflow/environments/built-in.js +55 -6
  67. package/dataflow/environments/clone.d.ts +5 -0
  68. package/dataflow/environments/clone.js +5 -0
  69. package/dataflow/environments/default-builtin-config.d.ts +2 -0
  70. package/dataflow/environments/default-builtin-config.js +164 -13
  71. package/dataflow/environments/define.d.ts +5 -1
  72. package/dataflow/environments/define.js +36 -10
  73. package/dataflow/environments/overwrite.js +4 -0
  74. package/dataflow/environments/remove.d.ts +6 -0
  75. package/dataflow/environments/remove.js +24 -0
  76. package/dataflow/environments/resolve-by-name.js +16 -5
  77. package/dataflow/extractor.js +2 -2
  78. package/dataflow/graph/dataflowgraph-builder.d.ts +79 -7
  79. package/dataflow/graph/dataflowgraph-builder.js +106 -8
  80. package/dataflow/graph/diff-dataflow-graph.d.ts +16 -0
  81. package/dataflow/graph/{diff.js → diff-dataflow-graph.js} +30 -56
  82. package/dataflow/graph/graph.d.ts +17 -4
  83. package/dataflow/graph/graph.js +51 -12
  84. package/dataflow/graph/vertex.d.ts +59 -4
  85. package/dataflow/graph/vertex.js +32 -0
  86. package/dataflow/internal/linker.d.ts +3 -2
  87. package/dataflow/internal/linker.js +36 -25
  88. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
  89. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +1 -1
  90. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -0
  91. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +67 -54
  92. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +6 -4
  93. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +108 -21
  94. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +54 -17
  95. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +10 -0
  96. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +140 -0
  97. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -4
  98. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +3 -2
  99. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +15 -4
  100. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +4 -3
  101. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -3
  102. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +4 -3
  103. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +51 -17
  104. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +1 -1
  105. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -7
  106. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +3 -2
  107. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +4 -0
  108. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +100 -31
  109. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +7 -0
  110. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +41 -0
  111. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +35 -8
  112. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +4 -3
  113. package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +15 -0
  114. package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +75 -0
  115. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +3 -3
  116. package/dataflow/internal/process/functions/call/common.d.ts +5 -2
  117. package/dataflow/internal/process/functions/call/common.js +9 -5
  118. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -2
  119. package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
  120. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +2 -0
  121. package/dataflow/internal/process/functions/call/named-call-handling.js +10 -6
  122. package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +1 -0
  123. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +6 -4
  124. package/dataflow/internal/process/process-named-call.d.ts +4 -1
  125. package/dataflow/internal/process/process-named-call.js +8 -5
  126. package/dataflow/origin/dfg-get-origin.d.ts +82 -0
  127. package/dataflow/origin/dfg-get-origin.js +116 -0
  128. package/documentation/doc-util/doc-cfg.d.ts +20 -4
  129. package/documentation/doc-util/doc-cfg.js +41 -7
  130. package/documentation/doc-util/doc-cli-option.js +4 -2
  131. package/documentation/doc-util/doc-code.js +10 -2
  132. package/documentation/doc-util/doc-dfg.js +3 -3
  133. package/documentation/doc-util/doc-escape.d.ts +7 -0
  134. package/documentation/doc-util/doc-escape.js +19 -0
  135. package/documentation/doc-util/doc-files.d.ts +1 -0
  136. package/documentation/doc-util/doc-files.js +2 -1
  137. package/documentation/doc-util/doc-normalized-ast.js +3 -3
  138. package/documentation/doc-util/doc-query.js +2 -2
  139. package/documentation/doc-util/doc-repl.js +1 -1
  140. package/documentation/doc-util/doc-search.js +1 -1
  141. package/documentation/doc-util/doc-server-message.js +2 -2
  142. package/documentation/doc-util/doc-structure.d.ts +1 -0
  143. package/documentation/doc-util/doc-structure.js +5 -0
  144. package/documentation/doc-util/doc-types.d.ts +7 -1
  145. package/documentation/doc-util/doc-types.js +13 -2
  146. package/documentation/print-capabilities-markdown.js +28 -2
  147. package/documentation/print-cfg-wiki.d.ts +1 -0
  148. package/documentation/print-cfg-wiki.js +572 -0
  149. package/documentation/print-core-wiki.js +2 -2
  150. package/documentation/print-dataflow-graph-wiki.js +180 -25
  151. package/documentation/print-engines-wiki.js +1 -1
  152. package/documentation/print-faq-wiki.d.ts +1 -0
  153. package/documentation/print-faq-wiki.js +75 -0
  154. package/documentation/print-interface-wiki.js +2 -1
  155. package/documentation/print-linting-and-testing-wiki.js +52 -36
  156. package/documentation/print-normalized-ast-wiki.js +1 -1
  157. package/documentation/print-onboarding-wiki.d.ts +1 -0
  158. package/documentation/print-onboarding-wiki.js +42 -0
  159. package/documentation/print-query-wiki.js +23 -3
  160. package/documentation/print-readme.js +10 -3
  161. package/package.json +10 -6
  162. package/queries/catalog/call-context-query/call-context-query-executor.js +5 -5
  163. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
  164. package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
  165. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +2 -2
  166. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +24 -21
  167. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
  168. package/queries/catalog/cluster-query/cluster-query-format.js +1 -1
  169. package/queries/catalog/config-query/config-query-format.d.ts +1 -1
  170. package/queries/catalog/config-query/config-query-format.js +2 -2
  171. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
  172. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -2
  173. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
  174. package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -2
  175. package/queries/catalog/dependencies-query/dependencies-query-executor.js +17 -7
  176. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -26
  177. package/queries/catalog/dependencies-query/dependencies-query-format.js +4 -147
  178. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +24 -0
  179. package/queries/catalog/dependencies-query/function-info/function-info.js +10 -0
  180. package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +2 -0
  181. package/queries/catalog/dependencies-query/function-info/library-functions.js +18 -0
  182. package/queries/catalog/dependencies-query/function-info/read-functions.d.ts +2 -0
  183. package/queries/catalog/dependencies-query/function-info/read-functions.js +101 -0
  184. package/queries/catalog/dependencies-query/function-info/source-functions.d.ts +2 -0
  185. package/queries/catalog/dependencies-query/function-info/source-functions.js +11 -0
  186. package/queries/catalog/dependencies-query/function-info/write-functions.d.ts +2 -0
  187. package/queries/catalog/dependencies-query/function-info/write-functions.js +87 -0
  188. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
  189. package/queries/catalog/happens-before-query/happens-before-query-executor.js +4 -4
  190. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
  191. package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -2
  192. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
  193. package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
  194. package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -1
  195. package/queries/catalog/lineage-query/lineage-query-format.js +2 -2
  196. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  197. package/queries/catalog/location-map-query/location-map-query-format.js +2 -2
  198. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
  199. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -2
  200. package/queries/catalog/origin-query/origin-query-executor.d.ts +5 -0
  201. package/queries/catalog/origin-query/origin-query-executor.js +33 -0
  202. package/queries/catalog/origin-query/origin-query-format.d.ts +71 -0
  203. package/queries/catalog/origin-query/origin-query-format.js +27 -0
  204. package/queries/catalog/project-query/project-query-format.d.ts +1 -1
  205. package/queries/catalog/project-query/project-query-format.js +2 -2
  206. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  207. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -2
  208. package/queries/catalog/search-query/search-query-format.d.ts +1 -1
  209. package/queries/catalog/search-query/search-query-format.js +2 -2
  210. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
  211. package/queries/catalog/static-slice-query/static-slice-query-format.js +2 -2
  212. package/queries/query-print.d.ts +1 -1
  213. package/queries/query-print.js +4 -4
  214. package/queries/query.d.ts +61 -2
  215. package/queries/query.js +3 -1
  216. package/r-bridge/data/data.d.ts +2 -2
  217. package/r-bridge/data/data.js +2 -2
  218. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -2
  219. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +5 -0
  220. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -2
  221. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +5 -0
  222. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +1 -1
  223. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -1
  224. package/r-bridge/lang-4.x/ast/model/processing/fold.js +3 -1
  225. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
  226. package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
  227. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +1 -1
  228. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
  229. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
  230. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -1
  231. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +1 -1
  232. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +1 -1
  233. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -1
  234. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
  235. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +4 -4
  236. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +26 -8
  237. package/r-bridge/retriever.js +1 -1
  238. package/search/search-executor/search-generators.d.ts +1 -1
  239. package/search/search-executor/search-transformer.d.ts +1 -1
  240. package/slicing/criterion/collect-all.js +1 -1
  241. package/slicing/static/slice-call.js +13 -3
  242. package/statistics/features/supported/assignments/post-process.js +1 -1
  243. package/statistics/features/supported/defined-functions/post-process.js +2 -2
  244. package/statistics/features/supported/used-functions/post-process.js +1 -1
  245. package/statistics/features/supported/used-packages/post-process.js +2 -2
  246. package/statistics/features/supported/values/post-process.js +2 -2
  247. package/statistics/output/print-stats.js +2 -2
  248. package/statistics/summarizer/post-process/clusterer.d.ts +1 -1
  249. package/statistics/summarizer/post-process/clusterer.js +1 -1
  250. package/statistics/summarizer/post-process/histogram.js +3 -3
  251. package/statistics/summarizer/post-process/post-process-output.js +3 -3
  252. package/statistics/summarizer/second-phase/process.js +2 -2
  253. package/statistics/summarizer/summarizer.js +2 -2
  254. package/util/assert.js +36 -1
  255. package/util/cfg/cfg.d.ts +0 -80
  256. package/util/cfg/cfg.js +0 -549
  257. package/util/{arrays.d.ts → collections/arrays.d.ts} +24 -1
  258. package/util/{arrays.js → collections/arrays.js} +44 -3
  259. package/util/collections/set.js +17 -0
  260. package/util/{list-access.d.ts → containers.d.ts} +24 -4
  261. package/util/{list-access.js → containers.js} +42 -12
  262. package/util/diff-graph.d.ts +47 -0
  263. package/util/diff-graph.js +61 -0
  264. package/util/diff.d.ts +6 -6
  265. package/util/diff.js +1 -1
  266. package/util/mermaid/ast.js +12 -1
  267. package/util/mermaid/cfg.d.ts +9 -2
  268. package/util/mermaid/cfg.js +65 -13
  269. package/util/mermaid/dfg.d.ts +2 -1
  270. package/util/mermaid/dfg.js +26 -10
  271. package/util/mermaid/mermaid.d.ts +2 -0
  272. package/util/mermaid/mermaid.js +6 -0
  273. package/util/parallel.d.ts +2 -1
  274. package/util/parallel.js +11 -2
  275. package/util/prefix.d.ts +13 -0
  276. package/util/prefix.js +34 -0
  277. package/util/quads.js +1 -1
  278. package/util/schema.d.ts +1 -1
  279. package/util/schema.js +1 -1
  280. package/util/summarizer.js +1 -1
  281. package/util/{text.js → text/text.js} +1 -1
  282. package/util/{time.js → text/time.js} +1 -1
  283. package/util/version.js +1 -1
  284. package/dataflow/graph/diff.d.ts +0 -36
  285. package/util/cfg/happens-before.d.ts +0 -7
  286. package/util/cfg/visitor.d.ts +0 -9
  287. package/util/cfg/visitor.js +0 -30
  288. package/util/set.js +0 -31
  289. /package/util/{bimap.d.ts → collections/bimap.d.ts} +0 -0
  290. /package/util/{bimap.js → collections/bimap.js} +0 -0
  291. /package/util/{defaultmap.d.ts → collections/defaultmap.d.ts} +0 -0
  292. /package/util/{defaultmap.js → collections/defaultmap.js} +0 -0
  293. /package/util/{set.d.ts → collections/set.d.ts} +0 -0
  294. /package/util/{ansi.d.ts → text/ansi.d.ts} +0 -0
  295. /package/util/{ansi.js → text/ansi.js} +0 -0
  296. /package/util/{args.d.ts → text/args.d.ts} +0 -0
  297. /package/util/{args.js → text/args.js} +0 -0
  298. /package/util/{strings.d.ts → text/strings.d.ts} +0 -0
  299. /package/util/{strings.js → text/strings.js} +0 -0
  300. /package/util/{text.d.ts → text/text.d.ts} +0 -0
  301. /package/util/{time.d.ts → text/time.d.ts} +0 -0
@@ -1,9 +1,94 @@
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");
9
+ const GgPlotCreate = [
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',
13
+ ];
14
+ const TinyPlotCrate = [
15
+ 'tinyplot', 'plt'
16
+ ];
17
+ const PlotCreate = [
18
+ 'plot', 'plot.new', 'xspline', 'map', 'curve', 'image', 'boxplot', 'dotchart', 'sunflowerplot', 'barplot', 'matplot', 'hist', 'stem',
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',
23
+ ...TinyPlotCrate,
24
+ ...GgPlotCreate
25
+ ];
26
+ const GraphicDeviceOpen = [
27
+ 'pdf', 'jpeg', 'png', 'windows', 'postscript', 'xfig', 'bitmap', 'pictex', 'cairo_pdf', 'svg', 'bmp', 'tiff', 'X11', 'quartz', 'image_graph',
28
+ 'image_draw', 'dev.new', 'trellis.device', 'raster_pdf', 'agg_pdf'
29
+ ];
30
+ const TinyPlotAddons = [
31
+ 'tinyplot_add', 'plt_add'
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
+ ]);
81
+ const PlotAddons = [
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
85
+ ];
86
+ const GgPlotAddons = [
87
+ 'ggdraw', 'last_plot'
88
+ ];
89
+ function toRegex(n) {
90
+ return new RegExp(`^(${[...new Set(n)].map(s => s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')).filter(s => s.length > 0).join('|')})$`);
91
+ }
7
92
  /**
8
93
  * Contains the built-in definitions recognized by flowR
9
94
  */
@@ -20,7 +105,8 @@ exports.DefaultBuiltinConfig = [
20
105
  'unique', 'paste', 'paste0', 'read.csv', 'stop', 'is.null', 'numeric', 'as.character', 'as.integer', 'as.logical', 'as.numeric', 'as.matrix',
21
106
  'rbind', 'nrow', 'ncol', 'tryCatch', 'expression', 'factor',
22
107
  'missing', 'as.data.frame', 'data.frame', 'na.omit', 'rownames', 'names', 'order', 'length', 'any', 'dim', 'matrix', 'cbind', 'nchar',
23
- 'pdf', 'jpeg', 'png', 'windows', 'postscript', 'xfig', 'bitmap', 'pictex', 'cairo_pdf', 'svg', 'bmp', 'tiff', 'X11', 'quartz'
108
+ 'pdf', 'jpeg', 'png', 'windows', 'postscript', 'xfig', 'bitmap', 'pictex', 'cairo_pdf', 'svg', 'bmp', 'tiff', 'X11', 'quartz',
109
+ 'jitter'
24
110
  ],
25
111
  processor: 'builtin:default',
26
112
  config: { readAllArguments: true },
@@ -29,12 +115,13 @@ exports.DefaultBuiltinConfig = [
29
115
  {
30
116
  type: 'function',
31
117
  names: [
32
- 'c', 't', 'aperm' /* vector construction, concatenation, transpose function, permutation generation */
118
+ 't', 'aperm' /* transpose function, permutation generation */
33
119
  ],
34
120
  processor: 'builtin:default',
35
121
  config: { readAllArguments: true },
36
122
  assumePrimitive: false
37
123
  },
124
+ { type: 'function', names: ['rm'], processor: 'builtin:rm', config: {}, assumePrimitive: true },
38
125
  { type: 'function', names: ['options'], processor: 'builtin:default', config: { hasUnknownSideEffects: true, forceArgs: 'all' }, assumePrimitive: false },
39
126
  { type: 'function', names: ['mapply', 'Mapply'], processor: 'builtin:apply', config: { indexOfFunction: 0, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
40
127
  { type: 'function', names: ['lapply', 'sapply', 'vapply'], processor: 'builtin:apply', config: { indexOfFunction: 1, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
@@ -42,7 +129,7 @@ exports.DefaultBuiltinConfig = [
42
129
  { type: 'function', names: ['apply', 'tapply', 'Tapply'], processor: 'builtin:apply', config: { indexOfFunction: 2, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
43
130
  { type: 'function', names: ['print', 'message', 'warning'], processor: 'builtin:default', config: { returnsNthArgument: 0, forceArgs: 'all', hasUnknownSideEffects: { type: 'link-to-last-call', callName: /^sink$/ } }, assumePrimitive: false },
44
131
  // graphics base
45
- { type: 'function', names: ['plot', 'plot.new', 'curve', 'map', 'image', 'boxplot', 'dotchart', 'sunflowerplot', 'barplot', 'matplot', 'hist', 'stem', 'density', 'smoothScatter', 'contour', 'persp'],
132
+ { type: 'function', names: PlotCreate,
46
133
  processor: 'builtin:default',
47
134
  config: {
48
135
  forceArgs: 'all',
@@ -50,26 +137,29 @@ exports.DefaultBuiltinConfig = [
50
137
  type: 'link-to-last-call',
51
138
  ignoreIf: (source, graph) => {
52
139
  /* map with add = true appends to an existing plot */
53
- return (source.name === 'map' && (0, identify_link_to_last_call_relation_1.getValueOfArgument)(graph, source, {
54
- index: 11,
140
+ return (PlotFunctionsWithAddParam.has(source.name) && (0, identify_link_to_last_call_relation_1.getValueOfArgument)(graph, source, {
141
+ index: -1,
55
142
  name: 'add'
56
143
  }, [type_1.RType.Logical])?.content === true);
57
144
  },
58
- callName: /^(pdf|jpeg|png|windows|postscript|xfig|bitmap|pictex|cairo_pdf|svg|bmp|tiff|X11|quartz)$/
145
+ callName: toRegex(GraphicDeviceOpen)
59
146
  }
60
147
  }, assumePrimitive: true },
61
148
  // graphics addons
62
- { type: 'function', names: ['points', 'abline', 'map', 'mtext', 'lines', 'text', 'legend', 'title', 'axis', 'polygon', 'polypath', 'pie', 'rect', 'segments', 'arrows', 'symbols', 'tiplabels'],
149
+ { type: 'function', names: PlotAddons,
63
150
  processor: 'builtin:default', config: {
64
151
  forceArgs: 'all',
152
+ treatAsFnCall: {
153
+ 'facet_grid': ['labeller']
154
+ },
65
155
  hasUnknownSideEffects: {
66
156
  type: 'link-to-last-call',
67
- callName: /^(dev\.new|dev\.copy|plot\.new|xspline|sunflowerplot|dotchart|plot|map|image|curve|boxplot|barplot|matplot|hist|stem|density|smoothScatter|contour|persp)$/,
157
+ callName: toRegex([...PlotCreate, ...PlotAddons]),
68
158
  ignoreIf: (source, graph) => {
69
159
  const sourceVertex = graph.getVertex(source);
70
160
  /* map with add = true appends to an existing plot */
71
- return (sourceVertex?.name === 'map' && (0, identify_link_to_last_call_relation_1.getValueOfArgument)(graph, sourceVertex, {
72
- index: 11,
161
+ return (PlotFunctionsWithAddParam.has(sourceVertex.name ?? '') && (0, identify_link_to_last_call_relation_1.getValueOfArgument)(graph, sourceVertex, {
162
+ index: -1,
73
163
  name: 'add'
74
164
  }, [type_1.RType.Logical])?.content !== true);
75
165
  },
@@ -82,9 +172,47 @@ exports.DefaultBuiltinConfig = [
82
172
  }
83
173
  }
84
174
  }, assumePrimitive: true },
175
+ // plot tags
176
+ {
177
+ type: 'function',
178
+ names: GgPlotAddons,
179
+ processor: 'builtin:default',
180
+ config: {
181
+ forceArgs: 'all',
182
+ hasUnknownSideEffects: {
183
+ type: 'link-to-last-call',
184
+ callName: toRegex([...GgPlotCreate, ...GgPlotAddons])
185
+ }
186
+ }, assumePrimitive: true
187
+ },
188
+ {
189
+ type: 'function',
190
+ names: TinyPlotAddons,
191
+ processor: 'builtin:default',
192
+ config: {
193
+ forceArgs: 'all',
194
+ hasUnknownSideEffects: {
195
+ type: 'link-to-last-call',
196
+ callName: toRegex([...TinyPlotCrate, ...TinyPlotAddons])
197
+ }
198
+ }, assumePrimitive: true
199
+ },
200
+ {
201
+ type: 'function',
202
+ names: ['image_write', 'image_capture', 'dev.capture', 'dev.off'],
203
+ processor: 'builtin:default',
204
+ config: {
205
+ forceArgs: 'all',
206
+ hasUnknownSideEffects: {
207
+ type: 'link-to-last-call',
208
+ callName: toRegex([...GraphicDeviceOpen, ...PlotCreate, ...PlotAddons, ...GgPlotAddons, ...TinyPlotAddons])
209
+ }
210
+ }, assumePrimitive: true
211
+ },
85
212
  { type: 'function', names: ['('], processor: 'builtin:default', config: { returnsNthArgument: 0 }, assumePrimitive: true },
86
213
  { type: 'function', names: ['load', 'load_all', 'setwd', 'set.seed'], processor: 'builtin:default', config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: false },
87
- { type: 'function', names: ['eval', 'body', 'formals', 'environment'], processor: 'builtin:default', config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: false },
214
+ { type: 'function', names: ['body', 'formals', 'environment'], processor: 'builtin:default', config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: true },
215
+ { type: 'function', names: ['eval'], processor: 'builtin:eval', config: { includeFunctionCall: true }, assumePrimitive: true },
88
216
  { type: 'function', names: ['cat'], processor: 'builtin:default', config: { forceArgs: 'all', hasUnknownSideEffects: { type: 'link-to-last-call', callName: /^sink$/ } }, assumePrimitive: false },
89
217
  { type: 'function', names: ['switch'], processor: 'builtin:default', config: { forceArgs: [true] }, assumePrimitive: false },
90
218
  { type: 'function', names: ['return'], processor: 'builtin:default', config: { returnsNthArgument: 0, cfg: 1 /* ExitPointType.Return */ }, assumePrimitive: false },
@@ -113,7 +241,11 @@ exports.DefaultBuiltinConfig = [
113
241
  { type: 'function', names: ['repeat'], processor: 'builtin:repeat-loop', config: {}, assumePrimitive: true },
114
242
  { type: 'function', names: ['while'], processor: 'builtin:while-loop', config: {}, assumePrimitive: true },
115
243
  { type: 'function', names: ['do.call'], processor: 'builtin:apply', config: { indexOfFunction: 0, unquoteFunction: true }, assumePrimitive: true },
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 },
116
247
  { type: 'function', names: ['list'], processor: 'builtin:list', config: {}, assumePrimitive: true },
248
+ { type: 'function', names: ['c'], processor: 'builtin:vector', config: {}, assumePrimitive: true },
117
249
  {
118
250
  type: 'function',
119
251
  names: ['setnames', 'setNames', 'setkey', 'setkeyv', 'setindex', 'setindexv', 'setattr'],
@@ -128,7 +260,7 @@ exports.DefaultBuiltinConfig = [
128
260
  {
129
261
  type: 'function',
130
262
  names: [
131
- 'on.exit', 'sys.on.exit', 'par', 'sink',
263
+ 'on.exit', 'sys.on.exit', 'par', 'tpar', 'sink', 'tinytheme', 'theme_set',
132
264
  /* library and require is handled above */
133
265
  'requireNamespace', 'loadNamespace', 'attachNamespace', 'asNamespace',
134
266
  /* downloader and installer functions (R, devtools, BiocManager) */
@@ -146,7 +278,26 @@ exports.DefaultBuiltinConfig = [
146
278
  {
147
279
  type: 'replacement',
148
280
  suffixes: ['<-', '<<-'],
149
- names: ['[', '[[', '$', '@', 'names', 'dimnames', 'attributes', 'attr', 'class', 'levels', 'rownames', 'colnames', 'body', 'environment', 'formals']
281
+ names: ['[', '[[', 'names', 'dimnames', 'attributes', 'attr', 'class', 'levels', 'rownames', 'colnames', 'body', 'environment', 'formals'],
282
+ config: {
283
+ readIndices: true
284
+ }
285
+ },
286
+ {
287
+ type: 'replacement',
288
+ suffixes: ['<-', '<<-'],
289
+ names: ['$', '@'],
290
+ config: {
291
+ readIndices: false
292
+ }
150
293
  }
151
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
+ }
152
303
  //# sourceMappingURL=default-builtin-config.js.map
@@ -1,5 +1,9 @@
1
1
  import type { REnvironmentInformation } from './environment';
2
- import type { IdentifierDefinition } from './identifier';
2
+ import type { IdentifierDefinition, InGraphIdentifierDefinition } from './identifier';
3
+ /**
4
+ * assumes: existing is not undefined, the overwrite has indices
5
+ */
6
+ export declare function mergeDefinitions(existing: readonly IdentifierDefinition[], definition: InGraphIdentifierDefinition): InGraphIdentifierDefinition[];
3
7
  /**
4
8
  * Insert the given `definition` --- defined within the given scope --- into the passed along `environments` will take care of propagation.
5
9
  * Does not modify the passed along `environments` in-place! It returns the new reference.
@@ -1,17 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeDefinitions = mergeDefinitions;
3
4
  exports.define = define;
4
5
  const assert_1 = require("../../util/assert");
5
6
  const environment_1 = require("./environment");
6
7
  const clone_1 = require("./clone");
7
8
  const vertex_1 = require("../graph/vertex");
9
+ const config_1 = require("../../config");
8
10
  function defInEnv(newEnvironments, name, definition) {
9
11
  const existing = newEnvironments.memory.get(name);
10
12
  // When there are defined indices, merge the definitions
11
13
  const inGraphDefinition = definition;
12
- if (existing !== undefined && inGraphDefinition.indicesCollection !== undefined && inGraphDefinition.controlDependencies === undefined) {
13
- newEnvironments.memory.set(name, mergeDefinitions(existing, inGraphDefinition));
14
- return;
14
+ if ((0, config_1.getConfig)().solver.pointerTracking &&
15
+ existing !== undefined &&
16
+ inGraphDefinition.controlDependencies === undefined) {
17
+ if (inGraphDefinition.indicesCollection !== undefined) {
18
+ newEnvironments.memory.set(name, mergeDefinitions(existing, inGraphDefinition));
19
+ return;
20
+ }
21
+ else if (existing?.flatMap(i => i.indicesCollection ?? []).length > 0) {
22
+ // When indices couldn't be resolved, but indices where defined before, just add the definition
23
+ existing.push(definition);
24
+ return;
25
+ }
15
26
  }
16
27
  // check if it is maybe or not
17
28
  if (existing === undefined || definition.controlDependencies === undefined) {
@@ -21,28 +32,43 @@ function defInEnv(newEnvironments, name, definition) {
21
32
  existing.push(definition);
22
33
  }
23
34
  }
35
+ /**
36
+ * assumes: existing is not undefined, the overwrite has indices
37
+ */
24
38
  function mergeDefinitions(existing, definition) {
25
39
  // When new definition is not a single index, e.g., a list redefinition, then reset existing definition
26
40
  if (definition.indicesCollection?.some(indices => indices.isContainer)) {
27
41
  return [definition];
28
42
  }
29
- const existingDefs = existing.map((def) => def).filter((def) => def !== undefined);
43
+ const existingDefs = existing.filter(assert_1.isNotUndefined);
30
44
  const overwriteIndices = definition.indicesCollection?.flatMap(indices => indices.indices) ?? [];
31
45
  // Compare existing and new definitions,
32
46
  // add new definitions and remove existing definitions that are overwritten by new definition
33
47
  const newExistingDefs = [];
48
+ const hasCache = new Set();
34
49
  for (const overwriteIndex of overwriteIndices) {
35
50
  for (const existingDef of existingDefs) {
36
- if (existingDef.indicesCollection === undefined) {
51
+ // empty or missing
52
+ if (existingDef.indicesCollection === undefined || existingDef.indicesCollection.length === 0) {
53
+ const existingDefPrint = JSON.stringify(existingDef);
54
+ if (!hasCache.has(existingDefPrint)) {
55
+ newExistingDefs.push(existingDef);
56
+ hasCache.add(existingDefPrint);
57
+ }
37
58
  continue;
38
59
  }
39
60
  const newIndicesCollection = overwriteContainerIndices(existingDef.indicesCollection, overwriteIndex);
40
61
  // if indices are now empty list, don't keep empty definition
41
62
  if (newIndicesCollection.length > 0) {
42
- newExistingDefs.push({
63
+ const obj = {
43
64
  ...existingDef,
44
65
  indicesCollection: newIndicesCollection,
45
- });
66
+ };
67
+ const objHash = JSON.stringify(obj);
68
+ if (!hasCache.has(objHash)) {
69
+ newExistingDefs.push(obj);
70
+ hasCache.add(objHash);
71
+ }
46
72
  }
47
73
  }
48
74
  }
@@ -57,7 +83,7 @@ function overwriteContainerIndices(existingIndices, overwriteIndex) {
57
83
  if ((0, vertex_1.isParentContainerIndex)(overwriteIndex)) {
58
84
  newIndices = [];
59
85
  for (const index of indices.indices) {
60
- if (index.lexeme === overwriteIndex.lexeme && (0, vertex_1.isParentContainerIndex)(index)) {
86
+ if ((0, vertex_1.isSameIndex)(index, overwriteIndex) && (0, vertex_1.isParentContainerIndex)(index)) {
61
87
  const overwriteSubIndices = overwriteIndex.subIndices.flatMap(a => a.indices);
62
88
  let newSubIndices = index.subIndices;
63
89
  for (const overwriteSubIndex of overwriteSubIndices) {
@@ -70,7 +96,7 @@ function overwriteContainerIndices(existingIndices, overwriteIndex) {
70
96
  });
71
97
  }
72
98
  }
73
- if (index.lexeme !== overwriteIndex.lexeme || !(0, vertex_1.isParentContainerIndex)(index)) {
99
+ if (!(0, vertex_1.isSameIndex)(index, overwriteIndex) || !(0, vertex_1.isParentContainerIndex)(index)) {
74
100
  newIndices.push(index);
75
101
  }
76
102
  }
@@ -81,7 +107,7 @@ function overwriteContainerIndices(existingIndices, overwriteIndex) {
81
107
  }
82
108
  else {
83
109
  // Filter existing indices with the same name
84
- newIndices = indices.indices.filter(def => def.lexeme !== overwriteIndex.lexeme);
110
+ newIndices = indices.indices.filter(def => !(0, vertex_1.isSameIndex)(def, overwriteIndex));
85
111
  }
86
112
  if (indices.isContainer || newIndices.length > 0) {
87
113
  newIndicesCollection.push({
@@ -4,6 +4,7 @@ exports.overwriteIEnvironmentWith = overwriteIEnvironmentWith;
4
4
  exports.overwriteEnvironment = overwriteEnvironment;
5
5
  const assert_1 = require("../../util/assert");
6
6
  const environment_1 = require("./environment");
7
+ const log_1 = require("../../util/log");
7
8
  function anyIsMaybeOrEmpty(values) {
8
9
  if (values.length === 0) {
9
10
  return true;
@@ -19,6 +20,9 @@ function overwriteIEnvironmentWith(base, next, includeParent = true, applyCds) {
19
20
  (0, assert_1.guard)(base !== undefined && next !== undefined, 'can not overwrite environments with undefined');
20
21
  const map = new Map(base.memory);
21
22
  for (const [key, values] of next.memory) {
23
+ if (values.length > 1_000_000) {
24
+ log_1.log.warn(`Overwriting environment with ${values.length} definitions for ${key}`);
25
+ }
22
26
  const hasMaybe = applyCds?.length === 0 || applyCds !== undefined ? true : anyIsMaybeOrEmpty(values);
23
27
  if (hasMaybe) {
24
28
  const old = map.get(key);
@@ -0,0 +1,6 @@
1
+ import type { REnvironmentInformation } from './environment';
2
+ import type { Identifier } from './identifier';
3
+ /**
4
+ * Removes all definitions of a given name from the environment.
5
+ */
6
+ export declare function remove(name: Identifier, environment: REnvironmentInformation): REnvironmentInformation;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.remove = remove;
4
+ const environment_1 = require("./environment");
5
+ const info_1 = require("../info");
6
+ /**
7
+ * Removes all definitions of a given name from the environment.
8
+ */
9
+ function remove(name, environment) {
10
+ let current = environment.current;
11
+ do {
12
+ const definition = current.memory.get(name);
13
+ if (definition !== undefined) {
14
+ current.memory.delete(name);
15
+ if (definition.every(d => (0, info_1.happensInEveryBranch)(d.controlDependencies))) {
16
+ break;
17
+ }
18
+ }
19
+ current = current.parent;
20
+ } while (current.id !== environment_1.BuiltInEnvironment.id);
21
+ // we never remove built ins
22
+ return environment;
23
+ }
24
+ //# sourceMappingURL=remove.js.map
@@ -52,20 +52,20 @@ 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
  }
59
59
  else if (filtered.length > 0) {
60
60
  definitions ??= [];
61
- definitions.push(...filtered);
61
+ definitions = definitions.concat(filtered);
62
62
  }
63
63
  }
64
64
  current = current.parent;
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) {