@eagleoutice/flowr 2.13.15 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/README.md +31 -37
  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/abstract-interpretation/unsupported-functions.d.ts +1 -0
  10. package/abstract-interpretation/unsupported-functions.js +1 -0
  11. package/benchmark/calibration.d.ts +12 -5
  12. package/benchmark/calibration.js +42 -14
  13. package/benchmark/slicer.d.ts +1 -1
  14. package/benchmark/slicer.js +5 -4
  15. package/benchmark/stats/size-of.js +1 -1
  16. package/benchmark/summarizer/first-phase/process.d.ts +2 -0
  17. package/benchmark/summarizer/first-phase/process.js +2 -0
  18. package/cli/common/options.d.ts +0 -31
  19. package/cli/common/options.js +1 -8
  20. package/cli/common/scripts-info.d.ts +0 -38
  21. package/cli/common/scripts-info.js +0 -8
  22. package/cli/repl/commands/repl-query.js +37 -2
  23. package/cli/repl/core.js +6 -3
  24. package/cli/repl/parser/slice-query-parser.js +1 -1
  25. package/cli/repl/print-version.js +2 -2
  26. package/config.d.ts +16 -0
  27. package/config.js +79 -0
  28. package/control-flow/control-flow-graph.d.ts +2 -0
  29. package/control-flow/control-flow-graph.js +2 -0
  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/built-in-props.d.ts +8 -1
  38. package/dataflow/environments/built-in-props.js +18 -0
  39. package/dataflow/environments/built-in.d.ts +7 -1
  40. package/dataflow/environments/built-in.js +42 -3
  41. package/dataflow/environments/default-builtin-config.d.ts +442 -10
  42. package/dataflow/environments/default-builtin-config.js +188 -18
  43. package/dataflow/environments/environment.d.ts +1 -1
  44. package/dataflow/environments/identifier.d.ts +7 -2
  45. package/dataflow/environments/identifier.js +6 -1
  46. package/dataflow/environments/query-fn-props.js +2 -2
  47. package/dataflow/environments/reference-to-maybe.js +5 -5
  48. package/dataflow/environments/resolve-by-name.d.ts +3 -0
  49. package/dataflow/environments/resolve-by-name.js +30 -5
  50. package/dataflow/environments/resolve-helper.d.ts +6 -0
  51. package/dataflow/environments/resolve-helper.js +6 -0
  52. package/dataflow/eval/resolve/alias-tracking.d.ts +5 -0
  53. package/dataflow/eval/resolve/alias-tracking.js +21 -14
  54. package/dataflow/eval/resolve/node-value.d.ts +6 -0
  55. package/dataflow/eval/resolve/node-value.js +15 -9
  56. package/dataflow/eval/resolve/resolve-argument.js +2 -2
  57. package/dataflow/eval/resolve/resolve-numbers.js +2 -2
  58. package/dataflow/eval/resolve/resolve-operators.js +4 -3
  59. package/dataflow/eval/resolve/resolve-strings.js +3 -3
  60. package/dataflow/eval/resolve/resolve-working-directory.js +2 -1
  61. package/dataflow/eval/resolve/resolve.d.ts +5 -5
  62. package/dataflow/eval/resolve/resolve.js +10 -11
  63. package/dataflow/eval/values/general.d.ts +4 -1
  64. package/dataflow/eval/values/general.js +4 -1
  65. package/dataflow/extractor.js +2 -1
  66. package/dataflow/fn/exceptions-of-function.js +5 -4
  67. package/dataflow/fn/higher-order-function.d.ts +1 -1
  68. package/dataflow/fn/higher-order-function.js +22 -2
  69. package/dataflow/graph/call-graph.d.ts +1 -1
  70. package/dataflow/graph/call-graph.js +15 -15
  71. package/dataflow/graph/df-helper.d.ts +17 -2
  72. package/dataflow/graph/df-helper.js +11 -5
  73. package/dataflow/graph/diff-dataflow-graph.js +6 -6
  74. package/dataflow/graph/edge.d.ts +27 -0
  75. package/dataflow/graph/edge.js +33 -0
  76. package/dataflow/graph/graph-helper.d.ts +4 -4
  77. package/dataflow/graph/graph-helper.js +5 -5
  78. package/dataflow/graph/graph.d.ts +11 -1
  79. package/dataflow/graph/graph.js +16 -5
  80. package/dataflow/graph/vertex.d.ts +47 -6
  81. package/dataflow/graph/vertex.js +47 -6
  82. package/dataflow/internal/linker.d.ts +1 -0
  83. package/dataflow/internal/linker.js +11 -9
  84. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
  85. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
  86. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -5
  87. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +2 -2
  88. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -7
  89. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -6
  90. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -0
  91. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +19 -18
  92. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +6 -1
  93. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
  94. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +2 -2
  95. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
  96. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -5
  97. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +1 -1
  98. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +3 -3
  99. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +3 -3
  100. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
  101. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
  102. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
  103. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +8 -2
  104. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +1 -1
  105. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +3 -3
  106. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +3 -1
  107. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +15 -12
  108. package/dataflow/internal/process/functions/call/common.d.ts +9 -1
  109. package/dataflow/internal/process/functions/call/common.js +17 -6
  110. package/dataflow/internal/process/functions/call/deferred.d.ts +7 -0
  111. package/dataflow/internal/process/functions/call/deferred.js +24 -1
  112. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -1
  113. package/dataflow/internal/process/functions/call/known-call-handling.js +6 -3
  114. package/dataflow/internal/process/functions/call/named-call-handling.js +44 -12
  115. package/dataflow/internal/process/functions/call/nse.d.ts +34 -5
  116. package/dataflow/internal/process/functions/call/nse.js +114 -6
  117. package/dataflow/internal/process/functions/call/quoted.d.ts +6 -0
  118. package/dataflow/internal/process/functions/call/quoted.js +26 -11
  119. package/dataflow/origin/dfg-get-origin.d.ts +1 -0
  120. package/dataflow/origin/dfg-get-origin.js +9 -6
  121. package/documentation/data/faq/faqs.js +88 -88
  122. package/documentation/data/faq/recommended-configs.js +1 -1
  123. package/documentation/data/faq/wiki-faq-store.js +1 -1
  124. package/documentation/doc-capabilities.js +1 -1
  125. package/documentation/doc-readme.js +1 -1
  126. package/documentation/doc-util/doc-auto-gen.js +6 -2
  127. package/documentation/doc-util/doc-functions.js +1 -1
  128. package/documentation/wiki-cfg.js +2 -2
  129. package/documentation/wiki-create-linting-rules.js +45 -45
  130. package/documentation/wiki-dataflow-graph.js +25 -18
  131. package/documentation/wiki-linting-and-testing.js +93 -5
  132. package/documentation/wiki-mk/doc-maker.js +1 -1
  133. package/documentation/wiki-overview.js +12 -1
  134. package/documentation/wiki-signature-database.js +3 -0
  135. package/linter/linter-format.d.ts +1 -0
  136. package/linter/linter-format.js +1 -0
  137. package/linter/rules/file-path-validity.js +1 -1
  138. package/linter/rules/function-finder-util.js +1 -1
  139. package/linter/rules/naming-convention.js +1 -1
  140. package/linter/rules/no-leaked-credentials.js +2 -1
  141. package/linter/rules/stop-with-call-arg.js +4 -4
  142. package/linter/rules/undefined-symbol-util.d.ts +1 -1
  143. package/linter/rules/undefined-symbol-util.js +5 -4
  144. package/linter/rules/undefined-symbol.js +3 -3
  145. package/linter/rules/unused-definition.js +2 -1
  146. package/package.json +35 -45
  147. package/project/context/flowr-analyzer-environment-context.d.ts +23 -0
  148. package/project/context/flowr-analyzer-environment-context.js +25 -0
  149. package/project/dependency-version-space.js +1 -2
  150. package/project/flowr-analyzer.js +1 -1
  151. package/project/plugins/file-plugins/files/flowr-rda-file.js +3 -3
  152. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
  153. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +3 -1
  154. package/project/sigdb/build.js +16 -16
  155. package/project/sigdb/codec.d.ts +1 -1
  156. package/project/sigdb/codec.js +13 -13
  157. package/project/sigdb/decompress.d.ts +1 -1
  158. package/project/sigdb/decompress.js +33 -33
  159. package/project/sigdb/index-format.js +2 -2
  160. package/project/sigdb/manifest.js +21 -21
  161. package/project/sigdb/memory-source.d.ts +64 -0
  162. package/project/sigdb/memory-source.js +133 -0
  163. package/project/sigdb/reader.js +13 -13
  164. package/queries/catalog/absint-query/absint-query-format.js +1 -1
  165. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
  166. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -2
  167. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
  168. package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
  169. package/queries/catalog/dependencies-query/link-devices.js +2 -2
  170. package/queries/catalog/does-call-query/does-call-query-executor.js +2 -1
  171. package/queries/catalog/does-call-query/does-call-query-format.js +2 -1
  172. package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -1
  173. package/queries/catalog/input-sources-query/simple-input-classifier.js +4 -4
  174. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -1
  175. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -1
  176. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +1 -1
  177. package/queries/catalog/location-map-query/location-map-query-format.js +2 -2
  178. package/queries/catalog/origin-query/origin-query-format.js +1 -1
  179. package/queries/catalog/provenance-query/provenance-query-format.js +1 -1
  180. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
  181. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
  182. package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -0
  183. package/queries/catalog/signature-query/signature-query-executor.js +3 -2
  184. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
  185. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
  186. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +3 -3
  187. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
  188. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
  189. package/r-bridge/retriever.d.ts +2 -1
  190. package/r-bridge/retriever.js +3 -2
  191. package/r-bridge/roxygen2/documentation-provider.d.ts +1 -0
  192. package/r-bridge/roxygen2/documentation-provider.js +1 -0
  193. package/r-bridge/roxygen2/roxygen-parse.d.ts +1 -1
  194. package/r-bridge/roxygen2/roxygen-parse.js +1 -1
  195. package/search/flowr-search-filters.d.ts +1 -1
  196. package/search/flowr-search-filters.js +2 -2
  197. package/search/search-executor/search-enrichers.js +4 -4
  198. package/search/search-executor/search-generators.js +1 -1
  199. package/slicing/criterion/parse.d.ts +1 -0
  200. package/slicing/criterion/parse.js +4 -3
  201. package/slicing/static/slice-call.d.ts +1 -1
  202. package/slicing/static/slice-call.js +2 -2
  203. package/slicing/static/static-slicer.js +4 -3
  204. package/util/assert.js +1 -1
  205. package/util/log.d.ts +4 -1
  206. package/util/log.js +15 -2
  207. package/util/logic.js +2 -2
  208. package/util/mermaid/cfg.js +1 -1
  209. package/util/mermaid/dfg.js +6 -6
  210. package/util/mermaid/mermaid.js +3 -1
  211. package/util/quads.js +19 -6
  212. package/util/r-version.d.ts +2 -0
  213. package/util/r-version.js +2 -0
  214. package/util/record.d.ts +1 -0
  215. package/util/record.js +1 -0
  216. package/util/schema.js +2 -2
  217. package/util/text/ansi.d.ts +2 -0
  218. package/util/text/ansi.js +8 -0
  219. package/util/text/name-rank.d.ts +29 -0
  220. package/util/text/name-rank.js +39 -0
  221. package/util/text/url-encoding.d.ts +15 -0
  222. package/util/text/url-encoding.js +59 -0
  223. package/util/version.js +1 -1
  224. package/cli/export-quads-app.d.ts +0 -7
  225. package/cli/export-quads-app.js +0 -44
@@ -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
  }
@@ -28,7 +28,12 @@ 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
32
37
  }
33
38
  /**
34
39
  * What the call as a whole does, as a bitmask. The resource bits ({@link CallProp.File} and its neighbors)
@@ -158,6 +163,8 @@ export declare const FnSig: {
158
163
  /** The positions carrying any of the given roles; see {@link argsWith}. */
159
164
  readonly posWith: typeof argsWith;
160
165
  };
166
+ /** What a call states about itself, as words rather than as a bit mask, for anything showing it to a reader. */
167
+ export declare function callPropWords(props: CallProps | undefined): string[];
161
168
  /**
162
169
  * Semantics of a built-in that hold no matter which processor handles the call. The remaining facts already
163
170
  * 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,11 @@ 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";
36
42
  })(ArgProp || (exports.ArgProp = ArgProp = {}));
37
43
  /**
38
44
  * What the call as a whole does, as a bitmask. The resource bits ({@link CallProp.File} and its neighbors)
@@ -165,6 +171,18 @@ exports.FnSig = {
165
171
  /** The positions carrying any of the given roles; see {@link argsWith}. */
166
172
  posWith: argsWith
167
173
  };
174
+ /** the {@link CallProp} bits as the words a reader wants, in the order they are declared */
175
+ const CallPropNames = [
176
+ [CallProp.Pure, 'pure'], [CallProp.Throws, 'can throw'], [CallProp.Invisible, 'invisible'],
177
+ [CallProp.Generic, 'generic'], [CallProp.Method, 's3 method'], [CallProp.Scope, 'changes scope'],
178
+ [CallProp.NonDet, 'non deterministic'], [CallProp.Random, 'random'], [CallProp.Ambient, 'ambient state'],
179
+ [CallProp.File, 'file system'], [CallProp.Reads, 'reads'], [CallProp.Writes, 'writes'],
180
+ [CallProp.Network, 'network'], [CallProp.Prints, 'prints']
181
+ ];
182
+ /** What a call states about itself, as words rather than as a bit mask, for anything showing it to a reader. */
183
+ function callPropWords(props) {
184
+ return props === undefined ? [] : CallPropNames.filter(([bit]) => (props & bit) !== 0).map(([, word]) => word);
185
+ }
168
186
  const layouts = new WeakMap();
169
187
  /**
170
188
  * 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) {