@eagleoutice/flowr 2.5.0 → 2.6.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 (254) hide show
  1. package/README.md +46 -35
  2. package/abstract-interpretation/data-frame/absint-visitor.d.ts +1 -1
  3. package/abstract-interpretation/data-frame/absint-visitor.js +1 -1
  4. package/cli/flowr.js +11 -33
  5. package/cli/repl/commands/repl-cfg.d.ts +5 -5
  6. package/cli/repl/commands/repl-cfg.js +21 -22
  7. package/cli/repl/commands/repl-commands.d.ts +3 -3
  8. package/cli/repl/commands/repl-commands.js +2 -0
  9. package/cli/repl/commands/repl-dataflow.d.ts +5 -5
  10. package/cli/repl/commands/repl-dataflow.js +27 -30
  11. package/cli/repl/commands/repl-execute.d.ts +1 -1
  12. package/cli/repl/commands/repl-execute.js +8 -7
  13. package/cli/repl/commands/repl-lineage.d.ts +2 -2
  14. package/cli/repl/commands/repl-lineage.js +11 -11
  15. package/cli/repl/commands/repl-main.d.ts +35 -7
  16. package/cli/repl/commands/repl-normalize.d.ts +3 -3
  17. package/cli/repl/commands/repl-normalize.js +15 -19
  18. package/cli/repl/commands/repl-parse.d.ts +2 -2
  19. package/cli/repl/commands/repl-parse.js +14 -8
  20. package/cli/repl/commands/repl-query.d.ts +3 -3
  21. package/cli/repl/commands/repl-query.js +29 -19
  22. package/cli/repl/commands/repl-quit.js +1 -0
  23. package/cli/repl/commands/repl-version.d.ts +1 -16
  24. package/cli/repl/commands/repl-version.js +2 -18
  25. package/cli/repl/core.d.ts +12 -9
  26. package/cli/repl/core.js +26 -12
  27. package/cli/repl/print-version.js +2 -2
  28. package/cli/repl/server/connection.d.ts +7 -3
  29. package/cli/repl/server/connection.js +46 -50
  30. package/cli/repl/server/messages/message-hello.d.ts +1 -1
  31. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  32. package/cli/repl/server/server.js +2 -2
  33. package/cli/slicer-app.js +1 -1
  34. package/config.d.ts +1 -1
  35. package/config.js +4 -1
  36. package/control-flow/extract-cfg.d.ts +1 -1
  37. package/control-flow/extract-cfg.js +1 -1
  38. package/core/pipeline-executor.d.ts +5 -0
  39. package/core/pipeline-executor.js +5 -0
  40. package/core/steps/all/core/20-dataflow.d.ts +3 -1
  41. package/core/steps/pipeline/create-pipeline.js +1 -1
  42. package/core/steps/pipeline/default-pipelines.d.ts +24 -8
  43. package/core/steps/pipeline/default-pipelines.js +4 -1
  44. package/dataflow/environments/default-builtin-config.js +8 -0
  45. package/dataflow/eval/resolve/alias-tracking.js +2 -0
  46. package/dataflow/eval/resolve/resolve.js +3 -0
  47. package/dataflow/eval/values/r-value.d.ts +4 -1
  48. package/dataflow/eval/values/r-value.js +2 -0
  49. package/dataflow/extractor.d.ts +4 -1
  50. package/dataflow/extractor.js +7 -5
  51. package/dataflow/fn/higher-order-function.d.ts +9 -0
  52. package/dataflow/fn/higher-order-function.js +75 -0
  53. package/dataflow/graph/dataflowgraph-builder.d.ts +11 -12
  54. package/dataflow/graph/dataflowgraph-builder.js +6 -6
  55. package/documentation/doc-util/doc-query.d.ts +3 -6
  56. package/documentation/doc-util/doc-query.js +5 -17
  57. package/documentation/doc-util/doc-repl.js +5 -2
  58. package/documentation/doc-util/doc-search.js +7 -10
  59. package/documentation/doc-util/doc-structure.d.ts +4 -0
  60. package/documentation/doc-util/doc-structure.js +28 -0
  61. package/documentation/doc-util/doc-types.d.ts +5 -1
  62. package/documentation/doc-util/doc-types.js +29 -3
  63. package/documentation/print-analyzer-wiki.d.ts +1 -0
  64. package/documentation/print-analyzer-wiki.js +137 -0
  65. package/documentation/print-core-wiki.d.ts +2 -1
  66. package/documentation/print-core-wiki.js +58 -4
  67. package/documentation/print-dataflow-graph-wiki.js +16 -23
  68. package/documentation/print-interface-wiki.js +18 -1
  69. package/documentation/print-linter-wiki.js +5 -1
  70. package/documentation/print-normalized-ast-wiki.js +6 -8
  71. package/documentation/print-query-wiki.js +20 -0
  72. package/documentation/print-readme.js +1 -1
  73. package/engines.d.ts +9 -0
  74. package/engines.js +38 -0
  75. package/linter/linter-executor.d.ts +2 -8
  76. package/linter/linter-executor.js +9 -4
  77. package/linter/linter-format.d.ts +8 -9
  78. package/linter/linter-rules.d.ts +57 -15
  79. package/linter/linter-rules.js +2 -0
  80. package/linter/rules/absolute-path.d.ts +1 -0
  81. package/linter/rules/dataframe-access-validation.d.ts +4 -3
  82. package/linter/rules/dataframe-access-validation.js +7 -4
  83. package/linter/rules/dead-code.d.ts +2 -1
  84. package/linter/rules/deprecated-functions.d.ts +15 -28
  85. package/linter/rules/deprecated-functions.js +5 -43
  86. package/linter/rules/file-path-validity.d.ts +2 -1
  87. package/linter/rules/file-path-validity.js +1 -1
  88. package/linter/rules/function-finder-util.d.ts +51 -0
  89. package/linter/rules/function-finder-util.js +77 -0
  90. package/linter/rules/naming-convention.d.ts +2 -1
  91. package/linter/rules/network-functions.d.ts +40 -0
  92. package/linter/rules/network-functions.js +24 -0
  93. package/linter/rules/seeded-randomness.d.ts +2 -1
  94. package/linter/rules/unused-definition.d.ts +2 -1
  95. package/linter/rules/useless-loop.d.ts +3 -2
  96. package/linter/rules/useless-loop.js +4 -6
  97. package/package.json +2 -1
  98. package/project/cache/flowr-analyzer-cache.d.ts +94 -0
  99. package/project/cache/flowr-analyzer-cache.js +164 -0
  100. package/project/cache/flowr-cache.d.ts +28 -0
  101. package/project/cache/flowr-cache.js +49 -0
  102. package/project/cfg-kind.d.ts +17 -0
  103. package/project/cfg-kind.js +22 -0
  104. package/project/context/abstract-flowr-analyzer-context.d.ts +39 -0
  105. package/project/context/abstract-flowr-analyzer-context.js +46 -0
  106. package/project/context/flowr-analyzer-context.d.ts +54 -0
  107. package/project/context/flowr-analyzer-context.js +58 -0
  108. package/project/context/flowr-analyzer-dependencies-context.d.ts +39 -0
  109. package/project/context/flowr-analyzer-dependencies-context.js +43 -0
  110. package/project/context/flowr-analyzer-files-context.d.ts +87 -0
  111. package/project/context/flowr-analyzer-files-context.js +134 -0
  112. package/project/context/flowr-analyzer-loading-order-context.d.ts +77 -0
  113. package/project/context/flowr-analyzer-loading-order-context.js +96 -0
  114. package/project/context/flowr-file.d.ts +89 -0
  115. package/project/context/flowr-file.js +78 -0
  116. package/project/flowr-analyzer-builder.d.ts +106 -0
  117. package/project/flowr-analyzer-builder.js +197 -0
  118. package/project/flowr-analyzer.d.ts +126 -0
  119. package/project/flowr-analyzer.js +88 -0
  120. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +17 -0
  121. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +28 -0
  122. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +21 -0
  123. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +34 -0
  124. package/project/plugins/file-plugins/flowr-description-file.d.ts +24 -0
  125. package/project/plugins/file-plugins/flowr-description-file.js +38 -0
  126. package/project/plugins/flowr-analyzer-plugin.d.ts +90 -0
  127. package/project/plugins/flowr-analyzer-plugin.js +82 -0
  128. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +14 -0
  129. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +56 -0
  130. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.d.ts +13 -0
  131. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +33 -0
  132. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +14 -0
  133. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +41 -0
  134. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
  135. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +29 -0
  136. package/project/plugins/package-version-plugins/package.d.ts +15 -0
  137. package/project/plugins/package-version-plugins/package.js +56 -0
  138. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +15 -0
  139. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +44 -0
  140. package/queries/base-query-format.d.ts +2 -8
  141. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
  142. package/queries/catalog/call-context-query/call-context-query-executor.js +21 -13
  143. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -3
  144. package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
  145. package/queries/catalog/cluster-query/cluster-query-executor.d.ts +1 -1
  146. package/queries/catalog/cluster-query/cluster-query-executor.js +2 -2
  147. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -54
  148. package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
  149. package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
  150. package/queries/catalog/config-query/config-query-executor.js +5 -5
  151. package/queries/catalog/config-query/config-query-format.d.ts +1 -1
  152. package/queries/catalog/config-query/config-query-format.js +1 -1
  153. package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
  154. package/queries/catalog/control-flow-query/control-flow-query-executor.js +3 -3
  155. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -54
  156. package/queries/catalog/control-flow-query/control-flow-query-format.js +2 -2
  157. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.d.ts +1 -1
  158. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -2
  159. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -54
  160. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -1
  161. package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +1 -1
  162. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
  163. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -54
  164. package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -1
  165. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
  166. package/queries/catalog/dependencies-query/dependencies-query-executor.js +19 -12
  167. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +7 -56
  168. package/queries/catalog/dependencies-query/dependencies-query-format.js +7 -4
  169. package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
  170. package/queries/catalog/df-shape-query/df-shape-query-executor.js +4 -4
  171. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +1 -54
  172. package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
  173. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
  174. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
  175. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -54
  176. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -1
  177. package/queries/catalog/id-map-query/id-map-query-executor.d.ts +1 -1
  178. package/queries/catalog/id-map-query/id-map-query-executor.js +2 -2
  179. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -54
  180. package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
  181. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +3 -0
  182. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +45 -0
  183. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +22 -0
  184. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +32 -0
  185. package/queries/catalog/lineage-query/lineage-query-executor.d.ts +1 -1
  186. package/queries/catalog/lineage-query/lineage-query-executor.js +2 -2
  187. package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -54
  188. package/queries/catalog/lineage-query/lineage-query-format.js +1 -1
  189. package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
  190. package/queries/catalog/linter-query/linter-query-executor.js +2 -3
  191. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -54
  192. package/queries/catalog/linter-query/linter-query-format.js +1 -1
  193. package/queries/catalog/location-map-query/location-map-query-executor.d.ts +1 -1
  194. package/queries/catalog/location-map-query/location-map-query-executor.js +3 -2
  195. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  196. package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
  197. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +1 -1
  198. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -2
  199. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -54
  200. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -1
  201. package/queries/catalog/origin-query/origin-query-executor.d.ts +2 -2
  202. package/queries/catalog/origin-query/origin-query-executor.js +3 -3
  203. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -54
  204. package/queries/catalog/origin-query/origin-query-format.js +1 -1
  205. package/queries/catalog/project-query/project-query-executor.d.ts +1 -1
  206. package/queries/catalog/project-query/project-query-executor.js +2 -2
  207. package/queries/catalog/project-query/project-query-format.d.ts +1 -54
  208. package/queries/catalog/project-query/project-query-format.js +1 -1
  209. package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
  210. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -2
  211. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -54
  212. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
  213. package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
  214. package/queries/catalog/search-query/search-query-executor.js +3 -3
  215. package/queries/catalog/search-query/search-query-format.d.ts +1 -54
  216. package/queries/catalog/search-query/search-query-format.js +1 -1
  217. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
  218. package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -3
  219. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -54
  220. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -1
  221. package/queries/query-print.d.ts +4 -4
  222. package/queries/query-print.js +12 -12
  223. package/queries/query.d.ts +37 -885
  224. package/queries/query.js +3 -1
  225. package/r-bridge/parser.d.ts +7 -0
  226. package/r-bridge/retriever.d.ts +6 -5
  227. package/r-bridge/retriever.js +9 -5
  228. package/search/flowr-search-executor.d.ts +3 -5
  229. package/search/flowr-search-executor.js +6 -4
  230. package/search/flowr-search-filters.d.ts +12 -6
  231. package/search/flowr-search-filters.js +1 -1
  232. package/search/flowr-search.d.ts +5 -16
  233. package/search/flowr-search.js +14 -5
  234. package/search/search-executor/search-enrichers.d.ts +37 -36
  235. package/search/search-executor/search-enrichers.js +5 -4
  236. package/search/search-executor/search-generators.d.ts +12 -12
  237. package/search/search-executor/search-generators.js +27 -19
  238. package/search/search-executor/search-mappers.d.ts +5 -5
  239. package/search/search-executor/search-transformer.d.ts +17 -17
  240. package/search/search-executor/search-transformer.js +14 -7
  241. package/util/collections/arrays.d.ts +1 -0
  242. package/util/collections/arrays.js +15 -0
  243. package/util/collections/objectmap.d.ts +17 -0
  244. package/util/collections/objectmap.js +28 -0
  245. package/util/containers.d.ts +0 -1
  246. package/util/containers.js +0 -1
  247. package/util/files.d.ts +17 -0
  248. package/util/files.js +65 -0
  249. package/util/formats/adapter.d.ts +4 -2
  250. package/util/formats/adapter.js +11 -4
  251. package/util/r-value.d.ts +1 -1
  252. package/util/r-value.js +2 -0
  253. package/util/version.d.ts +17 -0
  254. package/util/version.js +28 -1
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeIdMapQuery = executeIdMapQuery;
4
4
  const log_1 = require("../../../util/log");
5
- function executeIdMapQuery({ ast }, queries) {
5
+ async function executeIdMapQuery({ analyzer }, queries) {
6
6
  if (queries.length !== 1) {
7
7
  log_1.log.warn('Id-Map query expects only up to one query, but got', queries.length);
8
8
  }
@@ -11,7 +11,7 @@ function executeIdMapQuery({ ast }, queries) {
11
11
  /* there is no sense in measuring a get */
12
12
  timing: 0
13
13
  },
14
- idMap: ast.idMap
14
+ idMap: (await analyzer.normalize()).idMap
15
15
  };
16
16
  }
17
17
  //# sourceMappingURL=id-map-query-executor.js.map
@@ -10,60 +10,7 @@ export interface IdMapQueryResult extends BaseQueryResult {
10
10
  }
11
11
  export declare const IdMapQueryDefinition: {
12
12
  readonly executor: typeof executeIdMapQuery;
13
- readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
14
- readonly name: "parse";
15
- readonly humanReadableName: "parse with R shell";
16
- readonly description: "Parse the given R code into an AST";
17
- readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
18
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
19
- readonly printer: {
20
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
21
- readonly 2: {
22
- (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
23
- (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
24
- };
25
- readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
26
- };
27
- readonly dependencies: readonly [];
28
- readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
29
- } | {
30
- readonly name: "normalize";
31
- readonly humanReadableName: "normalize";
32
- readonly description: "Normalize the AST to flowR's AST";
33
- readonly processor: (results: {
34
- parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
35
- }, input: Partial<import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../r-bridge/lang-4.x/ast/model/model").RNode<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
36
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
37
- readonly printer: {
38
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
39
- readonly 2: typeof import("../../../core/print/normalize-printer").normalizedAstToJson;
40
- readonly 5: typeof import("../../../core/print/normalize-printer").normalizedAstToQuads;
41
- readonly 3: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaid;
42
- readonly 4: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaidUrl;
43
- };
44
- readonly dependencies: readonly ["parse"];
45
- readonly requiredInput: import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput;
46
- } | {
47
- readonly humanReadableName: "dataflow";
48
- readonly processor: (results: {
49
- normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
50
- }, input: {
51
- request?: import("../../../r-bridge/retriever").RParseRequests;
52
- parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
53
- }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
54
- readonly requiredInput: {};
55
- readonly name: "dataflow";
56
- readonly description: "Construct the dataflow graph";
57
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
58
- readonly printer: {
59
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
60
- readonly 2: typeof import("../../../core/print/dataflow-printer").dataflowGraphToJson;
61
- readonly 5: typeof import("../../../core/print/dataflow-printer").dataflowGraphToQuads;
62
- readonly 3: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaid;
63
- readonly 4: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaidUrl;
64
- };
65
- readonly dependencies: readonly ["normalize"];
66
- }>>, queryResults: BaseQueryResult, result: string[]) => true;
13
+ readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../../project/flowr-analyzer").FlowrAnalysisProvider, queryResults: BaseQueryResult, result: string[]) => true;
67
14
  readonly schema: Joi.ObjectSchema<any>;
68
15
  readonly flattenInvolvedNodes: () => never[];
69
16
  };
@@ -11,10 +11,10 @@ const joi_1 = __importDefault(require("joi"));
11
11
  const query_print_1 = require("../../query-print");
12
12
  exports.IdMapQueryDefinition = {
13
13
  executor: id_map_query_executor_1.executeIdMapQuery,
14
- asciiSummarizer: (formatter, _processed, queryResults, result) => {
14
+ asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
15
15
  const out = queryResults;
16
16
  result.push(`Query: ${(0, ansi_1.bold)('id-map', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
17
- result.push(` ╰ Id List: {${(0, query_print_1.summarizeIdsIfTooLong)(formatter, [...out.idMap.keys()])}}`);
17
+ result.push(` ╰ Id List: {${(0, query_print_1.summarizeIdsIfTooLong)(formatter, Array.from(out.idMap.keys()))}}`);
18
18
  return true;
19
19
  },
20
20
  schema: joi_1.default.object({
@@ -0,0 +1,3 @@
1
+ import type { InspectHigherOrderQuery, InspectHigherOrderQueryResult } from './inspect-higher-order-query-format';
2
+ import type { BasicQueryData } from '../../base-query-format';
3
+ export declare function executeHigherOrderQuery({ analyzer }: BasicQueryData, queries: readonly InspectHigherOrderQuery[]): Promise<InspectHigherOrderQueryResult>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeHigherOrderQuery = executeHigherOrderQuery;
4
+ const parse_1 = require("../../../slicing/criterion/parse");
5
+ const vertex_1 = require("../../../dataflow/graph/vertex");
6
+ const higher_order_function_1 = require("../../../dataflow/fn/higher-order-function");
7
+ async function executeHigherOrderQuery({ analyzer }, queries) {
8
+ const start = Date.now();
9
+ let filters = undefined;
10
+ // filter will remain undefined if at least one of the queries wants all functions
11
+ for (const q of queries) {
12
+ if (q.filter === undefined) {
13
+ filters = undefined;
14
+ break;
15
+ }
16
+ else {
17
+ filters ??= [];
18
+ filters = filters.concat(filters);
19
+ }
20
+ }
21
+ const ast = await analyzer.normalize();
22
+ const filterFor = new Set();
23
+ if (filters) {
24
+ for (const f of filters) {
25
+ const i = (0, parse_1.tryResolveSliceCriterionToId)(f, ast.idMap);
26
+ if (i !== undefined) {
27
+ filterFor.add(i);
28
+ }
29
+ }
30
+ }
31
+ const graph = (await analyzer.dataflow()).graph;
32
+ const fns = graph.vertices(true)
33
+ .filter(([, v]) => (0, vertex_1.isFunctionDefinitionVertex)(v) && (filterFor.size === 0 || filterFor.has(v.id)));
34
+ const result = {};
35
+ for (const [id,] of fns) {
36
+ result[id] = (0, higher_order_function_1.isHigherOrder)(id, graph);
37
+ }
38
+ return {
39
+ '.meta': {
40
+ timing: Date.now() - start
41
+ },
42
+ higherOrder: result
43
+ };
44
+ }
45
+ //# sourceMappingURL=inspect-higher-order-query-executor.js.map
@@ -0,0 +1,22 @@
1
+ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
2
+ import Joi from 'joi';
3
+ import { executeHigherOrderQuery } from './inspect-higher-order-query-executor';
4
+ import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
5
+ import type { SingleSlicingCriterion } from '../../../slicing/criterion/parse';
6
+ /**
7
+ * Either returns all function definitions alongside whether they are higher-order functions,
8
+ * or just those matching the filters.
9
+ */
10
+ export interface InspectHigherOrderQuery extends BaseQueryFormat {
11
+ readonly type: 'inspect-higher-order';
12
+ readonly filter?: SingleSlicingCriterion[];
13
+ }
14
+ export interface InspectHigherOrderQueryResult extends BaseQueryResult {
15
+ readonly higherOrder: Record<NodeId, boolean>;
16
+ }
17
+ export declare const InspectHigherOrderQueryDefinition: {
18
+ readonly executor: typeof executeHigherOrderQuery;
19
+ readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, processed: import("../../../project/flowr-analyzer").FlowrAnalysisProvider, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
20
+ readonly schema: Joi.ObjectSchema<any>;
21
+ readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
22
+ };
@@ -0,0 +1,32 @@
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.InspectHigherOrderQueryDefinition = void 0;
7
+ const ansi_1 = require("../../../util/text/ansi");
8
+ const joi_1 = __importDefault(require("joi"));
9
+ const inspect_higher_order_query_executor_1 = require("./inspect-higher-order-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
+ exports.InspectHigherOrderQueryDefinition = {
13
+ executor: inspect_higher_order_query_executor_1.executeHigherOrderQuery,
14
+ asciiSummarizer: async (formatter, processed, queryResults, result) => {
15
+ const out = queryResults;
16
+ result.push(`Query: ${(0, ansi_1.bold)('inspect-higher-order', formatter)} (${out['.meta'].timing.toFixed(0)}ms)`);
17
+ for (const [r, v] of Object.entries(out.higherOrder)) {
18
+ const loc = (await processed.normalize()).idMap.get((0, node_id_1.normalizeIdToNumberIfPossible)(r))?.location ?? undefined;
19
+ result.push(` - Function ${(0, ansi_1.bold)(r, formatter)} (${(0, dfg_1.formatRange)(loc)}) is ${v ? '' : 'not '}a higher-order function`);
20
+ }
21
+ return true;
22
+ },
23
+ schema: joi_1.default.object({
24
+ type: joi_1.default.string().valid('inspect-higher-order').required().description('The type of the query.'),
25
+ 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.')
26
+ }).description('Either returns all function definitions alongside whether they are higher-order functions, or just those matching the filters.'),
27
+ flattenInvolvedNodes: (queryResults) => {
28
+ const out = queryResults;
29
+ return Object.keys(out.higherOrder).filter(id => out.higherOrder[id]);
30
+ }
31
+ };
32
+ //# sourceMappingURL=inspect-higher-order-query-format.js.map
@@ -1,3 +1,3 @@
1
1
  import type { LineageQuery, LineageQueryResult } from './lineage-query-format';
2
2
  import type { BasicQueryData } from '../../base-query-format';
3
- export declare function executeLineageQuery({ dataflow: { graph }, ast }: BasicQueryData, queries: readonly LineageQuery[]): LineageQueryResult;
3
+ export declare function executeLineageQuery({ analyzer }: BasicQueryData, queries: readonly LineageQuery[]): Promise<LineageQueryResult>;
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeLineageQuery = executeLineageQuery;
4
4
  const log_1 = require("../../../util/log");
5
5
  const repl_lineage_1 = require("../../../cli/repl/commands/repl-lineage");
6
- function executeLineageQuery({ dataflow: { graph }, ast }, queries) {
6
+ async function executeLineageQuery({ analyzer }, queries) {
7
7
  const start = Date.now();
8
8
  const result = {};
9
9
  for (const { criterion } of queries) {
10
10
  if (result[criterion]) {
11
11
  log_1.log.warn('Duplicate criterion in lineage query:', criterion);
12
12
  }
13
- result[criterion] = (0, repl_lineage_1.getLineage)(criterion, graph, ast.idMap);
13
+ result[criterion] = (0, repl_lineage_1.getLineage)(criterion, (await analyzer.dataflow()).graph, (await analyzer.normalize()).idMap);
14
14
  }
15
15
  return {
16
16
  '.meta': {
@@ -16,60 +16,7 @@ export interface LineageQueryResult extends BaseQueryResult {
16
16
  }
17
17
  export declare const LineageQueryDefinition: {
18
18
  readonly executor: typeof executeLineageQuery;
19
- readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
20
- readonly name: "parse";
21
- readonly humanReadableName: "parse with R shell";
22
- readonly description: "Parse the given R code into an AST";
23
- readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
24
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
25
- readonly printer: {
26
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
27
- readonly 2: {
28
- (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
29
- (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
30
- };
31
- readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
32
- };
33
- readonly dependencies: readonly [];
34
- readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
35
- } | {
36
- readonly name: "normalize";
37
- readonly humanReadableName: "normalize";
38
- readonly description: "Normalize the AST to flowR's AST";
39
- readonly processor: (results: {
40
- parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
41
- }, input: Partial<import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../r-bridge/lang-4.x/ast/model/model").RNode<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
42
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
43
- readonly printer: {
44
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
45
- readonly 2: typeof import("../../../core/print/normalize-printer").normalizedAstToJson;
46
- readonly 5: typeof import("../../../core/print/normalize-printer").normalizedAstToQuads;
47
- readonly 3: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaid;
48
- readonly 4: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaidUrl;
49
- };
50
- readonly dependencies: readonly ["parse"];
51
- readonly requiredInput: import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput;
52
- } | {
53
- readonly humanReadableName: "dataflow";
54
- readonly processor: (results: {
55
- normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
56
- }, input: {
57
- request?: import("../../../r-bridge/retriever").RParseRequests;
58
- parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
59
- }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
60
- readonly requiredInput: {};
61
- readonly name: "dataflow";
62
- readonly description: "Construct the dataflow graph";
63
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
64
- readonly printer: {
65
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
66
- readonly 2: typeof import("../../../core/print/dataflow-printer").dataflowGraphToJson;
67
- readonly 5: typeof import("../../../core/print/dataflow-printer").dataflowGraphToQuads;
68
- readonly 3: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaid;
69
- readonly 4: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaidUrl;
70
- };
71
- readonly dependencies: readonly ["normalize"];
72
- }>>, queryResults: BaseQueryResult, result: string[]) => true;
19
+ readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../../project/flowr-analyzer").FlowrAnalysisProvider, queryResults: BaseQueryResult, result: string[]) => true;
73
20
  readonly schema: Joi.ObjectSchema<any>;
74
21
  readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
75
22
  };
@@ -11,7 +11,7 @@ const lineage_query_executor_1 = require("./lineage-query-executor");
11
11
  const query_print_1 = require("../../query-print");
12
12
  exports.LineageQueryDefinition = {
13
13
  executor: lineage_query_executor_1.executeLineageQuery,
14
- asciiSummarizer: (formatter, _processed, queryResults, result) => {
14
+ asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
15
15
  const out = queryResults;
16
16
  result.push(`Query: ${(0, ansi_1.bold)('lineage', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
17
17
  for (const [criteria, lineage] of Object.entries(out.lineages)) {
@@ -1,3 +1,3 @@
1
1
  import type { BasicQueryData } from '../../base-query-format';
2
2
  import type { LinterQuery, LinterQueryResult } from './linter-query-format';
3
- export declare function executeLinterQuery({ ast, dataflow, config }: BasicQueryData, queries: readonly LinterQuery[]): LinterQueryResult;
3
+ export declare function executeLinterQuery({ analyzer }: BasicQueryData, queries: readonly LinterQuery[]): Promise<LinterQueryResult>;
@@ -4,7 +4,7 @@ exports.executeLinterQuery = executeLinterQuery;
4
4
  const linter_rules_1 = require("../../../linter/linter-rules");
5
5
  const log_1 = require("../../../util/log");
6
6
  const linter_executor_1 = require("../../../linter/linter-executor");
7
- function executeLinterQuery({ ast, dataflow, config }, queries) {
7
+ async function executeLinterQuery({ analyzer }, queries) {
8
8
  const flattened = queries.flatMap(q => q.rules ?? Object.keys(linter_rules_1.LintingRules));
9
9
  const distinct = new Set(flattened);
10
10
  if (distinct.size !== flattened.length) {
@@ -13,10 +13,9 @@ function executeLinterQuery({ ast, dataflow, config }, queries) {
13
13
  }
14
14
  const results = { results: {} };
15
15
  const start = Date.now();
16
- const input = { normalize: ast, dataflow, config };
17
16
  for (const entry of distinct) {
18
17
  const ruleName = typeof entry === 'string' ? entry : entry.name;
19
- results.results[ruleName] = (0, linter_executor_1.executeLintingRule)(ruleName, input, entry?.config);
18
+ results.results[ruleName] = await (0, linter_executor_1.executeLintingRule)(ruleName, analyzer, entry?.config);
20
19
  }
21
20
  return {
22
21
  ...results,
@@ -21,60 +21,7 @@ export interface LinterQueryResult extends BaseQueryResult {
21
21
  }
22
22
  export declare const LinterQueryDefinition: {
23
23
  readonly executor: typeof executeLinterQuery;
24
- readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
25
- readonly name: "parse";
26
- readonly humanReadableName: "parse with R shell";
27
- readonly description: "Parse the given R code into an AST";
28
- readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
29
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
30
- readonly printer: {
31
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
32
- readonly 2: {
33
- (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
34
- (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
35
- };
36
- readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
37
- };
38
- readonly dependencies: readonly [];
39
- readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
40
- } | {
41
- readonly name: "normalize";
42
- readonly humanReadableName: "normalize";
43
- readonly description: "Normalize the AST to flowR's AST";
44
- readonly processor: (results: {
45
- parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
46
- }, input: Partial<import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../r-bridge/lang-4.x/ast/model/model").RNode<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
47
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
48
- readonly printer: {
49
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
50
- readonly 2: typeof import("../../../core/print/normalize-printer").normalizedAstToJson;
51
- readonly 5: typeof import("../../../core/print/normalize-printer").normalizedAstToQuads;
52
- readonly 3: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaid;
53
- readonly 4: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaidUrl;
54
- };
55
- readonly dependencies: readonly ["parse"];
56
- readonly requiredInput: import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput;
57
- } | {
58
- readonly humanReadableName: "dataflow";
59
- readonly processor: (results: {
60
- normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
61
- }, input: {
62
- request?: import("../../../r-bridge/retriever").RParseRequests;
63
- parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
64
- }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
65
- readonly requiredInput: {};
66
- readonly name: "dataflow";
67
- readonly description: "Construct the dataflow graph";
68
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
69
- readonly printer: {
70
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
71
- readonly 2: typeof import("../../../core/print/dataflow-printer").dataflowGraphToJson;
72
- readonly 5: typeof import("../../../core/print/dataflow-printer").dataflowGraphToQuads;
73
- readonly 3: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaid;
74
- readonly 4: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaidUrl;
75
- };
76
- readonly dependencies: readonly ["normalize"];
77
- }>>, queryResults: BaseQueryResult, result: string[]) => true;
24
+ readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../../project/flowr-analyzer").FlowrAnalysisProvider, queryResults: BaseQueryResult, result: string[]) => true;
78
25
  readonly schema: Joi.ObjectSchema<any>;
79
26
  readonly flattenInvolvedNodes: () => never[];
80
27
  };
@@ -13,7 +13,7 @@ const time_1 = require("../../../util/text/time");
13
13
  const doc_code_1 = require("../../../documentation/doc-util/doc-code");
14
14
  exports.LinterQueryDefinition = {
15
15
  executor: linter_query_executor_1.executeLinterQuery,
16
- asciiSummarizer: (formatter, _processed, queryResults, result) => {
16
+ asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
17
17
  const out = queryResults;
18
18
  result.push(`Query: ${(0, ansi_1.bold)('linter', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
19
19
  for (const [ruleName, results] of Object.entries(out.results)) {
@@ -1,3 +1,3 @@
1
1
  import type { LocationMapQuery, LocationMapQueryResult } from './location-map-query-format';
2
2
  import type { BasicQueryData } from '../../base-query-format';
3
- export declare function executeLocationMapQuery({ ast, dataflow: { graph } }: BasicQueryData, queries: readonly LocationMapQuery[]): LocationMapQueryResult;
3
+ export declare function executeLocationMapQuery({ analyzer }: BasicQueryData, queries: readonly LocationMapQuery[]): Promise<LocationMapQueryResult>;
@@ -22,7 +22,7 @@ function fuzzyFindFile(node, idMap) {
22
22
  }
23
23
  return '<inline>';
24
24
  }
25
- function executeLocationMapQuery({ ast, dataflow: { graph } }, queries) {
25
+ async function executeLocationMapQuery({ analyzer }, queries) {
26
26
  const start = Date.now();
27
27
  const criteriaOfInterest = new Set(queries
28
28
  .flatMap(q => q.ids ?? [])
@@ -34,11 +34,12 @@ function executeLocationMapQuery({ ast, dataflow: { graph } }, queries) {
34
34
  };
35
35
  let count = 0;
36
36
  const inverseMap = new Map();
37
- for (const file of graph.sourced) {
37
+ for (const file of (await analyzer.dataflow()).graph.sourced) {
38
38
  locationMap.files[count] = file;
39
39
  inverseMap.set(file, count);
40
40
  count++;
41
41
  }
42
+ const ast = await analyzer.normalize();
42
43
  for (const [id, node] of ast.idMap.entries()) {
43
44
  if (node.location && (criteriaOfInterest.size === 0 || criteriaOfInterest.has(id))) {
44
45
  const file = fuzzyFindFile(node, ast.idMap);
@@ -24,7 +24,7 @@ export interface LocationMapQueryResult extends BaseQueryResult {
24
24
  }
25
25
  export declare const LocationMapQueryDefinition: {
26
26
  readonly executor: typeof executeLocationMapQuery;
27
- readonly asciiSummarizer: (formatter: OutputFormatter, _processed: unknown, queryResults: BaseQueryResult, result: string[]) => boolean;
27
+ readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: unknown, queryResults: BaseQueryResult, result: string[]) => boolean;
28
28
  readonly schema: Joi.ObjectSchema<any>;
29
29
  readonly flattenInvolvedNodes: () => never[];
30
30
  };
@@ -11,7 +11,7 @@ const joi_1 = __importDefault(require("joi"));
11
11
  const query_print_1 = require("../../query-print");
12
12
  exports.LocationMapQueryDefinition = {
13
13
  executor: location_map_query_executor_1.executeLocationMapQuery,
14
- asciiSummarizer: (formatter, _processed, queryResults, result) => {
14
+ asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
15
15
  const out = queryResults;
16
16
  result.push(`Query: ${(0, ansi_1.bold)('location-map', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
17
17
  result.push(' ╰ File List:');
@@ -1,3 +1,3 @@
1
1
  import type { NormalizedAstQuery, NormalizedAstQueryResult } from './normalized-ast-query-format';
2
2
  import type { BasicQueryData } from '../../base-query-format';
3
- export declare function executeNormalizedAstQuery({ ast }: BasicQueryData, queries: readonly NormalizedAstQuery[]): NormalizedAstQueryResult;
3
+ export declare function executeNormalizedAstQuery({ analyzer }: BasicQueryData, queries: readonly NormalizedAstQuery[]): Promise<NormalizedAstQueryResult>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeNormalizedAstQuery = executeNormalizedAstQuery;
4
4
  const log_1 = require("../../../util/log");
5
- function executeNormalizedAstQuery({ ast }, queries) {
5
+ async function executeNormalizedAstQuery({ analyzer }, queries) {
6
6
  if (queries.length !== 1) {
7
7
  log_1.log.warn('Normalized-Ast query expects only up to one query, but got', queries.length);
8
8
  }
@@ -11,7 +11,7 @@ function executeNormalizedAstQuery({ ast }, queries) {
11
11
  /* there is no sense in measuring a get */
12
12
  timing: 0
13
13
  },
14
- normalized: ast
14
+ normalized: await analyzer.normalize()
15
15
  };
16
16
  }
17
17
  //# sourceMappingURL=normalized-ast-query-executor.js.map
@@ -13,60 +13,7 @@ export interface NormalizedAstQueryResult extends BaseQueryResult {
13
13
  }
14
14
  export declare const NormalizedAstQueryDefinition: {
15
15
  readonly executor: typeof executeNormalizedAstQuery;
16
- readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
17
- readonly name: "parse";
18
- readonly humanReadableName: "parse with R shell";
19
- readonly description: "Parse the given R code into an AST";
20
- readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
21
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
22
- readonly printer: {
23
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
24
- readonly 2: {
25
- (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
26
- (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
27
- };
28
- readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
29
- };
30
- readonly dependencies: readonly [];
31
- readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
32
- } | {
33
- readonly name: "normalize";
34
- readonly humanReadableName: "normalize";
35
- readonly description: "Normalize the AST to flowR's AST";
36
- readonly processor: (results: {
37
- parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
38
- }, input: Partial<import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => NormalizedAst<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../r-bridge/lang-4.x/ast/model/model").RNode<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
39
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
40
- readonly printer: {
41
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
42
- readonly 2: typeof import("../../../core/print/normalize-printer").normalizedAstToJson;
43
- readonly 5: typeof import("../../../core/print/normalize-printer").normalizedAstToQuads;
44
- readonly 3: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaid;
45
- readonly 4: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaidUrl;
46
- };
47
- readonly dependencies: readonly ["parse"];
48
- readonly requiredInput: import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput;
49
- } | {
50
- readonly humanReadableName: "dataflow";
51
- readonly processor: (results: {
52
- normalize?: NormalizedAst;
53
- }, input: {
54
- request?: import("../../../r-bridge/retriever").RParseRequests;
55
- parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
56
- }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
57
- readonly requiredInput: {};
58
- readonly name: "dataflow";
59
- readonly description: "Construct the dataflow graph";
60
- readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
61
- readonly printer: {
62
- readonly 0: typeof import("../../../core/print/print").internalPrinter;
63
- readonly 2: typeof import("../../../core/print/dataflow-printer").dataflowGraphToJson;
64
- readonly 5: typeof import("../../../core/print/dataflow-printer").dataflowGraphToQuads;
65
- readonly 3: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaid;
66
- readonly 4: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaidUrl;
67
- };
68
- readonly dependencies: readonly ["normalize"];
69
- }>>, queryResults: BaseQueryResult, result: string[]) => true;
16
+ readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../../project/flowr-analyzer").FlowrAnalysisProvider, queryResults: BaseQueryResult, result: string[]) => true;
70
17
  readonly schema: Joi.ObjectSchema<any>;
71
18
  readonly flattenInvolvedNodes: () => never[];
72
19
  };
@@ -11,7 +11,7 @@ const ast_1 = require("../../../util/mermaid/ast");
11
11
  const joi_1 = __importDefault(require("joi"));
12
12
  exports.NormalizedAstQueryDefinition = {
13
13
  executor: normalized_ast_query_executor_1.executeNormalizedAstQuery,
14
- asciiSummarizer: (formatter, _processed, queryResults, result) => {
14
+ asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
15
15
  const out = queryResults;
16
16
  result.push(`Query: ${(0, ansi_1.bold)('normalized-ast', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
17
17
  result.push(` ╰ [Normalized AST](${(0, ast_1.normalizedAstToMermaidUrl)(out.normalized.ast)})`);
@@ -1,5 +1,5 @@
1
1
  import type { BasicQueryData } from '../../base-query-format';
2
2
  import type { SingleSlicingCriterion } from '../../../slicing/criterion/parse';
3
- import type { OriginQueryResult, OriginQuery } from './origin-query-format';
3
+ import type { OriginQuery, OriginQueryResult } from './origin-query-format';
4
4
  export declare function fingerPrintOfQuery(query: OriginQuery): SingleSlicingCriterion;
5
- export declare function executeResolveValueQuery({ dataflow: { graph }, ast }: BasicQueryData, queries: readonly OriginQuery[]): OriginQueryResult;
5
+ export declare function executeResolveValueQuery({ analyzer }: BasicQueryData, queries: readonly OriginQuery[]): Promise<OriginQueryResult>;
@@ -8,7 +8,7 @@ const dfg_get_origin_1 = require("../../../dataflow/origin/dfg-get-origin");
8
8
  function fingerPrintOfQuery(query) {
9
9
  return query.criterion;
10
10
  }
11
- function executeResolveValueQuery({ dataflow: { graph }, ast }, queries) {
11
+ async function executeResolveValueQuery({ analyzer }, queries) {
12
12
  const start = Date.now();
13
13
  const results = {};
14
14
  for (const query of queries) {
@@ -16,12 +16,12 @@ function executeResolveValueQuery({ dataflow: { graph }, ast }, queries) {
16
16
  if (results[key]) {
17
17
  log_1.log.warn(`Duplicate Key for origin-query: ${key}, skipping...`);
18
18
  }
19
- const astId = (0, parse_1.slicingCriterionToId)(key, ast.idMap);
19
+ const astId = (0, parse_1.slicingCriterionToId)(key, (await analyzer.normalize()).idMap);
20
20
  if (astId === undefined) {
21
21
  log_1.log.warn(`Could not resolve id for ${key}, skipping...`);
22
22
  continue;
23
23
  }
24
- results[key] = (0, dfg_get_origin_1.getOriginInDfg)(graph, astId);
24
+ results[key] = (0, dfg_get_origin_1.getOriginInDfg)((await analyzer.dataflow()).graph, astId);
25
25
  }
26
26
  return {
27
27
  '.meta': {