@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
@@ -6,6 +6,7 @@ const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-
6
6
  const identifier_1 = require("../../../dataflow/environments/identifier");
7
7
  const parse_1 = require("../../../slicing/criterion/parse");
8
8
  const expand_library_internals_1 = require("../call-graph-query/expand-library-internals");
9
+ const graph_1 = require("../../../dataflow/graph/graph");
9
10
  /**
10
11
  * Execute does call queries on the given analyzer.
11
12
  */
@@ -97,7 +98,7 @@ function findCallersMatchingConstraints(cg, start, constraints, expandDeps) {
97
98
  if (constraints(vtx, cg)) {
98
99
  return { call: start };
99
100
  }
100
- for (const out of cg.outgoingEdges(cur) ?? []) {
101
+ for (const out of cg.outgoingEdges(cur) ?? graph_1.NoEdges) {
101
102
  toVisit.push(out[0]);
102
103
  }
103
104
  }
@@ -173,10 +173,10 @@ class InputClassifier {
173
173
  if (vtx === undefined) {
174
174
  return;
175
175
  }
176
- else if (vtx.tag === vertex_1.VertexType.FunctionDefinition) {
176
+ else if (vertex_1.FunctionDefinitionVertex.is(vtx)) {
177
177
  yield vtx.id;
178
178
  }
179
- else if (vtx.tag === vertex_1.VertexType.VariableDefinition) {
179
+ else if (vertex_1.VariableDefinitionVertex.is(vtx)) {
180
180
  for (const source of vtx.source ?? []) {
181
181
  yield* this.functionDefinitionsAt(source, depth + 1);
182
182
  }
@@ -538,7 +538,7 @@ class InputClassifier {
538
538
  acc.allPure = false;
539
539
  }
540
540
  // if this is a variable definition that is a parameter, classify as Parameter
541
- if (v.tag === vertex_1.VertexType.VariableDefinition && this.dfg.idMap?.get(v.id)?.info.role === "param-n" /* RoleInParent.ParameterName */) {
541
+ if (vertex_1.VariableDefinitionVertex.is(v) && this.dfg.idMap?.get(v.id)?.info.role === "param-n" /* RoleInParent.ParameterName */) {
542
542
  acc.types.push(this.matchWholeLinkedObject(v.id)?.type ?? input_types_1.InputType.Parameter);
543
543
  acc.values.push(undefined);
544
544
  return;
@@ -657,7 +657,7 @@ function classifyInput(id, dfg, config, fullDfg, packages) {
657
657
  return [];
658
658
  }
659
659
  const c = new InputClassifier(dfg, config, fullDfg, packages);
660
- if (vtx.tag === vertex_1.VertexType.FunctionCall) {
660
+ if (vertex_1.FunctionCallVertex.is(vtx)) {
661
661
  const ret = [];
662
662
  const args = vtx.args;
663
663
  for (const arg of args) {
@@ -25,7 +25,8 @@ async function executeExceptionQuery({ analyzer }, queries) {
25
25
  '.meta': {
26
26
  timing: Date.now() - start
27
27
  },
28
- exceptions: result
28
+ /* collecting walks whatever the call graph holds, reporting stays with the definitions someone wrote */
29
+ exceptions: Object.fromEntries(Object.entries(result).filter(([id]) => query_function_filter_1.QueryFunctionFilter.written(id)))
29
30
  };
30
31
  }
31
32
  //# sourceMappingURL=inspect-exception-query-executor.js.map
@@ -13,6 +13,7 @@ async function executeHigherOrderQuery({ analyzer }, queries) {
13
13
  const filterFor = await query_function_filter_1.QueryFunctionFilter.criteria(queries, analyzer);
14
14
  const graph = (await analyzer.dataflow()).graph;
15
15
  const fns = graph.verticesOfType(vertex_1.VertexType.FunctionDefinition)
16
+ .filter(([id]) => query_function_filter_1.QueryFunctionFilter.written(id))
16
17
  .filter(([, v]) => filterFor.size === 0 || filterFor.has(v.id));
17
18
  let invertedGraph;
18
19
  if (filterFor.size === 0 || filterFor.size > 10) {
@@ -0,0 +1,6 @@
1
+ import type { InspectStrictnessQuery, InspectStrictnessQueryResult } from './inspect-strictness-query-format';
2
+ import type { BasicQueryData } from '../../base-query-format';
3
+ /**
4
+ * Execute strictness inspection queries on the given analyzer.
5
+ */
6
+ export declare function executeStrictnessQuery({ analyzer }: BasicQueryData, queries: readonly InspectStrictnessQuery[]): Promise<InspectStrictnessQueryResult>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeStrictnessQuery = executeStrictnessQuery;
4
+ const vertex_1 = require("../../../dataflow/graph/vertex");
5
+ const strict_function_1 = require("../../../dataflow/fn/strict-function");
6
+ const query_function_filter_1 = require("../../query-function-filter");
7
+ /**
8
+ * Execute strictness inspection queries on the given analyzer.
9
+ */
10
+ async function executeStrictnessQuery({ analyzer }, queries) {
11
+ const start = Date.now();
12
+ const filterFor = await query_function_filter_1.QueryFunctionFilter.criteria(queries, analyzer);
13
+ const graph = (await analyzer.dataflow()).graph;
14
+ const fns = graph.verticesOfType(vertex_1.VertexType.FunctionDefinition)
15
+ .filter(([id]) => query_function_filter_1.QueryFunctionFilter.written(id))
16
+ .filter(([id]) => filterFor.size === 0 || filterFor.has(id))
17
+ .map(([id]) => id);
18
+ return {
19
+ '.meta': {
20
+ timing: Date.now() - start
21
+ },
22
+ strictness: (0, strict_function_1.strictnessOfFunctions)(fns, graph, analyzer.inspectContext())
23
+ };
24
+ }
25
+ //# sourceMappingURL=inspect-strictness-query-executor.js.map
@@ -0,0 +1,31 @@
1
+ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
2
+ import Joi from 'joi';
3
+ import type { ParsedQueryLine } from '../../query';
4
+ import { executeStrictnessQuery } from './inspect-strictness-query-executor';
5
+ import { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
6
+ import type { SlicingCriterion } from '../../../slicing/criterion/parse';
7
+ import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
8
+ import type { FlowrConfig } from '../../../config';
9
+ import type { FunctionStrictness } from '../../../dataflow/fn/strict-function';
10
+ /**
11
+ * Either returns all function definitions alongside whether they are strict,
12
+ * or just those matching the filters.
13
+ */
14
+ export interface InspectStrictnessQuery extends BaseQueryFormat {
15
+ readonly type: 'inspect-strictness';
16
+ readonly filter?: SlicingCriterion[];
17
+ }
18
+ export interface InspectStrictnessQueryResult extends BaseQueryResult {
19
+ readonly strictness: Record<NodeId, FunctionStrictness>;
20
+ }
21
+ declare function inspectStrictLineParser(output: ReplOutput, line: readonly string[], _config: FlowrConfig): ParsedQueryLine<'inspect-strictness'>;
22
+ export declare const InspectStrictnessQueryDefinition: {
23
+ readonly title: "Inspect Strict Functions Query";
24
+ readonly executor: typeof executeStrictnessQuery;
25
+ readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, processed: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
26
+ readonly fromLine: typeof inspectStrictLineParser;
27
+ readonly syntax: "@inspect-strictness [(<crit>;...)] <code | file://path>";
28
+ readonly schema: Joi.ObjectSchema<any>;
29
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
30
+ };
31
+ export {};
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.InspectStrictnessQueryDefinition = void 0;
7
+ const ansi_1 = require("../../../util/text/ansi");
8
+ const joi_1 = __importDefault(require("joi"));
9
+ const inspect_strictness_query_executor_1 = require("./inspect-strictness-query-executor");
10
+ const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
11
+ const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parser");
12
+ const range_1 = require("../../../util/range");
13
+ const logic_1 = require("../../../util/logic");
14
+ function inspectStrictLineParser(output, line, _config) {
15
+ const criteria = (0, slice_query_parser_1.sliceCriteriaParser)(line[0]);
16
+ return {
17
+ query: {
18
+ type: 'inspect-strictness',
19
+ filter: criteria
20
+ },
21
+ rCode: (0, slice_query_parser_1.queryLineCode)(line, criteria ? 1 : 0)
22
+ };
23
+ }
24
+ /** How a verdict reads in a sentence, `always`, `never`, or `conditionally` strict. */
25
+ function phrase(value) {
26
+ return value === logic_1.Ternary.Maybe ? 'conditionally' : value;
27
+ }
28
+ exports.InspectStrictnessQueryDefinition = {
29
+ title: 'Inspect Strict Functions Query',
30
+ executor: inspect_strictness_query_executor_1.executeStrictnessQuery,
31
+ asciiSummarizer: async (formatter, processed, queryResults, result) => {
32
+ const out = queryResults;
33
+ result.push(`Query: ${(0, ansi_1.bold)('inspect-strictness', formatter)} (${out['.meta'].timing.toFixed(0)}ms)`);
34
+ const idMap = (await processed.normalize()).idMap;
35
+ for (const [id, info] of Object.entries(out.strictness)) {
36
+ const node = idMap.get(node_id_1.NodeId.normalize(id));
37
+ const loc = node ? range_1.SourceLocation.fromNode(node) : undefined;
38
+ const params = Object.entries(info.parameters)
39
+ .map(([param, value]) => `${idMap.get(node_id_1.NodeId.normalize(param))?.lexeme ?? param}: ${phrase(value)}`)
40
+ .join(', ');
41
+ result.push(` - Function ${(0, ansi_1.bold)(id, formatter)} (${range_1.SourceLocation.format(loc)}) is ${phrase(info.strict)} strict${params.length > 0 ? ` (${params})` : ''}`);
42
+ }
43
+ return true;
44
+ },
45
+ fromLine: inspectStrictLineParser,
46
+ syntax: '@inspect-strictness [(<crit>;...)] <code | file://path>',
47
+ schema: joi_1.default.object({
48
+ type: joi_1.default.string().valid('inspect-strictness').required().description('The type of the query.'),
49
+ filter: joi_1.default.array().items(joi_1.default.string().required()).optional().description('If given, only function definitions that match one of the given slicing criteria are considered. Each criterion can be either `line:column`, `line@variable-name`, or `$id`, where the latter directly specifies the node id of the function definition to be considered.')
50
+ }).description('Either returns all function definitions alongside whether they are strict, or just those matching the filters.'),
51
+ flattenInvolvedNodes: (queryResults) => {
52
+ const out = queryResults;
53
+ return Object.keys(out.strictness).filter(id => out.strictness[id].strict === logic_1.Ternary.Always);
54
+ }
55
+ };
56
+ //# sourceMappingURL=inspect-strictness-query-format.js.map
@@ -46,7 +46,7 @@ exports.LocationMapQueryDefinition = {
46
46
  for (const [id, file] of Object.entries(out.map.files)) {
47
47
  result.push(` ╰ ${id}: \`${file}\``);
48
48
  }
49
- result.push(` ╰ Id List: {${(0, query_print_1.summarizeIdsIfTooLong)(formatter, [...Object.keys(out.map.ids)])}}`);
49
+ result.push(` ╰ Id List: {${(0, query_print_1.summarizeIdsIfTooLong)(formatter, Object.keys(out.map.ids))}}`);
50
50
  return true;
51
51
  },
52
52
  fromLine: locationMapLineParser,
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fingerPrintOfQuery = fingerPrintOfQuery;
4
4
  exports.executeResolveValueQuery = executeResolveValueQuery;
5
5
  const log_1 = require("../../../util/log");
6
- const alias_tracking_1 = require("../../../dataflow/eval/resolve/alias-tracking");
7
6
  const parse_1 = require("../../../slicing/criterion/parse");
7
+ const resolve_helper_1 = require("../../../dataflow/environments/resolve-helper");
8
8
  /**
9
9
  * Naive fingerprint to filter out duplicate queries.
10
10
  */
@@ -26,7 +26,7 @@ async function executeResolveValueQuery({ analyzer }, queries) {
26
26
  }
27
27
  const values = query.criteria
28
28
  .map(criteria => parse_1.SlicingCriterion.parse(criteria, idMap))
29
- .flatMap(ident => (0, alias_tracking_1.resolveIdToValue)(ident, { graph, full: true, idMap, resolve: analyzer.flowrConfig.solver.variables, ctx: analyzer.inspectContext() }));
29
+ .flatMap(ident => resolve_helper_1.Resolve.toValue(ident, { graph, full: true, idMap, resolve: analyzer.flowrConfig.solver.variables, ctx: analyzer.inspectContext() }));
30
30
  results[key] = {
31
31
  values: values
32
32
  };
@@ -13,6 +13,8 @@ export declare function cranMirrorSourceUrl(pkg: string, version: string | undef
13
13
  * is unknown.
14
14
  */
15
15
  export declare function rSourceRef(version: string | undefined): string;
16
+ /** deep-link a base-R definition into the R sources mirror at the release series of `version` */
17
+ export declare function rSourceUrl(pkg: string, version: string | undefined, file: string, line?: number): string;
16
18
  /** best-effort rdrr.io documentation link: `/r/<pkg>/<fn>` for base R, `/cran/<pkg>/man/<fn>` for CRAN */
17
19
  export declare function rdrrDocUrl(pkg: string, fn: string, opts: {
18
20
  base: boolean;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cranPageUrl = cranPageUrl;
4
4
  exports.cranMirrorSourceUrl = cranMirrorSourceUrl;
5
5
  exports.rSourceRef = rSourceRef;
6
+ exports.rSourceUrl = rSourceUrl;
6
7
  exports.rdrrDocUrl = rdrrDocUrl;
7
8
  exports.signatureFunctionInfo = signatureFunctionInfo;
8
9
  exports.signaturePackageInfo = signaturePackageInfo;
@@ -15,12 +16,12 @@ const schema_1 = require("../../../project/sigdb/schema");
15
16
  const attached_packages_1 = require("../../../project/attached-packages");
16
17
  const manifest_1 = require("../../../project/sigdb/manifest");
17
18
  const query_fn_props_1 = require("../../../dataflow/environments/query-fn-props");
18
- const resolve_by_name_1 = require("../../../dataflow/environments/resolve-by-name");
19
19
  const built_in_props_1 = require("../../../dataflow/environments/built-in-props");
20
20
  const identifier_1 = require("../../../dataflow/environments/identifier");
21
21
  const r_version_1 = require("../../../util/r-version");
22
22
  const r_base_packages_1 = require("../../../util/r-base-packages");
23
23
  const mermaid_1 = require("../../../util/mermaid/mermaid");
24
+ const resolve_helper_1 = require("../../../dataflow/environments/resolve-helper");
24
25
  /** the CRAN package landing page (only meaningful for CRAN packages, not base R) */
25
26
  function cranPageUrl(pkg) {
26
27
  return `https://cran.r-project.org/package=${encodeURIComponent(pkg)}`;
@@ -219,7 +220,7 @@ function flowrOnlyFunctionInfo(env, pkg, name) {
219
220
  if (env === undefined) {
220
221
  return undefined;
221
222
  }
222
- const resolved = (0, resolve_by_name_1.resolveByName)(pkg === undefined ? name : identifier_1.Identifier.make(name, pkg), env, identifier_1.ReferenceType.Function);
223
+ const resolved = resolve_helper_1.Resolve.byNameAndType(pkg === undefined ? name : identifier_1.Identifier.make(name, pkg), env, identifier_1.ReferenceType.Function);
223
224
  const definition = resolved?.find(d => d.type === identifier_1.ReferenceType.BuiltInFunction);
224
225
  if (definition === undefined) {
225
226
  return undefined;
@@ -55,5 +55,5 @@ export declare const SliceQueryOptionsSchema: {
55
55
  * as {@link SlicingCriteria.convertAll} keeps them verbatim.
56
56
  */
57
57
  export declare function resolveSliceCriteria(criteria: SlicingCriteria, ast: NormalizedAst): NodeId[];
58
- /** Reconstruct the given `nodes` of `ast`, honoring the inlining, per-file and magic-comment options. */
58
+ /** Reconstruct the given `nodes` of `ast`, honoring the inlining, per-file, and magic-comment options. */
59
59
  export declare function reconstructSlice(ast: NormalizedAst, graph: DataflowGraph, nodes: ReadonlySet<NodeId>, options: SliceQueryOptions): ReconstructionResult;
@@ -39,7 +39,7 @@ function resolveSliceCriteria(criteria, ast) {
39
39
  }
40
40
  return ids;
41
41
  }
42
- /** Reconstruct the given `nodes` of `ast`, honoring the inlining, per-file and magic-comment options. */
42
+ /** Reconstruct the given `nodes` of `ast`, honoring the inlining, per-file, and magic-comment options. */
43
43
  function reconstructSlice(ast, graph, nodes, options) {
44
44
  const { inlineSources, inlineFull, perFile, noMagicComments } = options;
45
45
  const inlining = inlineSources || inlineFull;
@@ -1,4 +1,4 @@
1
- import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
1
+ import { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
2
2
  import type { ReadonlyFlowrAnalysisProvider } from '../project/flowr-analyzer';
3
3
  import { SlicingCriterion } from '../slicing/criterion/parse';
4
4
  /** A query that may restrict the functions it inspects to a set of slicing criteria. */
@@ -10,12 +10,18 @@ interface FunctionFilteringQuery {
10
10
  */
11
11
  export declare const QueryFunctionFilter: {
12
12
  readonly name: "QueryFunctionFilter";
13
+ /**
14
+ * Whether the definition is one the analyzed code writes. A deferred expression (`on.exit` and its
15
+ * relatives) is wrapped in a definition of its own, which carries an id no node of the ast does, and
16
+ * nobody asks about a function they never wrote.
17
+ */
18
+ readonly written: (this: void, id: NodeId) => boolean;
13
19
  /** The ids the given queries restrict themselves to; empty if at least one query wants all functions. */
14
20
  readonly criteria: (this: void, queries: readonly FunctionFilteringQuery[], analyzer: ReadonlyFlowrAnalysisProvider) => Promise<ReadonlySet<NodeId>>;
15
21
  /** The call graph together with the functions the given queries want to inspect. */
16
22
  readonly inCallGraph: (this: void, queries: readonly FunctionFilteringQuery[], analyzer: ReadonlyFlowrAnalysisProvider, onlyDefinitions?: boolean) => Promise<{
17
23
  cg: import("../dataflow/graph/call-graph").CallGraph;
18
- fns: MapIterator<[NodeId, Required<import("../dataflow/graph/vertex").DataflowGraphVertexFunctionCall | import("../dataflow/graph/vertex").DataflowGraphVertexFunctionDefinition>]>;
24
+ fns: IteratorObject<[NodeId, Required<import("../dataflow/graph/vertex").DataflowGraphVertexFunctionDefinition | import("../dataflow/graph/vertex").DataflowGraphVertexFunctionCall>], undefined, unknown>;
19
25
  }>;
20
26
  };
21
27
  export {};
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.QueryFunctionFilter = void 0;
4
+ const node_id_1 = require("../r-bridge/lang-4.x/ast/model/processing/node-id");
4
5
  const parse_1 = require("../slicing/criterion/parse");
5
6
  const vertex_1 = require("../dataflow/graph/vertex");
6
7
  /**
@@ -8,6 +9,14 @@ const vertex_1 = require("../dataflow/graph/vertex");
8
9
  */
9
10
  exports.QueryFunctionFilter = {
10
11
  name: 'QueryFunctionFilter',
12
+ /**
13
+ * Whether the definition is one the analyzed code writes. A deferred expression (`on.exit` and its
14
+ * relatives) is wrapped in a definition of its own, which carries an id no node of the ast does, and
15
+ * nobody asks about a function they never wrote.
16
+ */
17
+ written(id) {
18
+ return typeof node_id_1.NodeId.normalize(id) === 'number';
19
+ },
11
20
  /** The ids the given queries restrict themselves to; empty if at least one query wants all functions. */
12
21
  async criteria(queries, analyzer) {
13
22
  let filters = undefined;
@@ -38,7 +47,8 @@ exports.QueryFunctionFilter = {
38
47
  async inCallGraph(queries, analyzer, onlyDefinitions = true) {
39
48
  const filterFor = await exports.QueryFunctionFilter.criteria(queries, analyzer);
40
49
  const cg = await analyzer.callGraph();
41
- let fns = (onlyDefinitions || filterFor.size === 0 ? cg.verticesOfType(vertex_1.VertexType.FunctionDefinition) : cg.vertices(true));
50
+ let fns = (onlyDefinitions || filterFor.size === 0 ? cg.verticesOfType(vertex_1.VertexType.FunctionDefinition) : cg.vertices(true))
51
+ .filter(([id]) => exports.QueryFunctionFilter.written(id));
42
52
  if (filterFor.size > 0) {
43
53
  fns = fns.filter(([id]) => filterFor.has(id));
44
54
  }
@@ -31,6 +31,7 @@ import type { CommandCompletions } from '../cli/repl/core';
31
31
  import type { FilesQuery } from './catalog/files-query/files-query-format';
32
32
  import type { CallGraphQuery } from './catalog/call-graph-query/call-graph-query-format';
33
33
  import type { InspectRecursionQuery } from './catalog/inspect-recursion-query/inspect-recursion-query-format';
34
+ import type { InspectStrictnessQuery } from './catalog/inspect-strictness-query/inspect-strictness-query-format';
34
35
  import type { DoesCallQuery } from './catalog/does-call-query/does-call-query-format';
35
36
  import type { InspectExceptionQuery } from './catalog/inspect-exceptions-query/inspect-exception-query-format';
36
37
  import type { InputSourcesQuery } from './catalog/input-sources-query/input-sources-query-format';
@@ -42,7 +43,7 @@ import { type AbsintQuery } from './catalog/absint-query/absint-query-format';
42
43
  /**
43
44
  * These are all queries that can be executed from within flowR
44
45
  */
45
- export type Query = CallContextQuery | ConfigQuery | SearchQuery | DataflowQuery | DoesCallQuery | CallGraphQuery | ControlFlowQuery | DataflowLensQuery | FilesQuery | AbsintQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | DependenciesQuery | LocationMapQuery | HappensBeforeQuery | InspectExceptionQuery | InspectHigherOrderQuery | InspectRecursionQuery | ResolveValueQuery | ProjectQuery | SignatureQuery | OriginQuery | LinterQuery | ProvenanceQuery | InputSourcesQuery | DiceQuery | GuessDepVersionsQuery;
46
+ export type Query = CallContextQuery | ConfigQuery | SearchQuery | DataflowQuery | DoesCallQuery | CallGraphQuery | ControlFlowQuery | DataflowLensQuery | FilesQuery | AbsintQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | DependenciesQuery | LocationMapQuery | HappensBeforeQuery | InspectExceptionQuery | InspectHigherOrderQuery | InspectRecursionQuery | InspectStrictnessQuery | ResolveValueQuery | ProjectQuery | SignatureQuery | OriginQuery | LinterQuery | ProvenanceQuery | InputSourcesQuery | DiceQuery | GuessDepVersionsQuery;
46
47
  export type QueryArgumentsWithType<QueryType extends BaseQueryFormat['type']> = Query & {
47
48
  type: QueryType;
48
49
  };
@@ -266,6 +267,15 @@ export declare const SupportedQueries: {
266
267
  readonly schema: Joi.ObjectSchema<any>;
267
268
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
268
269
  };
270
+ readonly 'inspect-strictness': {
271
+ readonly title: "Inspect Strict Functions Query";
272
+ readonly executor: typeof import("./catalog/inspect-strictness-query/inspect-strictness-query-executor").executeStrictnessQuery;
273
+ readonly asciiSummarizer: (formatter: OutputFormatter, processed: ReadonlyFlowrAnalysisProvider<import("../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
274
+ readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"inspect-strictness">;
275
+ readonly syntax: "@inspect-strictness [(<crit>;...)] <code | file://path>";
276
+ readonly schema: Joi.ObjectSchema<any>;
277
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
278
+ };
269
279
  readonly 'resolve-value': {
270
280
  readonly title: "Resolve Value Query";
271
281
  readonly executor: typeof import("./catalog/resolve-value-query/resolve-value-query-executor").executeResolveValueQuery;
package/queries/query.js CHANGED
@@ -40,6 +40,7 @@ const fs_1 = __importDefault(require("fs"));
40
40
  const files_query_format_1 = require("./catalog/files-query/files-query-format");
41
41
  const call_graph_query_format_1 = require("./catalog/call-graph-query/call-graph-query-format");
42
42
  const inspect_recursion_query_format_1 = require("./catalog/inspect-recursion-query/inspect-recursion-query-format");
43
+ const inspect_strictness_query_format_1 = require("./catalog/inspect-strictness-query/inspect-strictness-query-format");
43
44
  const does_call_query_format_1 = require("./catalog/does-call-query/does-call-query-format");
44
45
  const inspect_exception_query_format_1 = require("./catalog/inspect-exceptions-query/inspect-exception-query-format");
45
46
  const input_sources_query_format_1 = require("./catalog/input-sources-query/input-sources-query-format");
@@ -70,6 +71,7 @@ exports.SupportedQueries = {
70
71
  'inspect-exception': inspect_exception_query_format_1.InspectExceptionQueryDefinition,
71
72
  'inspect-higher-order': inspect_higher_order_query_format_1.InspectHigherOrderQueryDefinition,
72
73
  'inspect-recursion': inspect_recursion_query_format_1.InspectRecursionQueryDefinition,
74
+ 'inspect-strictness': inspect_strictness_query_format_1.InspectStrictnessQueryDefinition,
73
75
  'resolve-value': resolve_value_query_format_1.ResolveValueQueryDefinition,
74
76
  'project': project_query_format_1.ProjectQueryDefinition,
75
77
  'signature': signature_query_format_1.SignatureQueryDefinition,
@@ -116,7 +116,7 @@ export declare const RConstant: {
116
116
  */
117
117
  readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RConstant<Info>;
118
118
  /**
119
- * A set of all types of constants in the normalized AST, i.e. number, string and logical constants.
119
+ * A set of all types of constants in the normalized AST, i.e. number, string, and logical constants.
120
120
  */
121
121
  readonly constantTypes: ReadonlySet<RType>;
122
122
  };
@@ -126,7 +126,7 @@ export declare const RConstant: {
126
126
  */
127
127
  export type RSingleNode<Info> = RComment<Info> | RSymbol<Info> | RConstant<Info> | RBreak<Info> | RNext<Info> | RLineDirective<Info>;
128
128
  /**
129
- * Represents a leaf node in the normalized AST, i.e. a node that does not have any children. This includes comment, symbol, constant, break, next and line directive nodes.
129
+ * Represents a leaf node in the normalized AST, i.e. a node that does not have any children. This includes comment, symbol, constant, break, next, and line directive nodes.
130
130
  */
131
131
  export declare const RSingleNode: {
132
132
  readonly name: "RSingleNode";
@@ -136,7 +136,7 @@ export declare const RSingleNode: {
136
136
  */
137
137
  readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RSingleNode<Info>;
138
138
  /**
139
- * A set of all types of single nodes in the normalized AST, i.e. comment, symbol, constant, break, next and line directive nodes.
139
+ * A set of all types of single nodes in the normalized AST, i.e. comment, symbol, constant, break, next, and line directive nodes.
140
140
  */
141
141
  readonly singleNodeTypes: ReadonlySet<RType>;
142
142
  };
@@ -186,7 +186,7 @@ export declare const RFunctions: {
186
186
  */
187
187
  readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RFunctions<Info>;
188
188
  /**
189
- * A set of all types of function-related nodes in the normalized AST, i.e. function definitions, function calls, parameters and arguments.
189
+ * A set of all types of function-related nodes in the normalized AST, i.e. function definitions, function calls, parameters, and arguments.
190
190
  */
191
191
  readonly functionTypes: ReadonlySet<RType>;
192
192
  };
@@ -25,12 +25,12 @@ exports.RConstant = {
25
25
  return t === type_1.RType.Number || t === type_1.RType.String || t === type_1.RType.Logical;
26
26
  },
27
27
  /**
28
- * A set of all types of constants in the normalized AST, i.e. number, string and logical constants.
28
+ * A set of all types of constants in the normalized AST, i.e. number, string, and logical constants.
29
29
  */
30
30
  constantTypes: new Set([type_1.RType.Number, type_1.RType.String, type_1.RType.Logical])
31
31
  };
32
32
  /**
33
- * Represents a leaf node in the normalized AST, i.e. a node that does not have any children. This includes comment, symbol, constant, break, next and line directive nodes.
33
+ * Represents a leaf node in the normalized AST, i.e. a node that does not have any children. This includes comment, symbol, constant, break, next, and line directive nodes.
34
34
  */
35
35
  exports.RSingleNode = {
36
36
  name: 'RSingleNode',
@@ -46,7 +46,7 @@ exports.RSingleNode = {
46
46
  return t === type_1.RType.Comment || t === type_1.RType.Symbol || exports.RConstant.constantTypes.has(t) || t === type_1.RType.Break || t === type_1.RType.Next || t === type_1.RType.LineDirective;
47
47
  },
48
48
  /**
49
- * A set of all types of single nodes in the normalized AST, i.e. comment, symbol, constant, break, next and line directive nodes.
49
+ * A set of all types of single nodes in the normalized AST, i.e. comment, symbol, constant, break, next, and line directive nodes.
50
50
  */
51
51
  singleNodeTypes: new Set([type_1.RType.Comment, type_1.RType.Symbol, type_1.RType.Break, type_1.RType.Next, type_1.RType.LineDirective, ...exports.RConstant.constantTypes])
52
52
  };
@@ -100,7 +100,7 @@ exports.RFunctions = {
100
100
  return t === type_1.RType.FunctionDefinition || t === type_1.RType.FunctionCall || t === type_1.RType.Parameter || t === type_1.RType.Argument;
101
101
  },
102
102
  /**
103
- * A set of all types of function-related nodes in the normalized AST, i.e. function definitions, function calls, parameters and arguments.
103
+ * A set of all types of function-related nodes in the normalized AST, i.e. function definitions, function calls, parameters, and arguments.
104
104
  */
105
105
  functionTypes: new Set([type_1.RType.FunctionDefinition, type_1.RType.FunctionCall, type_1.RType.Parameter, type_1.RType.Argument])
106
106
  };
@@ -84,7 +84,7 @@ exports.NodeId = {
84
84
  */
85
85
  mapBuiltInProc(proc) {
86
86
  const bi = 'builtin:';
87
- return exports.NodeId.toBuiltIn(proc.startsWith(bi) ? proc.substring(bi.length) : proc);
87
+ return exports.NodeId.toBuiltIn(proc.startsWith(bi) ? proc.slice(bi.length) : proc);
88
88
  },
89
89
  /**
90
90
  * Recovers the built-in function or operator name from a built-in id by removing the built-in prefix.
@@ -108,7 +108,7 @@ function recoverName(id, idMap) {
108
108
  */
109
109
  function recoverContent(id, graph) {
110
110
  const vertex = graph.getVertex(id);
111
- if (vertex && vertex.tag === vertex_1.VertexType.FunctionCall && vertex.name) {
111
+ if (vertex && vertex_1.FunctionCallVertex.is(vertex) && vertex.name) {
112
112
  return identifier_1.Identifier.toString(vertex.name);
113
113
  }
114
114
  const node = graph.idMap?.get(id);
@@ -116,7 +116,7 @@ function recoverContent(id, graph) {
116
116
  return undefined;
117
117
  }
118
118
  const lexeme = node.lexeme ?? node.info.fullLexeme ?? '';
119
- if (vertex?.tag === vertex_1.VertexType.Use) {
119
+ if (vertex_1.UseVertex.is(vertex)) {
120
120
  return (0, retriever_1.removeRQuotes)(lexeme);
121
121
  }
122
122
  return lexeme;
@@ -35,7 +35,7 @@ function tryNormalizeFunctionCall(data, mappedWithName) {
35
35
  // special handling when someone calls a function by string
36
36
  return parseNamedFunctionCall(data, namedSymbolContent, mappedWithName, location, content);
37
37
  }
38
- else if (namedSymbolContent.findIndex(x => x.name === type_1.RawRType.SymbolFunctionCall) < 0) {
38
+ else if (!namedSymbolContent.some(x => x.name === type_1.RawRType.SymbolFunctionCall)) {
39
39
  parser_1.parseLog.trace(`is not named function call, as the name is not of type ${type_1.RType.FunctionCall}, but: ${namedSymbolContent.map(n => n.name).join(',')}`);
40
40
  return tryParseUnnamedFunctionCall(data, mappedWithName, location, content);
41
41
  }
@@ -27,7 +27,7 @@ function tryNormalizeFunctionDefinition(data, mappedWithName) {
27
27
  (0, assert_1.guard)(closingParenIndex !== -1, () => `expected closing parenthesis, yet received ${JSON.stringify(mappedWithName)}`);
28
28
  const splitParameters = (0, arrays_1.splitArrayOn)(mappedWithName.slice(2, closingParenIndex), x => x.name === type_1.RawRType.Comma);
29
29
  const parameters = splitParameters.map(x => (0, normalize_parameter_1.tryNormalizeParameter)(data, x));
30
- if (parameters.some(p => p === undefined)) {
30
+ if (parameters.includes(undefined)) {
31
31
  parser_1.parseLog.error(`function had unexpected unknown parameters: ${JSON.stringify(parameters.filter(assert_1.isNotUndefined))}, aborting.`);
32
32
  return undefined;
33
33
  }
@@ -70,7 +70,8 @@ export declare function retrieveParseDataFromRCode(request: RParseRequest, shell
70
70
  /**
71
71
  * Uses {@link retrieveParseDataFromRCode} and returns the nicely formatted object-AST.
72
72
  * If successful, allows further querying the last result with {@link retrieveNumberOfRTokensOfLastParse}.
73
- * This function is outdated and should only be used for legacy reasons. Please use the {@link FlowrAnalyzer} instead.
73
+ * This function is outdated and should only be used for legacy reasons.
74
+ * @useInstead {@link FlowrAnalyzer}
74
75
  */
75
76
  export declare function retrieveNormalizedAstFromRCode(request: RParseRequest, shell: RShell): Promise<NormalizedAst>;
76
77
  /**
@@ -50,7 +50,7 @@ function requestFromInput(input) {
50
50
  if (file) {
51
51
  return {
52
52
  request: 'file',
53
- content: content.substring(exports.fileProtocol.length),
53
+ content: content.slice(exports.fileProtocol.length),
54
54
  };
55
55
  }
56
56
  else {
@@ -148,7 +148,8 @@ function retrieveParseDataFromRCode(request, shell) {
148
148
  /**
149
149
  * Uses {@link retrieveParseDataFromRCode} and returns the nicely formatted object-AST.
150
150
  * If successful, allows further querying the last result with {@link retrieveNumberOfRTokensOfLastParse}.
151
- * This function is outdated and should only be used for legacy reasons. Please use the {@link FlowrAnalyzer} instead.
151
+ * This function is outdated and should only be used for legacy reasons.
152
+ * @useInstead {@link FlowrAnalyzer}
152
153
  */
153
154
  async function retrieveNormalizedAstFromRCode(request, shell) {
154
155
  const data = await retrieveParseDataFromRCode(request, shell);
@@ -11,5 +11,6 @@ export type Documentation = RoxygenTag | readonly RoxygenTag[];
11
11
  * Additionally, this function instruments the normalized AST to cache the parsed documentation for future queries.
12
12
  * @param idMap - The AST ID map to use for looking up nodes and traversing the AST.
13
13
  * @param nodeId - The ID of the node to get documentation for.
14
+ * @useInstead {@link RNode.documentation}
14
15
  */
15
16
  export declare function getDocumentationOf(nodeId: NodeId, idMap: AstIdMap<ParentInformation & DocumentationInfo>): Documentation | undefined;
@@ -36,6 +36,7 @@ const defaultRetriever = (c, a) => (0, roxygen_parse_1.parseRoxygenCommentsOfNod
36
36
  * Additionally, this function instruments the normalized AST to cache the parsed documentation for future queries.
37
37
  * @param idMap - The AST ID map to use for looking up nodes and traversing the AST.
38
38
  * @param nodeId - The ID of the node to get documentation for.
39
+ * @useInstead {@link RNode.documentation}
39
40
  */
40
41
  function getDocumentationOf(nodeId, idMap) {
41
42
  const node = idMap.get(nodeId);
@@ -5,7 +5,7 @@ import type { AstIdMap, ParentInformation } from '../lang-4.x/ast/model/processi
5
5
  * Parses the roxygen comments attached to a node into a RoxygenBlock AST node.
6
6
  * Will return `undefined` if there are no valid roxygen comments attached to the node.
7
7
  * Please note that this does *not* do any clever mapping of parameters or requests.
8
- * For a higher-level function that also traverses up the AST to find comments attached to parent nodes, see {@link getDocumentationOf}.
8
+ * For a higher-level function that also traverses up the AST to find comments attached to parent nodes, see {@link RNode.documentation}.
9
9
  * @param node - The node to parse the roxygen comments for
10
10
  * @param idMap - An optional id map to traverse up the AST to find comments attached to parent nodes
11
11
  */
@@ -27,7 +27,7 @@ function prepareCommentContext(commentText) {
27
27
  * Parses the roxygen comments attached to a node into a RoxygenBlock AST node.
28
28
  * Will return `undefined` if there are no valid roxygen comments attached to the node.
29
29
  * Please note that this does *not* do any clever mapping of parameters or requests.
30
- * For a higher-level function that also traverses up the AST to find comments attached to parent nodes, see {@link getDocumentationOf}.
30
+ * For a higher-level function that also traverses up the AST to find comments attached to parent nodes, see {@link RNode.documentation}.
31
31
  * @param node - The node to parse the roxygen comments for
32
32
  * @param idMap - An optional id map to traverse up the AST to find comments attached to parent nodes
33
33
  */
@@ -1,5 +1,5 @@
1
1
  import { RType } from '../r-bridge/lang-4.x/ast/model/type';
2
- import { VertexType } from '../dataflow/graph/vertex';
2
+ import type { VertexType } from '../dataflow/graph/vertex';
3
3
  import type { ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
4
4
  import type { FlowrSearchElement } from './flowr-search';
5
5
  import type { Enrichment } from './search-executor/search-enrichers';