@eagleoutice/flowr 2.13.14 → 2.13.16

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 (166) hide show
  1. package/README.md +25 -31
  2. package/abstract-interpretation/data-frame/resolve-args.js +11 -12
  3. package/abstract-interpretation/unsupported-functions.d.ts +1 -0
  4. package/abstract-interpretation/unsupported-functions.js +1 -0
  5. package/benchmark/summarizer/second-phase/graph.d.ts +23 -0
  6. package/benchmark/summarizer/second-phase/graph.js +47 -14
  7. package/cli/repl/commands/repl-cfg.js +2 -42
  8. package/cli/repl/commands/repl-clipboard.d.ts +7 -0
  9. package/cli/repl/commands/repl-clipboard.js +53 -0
  10. package/cli/repl/commands/repl-dataflow.js +5 -70
  11. package/cli/repl/commands/repl-normalize.js +3 -51
  12. package/cli/repl/commands/repl-query.js +37 -2
  13. package/cli/repl/core.js +5 -2
  14. package/control-flow/cfg-dead-code.js +5 -29
  15. package/control-flow/control-flow-graph.d.ts +2 -0
  16. package/control-flow/control-flow-graph.js +2 -0
  17. package/control-flow/diff-cfg.js +2 -56
  18. package/control-flow/semantic-cfg-guided-visitor.d.ts +7 -0
  19. package/control-flow/semantic-cfg-guided-visitor.js +14 -0
  20. package/control-flow/useless-loop.js +4 -26
  21. package/core/steps/all/core/10-normalize.d.ts +8 -0
  22. package/core/steps/all/core/10-normalize.js +10 -8
  23. package/core/steps/all/core/11-normalize-tree-sitter.d.ts +5 -7
  24. package/core/steps/all/core/11-normalize-tree-sitter.js +2 -9
  25. package/data/r-base-packages.generated.d.ts +1 -0
  26. package/data/r-base-packages.generated.js +5 -3
  27. package/dataflow/environments/built-in-config.d.ts +9 -1
  28. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  29. package/dataflow/environments/built-in-proc-name.js +2 -0
  30. package/dataflow/environments/built-in-props.d.ts +4 -0
  31. package/dataflow/environments/built-in-props.js +3 -3
  32. package/dataflow/environments/built-in.d.ts +4 -2
  33. package/dataflow/environments/built-in.js +53 -3
  34. package/dataflow/environments/data-masking-functions.d.ts +3 -4
  35. package/dataflow/environments/data-masking-functions.js +7 -8
  36. package/dataflow/environments/default-builtin-config.d.ts +92 -12
  37. package/dataflow/environments/default-builtin-config.js +86 -43
  38. package/dataflow/environments/environment.d.ts +5 -0
  39. package/dataflow/environments/environment.js +17 -12
  40. package/dataflow/environments/identifier.d.ts +3 -0
  41. package/dataflow/eval/resolve/alias-tracking.js +4 -7
  42. package/dataflow/eval/resolve/node-value.d.ts +51 -0
  43. package/dataflow/eval/resolve/node-value.js +71 -0
  44. package/dataflow/eval/resolve/resolve-argument.js +10 -7
  45. package/dataflow/eval/resolve/resolve-operators.js +1 -2
  46. package/dataflow/eval/values/general.d.ts +4 -0
  47. package/dataflow/eval/values/general.js +14 -0
  48. package/dataflow/eval/values/r-value.d.ts +15 -0
  49. package/dataflow/eval/values/r-value.js +27 -1
  50. package/dataflow/extractor.js +2 -0
  51. package/dataflow/fn/higher-order-function.d.ts +1 -1
  52. package/dataflow/fn/higher-order-function.js +22 -4
  53. package/dataflow/graph/call-graph.d.ts +1 -1
  54. package/dataflow/graph/call-graph.js +1 -1
  55. package/dataflow/graph/df-helper.d.ts +2 -2
  56. package/dataflow/graph/df-helper.js +1 -1
  57. package/dataflow/graph/diff-dataflow-graph.js +3 -55
  58. package/dataflow/graph/graph-helper.d.ts +1 -0
  59. package/dataflow/graph/graph-helper.js +1 -0
  60. package/dataflow/graph/graph.d.ts +5 -0
  61. package/dataflow/graph/graph.js +27 -0
  62. package/dataflow/graph/vertex.d.ts +5 -0
  63. package/dataflow/graph/vertex.js +5 -0
  64. package/dataflow/internal/linker.d.ts +23 -0
  65. package/dataflow/internal/linker.js +70 -1
  66. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +4 -1
  67. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +2 -0
  68. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +8 -29
  69. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +39 -6
  70. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +10 -22
  71. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +29 -53
  72. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -5
  73. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -7
  74. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -3
  75. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +19 -12
  76. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +2 -1
  77. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +3 -0
  78. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +69 -52
  79. package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
  80. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +2 -8
  81. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -8
  82. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +2 -2
  83. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -2
  84. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +6 -1
  85. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +31 -5
  86. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +5 -4
  87. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +7 -10
  88. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +6 -1
  89. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +20 -3
  90. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +6 -8
  91. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.d.ts +25 -0
  92. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +105 -0
  93. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +1 -27
  94. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
  95. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +1 -1
  96. package/dataflow/internal/process/functions/call/deferred.d.ts +48 -0
  97. package/dataflow/internal/process/functions/call/deferred.js +149 -0
  98. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +13 -12
  99. package/dataflow/internal/process/functions/call/known-call-handling.js +35 -35
  100. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
  101. package/dataflow/internal/process/functions/call/named-call-handling.js +8 -4
  102. package/dataflow/internal/process/functions/call/nse.d.ts +29 -0
  103. package/dataflow/internal/process/functions/call/nse.js +88 -0
  104. package/dataflow/internal/process/functions/call/quoted.d.ts +30 -0
  105. package/dataflow/internal/process/functions/call/quoted.js +191 -0
  106. package/documentation/doc-util/doc-types.js +15 -9
  107. package/documentation/wiki-dataflow-graph.js +8 -0
  108. package/linter/linter-format.d.ts +1 -0
  109. package/linter/linter-format.js +1 -0
  110. package/linter/rules/deprecated-functions.js +9 -3
  111. package/linter/rules/seeded-randomness.js +2 -3
  112. package/linter/rules/undefined-symbol.js +10 -1
  113. package/package.json +1 -1
  114. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +6 -0
  115. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +17 -1
  116. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +2 -11
  117. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +3 -15
  118. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.d.ts +16 -0
  119. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.js +26 -0
  120. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -11
  121. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +3 -15
  122. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +4 -10
  123. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +2 -9
  124. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +2 -9
  125. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +1 -1
  126. package/project/sigdb/reader.d.ts +9 -0
  127. package/project/sigdb/reader.js +30 -0
  128. package/queries/catalog/absint-query/absint-query-format.js +1 -1
  129. package/queries/catalog/does-call-query/does-call-query-format.js +2 -1
  130. package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -2
  131. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +0 -12
  132. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -37
  133. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -1
  134. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +2 -23
  135. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -1
  136. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +2 -2
  137. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +1 -1
  138. package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
  139. package/queries/catalog/origin-query/origin-query-format.js +1 -1
  140. package/queries/catalog/provenance-query/provenance-query-format.js +1 -1
  141. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
  142. package/queries/query-function-filter.d.ts +21 -0
  143. package/queries/query-function-filter.js +48 -0
  144. package/r-bridge/data/data.d.ts +13 -3
  145. package/r-bridge/data/data.js +15 -3
  146. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
  147. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
  148. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +2 -0
  149. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +4 -0
  150. package/search/flowr-search-filters.d.ts +5 -1
  151. package/search/flowr-search-filters.js +31 -21
  152. package/search/search-executor/search-enrichers.d.ts +24 -4
  153. package/search/search-executor/search-enrichers.js +22 -9
  154. package/search/search-executor/search-transformer.js +1 -1
  155. package/slicing/criterion/parse.d.ts +1 -0
  156. package/slicing/criterion/parse.js +1 -0
  157. package/util/diff-graph.d.ts +13 -0
  158. package/util/diff-graph.js +64 -1
  159. package/util/files.js +9 -8
  160. package/util/r-base-packages.d.ts +2 -0
  161. package/util/r-base-packages.js +3 -1
  162. package/util/r-version.d.ts +2 -0
  163. package/util/r-version.js +2 -0
  164. package/util/record.d.ts +1 -0
  165. package/util/record.js +1 -0
  166. package/util/version.js +1 -1
package/README.md CHANGED
@@ -43,7 +43,7 @@ It offers a wide variety of features, for example:
43
43
 
44
44
  ```shell
45
45
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
46
- flowR repl v2.13.12, R grammar v14 (tree-sitter engine)
46
+ flowR repl v2.13.15, R grammar v14 (tree-sitter engine)
47
47
  R> :query @linter "read.csv(\"/root/x.txt\")"
48
48
  ```
49
49
 
@@ -52,17 +52,11 @@ It offers a wide variety of features, for example:
52
52
 
53
53
 
54
54
  ```text
55
- Query: linter (9 ms)
55
+ Query: linter (5 ms)
56
56
  ╰ Deprecated Functions (deprecated-functions): no findings
57
- ╰ File Path Validity (file-path-validity):
58
- ╰ certain:
59
- ╰ Path `/root/x.txt` at 1.1-23
60
- ╰ Metadata: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 0, processTimeMs: 1
57
+ ╰ File Path Validity (file-path-validity): no findings
61
58
  ╰ Seeded Randomness (seeded-randomness): no findings
62
- ╰ Absolute Paths (absolute-file-paths):
63
- ╰ certain:
64
- ╰ Path `/root/x.txt` at 1.1-23
65
- ╰ Metadata: totalConsidered: 1, totalUnknown: 0, searchTimeMs: 0, processTimeMs: 0
59
+ ╰ Absolute Paths (absolute-file-paths): no findings
66
60
  ╰ Unused Definitions (unused-definitions): no findings
67
61
  ╰ Network Functions (network-functions): no findings
68
62
  ╰ Dataframe Access Validation (dataframe-access-validation): no findings
@@ -73,7 +67,7 @@ It offers a wide variety of features, for example:
73
67
  ╰ Roxygen Arguments (roxygen-arguments): no findings
74
68
  ╰ No Leaked Credentials (no-leaked-credentials): no findings
75
69
  ╰ Undefined Symbol (undefined-symbol): no findings
76
- All queries together required ≈9 ms (1ms accuracy, total 10 ms)
70
+ All queries together required ≈5 ms (1ms accuracy, total 5 ms)
77
71
  ```
78
72
 
79
73
 
@@ -95,17 +89,17 @@ It offers a wide variety of features, for example:
95
89
 
96
90
  _Results (prettified and summarized):_
97
91
 
98
- Query: **linter** (252 ms)\
92
+ Query: **linter** (7 ms)\
99
93
     ╰ **Deprecated Functions** (deprecated-functions): _no findings_\
100
94
     ╰ **File Path Validity** (file-path-validity):\
101
95
         ╰ certain:\
102
96
             ╰ Path `/root/x.txt` at 1.1-23\
103
-        ╰ _Metadata_: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 3, processTimeMs: 1\
97
+        ╰ _Metadata_: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 1, processTimeMs: 1\
104
98
     ╰ **Seeded Randomness** (seeded-randomness): _no findings_\
105
99
     ╰ **Absolute Paths** (absolute-file-paths):\
106
100
         ╰ certain:\
107
101
             ╰ Path `/root/x.txt` at 1.1-23\
108
-        ╰ _Metadata_: totalConsidered: 1, totalUnknown: 0, searchTimeMs: 1, processTimeMs: 0\
102
+        ╰ _Metadata_: totalConsidered: 1, totalUnknown: 0, searchTimeMs: 0, processTimeMs: 0\
109
103
     ╰ **Unused Definitions** (unused-definitions): _no findings_\
110
104
     ╰ **Network Functions** (network-functions): _no findings_\
111
105
     ╰ **Dataframe Access Validation** (dataframe-access-validation): _no findings_\
@@ -116,11 +110,11 @@ It offers a wide variety of features, for example:
116
110
     ╰ **Roxygen Arguments** (roxygen-arguments): _no findings_\
117
111
     ╰ **No Leaked Credentials** (no-leaked-credentials): _no findings_\
118
112
     ╰ **Undefined Symbol** (undefined-symbol): _no findings_\
119
- _All queries together required ≈252 ms (1ms accuracy, total 254 ms)_
113
+ _All queries together required ≈7 ms (1ms accuracy, total 8 ms)_
120
114
 
121
115
  <details> <summary style="color:gray">Show Detailed Results as Json</summary>
122
116
 
123
- The analysis required _253.8 ms_ (including parsing and normalization and the query) within the generation environment.
117
+ The analysis required _8.3 ms_ (including parsing and normalization and the query) within the generation environment.
124
118
 
125
119
  In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR.
126
120
  Please consult the [Interface](https://github.com/flowr-analysis/flowr/wiki/Interface) wiki page for more information on how to get those.
@@ -137,8 +131,8 @@ It offers a wide variety of features, for example:
137
131
  ".meta": {
138
132
  "totalCalls": 0,
139
133
  "totalFunctionDefinitions": 0,
140
- "searchTimeMs": 52,
141
- "processTimeMs": 169
134
+ "searchTimeMs": 1,
135
+ "processTimeMs": 1
142
136
  }
143
137
  },
144
138
  "file-path-validity": {
@@ -160,7 +154,7 @@ It offers a wide variety of features, for example:
160
154
  "totalUnknown": 0,
161
155
  "totalWritesBeforeAlways": 0,
162
156
  "totalValid": 0,
163
- "searchTimeMs": 3,
157
+ "searchTimeMs": 1,
164
158
  "processTimeMs": 1
165
159
  }
166
160
  },
@@ -172,7 +166,7 @@ It offers a wide variety of features, for example:
172
166
  "callsWithAssignmentProducers": 0,
173
167
  "callsWithNonConstantProducers": 0,
174
168
  "callsWithOtherBranchProducers": 0,
175
- "searchTimeMs": 1,
169
+ "searchTimeMs": 0,
176
170
  "processTimeMs": 0
177
171
  }
178
172
  },
@@ -192,7 +186,7 @@ It offers a wide variety of features, for example:
192
186
  ".meta": {
193
187
  "totalConsidered": 1,
194
188
  "totalUnknown": 0,
195
- "searchTimeMs": 1,
189
+ "searchTimeMs": 0,
196
190
  "processTimeMs": 0
197
191
  }
198
192
  },
@@ -201,7 +195,7 @@ It offers a wide variety of features, for example:
201
195
  ".meta": {
202
196
  "totalConsidered": 0,
203
197
  "searchTimeMs": 0,
204
- "processTimeMs": 1
198
+ "processTimeMs": 0
205
199
  }
206
200
  },
207
201
  "network-functions": {
@@ -220,7 +214,7 @@ It offers a wide variety of features, for example:
220
214
  "numAccesses": 0,
221
215
  "totalAccessed": 0,
222
216
  "searchTimeMs": 0,
223
- "processTimeMs": 2
217
+ "processTimeMs": 0
224
218
  }
225
219
  },
226
220
  "dead-code": {
@@ -281,16 +275,16 @@ It offers a wide variety of features, for example:
281
275
  "subscript": 0
282
276
  },
283
277
  "searchTimeMs": 0,
284
- "processTimeMs": 20
278
+ "processTimeMs": 1
285
279
  }
286
280
  }
287
281
  },
288
282
  ".meta": {
289
- "timing": 252
283
+ "timing": 7
290
284
  }
291
285
  },
292
286
  ".meta": {
293
- "timing": 252
287
+ "timing": 7
294
288
  }
295
289
  }
296
290
  ```
@@ -354,7 +348,7 @@ It offers a wide variety of features, for example:
354
348
 
355
349
  ```shell
356
350
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
357
- flowR repl v2.13.12, R grammar v14 (tree-sitter engine)
351
+ flowR repl v2.13.15, R grammar v14 (tree-sitter engine)
358
352
  R> :query @static-slice (11@sum) file://test/testfiles/example.R
359
353
  ```
360
354
 
@@ -368,7 +362,7 @@ It offers a wide variety of features, for example:
368
362
  N <- 10
369
363
  for(i in 1:(N-1)) sum <- sum + i + w
370
364
  sum
371
- All queries together required ≈23 ms (1ms accuracy, total 24 ms)
365
+ All queries together required ≈2 ms (1ms accuracy, total 2 ms)
372
366
  ```
373
367
 
374
368
 
@@ -383,7 +377,7 @@ It offers a wide variety of features, for example:
383
377
  </details>
384
378
 
385
379
  * 🚀 **fast call-graph, data-, and control-flow graphs**\
386
- Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">81.7 ms</span></i> (as of Aug 10, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
380
+ Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">78.5 ms</span></i> (as of Aug 14, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
387
381
  _flowR_ can analyze the data- and control-flow of the average real-world R&nbsp;script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
388
382
  and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) for more details on the [dataflow graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) as well as [call graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph#perspectives-cg).
389
383
 
@@ -419,7 +413,7 @@ It offers a wide variety of features, for example:
419
413
 
420
414
  ```shell
421
415
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
422
- flowR repl v2.13.12, R grammar v14 (tree-sitter engine)
416
+ flowR repl v2.13.15, R grammar v14 (tree-sitter engine)
423
417
  R> :dataflow* test/testfiles/example.R
424
418
  ```
425
419
 
@@ -692,7 +686,7 @@ It offers a wide variety of features, for example:
692
686
  ```
693
687
 
694
688
 
695
- (The analysis required _2.6 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted for these generated graphs, so `library()` calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. `acf` as `stats::acf`).)
689
+ (The analysis required _1.7 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted for these generated graphs, so `library()` calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. `acf` as `stats::acf`).)
696
690
 
697
691
 
698
692
 
@@ -25,10 +25,8 @@ function resolveIdToArgName(id, info) {
25
25
  * Resolves the value of a function argument as string, number, boolean, or vector using {@link resolveIdToValue}
26
26
  */
27
27
  function resolveIdToArgValue(id, info) {
28
- const node = resolveIdToArgument(id, info);
29
- if (node?.value !== undefined) {
30
- const resolvedValue = (0, alias_tracking_1.resolveIdToValue)(node.value, info);
31
- const unliftedValue = (0, r_value_1.unliftRValue)(resolvedValue);
28
+ const unliftedValue = resolveArgToUnlifted(id, info);
29
+ if (unliftedValue !== undefined) {
32
30
  if (Array.isArray(unliftedValue)) {
33
31
  return (0, r_value_1.unwrapRVector)(unliftedValue);
34
32
  }
@@ -42,10 +40,8 @@ function resolveIdToArgValue(id, info) {
42
40
  * Resolves the value of a function argument to a string vector using {@link resolveIdToValue} and {@link unwrapRValueToString}
43
41
  */
44
42
  function resolveIdToArgStringVector(id, info) {
45
- const node = resolveIdToArgument(id, info);
46
- if (node?.value !== undefined) {
47
- const resolvedValue = (0, alias_tracking_1.resolveIdToValue)(node.value, info);
48
- const unliftedValue = (0, r_value_1.unliftRValue)(resolvedValue);
43
+ const unliftedValue = resolveArgToUnlifted(id, info);
44
+ if (unliftedValue !== undefined) {
49
45
  if (Array.isArray(unliftedValue)) {
50
46
  const array = unliftedValue.map(r_value_1.unwrapRValueToString);
51
47
  return array.every(assert_1.isNotUndefined) ? array : undefined;
@@ -74,10 +70,8 @@ function resolveIdToArgValueSymbolName(id, info) {
74
70
  * Resolves the vector length of the value of a function argument using {@link resolveIdToValue}
75
71
  */
76
72
  function resolveIdToArgVectorLength(id, info) {
77
- const node = resolveIdToArgument(id, info);
78
- if (node?.value !== undefined) {
79
- const resolvedValue = (0, alias_tracking_1.resolveIdToValue)(node.value, info);
80
- const unliftedValue = (0, r_value_1.unliftRValue)(resolvedValue);
73
+ const unliftedValue = resolveArgToUnlifted(id, info);
74
+ if (unliftedValue !== undefined) {
81
75
  if (Array.isArray(unliftedValue)) {
82
76
  return unliftedValue.length;
83
77
  }
@@ -87,6 +81,11 @@ function resolveIdToArgVectorLength(id, info) {
87
81
  }
88
82
  return undefined;
89
83
  }
84
+ /** The unlifted value of a function argument, `undefined` if the argument carries no value. */
85
+ function resolveArgToUnlifted(id, info) {
86
+ const node = resolveIdToArgument(id, info);
87
+ return node?.value !== undefined ? (0, r_value_1.unliftRValue)((0, alias_tracking_1.resolveIdToValue)(node.value, info)) : undefined;
88
+ }
90
89
  function resolveIdToArgument(id, { graph, idMap }) {
91
90
  idMap ??= graph?.idMap;
92
91
  const node = id === undefined || typeof id === 'object' ? id : idMap?.get(id);
@@ -4,6 +4,7 @@ import { type DataflowGraphVertexArgument } from '../dataflow/graph/vertex';
4
4
  * Helper for unsupported functions that may change the environment.
5
5
  */
6
6
  export declare const UnsupportedFunctions: {
7
+ name: string;
7
8
  /**
8
9
  * Checks whether a data flow graph vertex represents an unsupported (environment-changing) function call (e.g. `eval`, `load`, `attach`, `rm`, ...)
9
10
  */
@@ -41,6 +41,7 @@ const UnsupportedFunctionsList = unsupportedFunctions({
41
41
  * Helper for unsupported functions that may change the environment.
42
42
  */
43
43
  exports.UnsupportedFunctions = {
44
+ name: 'UnsupportedFunctions',
44
45
  /**
45
46
  * Checks whether a data flow graph vertex represents an unsupported (environment-changing) function call (e.g. `eval`, `load`, `attach`, `rm`, ...)
46
47
  */
@@ -1,7 +1,30 @@
1
1
  import type { UltimateSlicerStats } from '../data';
2
+ import type { MergeableRecord } from '../../../util/objects';
3
+ interface BenchmarkGraphEntry extends MergeableRecord {
4
+ name: string;
5
+ unit: string;
6
+ value: number;
7
+ range?: string;
8
+ extra?: string;
9
+ }
10
+ /**
11
+ * Whether an entry describes what the release *is* rather than how fast it *was*.
12
+ *
13
+ * The benchmark action compares every entry it uploads against the release before and calls a value that grew
14
+ * a regression. That is right for a runtime and wrong for a counter: a release with ten more linting rules or a
15
+ * larger signature database is not slower. Those entries are written to {@link infoGraphPath} instead and are
16
+ * uploaded under a suite of their own, where nothing alerts on them. The page merges the two back together.
17
+ *
18
+ * The failures are counters too, but a run that fails to re-parse more slices than the one before is exactly
19
+ * what an alert is for, so they stay with the measurements.
20
+ */
21
+ export declare function isInfoEntry({ name, unit }: Pick<BenchmarkGraphEntry, 'name' | 'unit'>): boolean;
22
+ /** where the counters of `path` go, next to it, so that one upload can alert and the other cannot */
23
+ export declare function infoGraphPath(path: string): string;
2
24
  /**
3
25
  * Write the graph output for the ultimate slicer stats to a file
4
26
  * @param ultimate - The ultimate slicer stats
5
27
  * @param outputGraphPath - The path to write the graph output to
6
28
  */
7
29
  export declare function writeGraphOutput(ultimate: UltimateSlicerStats, outputGraphPath: string): Promise<void>;
30
+ export {};
@@ -3,6 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isInfoEntry = isInfoEntry;
7
+ exports.infoGraphPath = infoGraphPath;
6
8
  exports.writeGraphOutput = writeGraphOutput;
7
9
  const fs_1 = __importDefault(require("fs"));
8
10
  const json_1 = require("../../../util/json");
@@ -13,11 +15,41 @@ function ms(nanoseconds) {
13
15
  return nanoseconds / 1e6;
14
16
  }
15
17
  /**
16
- * The median is a lot less sensitive to the load of the machine that produced the measurement than the mean,
17
- * hence we plot the median whenever there is one and only report the mean as additional information.
18
+ * Every plotted number is the mean, so that one series never mixes two statistics: a run that switches
19
+ * to the median steps up or down by the skew of the corpus, which reads as a change that never happened.
20
+ * The median travels along as additional information, see {@link plotExtra}.
18
21
  */
19
22
  function plotValue(measurement) {
20
- return Number.isFinite(measurement.median) ? measurement.median : measurement.mean;
23
+ return Number.isFinite(measurement.mean) ? measurement.mean : measurement.median;
24
+ }
25
+ /** the statistics a plotted mean is worth nothing without, stated on hover */
26
+ function plotExtra(measurement, digits = 2, scale = 1, unit = '') {
27
+ const say = (v) => (v * scale).toFixed(digits) + unit;
28
+ return `median: ${say(measurement.median)}, std: ${say(measurement.std)}`;
29
+ }
30
+ /**
31
+ * Whether an entry describes what the release *is* rather than how fast it *was*.
32
+ *
33
+ * The benchmark action compares every entry it uploads against the release before and calls a value that grew
34
+ * a regression. That is right for a runtime and wrong for a counter: a release with ten more linting rules or a
35
+ * larger signature database is not slower. Those entries are written to {@link infoGraphPath} instead and are
36
+ * uploaded under a suite of their own, where nothing alerts on them. The page merges the two back together.
37
+ *
38
+ * The failures are counters too, but a run that fails to re-parse more slices than the one before is exactly
39
+ * what an alert is for, so they stay with the measurements.
40
+ */
41
+ function isInfoEntry({ name, unit }) {
42
+ if (name.startsWith(SigDbPrefix)) {
43
+ return true; // the database ships with the release, its size is not this run being slow
44
+ }
45
+ if (unit === 'ms' || name.startsWith('memory')) {
46
+ return false; // a runtime or a size the analysis has to hold, both worth an alert
47
+ }
48
+ return unit === '#' && !/^(reduction|failed|times hit)/.test(name);
49
+ }
50
+ /** where the counters of `path` go, next to it, so that one upload can alert and the other cannot */
51
+ function infoGraphPath(path) {
52
+ return path.replace(/(\.json)?$/, m => '-info' + (m || '.json'));
21
53
  }
22
54
  function timeEntry(name, measurement) {
23
55
  if (!measurement?.mean || !measurement?.std) {
@@ -28,7 +60,7 @@ function timeEntry(name, measurement) {
28
60
  unit: 'ms',
29
61
  value: ms(plotValue(measurement)),
30
62
  range: String(ms(measurement.std)),
31
- extra: `mean: ${ms(measurement.mean).toFixed(2)}ms`
63
+ extra: plotExtra(measurement, 2, 1 / 1e6, 'ms')
32
64
  };
33
65
  }
34
66
  const SigDbPrefix = 'signature database';
@@ -166,7 +198,7 @@ async function writeGraphOutput(ultimate, outputGraphPath) {
166
198
  unit: '#',
167
199
  value: plotValue(measurement),
168
200
  range: String(measurement.std),
169
- extra: `mean: ${measurement.mean.toFixed(2)}`
201
+ extra: plotExtra(measurement)
170
202
  });
171
203
  }
172
204
  }
@@ -194,7 +226,7 @@ async function writeGraphOutput(ultimate, outputGraphPath) {
194
226
  name,
195
227
  unit: '#',
196
228
  value: measurement.total,
197
- extra: `mean: ${measurement.mean.toFixed(2)} per file`
229
+ extra: `mean: ${measurement.mean.toFixed(2)} per file, median: ${measurement.median.toFixed(2)}`
198
230
  });
199
231
  }
200
232
  data.push({
@@ -202,7 +234,7 @@ async function writeGraphOutput(ultimate, outputGraphPath) {
202
234
  unit: 'KiB',
203
235
  value: plotValue(shapes.sizeOfInfo) / 1024,
204
236
  range: String(shapes.sizeOfInfo.std / 1024),
205
- extra: `mean: ${(shapes.sizeOfInfo.mean / 1024).toFixed(2)}`
237
+ extra: plotExtra(shapes.sizeOfInfo, 2, 1 / 1024, ' KiB')
206
238
  });
207
239
  }
208
240
  data.push({
@@ -228,7 +260,7 @@ async function writeGraphOutput(ultimate, outputGraphPath) {
228
260
  name,
229
261
  unit: '#',
230
262
  value: plotValue(measurement),
231
- extra: `mean: ${measurement.mean.toFixed(4)}, std: ${measurement.std.toFixed(4)}`
263
+ extra: plotExtra(measurement, 4)
232
264
  });
233
265
  }
234
266
  }
@@ -236,13 +268,13 @@ async function writeGraphOutput(ultimate, outputGraphPath) {
236
268
  name: 'reduction (characters)',
237
269
  unit: '#',
238
270
  value: plotValue(ultimate.reduction.numberOfCharacters),
239
- extra: `mean: ${ultimate.reduction.numberOfCharacters.mean.toFixed(4)}, std: ${ultimate.reduction.numberOfCharacters.std.toFixed(4)}`
271
+ extra: plotExtra(ultimate.reduction.numberOfCharacters, 4)
240
272
  });
241
273
  data.push({
242
274
  name: 'reduction (normalized tokens)',
243
275
  unit: '#',
244
276
  value: plotValue(ultimate.reduction.numberOfNormalizedTokens),
245
- extra: `mean: ${ultimate.reduction.numberOfNormalizedTokens.mean.toFixed(4)}, std: ${ultimate.reduction.numberOfNormalizedTokens.std.toFixed(4)}`
277
+ extra: plotExtra(ultimate.reduction.numberOfNormalizedTokens, 4)
246
278
  });
247
279
  if (ultimate.controlFlow) {
248
280
  data.push({
@@ -250,7 +282,7 @@ async function writeGraphOutput(ultimate, outputGraphPath) {
250
282
  unit: 'KiB',
251
283
  value: plotValue(ultimate.controlFlow.sizeOfObject) / 1024,
252
284
  range: String(ultimate.controlFlow.sizeOfObject.std / 1024),
253
- extra: `mean: ${(ultimate.controlFlow.sizeOfObject.mean / 1024).toFixed(2)}`
285
+ extra: plotExtra(ultimate.controlFlow.sizeOfObject, 2, 1 / 1024, ' KiB')
254
286
  });
255
287
  }
256
288
  data.push({
@@ -258,11 +290,12 @@ async function writeGraphOutput(ultimate, outputGraphPath) {
258
290
  unit: 'KiB',
259
291
  value: plotValue(ultimate.dataflow.sizeOfObject) / 1024,
260
292
  range: String(ultimate.dataflow.sizeOfObject.std / 1024),
261
- extra: `mean: ${(ultimate.dataflow.sizeOfObject.mean / 1024).toFixed(2)}`
293
+ extra: plotExtra(ultimate.dataflow.sizeOfObject, 2, 1 / 1024, ' KiB')
262
294
  });
263
295
  // the database is a property of the release, not of a file, so it is counted once and comes last
264
296
  data.push(...signatureDatabaseEntries(await (0, sigdb_counts_1.countSignatureDatabase)()));
265
- // write the output file
266
- fs_1.default.writeFileSync(outputGraphPath, JSON.stringify(data, json_1.jsonReplacer));
297
+ /* the counters go into a file of their own, see infoGraphPath */
298
+ fs_1.default.writeFileSync(outputGraphPath, JSON.stringify(data.filter(e => !isInfoEntry(e)), json_1.jsonReplacer));
299
+ fs_1.default.writeFileSync(infoGraphPath(outputGraphPath), JSON.stringify(data.filter(isInfoEntry), json_1.jsonReplacer));
267
300
  }
268
301
  //# sourceMappingURL=graph.js.map
@@ -1,43 +1,11 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.controlflowBbStarCommand = exports.controlflowBbCommand = exports.controlflowStarCommand = exports.controlflowCommand = void 0;
37
4
  const cfg_1 = require("../../../util/mermaid/cfg");
38
5
  const ansi_1 = require("../../../util/text/ansi");
39
6
  const cfg_simplification_1 = require("../../../control-flow/cfg-simplification");
40
7
  const core_1 = require("../core");
8
+ const repl_clipboard_1 = require("./repl-clipboard");
41
9
  function formatInfo(out, type) {
42
10
  return out.formatter.format(`Copied ${type} to clipboard.`, { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 3 /* FontStyles.Italic */ });
43
11
  }
@@ -45,15 +13,7 @@ async function produceAndPrintCfg(analyzer, output, simplifications, cfgConverte
45
13
  const cfg = await analyzer.controlflow([...cfg_simplification_1.DefaultCfgSimplificationOrder, ...simplifications]);
46
14
  const normalizedAst = await analyzer.normalize();
47
15
  const mermaid = cfgConverter(cfg, normalizedAst);
48
- output.stdout(mermaid);
49
- if (output.allowClipboard !== false) {
50
- try {
51
- const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
52
- clipboard.default.writeSync(mermaid);
53
- output.stdout(formatInfo(output, 'mermaid code'));
54
- }
55
- catch { /* do nothing this is a service thing */ }
56
- }
16
+ await repl_clipboard_1.ReplClipboard.print(output, mermaid, formatInfo(output, 'mermaid code'));
57
17
  }
58
18
  exports.controlflowCommand = {
59
19
  description: 'Get mermaid code for the control-flow graph of R code',
@@ -0,0 +1,7 @@
1
+ import type { ReplOutput } from './repl-main';
2
+ /** Output that the user most likely wants on their clipboard as well. */
3
+ export declare const ReplClipboard: {
4
+ readonly name: "ReplClipboard";
5
+ /** Prints `text` and, if the output allows it, copies it to the clipboard and reports `note` afterwards. */
6
+ readonly print: (this: void, output: ReplOutput, text: string, note: string) => Promise<void>;
7
+ };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ReplClipboard = void 0;
37
+ /** Output that the user most likely wants on their clipboard as well. */
38
+ exports.ReplClipboard = {
39
+ name: 'ReplClipboard',
40
+ /** Prints `text` and, if the output allows it, copies it to the clipboard and reports `note` afterwards. */
41
+ async print(output, text, note) {
42
+ output.stdout(text);
43
+ if (output.allowClipboard !== false) {
44
+ try {
45
+ const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
46
+ clipboard.default.writeSync(text);
47
+ output.stdout(note);
48
+ }
49
+ catch { /* do nothing this is a service thing */ }
50
+ }
51
+ }
52
+ };
53
+ //# sourceMappingURL=repl-clipboard.js.map