@eagleoutice/flowr 2.7.6 → 2.8.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 (208) hide show
  1. package/README.md +67 -64
  2. package/cli/wiki.js +1 -1
  3. package/control-flow/extract-cfg.js +3 -3
  4. package/control-flow/useless-loop.d.ts +1 -1
  5. package/control-flow/useless-loop.js +2 -2
  6. package/dataflow/cluster.js +3 -3
  7. package/dataflow/environments/built-in-config.d.ts +8 -4
  8. package/dataflow/environments/built-in.d.ts +27 -14
  9. package/dataflow/environments/built-in.js +27 -12
  10. package/dataflow/environments/default-builtin-config.d.ts +615 -3
  11. package/dataflow/environments/default-builtin-config.js +50 -15
  12. package/dataflow/environments/environment.js +3 -2
  13. package/dataflow/environments/identifier.d.ts +5 -1
  14. package/dataflow/environments/reference-to-maybe.d.ts +2 -2
  15. package/dataflow/environments/reference-to-maybe.js +23 -14
  16. package/dataflow/environments/resolve-by-name.d.ts +6 -2
  17. package/dataflow/environments/resolve-by-name.js +5 -1
  18. package/dataflow/environments/scoping.js +1 -3
  19. package/dataflow/eval/resolve/alias-tracking.js +5 -1
  20. package/dataflow/extractor.js +3 -3
  21. package/dataflow/fn/exceptions-of-function.d.ts +13 -0
  22. package/dataflow/fn/exceptions-of-function.js +47 -0
  23. package/dataflow/fn/higher-order-function.d.ts +1 -1
  24. package/dataflow/fn/higher-order-function.js +3 -3
  25. package/dataflow/fn/recursive-function.d.ts +6 -0
  26. package/dataflow/fn/recursive-function.js +32 -0
  27. package/dataflow/graph/call-graph.d.ts +10 -0
  28. package/dataflow/graph/call-graph.js +212 -0
  29. package/dataflow/graph/dataflowgraph-builder.d.ts +7 -2
  30. package/dataflow/graph/dataflowgraph-builder.js +14 -9
  31. package/dataflow/graph/diff-dataflow-graph.js +96 -2
  32. package/dataflow/graph/graph.d.ts +10 -7
  33. package/dataflow/graph/graph.js +7 -8
  34. package/dataflow/graph/vertex.d.ts +6 -3
  35. package/dataflow/hooks.d.ts +30 -0
  36. package/dataflow/hooks.js +38 -0
  37. package/dataflow/info.d.ts +28 -5
  38. package/dataflow/info.js +66 -31
  39. package/dataflow/internal/linker.d.ts +13 -3
  40. package/dataflow/internal/linker.js +163 -73
  41. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +4 -0
  42. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +7 -0
  43. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
  44. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +19 -3
  45. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +14 -0
  46. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +30 -0
  47. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -1
  48. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +24 -17
  49. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -1
  50. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +5 -1
  51. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +59 -21
  52. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -3
  53. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +34 -0
  54. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +92 -0
  55. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -0
  56. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.d.ts +21 -0
  57. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +129 -0
  58. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +16 -0
  59. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +127 -0
  60. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +5 -3
  61. package/dataflow/internal/process/functions/call/common.d.ts +13 -1
  62. package/dataflow/internal/process/functions/call/common.js +33 -2
  63. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +13 -1
  64. package/dataflow/internal/process/functions/call/known-call-handling.js +29 -3
  65. package/dataflow/internal/process/functions/call/named-call-handling.js +2 -1
  66. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +6 -4
  67. package/dataflow/internal/process/functions/process-argument.js +7 -6
  68. package/dataflow/internal/process/functions/process-parameter.js +2 -1
  69. package/dataflow/internal/process/process-named-call.d.ts +2 -2
  70. package/dataflow/internal/process/process-symbol.js +3 -2
  71. package/dataflow/internal/process/process-value.d.ts +3 -2
  72. package/dataflow/internal/process/process-value.js +8 -6
  73. package/dataflow/origin/dfg-get-origin.js +2 -1
  74. package/dataflow/origin/dfg-get-symbol-refs.js +1 -1
  75. package/documentation/doc-readme.d.ts +1 -1
  76. package/documentation/doc-readme.js +6 -6
  77. package/documentation/doc-util/doc-code.js +1 -1
  78. package/documentation/doc-util/doc-dfg.d.ts +1 -0
  79. package/documentation/doc-util/doc-dfg.js +7 -4
  80. package/documentation/doc-util/doc-query.d.ts +1 -0
  81. package/documentation/doc-util/doc-query.js +1 -1
  82. package/documentation/doc-util/doc-repl.d.ts +2 -1
  83. package/documentation/doc-util/doc-repl.js +11 -3
  84. package/documentation/wiki-analyzer.js +2 -0
  85. package/documentation/wiki-dataflow-graph.js +59 -16
  86. package/documentation/wiki-interface.js +33 -5
  87. package/documentation/wiki-mk/doc-context.d.ts +2 -1
  88. package/documentation/wiki-mk/doc-context.js +2 -2
  89. package/documentation/wiki-mk/doc-maker.js +4 -3
  90. package/documentation/wiki-normalized-ast.js +6 -0
  91. package/documentation/wiki-query.js +109 -1
  92. package/linter/linter-rules.d.ts +1 -1
  93. package/linter/rules/seeded-randomness.js +17 -12
  94. package/linter/rules/useless-loop.d.ts +1 -1
  95. package/package.json +9 -9
  96. package/project/cache/flowr-analyzer-cache.d.ts +11 -0
  97. package/project/cache/flowr-analyzer-cache.js +19 -0
  98. package/project/context/flowr-analyzer-dependencies-context.d.ts +6 -1
  99. package/project/context/flowr-analyzer-dependencies-context.js +6 -0
  100. package/project/context/flowr-analyzer-files-context.d.ts +5 -2
  101. package/project/context/flowr-analyzer-files-context.js +24 -17
  102. package/project/context/flowr-file.d.ts +9 -4
  103. package/project/context/flowr-file.js +20 -6
  104. package/project/flowr-analyzer.d.ts +11 -0
  105. package/project/flowr-analyzer.js +6 -0
  106. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +8 -0
  107. package/project/plugins/file-plugins/files/flowr-description-file.js +36 -3
  108. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +1 -1
  109. package/project/plugins/file-plugins/files/flowr-namespace-file.js +1 -1
  110. package/project/plugins/file-plugins/files/flowr-news-file.js +1 -1
  111. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +1 -1
  112. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
  113. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +4 -1
  114. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +3 -0
  115. package/project/plugins/file-plugins/{flowr-analyzer-namespace-file-plugin.d.ts → flowr-analyzer-namespace-files-plugin.d.ts} +1 -1
  116. package/project/plugins/file-plugins/{flowr-analyzer-namespace-file-plugin.js → flowr-analyzer-namespace-files-plugin.js} +4 -4
  117. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +26 -0
  118. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +39 -0
  119. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +26 -0
  120. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +39 -0
  121. package/project/plugins/flowr-analyzer-plugin-defaults.js +6 -2
  122. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +3 -13
  123. package/project/plugins/package-version-plugins/package.d.ts +1 -1
  124. package/project/plugins/package-version-plugins/package.js +3 -3
  125. package/project/plugins/plugin-registry.d.ts +4 -2
  126. package/project/plugins/plugin-registry.js +6 -2
  127. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +11 -0
  128. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +5 -2
  129. package/queries/catalog/call-context-query/call-context-query-format.d.ts +4 -12
  130. package/queries/catalog/call-graph-query/call-graph-query-executor.d.ts +6 -0
  131. package/queries/catalog/call-graph-query/call-graph-query-executor.js +21 -0
  132. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +21 -0
  133. package/queries/catalog/call-graph-query/call-graph-query-format.js +32 -0
  134. package/queries/catalog/dataflow-query/dataflow-query-executor.js +4 -3
  135. package/queries/catalog/dependencies-query/dependencies-query-executor.js +29 -3
  136. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -0
  137. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +8 -1
  138. package/queries/catalog/dependencies-query/function-info/write-functions.js +13 -0
  139. package/queries/catalog/does-call-query/does-call-query-executor.d.ts +6 -0
  140. package/queries/catalog/does-call-query/does-call-query-executor.js +100 -0
  141. package/queries/catalog/does-call-query/does-call-query-format.d.ts +51 -0
  142. package/queries/catalog/does-call-query/does-call-query-format.js +102 -0
  143. package/queries/catalog/files-query/files-query-executor.js +4 -4
  144. package/queries/catalog/files-query/files-query-format.d.ts +2 -1
  145. package/queries/catalog/files-query/files-query-format.js +18 -2
  146. package/queries/catalog/id-map-query/id-map-query-executor.js +4 -3
  147. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +18 -0
  148. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +56 -0
  149. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +34 -0
  150. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +54 -0
  151. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -3
  152. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +6 -0
  153. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +12 -0
  154. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.d.ts +6 -0
  155. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +23 -0
  156. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +28 -0
  157. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +44 -0
  158. package/queries/catalog/linter-query/linter-query-format.js +4 -1
  159. package/queries/catalog/location-map-query/location-map-query-executor.js +1 -1
  160. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +4 -3
  161. package/queries/catalog/project-query/project-query-executor.js +9 -3
  162. package/queries/catalog/project-query/project-query-format.d.ts +6 -1
  163. package/queries/catalog/project-query/project-query-format.js +35 -9
  164. package/queries/query.d.ts +34 -2
  165. package/queries/query.js +9 -0
  166. package/r-bridge/data/data.d.ts +10 -5
  167. package/r-bridge/data/data.js +11 -5
  168. package/r-bridge/lang-4.x/ast/model/model.d.ts +7 -7
  169. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -2
  170. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +2 -2
  171. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -2
  172. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +5 -2
  173. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +8 -0
  174. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -2
  175. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -2
  176. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +3 -3
  177. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -2
  178. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -2
  179. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -2
  180. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -2
  181. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -2
  182. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -2
  183. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -2
  184. package/r-bridge/lang-4.x/ast/parser/main/internal/other/normalize-comment.js +0 -1
  185. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +0 -2
  186. package/r-bridge/roxygen2/roxygen-ast.d.ts +218 -0
  187. package/r-bridge/roxygen2/roxygen-ast.js +82 -0
  188. package/r-bridge/roxygen2/roxygen-parse.d.ts +24 -0
  189. package/r-bridge/roxygen2/roxygen-parse.js +214 -0
  190. package/reconstruct/auto-select/magic-comments.js +4 -4
  191. package/slicing/static/slice-call.js +3 -4
  192. package/slicing/static/static-slicer.js +2 -2
  193. package/statistics/features/supported/defined-functions/defined-functions.js +1 -1
  194. package/util/collections/defaultmap.d.ts +3 -3
  195. package/util/mermaid/dfg.js +5 -5
  196. package/util/objects.js +1 -1
  197. package/util/r-author.d.ts +5 -0
  198. package/util/r-author.js +110 -0
  199. package/util/r-license.d.ts +10 -1
  200. package/util/r-license.js +27 -6
  201. package/util/r-version.d.ts +19 -0
  202. package/util/r-version.js +106 -0
  203. package/util/range.d.ts +6 -0
  204. package/util/range.js +7 -0
  205. package/util/simple-df/dfg-ascii.js +2 -2
  206. package/util/text/args.d.ts +9 -0
  207. package/util/text/args.js +65 -0
  208. package/util/version.js +1 -1
@@ -0,0 +1,54 @@
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.InspectExceptionQueryDefinition = void 0;
7
+ const ansi_1 = require("../../../util/text/ansi");
8
+ const joi_1 = __importDefault(require("joi"));
9
+ const inspect_exception_query_executor_1 = require("./inspect-exception-query-executor");
10
+ const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
11
+ const dfg_1 = require("../../../util/mermaid/dfg");
12
+ const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parser");
13
+ const info_1 = require("../../../dataflow/info");
14
+ function inspectExceptionLineParser(_output, line, _config) {
15
+ const criteria = (0, slice_query_parser_1.sliceCriteriaParser)(line[0]);
16
+ return {
17
+ query: {
18
+ type: 'inspect-exception',
19
+ filter: criteria
20
+ },
21
+ rCode: criteria ? line[1] : line[0]
22
+ };
23
+ }
24
+ exports.InspectExceptionQueryDefinition = {
25
+ executor: inspect_exception_query_executor_1.executeExceptionQuery,
26
+ asciiSummarizer: async (formatter, processed, queryResults, result) => {
27
+ const out = queryResults;
28
+ result.push(`Query: ${(0, ansi_1.bold)('inspect-exception', formatter)} (${out['.meta'].timing.toFixed(0)}ms)`);
29
+ const n = await processed.normalize();
30
+ function getLoc(r) {
31
+ return n.idMap.get((0, node_id_1.normalizeIdToNumberIfPossible)(r))?.location ?? undefined;
32
+ }
33
+ function getLexeme(r) {
34
+ return n.idMap.get((0, node_id_1.normalizeIdToNumberIfPossible)(r))?.lexeme ?? String(r);
35
+ }
36
+ for (const [r, v] of Object.entries(out.exceptions)) {
37
+ result.push(` - Function ${(0, ansi_1.bold)(r, formatter)} (${(0, dfg_1.formatRange)(getLoc(r))}) ${v.length > 0 ? 'throws exceptions:' : 'does not throw exceptions.'}`);
38
+ for (const { id: ex, cds } of v) {
39
+ result.push(` - Exception ${(0, info_1.happensInEveryBranch)(cds) ? 'always ' : 'maybe '}thrown at id ${(0, ansi_1.bold)(String(ex), formatter)} "${getLexeme(ex)}" (${(0, dfg_1.formatRange)(getLoc(ex))}, cds: ${cds?.map(c => c.when + ':' + (0, dfg_1.formatRange)(getLoc(c.id))).join(', ') ?? 'none'})`);
40
+ }
41
+ }
42
+ return true;
43
+ },
44
+ fromLine: inspectExceptionLineParser,
45
+ schema: joi_1.default.object({
46
+ type: joi_1.default.string().valid('inspect-exception').required().description('The type of the query.'),
47
+ 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.'),
48
+ }).description('Query to inspect which functions throw exceptions.'),
49
+ flattenInvolvedNodes: (queryResults) => {
50
+ const out = queryResults;
51
+ return Object.keys(out.exceptions).filter(id => out.exceptions[id].length > 0);
52
+ }
53
+ };
54
+ //# sourceMappingURL=inspect-exception-query-format.js.map
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeHigherOrderQuery = executeHigherOrderQuery;
4
+ const higher_order_function_1 = require("../../../dataflow/fn/higher-order-function");
4
5
  const parse_1 = require("../../../slicing/criterion/parse");
5
6
  const vertex_1 = require("../../../dataflow/graph/vertex");
6
- const higher_order_function_1 = require("../../../dataflow/fn/higher-order-function");
7
7
  /**
8
8
  * Execute higher-order function inspection queries on the given analyzer.
9
9
  */
@@ -18,7 +18,7 @@ async function executeHigherOrderQuery({ analyzer }, queries) {
18
18
  }
19
19
  else {
20
20
  filters ??= [];
21
- filters = filters.concat(filters);
21
+ filters = filters.concat(q.filter);
22
22
  }
23
23
  }
24
24
  const ast = await analyzer.normalize();
@@ -36,7 +36,7 @@ async function executeHigherOrderQuery({ analyzer }, queries) {
36
36
  .filter(([, v]) => filterFor.size === 0 || filterFor.has(v.id));
37
37
  const result = {};
38
38
  for (const [id,] of fns) {
39
- result[id] = (0, higher_order_function_1.isHigherOrder)(id, graph, analyzer.inspectContext());
39
+ result[id] = (0, higher_order_function_1.isFunctionHigherOrder)(id, graph, analyzer.inspectContext());
40
40
  }
41
41
  return {
42
42
  '.meta': {
@@ -1,8 +1,11 @@
1
1
  import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
2
2
  import Joi from 'joi';
3
+ import type { ParsedQueryLine } from '../../query';
3
4
  import { executeHigherOrderQuery } from './inspect-higher-order-query-executor';
4
5
  import { type NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
5
6
  import type { SingleSlicingCriterion } from '../../../slicing/criterion/parse';
7
+ import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
8
+ import type { FlowrConfigOptions } from '../../../config';
6
9
  /**
7
10
  * Either returns all function definitions alongside whether they are higher-order functions,
8
11
  * or just those matching the filters.
@@ -14,9 +17,12 @@ export interface InspectHigherOrderQuery extends BaseQueryFormat {
14
17
  export interface InspectHigherOrderQueryResult extends BaseQueryResult {
15
18
  readonly higherOrder: Record<NodeId, boolean>;
16
19
  }
20
+ declare function inspectHoLineParser(output: ReplOutput, line: readonly string[], _config: FlowrConfigOptions): ParsedQueryLine<'inspect-higher-order'>;
17
21
  export declare const InspectHigherOrderQueryDefinition: {
18
22
  readonly executor: typeof executeHigherOrderQuery;
19
23
  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>;
24
+ readonly fromLine: typeof inspectHoLineParser;
20
25
  readonly schema: Joi.ObjectSchema<any>;
21
26
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
22
27
  };
28
+ export {};
@@ -9,6 +9,17 @@ const joi_1 = __importDefault(require("joi"));
9
9
  const inspect_higher_order_query_executor_1 = require("./inspect-higher-order-query-executor");
10
10
  const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
11
11
  const dfg_1 = require("../../../util/mermaid/dfg");
12
+ const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parser");
13
+ function inspectHoLineParser(output, line, _config) {
14
+ const criteria = (0, slice_query_parser_1.sliceCriteriaParser)(line[0]);
15
+ return {
16
+ query: {
17
+ type: 'inspect-higher-order',
18
+ filter: criteria
19
+ },
20
+ rCode: criteria ? line[1] : line[0]
21
+ };
22
+ }
12
23
  exports.InspectHigherOrderQueryDefinition = {
13
24
  executor: inspect_higher_order_query_executor_1.executeHigherOrderQuery,
14
25
  asciiSummarizer: async (formatter, processed, queryResults, result) => {
@@ -20,6 +31,7 @@ exports.InspectHigherOrderQueryDefinition = {
20
31
  }
21
32
  return true;
22
33
  },
34
+ fromLine: inspectHoLineParser,
23
35
  schema: joi_1.default.object({
24
36
  type: joi_1.default.string().valid('inspect-higher-order').required().description('The type of the query.'),
25
37
  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.')
@@ -0,0 +1,6 @@
1
+ import type { InspectRecursionQuery, InspectRecursionQueryResult } from './inspect-recursion-query-format';
2
+ import type { BasicQueryData } from '../../base-query-format';
3
+ /**
4
+ * Execute recursion function inspection queries on the given analyzer.
5
+ */
6
+ export declare function executeRecursionQuery({ analyzer }: BasicQueryData, queries: readonly InspectRecursionQuery[]): Promise<InspectRecursionQueryResult>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeRecursionQuery = executeRecursionQuery;
4
+ const recursive_function_1 = require("../../../dataflow/fn/recursive-function");
5
+ const inspect_exception_query_executor_1 = require("../inspect-exceptions-query/inspect-exception-query-executor");
6
+ /**
7
+ * Execute recursion function inspection queries on the given analyzer.
8
+ */
9
+ async function executeRecursionQuery({ analyzer }, queries) {
10
+ const start = Date.now();
11
+ const { cg, fns } = await (0, inspect_exception_query_executor_1.getFunctionsToConsiderInCallGraph)(queries, analyzer);
12
+ const result = {};
13
+ for (const [id,] of fns) {
14
+ result[id] = (0, recursive_function_1.isFunctionRecursive)(id, cg);
15
+ }
16
+ return {
17
+ '.meta': {
18
+ timing: Date.now() - start
19
+ },
20
+ recursive: result
21
+ };
22
+ }
23
+ //# sourceMappingURL=inspect-recursion-query-executor.js.map
@@ -0,0 +1,28 @@
1
+ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
2
+ import Joi from 'joi';
3
+ import type { ParsedQueryLine } from '../../query';
4
+ import { executeRecursionQuery } from './inspect-recursion-query-executor';
5
+ import { type NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
6
+ import type { SingleSlicingCriterion } from '../../../slicing/criterion/parse';
7
+ import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
8
+ import type { FlowrConfigOptions } from '../../../config';
9
+ /**
10
+ * Either returns all function definitions alongside whether they are recursive,
11
+ * or just those matching the filters.
12
+ */
13
+ export interface InspectRecursionQuery extends BaseQueryFormat {
14
+ readonly type: 'inspect-recursion';
15
+ readonly filter?: SingleSlicingCriterion[];
16
+ }
17
+ export interface InspectRecursionQueryResult extends BaseQueryResult {
18
+ readonly recursive: Record<NodeId, boolean>;
19
+ }
20
+ declare function inspectRecLineParser(output: ReplOutput, line: readonly string[], _config: FlowrConfigOptions): ParsedQueryLine<'inspect-recursion'>;
21
+ export declare const InspectRecursionQueryDefinition: {
22
+ readonly executor: typeof executeRecursionQuery;
23
+ 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>;
24
+ readonly fromLine: typeof inspectRecLineParser;
25
+ readonly schema: Joi.ObjectSchema<any>;
26
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
27
+ };
28
+ export {};
@@ -0,0 +1,44 @@
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.InspectRecursionQueryDefinition = void 0;
7
+ const ansi_1 = require("../../../util/text/ansi");
8
+ const joi_1 = __importDefault(require("joi"));
9
+ const inspect_recursion_query_executor_1 = require("./inspect-recursion-query-executor");
10
+ const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
11
+ const dfg_1 = require("../../../util/mermaid/dfg");
12
+ const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parser");
13
+ function inspectRecLineParser(output, line, _config) {
14
+ const criteria = (0, slice_query_parser_1.sliceCriteriaParser)(line[0]);
15
+ return {
16
+ query: {
17
+ type: 'inspect-recursion',
18
+ filter: criteria
19
+ },
20
+ rCode: criteria ? line[1] : line[0]
21
+ };
22
+ }
23
+ exports.InspectRecursionQueryDefinition = {
24
+ executor: inspect_recursion_query_executor_1.executeRecursionQuery,
25
+ asciiSummarizer: async (formatter, processed, queryResults, result) => {
26
+ const out = queryResults;
27
+ result.push(`Query: ${(0, ansi_1.bold)('inspect-recursion', formatter)} (${out['.meta'].timing.toFixed(0)}ms)`);
28
+ for (const [r, v] of Object.entries(out.recursive)) {
29
+ const loc = (await processed.normalize()).idMap.get((0, node_id_1.normalizeIdToNumberIfPossible)(r))?.location ?? undefined;
30
+ result.push(` - Function ${(0, ansi_1.bold)(r, formatter)} (${(0, dfg_1.formatRange)(loc)}) is ${v ? '' : 'not '}recursive`);
31
+ }
32
+ return true;
33
+ },
34
+ fromLine: inspectRecLineParser,
35
+ schema: joi_1.default.object({
36
+ type: joi_1.default.string().valid('inspect-recursion').required().description('The type of the query.'),
37
+ 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.')
38
+ }).description('Either returns all function definitions alongside whether they are recursive, or just those matching the filters.'),
39
+ flattenInvolvedNodes: (queryResults) => {
40
+ const out = queryResults;
41
+ return Object.keys(out.recursive).filter(id => out.recursive[id]);
42
+ }
43
+ };
44
+ //# sourceMappingURL=inspect-recursion-query-format.js.map
@@ -125,6 +125,9 @@ function addLintingRuleResult(ruleName, results, result) {
125
125
  }
126
126
  }
127
127
  }
128
- result.push(` ╰ _Metadata_: ${(0, doc_code_1.codeInline)(JSON.stringify(results['.meta']))}`);
128
+ result.push(` ╰ _Metadata_: ${(0, doc_code_1.codeInline)(renderMetaData(results['.meta']))}`);
129
+ }
130
+ function renderMetaData(metadata) {
131
+ return Object.entries(metadata).map(r => `${r[0]}: ${JSON.stringify(r[1])}`).join(', ');
129
132
  }
130
133
  //# sourceMappingURL=linter-query-format.js.map
@@ -20,7 +20,7 @@ function fuzzyFindFile(node, idMap) {
20
20
  return fuzzyFindFile(parent, idMap);
21
21
  }
22
22
  }
23
- return '<inline>';
23
+ return '@inline';
24
24
  }
25
25
  /**
26
26
  * Executes a location map query
@@ -9,12 +9,13 @@ async function executeNormalizedAstQuery({ analyzer }, queries) {
9
9
  if (queries.length !== 1) {
10
10
  log_1.log.warn('Normalized-Ast query expects only up to one query, but got', queries.length);
11
11
  }
12
+ const startTime = Date.now();
13
+ const normalized = await analyzer.normalize();
12
14
  return {
13
15
  '.meta': {
14
- /* there is no sense in measuring a get */
15
- timing: 0
16
+ timing: Date.now() - startTime
16
17
  },
17
- normalized: await analyzer.normalize()
18
+ normalized
18
19
  };
19
20
  }
20
21
  //# sourceMappingURL=normalized-ast-query-executor.js.map
@@ -10,6 +10,7 @@ async function executeProjectQuery({ analyzer }, queries) {
10
10
  if (queries.length !== 1) {
11
11
  log_1.log.warn('Project query expects only up to one query, but got', queries.length);
12
12
  }
13
+ const startTime = Date.now();
13
14
  const withDf = queries.some(q => q.withDf);
14
15
  // we need to know what is considered by the analyzer
15
16
  if (withDf) {
@@ -17,16 +18,21 @@ async function executeProjectQuery({ analyzer }, queries) {
17
18
  }
18
19
  const descFile = analyzer.inspectContext().files.getFilesByRole(flowr_file_1.FileRole.Description);
19
20
  const desc = descFile[0];
21
+ const roleCounts = {};
22
+ for (const file of Object.values(flowr_file_1.FileRole)) {
23
+ roleCounts[file] = analyzer.inspectContext().files.getFilesByRole(file).length;
24
+ }
20
25
  return {
21
26
  '.meta': {
22
- /* there is no sense in measuring a get */
23
- timing: 0
27
+ timing: Date.now() - startTime
24
28
  },
29
+ name: desc?.content().get('Package')?.[0] ?? desc?.content()?.get('Title')?.[0],
25
30
  files: Array.from(analyzer.inspectContext().files.consideredFilesList()),
26
31
  authors: desc?.authors(),
27
32
  encoding: desc?.content().get('Encoding')?.[0],
28
33
  version: desc?.content().get('Version')?.[0],
29
- licenses: desc?.license()
34
+ licenses: desc?.license(),
35
+ roleCounts: roleCounts
30
36
  };
31
37
  }
32
38
  //# sourceMappingURL=project-query-executor.js.map
@@ -3,16 +3,21 @@ import { executeProjectQuery } from './project-query-executor';
3
3
  import Joi from 'joi';
4
4
  import type { RAuthorInfo } from '../../../util/r-author';
5
5
  import type { RLicenseElementInfo } from '../../../util/r-license';
6
+ import type { FileRole } from '../../../project/context/flowr-file';
6
7
  export interface ProjectQuery extends BaseQueryFormat {
7
8
  readonly type: 'project';
8
9
  /** Whether to include Dataflow information in the result. */
9
10
  readonly withDf?: boolean;
10
11
  }
11
12
  export interface ProjectQueryResult extends BaseQueryResult {
13
+ /** The name of the project, if available. */
14
+ readonly name?: string;
12
15
  /** The authors of the project. */
13
16
  readonly authors?: RAuthorInfo[];
14
17
  /** The files considered part of the project. */
15
18
  readonly files: (string | '<inline>')[];
19
+ /** The counts of files by their role in the project. */
20
+ readonly roleCounts?: Record<FileRole, number>;
16
21
  /** The licenses of the project. */
17
22
  readonly licenses?: RLicenseElementInfo[];
18
23
  /** The encoding of the project files. */
@@ -22,7 +27,7 @@ export interface ProjectQueryResult extends BaseQueryResult {
22
27
  }
23
28
  export declare const ProjectQueryDefinition: {
24
29
  readonly executor: typeof executeProjectQuery;
25
- readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
30
+ readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, analyzer: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
26
31
  readonly schema: Joi.ObjectSchema<any>;
27
32
  readonly flattenInvolvedNodes: () => never[];
28
33
  };
@@ -9,11 +9,18 @@ const ansi_1 = require("../../../util/text/ansi");
9
9
  const time_1 = require("../../../util/text/time");
10
10
  const joi_1 = __importDefault(require("joi"));
11
11
  const r_author_1 = require("../../../util/r-author");
12
+ const r_license_1 = require("../../../util/r-license");
13
+ function addSuffix(count, singular = '', plural = 's') {
14
+ return `${count === 1 ? singular : plural}`;
15
+ }
12
16
  exports.ProjectQueryDefinition = {
13
17
  executor: project_query_executor_1.executeProjectQuery,
14
- asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
18
+ asciiSummarizer: (formatter, analyzer, queryResults, result) => {
15
19
  const out = queryResults;
16
20
  result.push(`Query: ${(0, ansi_1.bold)('project', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
21
+ if (out.name) {
22
+ result.push(` ╰ Project Name: ${out.name}`);
23
+ }
17
24
  if (out.version) {
18
25
  result.push(` ╰ Version: ${out.version}`);
19
26
  }
@@ -21,23 +28,42 @@ exports.ProjectQueryDefinition = {
21
28
  result.push(` ╰ Encoding: ${out.encoding}`);
22
29
  }
23
30
  if (out.authors && out.authors.length > 0) {
24
- result.push(' ╰ Author(s):');
31
+ result.push(` ╰ Author${addSuffix(out.authors.length)}:`);
25
32
  for (const author of out.authors) {
26
33
  result.push(` ╰ ${(0, r_author_1.rAuthorInfoToReadable)(author)}`);
27
34
  }
28
35
  }
29
36
  if (out.licenses && out.licenses.length > 0) {
30
- result.push(' ╰ License(s):');
37
+ result.push(` ╰ License${addSuffix(out.licenses.length)}:`);
31
38
  for (const license of out.licenses) {
32
- result.push(` ╰ ${JSON.stringify(license)}`);
39
+ result.push(` ╰ ${(0, r_license_1.stringifyRLicense)(license)}`);
40
+ }
41
+ }
42
+ if (out.roleCounts) {
43
+ const entries = Object.entries(out.roleCounts).filter(([, count]) => count > 0);
44
+ if (entries.length > 0) {
45
+ result.push(' ╰ File Role Counts:');
46
+ const longestRole = Math.max(...entries.map(([r]) => r.length));
47
+ const longestCount = Math.max(...entries.map(([, c]) => String(c).length));
48
+ for (const [role, count] of entries) {
49
+ result.push(` ╰ ${(role + ':').padEnd(longestRole + 1, ' ')} ${formatter.format(String(count).padStart(longestCount, ' '), {
50
+ effect: ansi_1.ColorEffect.Foreground,
51
+ color: 6 /* Colors.Cyan */
52
+ })}`);
53
+ }
33
54
  }
34
55
  }
35
- result.push(` ╰ Dataflow Analysis considered ${out.files.length} file${out.files.length === 1 ? '' : 's'}`);
36
- for (const file of out.files.slice(0, 20)) {
37
- result.push(` ╰ \`${file}\``);
56
+ if (analyzer.peekDataflow() === undefined) {
57
+ result.push(formatter.format(' ╰ Dataflow Analysis not performed', { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground }));
38
58
  }
39
- if (out.files.length > 20) {
40
- result.push(` ... and ${out.files.length - 20} more files`);
59
+ else {
60
+ result.push(` Dataflow Analysis considered ${out.files.length} file${out.files.length === 1 ? '' : 's'}`);
61
+ for (const file of out.files.slice(0, 20)) {
62
+ result.push(` ╰ \`${file}\``);
63
+ }
64
+ if (out.files.length > 20) {
65
+ result.push(` ╰ ... and ${out.files.length - 20} more files`);
66
+ }
41
67
  }
42
68
  return true;
43
69
  },
@@ -29,10 +29,14 @@ import type { ReadonlyFlowrAnalysisProvider } from '../project/flowr-analyzer';
29
29
  import type { ReplOutput } from '../cli/repl/commands/repl-main';
30
30
  import type { CommandCompletions } from '../cli/repl/core';
31
31
  import type { FilesQuery } from './catalog/files-query/files-query-format';
32
+ import type { CallGraphQuery } from './catalog/call-graph-query/call-graph-query-format';
33
+ import type { InspectRecursionQuery } from './catalog/inspect-recursion-query/inspect-recursion-query-format';
34
+ import type { DoesCallQuery } from './catalog/does-call-query/does-call-query-format';
35
+ import type { InspectExceptionQuery } from './catalog/inspect-exceptions-query/inspect-exception-query-format';
32
36
  /**
33
37
  * These are all queries that can be executed from within flowR
34
38
  */
35
- export type Query = CallContextQuery | ConfigQuery | SearchQuery | DataflowQuery | ControlFlowQuery | DataflowLensQuery | FilesQuery | DfShapeQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | DependenciesQuery | LocationMapQuery | HappensBeforeQuery | InspectHigherOrderQuery | ResolveValueQuery | ProjectQuery | OriginQuery | LinterQuery;
39
+ export type Query = CallContextQuery | ConfigQuery | SearchQuery | DataflowQuery | DoesCallQuery | CallGraphQuery | ControlFlowQuery | DataflowLensQuery | FilesQuery | DfShapeQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | DependenciesQuery | LocationMapQuery | HappensBeforeQuery | InspectExceptionQuery | InspectHigherOrderQuery | InspectRecursionQuery | ResolveValueQuery | ProjectQuery | OriginQuery | LinterQuery;
36
40
  export type QueryArgumentsWithType<QueryType extends BaseQueryFormat['type']> = Query & {
37
41
  type: QueryType;
38
42
  };
@@ -86,12 +90,25 @@ export declare const SupportedQueries: {
86
90
  readonly schema: Joi.ObjectSchema<any>;
87
91
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
88
92
  };
93
+ readonly 'call-graph': {
94
+ readonly executor: typeof import("./catalog/call-graph-query/call-graph-query-executor").executeCallGraphQuery;
95
+ readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
96
+ readonly schema: Joi.ObjectSchema<any>;
97
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
98
+ };
89
99
  readonly dataflow: {
90
100
  readonly executor: typeof import("./catalog/dataflow-query/dataflow-query-executor").executeDataflowQuery;
91
101
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
92
102
  readonly schema: Joi.ObjectSchema<any>;
93
103
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
94
104
  };
105
+ readonly 'does-call': {
106
+ readonly executor: typeof import("./catalog/does-call-query/does-call-query-executor").executeDoesCallQuery;
107
+ readonly asciiSummarizer: (formatter: OutputFormatter, processed: ReadonlyFlowrAnalysisProvider<import("../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
108
+ readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfigOptions) => ParsedQueryLine<"does-call">;
109
+ readonly schema: Joi.ObjectSchema<any>;
110
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
111
+ };
95
112
  readonly 'dataflow-lens': {
96
113
  readonly executor: typeof import("./catalog/dataflow-lens-query/dataflow-lens-query-executor").executeDataflowLensQuery;
97
114
  readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
@@ -164,9 +181,24 @@ export declare const SupportedQueries: {
164
181
  readonly schema: Joi.ObjectSchema<any>;
165
182
  readonly flattenInvolvedNodes: () => never[];
166
183
  };
184
+ readonly 'inspect-exception': {
185
+ readonly executor: typeof import("./catalog/inspect-exceptions-query/inspect-exception-query-executor").executeExceptionQuery;
186
+ readonly asciiSummarizer: (formatter: OutputFormatter, processed: ReadonlyFlowrAnalysisProvider<import("../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
187
+ readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfigOptions) => ParsedQueryLine<"inspect-exception">;
188
+ readonly schema: Joi.ObjectSchema<any>;
189
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
190
+ };
167
191
  readonly 'inspect-higher-order': {
168
192
  readonly executor: typeof import("./catalog/inspect-higher-order-query/inspect-higher-order-query-executor").executeHigherOrderQuery;
169
193
  readonly asciiSummarizer: (formatter: OutputFormatter, processed: ReadonlyFlowrAnalysisProvider<import("../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
194
+ readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfigOptions) => ParsedQueryLine<"inspect-higher-order">;
195
+ readonly schema: Joi.ObjectSchema<any>;
196
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
197
+ };
198
+ readonly 'inspect-recursion': {
199
+ readonly executor: typeof import("./catalog/inspect-recursion-query/inspect-recursion-query-executor").executeRecursionQuery;
200
+ readonly asciiSummarizer: (formatter: OutputFormatter, processed: ReadonlyFlowrAnalysisProvider<import("../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
201
+ readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfigOptions) => ParsedQueryLine<"inspect-recursion">;
170
202
  readonly schema: Joi.ObjectSchema<any>;
171
203
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
172
204
  };
@@ -179,7 +211,7 @@ export declare const SupportedQueries: {
179
211
  };
180
212
  readonly project: {
181
213
  readonly executor: typeof import("./catalog/project-query/project-query-executor").executeProjectQuery;
182
- readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: ReadonlyFlowrAnalysisProvider<import("../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
214
+ readonly asciiSummarizer: (formatter: OutputFormatter, analyzer: ReadonlyFlowrAnalysisProvider<import("../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
183
215
  readonly schema: Joi.ObjectSchema<any>;
184
216
  readonly flattenInvolvedNodes: () => never[];
185
217
  };
package/queries/query.js CHANGED
@@ -36,11 +36,17 @@ const df_shape_query_format_1 = require("./catalog/df-shape-query/df-shape-query
36
36
  const inspect_higher_order_query_format_1 = require("./catalog/inspect-higher-order-query/inspect-higher-order-query-format");
37
37
  const log_1 = require("../util/log");
38
38
  const files_query_format_1 = require("./catalog/files-query/files-query-format");
39
+ const call_graph_query_format_1 = require("./catalog/call-graph-query/call-graph-query-format");
40
+ const inspect_recursion_query_format_1 = require("./catalog/inspect-recursion-query/inspect-recursion-query-format");
41
+ const does_call_query_format_1 = require("./catalog/does-call-query/does-call-query-format");
42
+ const inspect_exception_query_format_1 = require("./catalog/inspect-exceptions-query/inspect-exception-query-format");
39
43
  exports.SupportedQueries = {
40
44
  'call-context': call_context_query_format_1.CallContextQueryDefinition,
41
45
  'config': config_query_format_1.ConfigQueryDefinition,
42
46
  'control-flow': control_flow_query_format_1.ControlFlowQueryDefinition,
47
+ 'call-graph': call_graph_query_format_1.CallGraphQueryDefinition,
43
48
  'dataflow': dataflow_query_format_1.DataflowQueryDefinition,
49
+ 'does-call': does_call_query_format_1.DoesCallQueryDefinition,
44
50
  'dataflow-lens': dataflow_lens_query_format_1.DataflowLensQueryDefinition,
45
51
  'df-shape': df_shape_query_format_1.DfShapeQueryDefinition,
46
52
  'files': files_query_format_1.FilesQueryDefinition,
@@ -52,7 +58,9 @@ exports.SupportedQueries = {
52
58
  'location-map': location_map_query_format_1.LocationMapQueryDefinition,
53
59
  'search': search_query_format_1.SearchQueryDefinition,
54
60
  'happens-before': happens_before_query_format_1.HappensBeforeQueryDefinition,
61
+ 'inspect-exception': inspect_exception_query_format_1.InspectExceptionQueryDefinition,
55
62
  'inspect-higher-order': inspect_higher_order_query_format_1.InspectHigherOrderQueryDefinition,
63
+ 'inspect-recursion': inspect_recursion_query_format_1.InspectRecursionQueryDefinition,
56
64
  'resolve-value': resolve_value_query_format_1.ResolveValueQueryDefinition,
57
65
  'project': project_query_format_1.ProjectQueryDefinition,
58
66
  'origin': origin_query_format_1.OriginQueryDefinition,
@@ -161,6 +169,7 @@ async function genericWrapReplFailIfNoRequest(fn, output, analyzer) {
161
169
  output.stderr(output.formatter.format('No requests to analyze were found.', { color: 1 /* Colors.Red */, style: 1 /* FontStyles.Bold */, effect: ansi_1.ColorEffect.Foreground })
162
170
  + '\nIf you consider this an error, please report a bug: '
163
171
  + (0, assert_1.getGuardIssueUrl)('analyzer found no requests to analyze'));
172
+ output.stderr((e instanceof Error) ? e.message : String(e));
164
173
  }
165
174
  else {
166
175
  throw e;
@@ -162,6 +162,11 @@ export declare const flowrCapabilities: {
162
162
  readonly supported: "partially";
163
163
  readonly description: "_Handle side-effects of function calls (e.g., `setXTo(3)`, ...) for example achieved with the super assignment._ We need more tests and handlings. Furthermore, we do not detect side effects with external files, network, logging, etc.";
164
164
  }];
165
+ }, {
166
+ readonly name: "Recursion";
167
+ readonly id: "recursion";
168
+ readonly supported: "fully";
169
+ readonly description: "_Recognize and resolve recursive calls like `f(3)` inside the definition of `f`, ..._";
165
170
  }, {
166
171
  readonly name: "Anonymous Calls";
167
172
  readonly id: "call-anonymous";
@@ -349,9 +354,9 @@ export declare const flowrCapabilities: {
349
354
  readonly supported: "fully";
350
355
  readonly description: "_Handle `return(3)`, ... in function definitions_";
351
356
  }, {
352
- readonly name: "exceptions";
353
- readonly id: "exceptions";
354
- readonly supported: "not";
357
+ readonly name: "Exceptions and Errors";
358
+ readonly id: "exceptions-and-errors";
359
+ readonly supported: "partially";
355
360
  readonly description: "_Handle `try`, `stop`, ..._";
356
361
  }];
357
362
  }, {
@@ -513,7 +518,7 @@ export declare const flowrCapabilities: {
513
518
  }, {
514
519
  readonly name: "Hooks";
515
520
  readonly id: "hooks";
516
- readonly supported: "not";
521
+ readonly supported: "partially";
517
522
  readonly description: "_Handle hooks like [`userhooks`](https://stat.ethz.ch/R-manual/R-devel/library/base/html/userhooks.html) and [`on.exit`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/on.exit)._ We do not support hooks.";
518
523
  }, {
519
524
  readonly name: "Precedence";
@@ -577,7 +582,7 @@ export declare const flowrCapabilities: {
577
582
  readonly name: string;
578
583
  readonly href: "https://adv-r.hadley.nz/s4.html";
579
584
  }];
580
- readonly supported: "not";
585
+ readonly supported: "partially";
581
586
  readonly description: "_Handle S4 classes and methods as one unit. Including Dispatch and Inheritance_ We do not support typing currently and do not handle objects of these classes \"as units.\"";
582
587
  }, {
583
588
  readonly name: "R6";
@@ -217,6 +217,12 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
217
217
  }
218
218
  ]
219
219
  },
220
+ {
221
+ name: 'Recursion',
222
+ id: 'recursion',
223
+ supported: 'fully',
224
+ description: '_Recognize and resolve recursive calls like `f(3)` inside the definition of `f`, ..._'
225
+ },
220
226
  {
221
227
  name: 'Anonymous Calls',
222
228
  id: 'call-anonymous',
@@ -446,9 +452,9 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
446
452
  description: '_Handle `return(3)`, ... in function definitions_'
447
453
  },
448
454
  {
449
- name: 'exceptions',
450
- id: 'exceptions',
451
- supported: 'not',
455
+ name: 'Exceptions and Errors',
456
+ id: 'exceptions-and-errors',
457
+ supported: 'partially',
452
458
  description: '_Handle `try`, `stop`, ..._'
453
459
  }
454
460
  ]
@@ -652,7 +658,7 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
652
658
  {
653
659
  name: 'Hooks',
654
660
  id: 'hooks',
655
- supported: 'not',
661
+ supported: 'partially',
656
662
  description: '_Handle hooks like [`userhooks`](https://stat.ethz.ch/R-manual/R-devel/library/base/html/userhooks.html) and [`on.exit`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/on.exit)._ We do not support hooks.'
657
663
  },
658
664
  {
@@ -728,7 +734,7 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
728
734
  url: [
729
735
  { name: AdvancedR('S4'), href: 'https://adv-r.hadley.nz/s4.html' }
730
736
  ],
731
- supported: 'not',
737
+ supported: 'partially',
732
738
  description: '_Handle S4 classes and methods as one unit. Including Dispatch and Inheritance_ We do not support typing currently and do not handle objects of these classes "as units."'
733
739
  },
734
740
  {