@eagleoutice/flowr 2.13.16 → 2.14.1

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 (253) hide show
  1. package/README.md +36 -25
  2. package/abstract-interpretation/absint-visitor.js +1 -1
  3. package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -4
  4. package/abstract-interpretation/data-frame/mappers/arguments.js +7 -4
  5. package/abstract-interpretation/data-frame/mappers/function-mapper.js +18 -17
  6. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +6 -6
  7. package/abstract-interpretation/data-frame/resolve-args.d.ts +9 -4
  8. package/abstract-interpretation/data-frame/resolve-args.js +10 -5
  9. package/benchmark/calibration.d.ts +16 -7
  10. package/benchmark/calibration.js +44 -17
  11. package/benchmark/slicer.d.ts +3 -2
  12. package/benchmark/slicer.js +9 -5
  13. package/benchmark/stats/size-of.js +1 -1
  14. package/benchmark/summarizer/first-phase/process.d.ts +2 -0
  15. package/benchmark/summarizer/first-phase/process.js +2 -0
  16. package/cli/benchmark-app.js +4 -1
  17. package/cli/benchmark-helper-app.d.ts +1 -0
  18. package/cli/benchmark-helper-app.js +2 -2
  19. package/cli/common/options.d.ts +5 -31
  20. package/cli/common/options.js +2 -8
  21. package/cli/common/scripts-info.d.ts +5 -38
  22. package/cli/common/scripts-info.js +0 -8
  23. package/cli/repl/core.js +1 -1
  24. package/cli/repl/execute.d.ts +2 -2
  25. package/cli/repl/execute.js +2 -2
  26. package/cli/repl/parser/slice-query-parser.js +1 -1
  27. package/cli/repl/print-version.js +2 -2
  28. package/config.d.ts +16 -0
  29. package/config.js +83 -5
  30. package/control-flow/extract-cfg.js +1 -1
  31. package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
  32. package/control-flow/semantic-cfg-guided-visitor.js +1 -1
  33. package/control-flow/useless-loop.js +1 -1
  34. package/core/print/slice-diff-ansi.js +1 -1
  35. package/core/steps/pipeline/create-pipeline.js +1 -1
  36. package/dataflow/cluster.js +2 -2
  37. package/dataflow/environments/apply-kill.js +1 -1
  38. package/dataflow/environments/built-in-props.d.ts +13 -2
  39. package/dataflow/environments/built-in-props.js +23 -1
  40. package/dataflow/environments/built-in.d.ts +7 -1
  41. package/dataflow/environments/built-in.js +42 -3
  42. package/dataflow/environments/default-builtin-config.d.ts +518 -11
  43. package/dataflow/environments/default-builtin-config.js +218 -23
  44. package/dataflow/environments/environment.d.ts +10 -2
  45. package/dataflow/environments/environment.js +25 -7
  46. package/dataflow/environments/identifier.d.ts +8 -2
  47. package/dataflow/environments/identifier.js +6 -1
  48. package/dataflow/environments/query-fn-props.d.ts +6 -0
  49. package/dataflow/environments/query-fn-props.js +22 -2
  50. package/dataflow/environments/reference-to-maybe.js +5 -5
  51. package/dataflow/environments/resolve-by-name.d.ts +3 -0
  52. package/dataflow/environments/resolve-by-name.js +44 -7
  53. package/dataflow/environments/resolve-helper.d.ts +6 -0
  54. package/dataflow/environments/resolve-helper.js +6 -0
  55. package/dataflow/eval/resolve/alias-tracking.d.ts +5 -0
  56. package/dataflow/eval/resolve/alias-tracking.js +21 -14
  57. package/dataflow/eval/resolve/node-value.d.ts +6 -0
  58. package/dataflow/eval/resolve/node-value.js +15 -9
  59. package/dataflow/eval/resolve/resolve-argument.js +2 -2
  60. package/dataflow/eval/resolve/resolve-numbers.js +2 -2
  61. package/dataflow/eval/resolve/resolve-operators.js +5 -4
  62. package/dataflow/eval/resolve/resolve-strings.js +3 -3
  63. package/dataflow/eval/resolve/resolve-working-directory.d.ts +1 -1
  64. package/dataflow/eval/resolve/resolve-working-directory.js +3 -3
  65. package/dataflow/eval/resolve/resolve.d.ts +5 -5
  66. package/dataflow/eval/resolve/resolve.js +10 -11
  67. package/dataflow/eval/values/general.d.ts +4 -1
  68. package/dataflow/eval/values/general.js +1 -1
  69. package/dataflow/extractor.js +2 -1
  70. package/dataflow/fn/exceptions-of-function.d.ts +3 -1
  71. package/dataflow/fn/exceptions-of-function.js +87 -39
  72. package/dataflow/fn/higher-order-function.js +5 -4
  73. package/dataflow/fn/strict-function.d.ts +40 -0
  74. package/dataflow/fn/strict-function.js +337 -0
  75. package/dataflow/graph/call-graph.js +14 -14
  76. package/dataflow/graph/df-helper.d.ts +24 -1
  77. package/dataflow/graph/df-helper.js +29 -7
  78. package/dataflow/graph/diff-dataflow-graph.js +6 -6
  79. package/dataflow/graph/edge.d.ts +27 -0
  80. package/dataflow/graph/edge.js +33 -0
  81. package/dataflow/graph/graph-helper.d.ts +3 -4
  82. package/dataflow/graph/graph-helper.js +4 -5
  83. package/dataflow/graph/graph.d.ts +39 -3
  84. package/dataflow/graph/graph.js +75 -7
  85. package/dataflow/graph/vertex.d.ts +42 -6
  86. package/dataflow/graph/vertex.js +42 -6
  87. package/dataflow/info.d.ts +26 -0
  88. package/dataflow/info.js +28 -1
  89. package/dataflow/internal/linker.d.ts +1 -0
  90. package/dataflow/internal/linker.js +11 -9
  91. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
  92. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
  93. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -5
  94. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +2 -2
  95. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -7
  96. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -6
  97. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -0
  98. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +19 -18
  99. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +6 -1
  100. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
  101. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +2 -2
  102. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
  103. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -5
  104. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +1 -1
  105. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +3 -3
  106. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +3 -3
  107. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -0
  108. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +29 -3
  109. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
  110. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +1 -1
  111. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +3 -3
  112. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +3 -1
  113. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +44 -20
  114. package/dataflow/internal/process/functions/call/common.d.ts +9 -1
  115. package/dataflow/internal/process/functions/call/common.js +17 -6
  116. package/dataflow/internal/process/functions/call/deferred.js +2 -1
  117. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -1
  118. package/dataflow/internal/process/functions/call/known-call-handling.js +6 -3
  119. package/dataflow/internal/process/functions/call/named-call-handling.js +44 -12
  120. package/dataflow/internal/process/functions/call/nse.d.ts +33 -5
  121. package/dataflow/internal/process/functions/call/nse.js +113 -6
  122. package/dataflow/internal/process/functions/call/quoted.d.ts +5 -0
  123. package/dataflow/internal/process/functions/call/quoted.js +21 -9
  124. package/dataflow/origin/dfg-get-origin.d.ts +1 -0
  125. package/dataflow/origin/dfg-get-origin.js +9 -6
  126. package/documentation/data/faq/faqs.js +88 -88
  127. package/documentation/data/faq/recommended-configs.js +1 -1
  128. package/documentation/data/faq/wiki-faq-store.js +1 -1
  129. package/documentation/doc-capabilities.js +1 -1
  130. package/documentation/doc-readme.js +1 -1
  131. package/documentation/doc-util/doc-auto-gen.js +6 -2
  132. package/documentation/doc-util/doc-functions.js +1 -1
  133. package/documentation/wiki-cfg.js +2 -2
  134. package/documentation/wiki-core.js +1 -1
  135. package/documentation/wiki-create-linting-rules.js +45 -45
  136. package/documentation/wiki-dataflow-graph.js +18 -18
  137. package/documentation/wiki-linter.js +1 -0
  138. package/documentation/wiki-linting-and-testing.js +93 -5
  139. package/documentation/wiki-mk/doc-maker.js +1 -1
  140. package/documentation/wiki-overview.js +12 -1
  141. package/documentation/wiki-query.js +53 -0
  142. package/documentation/wiki-signature-database.js +3 -0
  143. package/linter/linter-output.js +1 -1
  144. package/linter/linter-rules.d.ts +24 -0
  145. package/linter/linter-rules.js +3 -1
  146. package/linter/rules/file-path-validity.js +1 -1
  147. package/linter/rules/function-finder-util.js +1 -1
  148. package/linter/rules/naming-convention.js +1 -1
  149. package/linter/rules/network-functions.d.ts +1 -1
  150. package/linter/rules/no-leaked-credentials.js +2 -1
  151. package/linter/rules/stop-with-call-arg.js +4 -4
  152. package/linter/rules/unclosed-connection.d.ts +44 -0
  153. package/linter/rules/unclosed-connection.js +200 -0
  154. package/linter/rules/undefined-symbol-util.d.ts +1 -1
  155. package/linter/rules/undefined-symbol-util.js +5 -4
  156. package/linter/rules/undefined-symbol.js +3 -3
  157. package/linter/rules/unused-definition.js +2 -1
  158. package/package.json +38 -51
  159. package/project/context/flowr-analyzer-environment-context.d.ts +23 -0
  160. package/project/context/flowr-analyzer-environment-context.js +25 -0
  161. package/project/dependency-version-space.d.ts +3 -3
  162. package/project/dependency-version-space.js +3 -4
  163. package/project/flowr-analyzer.js +1 -1
  164. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +1 -1
  165. package/project/plugins/file-plugins/files/flowr-description-file.js +1 -1
  166. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +1 -1
  167. package/project/plugins/file-plugins/files/flowr-namespace-file.js +1 -1
  168. package/project/plugins/file-plugins/files/flowr-news-file.d.ts +1 -1
  169. package/project/plugins/file-plugins/files/flowr-news-file.js +1 -1
  170. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +1 -1
  171. package/project/plugins/file-plugins/files/flowr-rda-file.js +4 -4
  172. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
  173. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +5 -5
  174. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +36 -7
  175. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
  176. package/project/sigdb/build.js +16 -16
  177. package/project/sigdb/codec.d.ts +1 -1
  178. package/project/sigdb/codec.js +13 -13
  179. package/project/sigdb/decompress.d.ts +1 -1
  180. package/project/sigdb/decompress.js +33 -33
  181. package/project/sigdb/index-format.js +2 -2
  182. package/project/sigdb/manifest.d.ts +3 -1
  183. package/project/sigdb/manifest.js +68 -27
  184. package/project/sigdb/memory-source.d.ts +64 -0
  185. package/project/sigdb/memory-source.js +133 -0
  186. package/project/sigdb/reader.js +14 -14
  187. package/project/sigdb/schema.d.ts +2 -2
  188. package/project/sigdb/schema.js +2 -2
  189. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
  190. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -2
  191. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
  192. package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
  193. package/queries/catalog/dependencies-query/link-devices.js +3 -9
  194. package/queries/catalog/does-call-query/does-call-query-executor.js +2 -1
  195. package/queries/catalog/input-sources-query/simple-input-classifier.js +4 -4
  196. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -1
  197. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -0
  198. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +6 -0
  199. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +25 -0
  200. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +31 -0
  201. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +56 -0
  202. package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
  203. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
  204. package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -0
  205. package/queries/catalog/signature-query/signature-query-executor.js +3 -2
  206. package/queries/catalog/slice-query-options.d.ts +1 -1
  207. package/queries/catalog/slice-query-options.js +1 -1
  208. package/queries/query-function-filter.d.ts +8 -2
  209. package/queries/query-function-filter.js +11 -1
  210. package/queries/query.d.ts +11 -1
  211. package/queries/query.js +2 -0
  212. package/r-bridge/lang-4.x/ast/model/model.d.ts +4 -4
  213. package/r-bridge/lang-4.x/ast/model/model.js +4 -4
  214. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +3 -3
  215. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
  216. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
  217. package/r-bridge/retriever.d.ts +2 -1
  218. package/r-bridge/retriever.js +3 -2
  219. package/r-bridge/roxygen2/documentation-provider.d.ts +1 -0
  220. package/r-bridge/roxygen2/documentation-provider.js +1 -0
  221. package/r-bridge/roxygen2/roxygen-parse.d.ts +1 -1
  222. package/r-bridge/roxygen2/roxygen-parse.js +1 -1
  223. package/search/flowr-search-filters.d.ts +1 -1
  224. package/search/flowr-search-filters.js +2 -14
  225. package/search/search-executor/search-enrichers.js +4 -4
  226. package/search/search-executor/search-generators.js +1 -1
  227. package/slicing/criterion/parse.d.ts +2 -2
  228. package/slicing/criterion/parse.js +5 -5
  229. package/slicing/static/fingerprint.js +1 -1
  230. package/slicing/static/slice-call.d.ts +1 -1
  231. package/slicing/static/slice-call.js +2 -2
  232. package/slicing/static/static-slicer.js +4 -3
  233. package/util/assert.js +1 -1
  234. package/util/log.d.ts +4 -1
  235. package/util/log.js +15 -2
  236. package/util/logic.js +2 -2
  237. package/util/mermaid/cfg.js +1 -1
  238. package/util/mermaid/dfg.js +6 -6
  239. package/util/mermaid/mermaid.js +3 -1
  240. package/util/objects.d.ts +12 -0
  241. package/util/objects.js +48 -0
  242. package/util/quads.js +19 -6
  243. package/util/schema.js +2 -2
  244. package/util/simple-df/dfg-ascii.js +14 -3
  245. package/util/text/ansi.d.ts +2 -0
  246. package/util/text/ansi.js +8 -0
  247. package/util/text/name-rank.d.ts +29 -0
  248. package/util/text/name-rank.js +39 -0
  249. package/util/text/url-encoding.d.ts +15 -0
  250. package/util/text/url-encoding.js +59 -0
  251. package/util/version.js +1 -1
  252. package/cli/export-quads-app.d.ts +0 -7
  253. package/cli/export-quads-app.js +0 -44
@@ -26,7 +26,7 @@ function onlyLoopsOnce(loop, dataflow, controlflow, ast, ctx) {
26
26
  if (!vertex) {
27
27
  return undefined;
28
28
  }
29
- (0, assert_1.guard)(vertex.tag === vertex_1.VertexType.FunctionCall, 'invalid vertex type for onlyLoopsOnce');
29
+ (0, assert_1.guard)(vertex_1.FunctionCallVertex.is(vertex), 'invalid vertex type for onlyLoopsOnce');
30
30
  (0, assert_1.guard)(vertex.origin !== 'unnamed' && exports.loopyFunctions.has(vertex.origin[0]), 'onlyLoopsOnce can only be called with loops');
31
31
  // 1. In case of for loop, check if vector has only one element
32
32
  if (vertex.origin[0] === built_in_proc_name_1.BuiltInProcName.ForLoop) {
@@ -44,7 +44,7 @@ function sliceDiffAnsi(slice, normalized, criteriaIds, originalCode) {
44
44
  for (const { selected, location } of importantLocations) {
45
45
  const [sl, sc, , ec] = location;
46
46
  const line = lines[sl - 1];
47
- lines[sl - 1] = `${line.substring(0, sc - 1)}${ansi_1.ansiFormatter.reset()}${highlight(line.substring(sc - 1, ec), selected)}${grayOut()}${line.substring(ec)}`;
47
+ lines[sl - 1] = `${line.slice(0, Math.max(0, sc - 1))}${ansi_1.ansiFormatter.reset()}${highlight(line.slice(Math.max(0, sc - 1), ec), selected)}${grayOut()}${line.slice(Math.max(0, ec))}`;
48
48
  }
49
49
  return `${grayOut()}${lines.join('\n')}${ansi_1.ansiFormatter.reset()}`;
50
50
  }
@@ -86,7 +86,7 @@ function topologicallyInsertDecoratorElements(decoratorsOfLastOthers, stepMap, v
86
86
  let changed = true;
87
87
  while (changed) {
88
88
  changed = false;
89
- for (const elem of [...decoratorsOfLastOthers]) {
89
+ for (const elem of decoratorsOfLastOthers) {
90
90
  const step = stepMap.get(elem);
91
91
  if (allDependenciesAreVisited(step, visited)) {
92
92
  decoratorsOfLastOthers.delete(elem);
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findAllClusters = findAllClusters;
4
4
  const edge_1 = require("./graph/edge");
5
- const vertex_1 = require("./graph/vertex");
6
5
  const assert_1 = require("../util/assert");
6
+ const vertex_1 = require("./graph/vertex");
7
7
  /**
8
8
  * Find all clusters in the given dataflow graph.
9
9
  */
@@ -56,7 +56,7 @@ function makeCluster(graph, from, notReached, incoming) {
56
56
  }
57
57
  }
58
58
  // cluster function def exit points
59
- if (info.tag === vertex_1.VertexType.FunctionDefinition) {
59
+ if (vertex_1.FunctionDefinitionVertex.is(info)) {
60
60
  for (const { nodeId } of info.exitPoints) {
61
61
  reach(nodeId);
62
62
  }
@@ -76,7 +76,7 @@ function weakenName(env, name, cds) {
76
76
  current.cache?.delete(plainName);
77
77
  }
78
78
  }
79
- current = current.parent;
79
+ current = current.writableParent;
80
80
  }
81
81
  }
82
82
  /** attaches `cds` to every user definition in the current frame, except the re-defined names */
@@ -28,7 +28,14 @@ export declare enum ArgProp {
28
28
  * the result is one of this argument's values, like `choices` in `match.arg(arg, choices)`. The bounding
29
29
  * argument of a {@link CallProp.Narrows} call; without one such a call yields a value of its own making.
30
30
  */
31
- Bounds = 1024
31
+ Bounds = 1024,
32
+ /**
33
+ * only atomic data works here, never a closure, as with `e1` in `e1 > e2`. A bare symbol in such an
34
+ * argument therefore names a variable even when a function of that name is in scope.
35
+ */
36
+ Atomic = 2048,
37
+ /** the open handle the call acts on, like `con` in `close(con)` */
38
+ Handle = 4096
32
39
  }
33
40
  /**
34
41
  * What the call as a whole does, as a bitmask. The resource bits ({@link CallProp.File} and its neighbors)
@@ -102,7 +109,9 @@ export declare enum CallProp {
102
109
  /** yields the paths it matches at run time rather than one it was handed (`list.files`, `Sys.glob`); empty is an answer */
103
110
  Glob = 33554432,
104
111
  /** hands back what the program was invoked with, as `commandArgs` and the option parsers built on it do */
105
- CommandLine = 67108864
112
+ CommandLine = 67108864,
113
+ /** hands back a handle the program is expected to close again, like `file` or `DBI::dbConnect` */
114
+ Opens = 134217728
106
115
  }
107
116
  /**
108
117
  * The {@link CallProp} bits that state an effect beyond computing a result, so no {@link CallProp.Pure}
@@ -158,6 +167,8 @@ export declare const FnSig: {
158
167
  /** The positions carrying any of the given roles; see {@link argsWith}. */
159
168
  readonly posWith: typeof argsWith;
160
169
  };
170
+ /** What a call states about itself, as words rather than as a bit mask, for anything showing it to a reader. */
171
+ export declare function callPropWords(props: CallProps | undefined): string[];
161
172
  /**
162
173
  * Semantics of a built-in that hold no matter which processor handles the call. The remaining facts already
163
174
  * have a home: the exit behavior in `cfg`, whether flowR can fold the call in the `evalHandler` of the
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DispatchCallees = exports.FnSig = exports.PropagatedProps = exports.FileInputProps = exports.SigDbInferable = exports.InputProps = exports.ExclusiveCallProps = exports.ImpureProps = exports.CallProp = exports.ArgProp = void 0;
4
+ exports.callPropWords = callPropWords;
4
5
  exports.fnInfoFromSignature = fnInfoFromSignature;
5
6
  /**
6
7
  * What a single argument of a call is used for, as a bitmask.
@@ -33,6 +34,13 @@ var ArgProp;
33
34
  * argument of a {@link CallProp.Narrows} call; without one such a call yields a value of its own making.
34
35
  */
35
36
  ArgProp[ArgProp["Bounds"] = 1024] = "Bounds";
37
+ /**
38
+ * only atomic data works here, never a closure, as with `e1` in `e1 > e2`. A bare symbol in such an
39
+ * argument therefore names a variable even when a function of that name is in scope.
40
+ */
41
+ ArgProp[ArgProp["Atomic"] = 2048] = "Atomic";
42
+ /** the open handle the call acts on, like `con` in `close(con)` */
43
+ ArgProp[ArgProp["Handle"] = 4096] = "Handle";
36
44
  })(ArgProp || (exports.ArgProp = ArgProp = {}));
37
45
  /**
38
46
  * What the call as a whole does, as a bitmask. The resource bits ({@link CallProp.File} and its neighbors)
@@ -108,6 +116,8 @@ var CallProp;
108
116
  CallProp[CallProp["Glob"] = 33554432] = "Glob";
109
117
  /** hands back what the program was invoked with, as `commandArgs` and the option parsers built on it do */
110
118
  CallProp[CallProp["CommandLine"] = 67108864] = "CommandLine";
119
+ /** hands back a handle the program is expected to close again, like `file` or `DBI::dbConnect` */
120
+ CallProp[CallProp["Opens"] = 134217728] = "Opens";
111
121
  })(CallProp || (exports.CallProp = CallProp = {}));
112
122
  /**
113
123
  * The {@link CallProp} bits that state an effect beyond computing a result, so no {@link CallProp.Pure}
@@ -116,7 +126,7 @@ var CallProp;
116
126
  exports.ImpureProps = CallProp.MayPure | CallProp.Scope | CallProp.NonDet | CallProp.Random | CallProp.Ambient
117
127
  | CallProp.File | CallProp.TempFile | CallProp.Network | CallProp.Process | CallProp.Ffi | CallProp.Lang
118
128
  | CallProp.User | CallProp.Graphics | CallProp.Database | CallProp.Reads | CallProp.Writes | CallProp.Prints
119
- | CallProp.Configures | CallProp.Closes | CallProp.CommandLine;
129
+ | CallProp.Configures | CallProp.Closes | CallProp.Opens | CallProp.CommandLine;
120
130
  /**
121
131
  * Which {@link CallProp} bits rule each other out, as `[bit, everything stating it forbids]`. A definition
122
132
  * that carries the left bit must carry none of the right ones; a test checks the {@link DefaultBuiltinConfig}
@@ -165,6 +175,18 @@ exports.FnSig = {
165
175
  /** The positions carrying any of the given roles; see {@link argsWith}. */
166
176
  posWith: argsWith
167
177
  };
178
+ /** the {@link CallProp} bits as the words a reader wants, in the order they are declared */
179
+ const CallPropNames = [
180
+ [CallProp.Pure, 'pure'], [CallProp.Throws, 'can throw'], [CallProp.Invisible, 'invisible'],
181
+ [CallProp.Generic, 'generic'], [CallProp.Method, 's3 method'], [CallProp.Scope, 'changes scope'],
182
+ [CallProp.NonDet, 'non deterministic'], [CallProp.Random, 'random'], [CallProp.Ambient, 'ambient state'],
183
+ [CallProp.File, 'file system'], [CallProp.Reads, 'reads'], [CallProp.Writes, 'writes'],
184
+ [CallProp.Network, 'network'], [CallProp.Prints, 'prints']
185
+ ];
186
+ /** What a call states about itself, as words rather than as a bit mask, for anything showing it to a reader. */
187
+ function callPropWords(props) {
188
+ return props === undefined ? [] : CallPropNames.filter(([bit]) => (props & bit) !== 0).map(([, word]) => word);
189
+ }
168
190
  const layouts = new WeakMap();
169
191
  /**
170
192
  * The positional view of a {@link FnSig}, computed on first use and cached per signature object,
@@ -67,6 +67,12 @@ export interface BuiltInIdentifierDefinition extends IdentifierReference {
67
67
  /** folds a call to this function to a constant, see {@link BuiltInEvalHandlerMapper} */
68
68
  evalHandler?: BuiltInEvalHandler;
69
69
  }
70
+ /**
71
+ * Whether the definition states that the call does not evaluate some of its arguments the standard way, either
72
+ * by quoting them or by handing them a data mask. Only such a definition changes what the arguments read, so
73
+ * only it has to run in place of the default processor.
74
+ */
75
+ export declare function statesNonStandardEvaluation(definition: BuiltInIdentifierDefinition | undefined): boolean;
70
76
  export interface BuiltInIdentifierConstant<T = unknown> extends IdentifierReference {
71
77
  type: ReferenceType.BuiltInConstant;
72
78
  definedAt: BuiltIn;
@@ -103,7 +109,7 @@ export interface BuiltInEvalHandlerArgs extends ResolveInfo {
103
109
  }
104
110
  export type BuiltInEvalHandler = (args: BuiltInEvalHandlerArgs) => Value;
105
111
  declare function defaultBuiltInProcessor<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, forceArgs, readAllArguments, cfg, hasUnknownSideEffects, treatAsFnCall, markArgsAsNSE: nse, markArgsAsMasked: masked, keepArgumentOut, sig }: DefaultBuiltInProcessorConfiguration): DataflowInformation;
106
- declare function defaultBuiltInProcessorReadallArgs<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, forceArgs, markArgsAsNSE: nse, markArgsAsMasked: masked }: Pick<DefaultBuiltInProcessorConfiguration, 'useAsProcessor' | 'forceArgs' | 'markArgsAsNSE' | 'markArgsAsMasked'>): DataflowInformation;
112
+ declare function defaultBuiltInProcessorReadallArgs<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, forceArgs, markArgsAsNSE: nse, markArgsAsMasked: masked, sig }: Pick<DefaultBuiltInProcessorConfiguration, 'useAsProcessor' | 'forceArgs' | 'markArgsAsNSE' | 'markArgsAsMasked' | 'sig'>): DataflowInformation;
107
113
  export declare const BuiltInProcessorMapper: {
108
114
  readonly "builtin:acc": typeof processAccess;
109
115
  readonly "builtin:app": typeof processApply;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BuiltIns = exports.BuiltInEvalHandlerMapper = exports.BuiltInProcessorMapper = void 0;
4
+ exports.statesNonStandardEvaluation = statesNonStandardEvaluation;
4
5
  const known_call_handling_1 = require("../internal/process/functions/call/known-call-handling");
5
6
  const built_in_access_1 = require("../internal/process/functions/call/built-in/built-in-access");
6
7
  const built_in_if_then_else_1 = require("../internal/process/functions/call/built-in/built-in-if-then-else");
@@ -19,6 +20,7 @@ const built_in_expression_list_1 = require("../internal/process/functions/call/b
19
20
  const built_in_get_1 = require("../internal/process/functions/call/built-in/built-in-get");
20
21
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
21
22
  const r_symbol_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
23
+ const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
22
24
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
23
25
  const edge_1 = require("../graph/edge");
24
26
  const built_in_library_1 = require("../internal/process/functions/call/built-in/built-in-library");
@@ -55,6 +57,39 @@ const built_in_namespace_access_1 = require("../internal/process/functions/call/
55
57
  const built_in_load_1 = require("../internal/process/functions/call/built-in/built-in-load");
56
58
  const built_in_string_template_1 = require("../internal/process/functions/call/built-in/built-in-string-template");
57
59
  const built_in_props_1 = require("./built-in-props");
60
+ /**
61
+ * Whether the definition states that the call does not evaluate some of its arguments the standard way, either
62
+ * by quoting them or by handing them a data mask. Only such a definition changes what the arguments read, so
63
+ * only it has to run in place of the default processor.
64
+ */
65
+ function statesNonStandardEvaluation(definition) {
66
+ const config = definition?.config;
67
+ return config?.markArgsAsNSE !== undefined || config?.markArgsAsMasked !== undefined;
68
+ }
69
+ /**
70
+ * The symbols handed to an {@link ArgProp.Atomic} argument directly: only data works there, so `id` in `id > 2`
71
+ * names a variable and not a function `id` that happens to be in scope, even though `>` may dispatch on the
72
+ * operand's class. Anything bubbling up from a nested call is left alone, that call decided it already.
73
+ */
74
+ function dataArgumentSymbols(args, sig) {
75
+ const layout = sig === undefined ? undefined : built_in_props_1.FnSig.layout(sig);
76
+ if (layout === undefined || (layout.any & built_in_props_1.ArgProp.Atomic) === 0) {
77
+ return undefined;
78
+ }
79
+ let symbols;
80
+ for (let i = 0; i < args.length; i++) {
81
+ const arg = args[i];
82
+ const prop = built_in_props_1.FnSig.propAt(layout, i);
83
+ if (arg === r_function_call_1.EmptyArgument || (prop & built_in_props_1.ArgProp.Atomic) === 0 || (prop & (built_in_props_1.ArgProp.Callee | built_in_props_1.ArgProp.Nse)) !== 0) {
84
+ continue;
85
+ }
86
+ const value = r_argument_1.RArgument.is(arg) ? arg.value : arg;
87
+ if (value !== undefined && r_symbol_1.RSymbol.is(value)) {
88
+ (symbols ??= new Set()).add(value.info.id);
89
+ }
90
+ }
91
+ return symbols;
92
+ }
58
93
  function defaultBuiltInProcessor(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, forceArgs, readAllArguments, cfg, hasUnknownSideEffects, treatAsFnCall, markArgsAsNSE: nse, markArgsAsMasked: masked, keepArgumentOut, sig }) {
59
94
  /* a signature states per argument what the individual options state for all of them at once */
60
95
  const layout = sig !== undefined ? built_in_props_1.FnSig.layout(sig) : undefined;
@@ -65,7 +100,9 @@ function defaultBuiltInProcessor(name, args, rootId, data, { useAsProcessor = bu
65
100
  const nsePositions = nsePositionsOf(nse, args.length);
66
101
  let lastEnv = data.environment;
67
102
  const { information: res, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({
68
- name, args, rootId, data, forceArgs, origin: useAsProcessor,
103
+ name, args, rootId, data, forceArgs,
104
+ origin: useAsProcessor,
105
+ nonFunction: dataArgumentSymbols(args, sig),
69
106
  /* an unevaluated argument must not read the current frame, so it is analyzed in a clean env like `quote` */
70
107
  patchData: nsePositions === undefined ? undefined : (d, index) => {
71
108
  if (nsePositions.has(index)) {
@@ -181,8 +218,10 @@ function dropQuotedReferences(res, processedArguments, nsePositions, lastEnv) {
181
218
  res.environment = lastEnv;
182
219
  }
183
220
  }
184
- function defaultBuiltInProcessorReadallArgs(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, forceArgs, markArgsAsNSE: nse, markArgsAsMasked: masked }) {
185
- const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs, origin: useAsProcessor });
221
+ function defaultBuiltInProcessorReadallArgs(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, forceArgs, markArgsAsNSE: nse, markArgsAsMasked: masked, sig }) {
222
+ const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({
223
+ name, args, rootId, data, forceArgs, origin: useAsProcessor, nonFunction: dataArgumentSymbols(args, sig)
224
+ });
186
225
  const g = information.graph;
187
226
  for (const arg of processedArguments) {
188
227
  if (arg) {