@eagleoutice/flowr 2.9.13 → 2.10.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 (237) hide show
  1. package/README.md +52 -28
  2. package/abstract-interpretation/absint-visitor.d.ts +1 -1
  3. package/abstract-interpretation/absint-visitor.js +20 -20
  4. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +2 -2
  5. package/benchmark/slicer.d.ts +1 -1
  6. package/benchmark/slicer.js +7 -5
  7. package/benchmark/stats/stats.d.ts +2 -2
  8. package/cli/repl/commands/repl-dataflow.js +5 -5
  9. package/cli/repl/parser/slice-query-parser.d.ts +3 -3
  10. package/cli/repl/parser/slice-query-parser.js +2 -2
  11. package/cli/repl/server/connection.js +2 -2
  12. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  13. package/cli/repl/server/messages/message-slice.js +2 -2
  14. package/config.d.ts +12 -8
  15. package/config.js +5 -3
  16. package/control-flow/extract-cfg.js +2 -2
  17. package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
  18. package/control-flow/semantic-cfg-guided-visitor.js +43 -43
  19. package/control-flow/useless-loop.d.ts +1 -1
  20. package/control-flow/useless-loop.js +3 -3
  21. package/core/print/dataflow-printer.d.ts +0 -14
  22. package/core/print/dataflow-printer.js +0 -21
  23. package/core/steps/all/core/20-dataflow.d.ts +3 -3
  24. package/core/steps/all/core/20-dataflow.js +3 -2
  25. package/core/steps/all/static-slicing/00-slice.d.ts +2 -5
  26. package/core/steps/all/static-slicing/00-slice.js +6 -8
  27. package/core/steps/pipeline/default-pipelines.d.ts +89 -89
  28. package/dataflow/environments/built-in-proc-name.d.ts +83 -0
  29. package/dataflow/environments/built-in-proc-name.js +88 -0
  30. package/dataflow/environments/built-in.d.ts +1 -83
  31. package/dataflow/environments/built-in.js +37 -120
  32. package/dataflow/environments/default-builtin-config.d.ts +1 -1
  33. package/dataflow/environments/default-builtin-config.js +75 -75
  34. package/dataflow/environments/identifier.d.ts +5 -0
  35. package/dataflow/environments/identifier.js +18 -0
  36. package/dataflow/eval/resolve/resolve.js +2 -2
  37. package/dataflow/fn/exceptions-of-function.d.ts +1 -1
  38. package/dataflow/fn/exceptions-of-function.js +2 -2
  39. package/dataflow/graph/call-graph.d.ts +46 -19
  40. package/dataflow/graph/call-graph.js +95 -114
  41. package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
  42. package/dataflow/graph/dataflowgraph-builder.js +2 -2
  43. package/dataflow/graph/df-helper.d.ts +133 -0
  44. package/dataflow/graph/df-helper.js +138 -0
  45. package/dataflow/graph/diff-dataflow-graph.d.ts +5 -10
  46. package/dataflow/graph/diff-dataflow-graph.js +3 -28
  47. package/dataflow/graph/edge.d.ts +1 -0
  48. package/dataflow/graph/edge.js +1 -0
  49. package/dataflow/graph/graph-helper.d.ts +60 -0
  50. package/dataflow/graph/graph-helper.js +128 -0
  51. package/dataflow/graph/graph.d.ts +19 -3
  52. package/dataflow/graph/graph.js +32 -5
  53. package/dataflow/graph/vertex.d.ts +3 -1
  54. package/dataflow/info.d.ts +14 -4
  55. package/dataflow/info.js +28 -16
  56. package/dataflow/internal/linker.d.ts +14 -10
  57. package/dataflow/internal/linker.js +29 -32
  58. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +5 -5
  59. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +5 -4
  60. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +8 -7
  61. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
  62. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +3 -3
  63. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +2 -2
  64. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +3 -3
  65. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +6 -6
  66. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +2 -2
  67. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +3 -3
  68. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +2 -2
  69. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
  70. package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -1
  71. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -5
  72. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
  73. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +2 -2
  74. package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
  75. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +5 -5
  76. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -2
  77. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -1
  78. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -4
  79. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
  80. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +3 -3
  81. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
  82. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
  83. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +7 -7
  84. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
  85. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +3 -3
  86. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -3
  87. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +2 -2
  88. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +6 -9
  89. package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
  90. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +2 -2
  91. package/dataflow/internal/process/functions/call/common.js +2 -1
  92. package/dataflow/internal/process/functions/call/known-call-handling.js +2 -2
  93. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
  94. package/dataflow/internal/process/functions/call/named-call-handling.js +1 -1
  95. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
  96. package/dataflow/internal/process/functions/process-parameter.js +1 -1
  97. package/dataflow/internal/process/process-uninteresting-leaf.d.ts +1 -1
  98. package/dataflow/internal/process/process-uninteresting-leaf.js +1 -1
  99. package/dataflow/origin/dfg-get-origin.d.ts +1 -1
  100. package/dataflow/origin/dfg-get-symbol-refs.js +6 -6
  101. package/documentation/doc-readme.js +2 -1
  102. package/documentation/doc-util/doc-dfg.d.ts +3 -0
  103. package/documentation/doc-util/doc-dfg.js +5 -7
  104. package/documentation/doc-util/doc-normalized-ast.d.ts +0 -6
  105. package/documentation/doc-util/doc-normalized-ast.js +0 -23
  106. package/documentation/doc-util/doc-structure.js +3 -3
  107. package/documentation/doc-util/doc-types.js +3 -3
  108. package/documentation/wiki-core.js +5 -4
  109. package/documentation/wiki-dataflow-graph.js +14 -12
  110. package/documentation/wiki-interface.js +3 -3
  111. package/documentation/wiki-linter.js +6 -0
  112. package/documentation/wiki-normalized-ast.js +5 -4
  113. package/documentation/wiki-query.js +28 -3
  114. package/linter/linter-rules.d.ts +49 -1
  115. package/linter/linter-rules.js +5 -1
  116. package/linter/rules/problematic-eval.d.ts +44 -0
  117. package/linter/rules/problematic-eval.js +83 -0
  118. package/linter/rules/seeded-randomness.js +2 -2
  119. package/linter/rules/stop-with-call-arg.d.ts +35 -0
  120. package/linter/rules/stop-with-call-arg.js +72 -0
  121. package/linter/rules/useless-loop.d.ts +1 -1
  122. package/package.json +7 -7
  123. package/project/cache/flowr-analyzer-cache.d.ts +1 -1
  124. package/project/cache/flowr-analyzer-cache.js +1 -1
  125. package/project/flowr-analyzer-builder.d.ts +3 -0
  126. package/project/flowr-analyzer.d.ts +1 -1
  127. package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +2 -2
  128. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
  129. package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -2
  130. package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
  131. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -2
  132. package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -2
  133. package/queries/catalog/df-shape-query/df-shape-query-executor.js +1 -2
  134. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +3 -3
  135. package/queries/catalog/does-call-query/does-call-query-executor.js +2 -2
  136. package/queries/catalog/does-call-query/does-call-query-format.d.ts +2 -2
  137. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
  138. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +3 -3
  139. package/queries/catalog/input-sources-query/input-sources-query-executor.d.ts +6 -0
  140. package/queries/catalog/input-sources-query/input-sources-query-executor.js +66 -0
  141. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +36 -0
  142. package/queries/catalog/input-sources-query/input-sources-query-format.js +63 -0
  143. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +90 -0
  144. package/queries/catalog/input-sources-query/simple-input-classifier.js +308 -0
  145. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +2 -2
  146. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
  147. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
  148. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -3
  149. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -2
  150. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -2
  151. package/queries/catalog/location-map-query/location-map-query-executor.js +2 -2
  152. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -2
  153. package/queries/catalog/origin-query/origin-query-executor.d.ts +2 -2
  154. package/queries/catalog/origin-query/origin-query-executor.js +3 -3
  155. package/queries/catalog/origin-query/origin-query-format.d.ts +3 -3
  156. package/queries/catalog/provenance-query/provenance-query-executor.d.ts +6 -0
  157. package/queries/catalog/provenance-query/provenance-query-executor.js +34 -0
  158. package/queries/catalog/provenance-query/provenance-query-format.d.ts +35 -0
  159. package/queries/catalog/provenance-query/provenance-query-format.js +62 -0
  160. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
  161. package/queries/catalog/search-query/search-query-format.js +1 -1
  162. package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -2
  163. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -2
  164. package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -3
  165. package/queries/query.d.ts +17 -1
  166. package/queries/query.js +4 -0
  167. package/r-bridge/lang-4.x/ast/model/model.d.ts +9 -0
  168. package/r-bridge/lang-4.x/ast/model/model.js +10 -1
  169. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +16 -1
  170. package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +2 -0
  171. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +16 -1
  172. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +2 -0
  173. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +16 -1
  174. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +2 -0
  175. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +15 -0
  176. package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +2 -0
  177. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +15 -0
  178. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +2 -0
  179. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +16 -1
  180. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +2 -0
  181. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +16 -1
  182. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +2 -0
  183. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +16 -1
  184. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +2 -0
  185. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +29 -1
  186. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +29 -0
  187. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +16 -1
  188. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +2 -0
  189. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +16 -1
  190. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +2 -0
  191. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +16 -1
  192. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +2 -0
  193. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +16 -1
  194. package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +2 -0
  195. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +16 -1
  196. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +2 -0
  197. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +16 -1
  198. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +2 -0
  199. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +16 -1
  200. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +2 -0
  201. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +16 -1
  202. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +2 -0
  203. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +16 -1
  204. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +2 -0
  205. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +16 -1
  206. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +2 -0
  207. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +16 -1
  208. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +2 -0
  209. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +16 -1
  210. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +2 -0
  211. package/search/flowr-search-filters.d.ts +1 -1
  212. package/search/flowr-search-printer.js +3 -3
  213. package/search/search-executor/search-enrichers.js +2 -2
  214. package/search/search-executor/search-generators.js +1 -1
  215. package/slicing/criterion/parse.d.ts +43 -18
  216. package/slicing/criterion/parse.js +68 -63
  217. package/slicing/static/slicer-types.d.ts +2 -3
  218. package/slicing/static/static-slicer.d.ts +3 -4
  219. package/slicing/static/static-slicer.js +32 -12
  220. package/util/collections/arrays.d.ts +4 -0
  221. package/util/collections/arrays.js +7 -0
  222. package/util/diff.d.ts +2 -2
  223. package/util/mermaid/ast.js +4 -4
  224. package/util/mermaid/cfg.js +5 -5
  225. package/util/mermaid/dfg.d.ts +33 -18
  226. package/util/mermaid/dfg.js +47 -31
  227. package/util/mermaid/mermaid.d.ts +57 -12
  228. package/util/mermaid/mermaid.js +74 -67
  229. package/util/range.d.ts +8 -0
  230. package/util/range.js +13 -1
  231. package/util/slice-direction.d.ts +7 -0
  232. package/util/slice-direction.js +12 -0
  233. package/util/version.js +1 -1
  234. package/dataflow/graph/invert-dfg.d.ts +0 -6
  235. package/dataflow/graph/invert-dfg.js +0 -20
  236. package/dataflow/graph/resolve-graph.d.ts +0 -8
  237. package/dataflow/graph/resolve-graph.js +0 -59
@@ -1,4 +1,5 @@
1
- import type { Leaf, Location, NoInfo, RNode } from '../model';
1
+ import type { Leaf, Location, NoInfo } from '../model';
2
+ import { RNode } from '../model';
2
3
  import type { RStringValue } from '../../../convert-values';
3
4
  import { RType } from '../type';
4
5
  import { SemVer } from 'semver';
@@ -25,4 +26,18 @@ export declare const RString: {
25
26
  * @see {@link RString}
26
27
  */
27
28
  rawStringAvailableFromRVersion(): SemVer;
29
+ getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
30
+ getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
31
+ getType: (this: void, node: RNode) => RType;
32
+ visitAst: <OtherInfo = object>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
33
+ collectAllIds: <OtherInfo>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
34
+ directChildren: <OtherInfo>(this: void, node: RNode<OtherInfo>) => readonly (RNode<OtherInfo> | typeof import("./r-function-call").EmptyArgument)[];
35
+ directParent: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: Map<import("../processing/node-id").NodeId, RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation> | undefined;
36
+ iterateParents: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation> | undefined, idMap: Map<import("../processing/node-id").NodeId, RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Generator<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>;
37
+ depth: (this: void, node: RNode<import("../processing/decorate").ParentInformation>, idMap: Map<import("../processing/node-id").NodeId, RNode<import("../processing/decorate").ParentInformation>>) => number;
38
+ collectAllIdsWithStop: <OtherInfo>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>, stop: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => Set<import("../processing/node-id").NodeId>;
39
+ lexeme: <R extends RNode<import("../processing/decorate").ParentInformation>>(this: void, node: R | undefined) => R extends {
40
+ lexeme: string;
41
+ } ? string : string | undefined;
42
+ documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf;
28
43
  };
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RString = void 0;
4
+ const model_1 = require("../model");
4
5
  const type_1 = require("../type");
5
6
  const semver_1 = require("semver");
6
7
  const versions_1 = require("../versions");
@@ -8,6 +9,7 @@ const versions_1 = require("../versions");
8
9
  * Helper for working with {@link RString} AST nodes.
9
10
  */
10
11
  exports.RString = {
12
+ ...model_1.RNode,
11
13
  name: 'RString',
12
14
  /**
13
15
  * Type guard for RString nodes.
@@ -1,4 +1,5 @@
1
- import type { Leaf, Location, NoInfo, RNode } from '../model';
1
+ import type { Leaf, Location, NoInfo } from '../model';
2
+ import { RNode } from '../model';
2
3
  import { RType } from '../type';
3
4
  import { RNa, RNull } from '../../../convert-values';
4
5
  import type { Identifier } from '../../../../../dataflow/environments/identifier';
@@ -29,4 +30,18 @@ export declare const RSymbol: {
29
30
  * @see {@link RSymbol.is} - to check whether a node is a symbol at all
30
31
  */
31
32
  readonly isSpecial: <OtherInfo = object>(this: void, node: RNode<OtherInfo> | undefined) => node is RSymbol<OtherInfo, typeof RNull | typeof RNa>;
33
+ readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
34
+ readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
35
+ readonly getType: (this: void, node: RNode) => RType;
36
+ readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
37
+ readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
38
+ readonly directChildren: <OtherInfo>(this: void, node: RNode<OtherInfo>) => readonly (RNode<OtherInfo> | typeof import("./r-function-call").EmptyArgument)[];
39
+ readonly directParent: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: Map<import("../processing/node-id").NodeId, RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation> | undefined;
40
+ readonly iterateParents: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation> | undefined, idMap: Map<import("../processing/node-id").NodeId, RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Generator<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>;
41
+ readonly depth: (this: void, node: RNode<import("../processing/decorate").ParentInformation>, idMap: Map<import("../processing/node-id").NodeId, RNode<import("../processing/decorate").ParentInformation>>) => number;
42
+ readonly collectAllIdsWithStop: <OtherInfo>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>, stop: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => Set<import("../processing/node-id").NodeId>;
43
+ readonly lexeme: <R extends RNode<import("../processing/decorate").ParentInformation>>(this: void, node: R | undefined) => R extends {
44
+ lexeme: string;
45
+ } ? string : string | undefined;
46
+ readonly documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf;
32
47
  };
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RSymbol = void 0;
4
+ const model_1 = require("../model");
4
5
  const type_1 = require("../type");
5
6
  const convert_values_1 = require("../../../convert-values");
6
7
  /**
7
8
  * Helper for working with {@link RSymbol} AST nodes.
8
9
  */
9
10
  exports.RSymbol = {
11
+ ...model_1.RNode,
10
12
  name: 'RSymbol',
11
13
  /**
12
14
  * Type guard for {@link RSymbol} nodes.
@@ -1,4 +1,5 @@
1
- import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
1
+ import type { RAstNodeBase, Location, NoInfo } from '../model';
2
+ import { RNode } from '../model';
2
3
  import { RType } from '../type';
3
4
  import type { OperatorInformationValue } from '../operators';
4
5
  /**
@@ -22,4 +23,18 @@ export declare const RUnaryOp: {
22
23
  * Get the operator information for a binary operator node.
23
24
  */
24
25
  readonly getOperatorInfo: <Info = object>(node: RUnaryOp<Info>) => OperatorInformationValue | undefined;
26
+ readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
27
+ readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
28
+ readonly getType: (this: void, node: RNode) => RType;
29
+ readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
30
+ readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
31
+ readonly directChildren: <OtherInfo>(this: void, node: RNode<OtherInfo>) => readonly (RNode<OtherInfo> | typeof import("./r-function-call").EmptyArgument)[];
32
+ readonly directParent: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: Map<import("../processing/node-id").NodeId, RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation> | undefined;
33
+ readonly iterateParents: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation> | undefined, idMap: Map<import("../processing/node-id").NodeId, RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Generator<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>;
34
+ readonly depth: (this: void, node: RNode<import("../processing/decorate").ParentInformation>, idMap: Map<import("../processing/node-id").NodeId, RNode<import("../processing/decorate").ParentInformation>>) => number;
35
+ readonly collectAllIdsWithStop: <OtherInfo>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>, stop: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => Set<import("../processing/node-id").NodeId>;
36
+ readonly lexeme: <R extends RNode<import("../processing/decorate").ParentInformation>>(this: void, node: R | undefined) => R extends {
37
+ lexeme: string;
38
+ } ? string : string | undefined;
39
+ readonly documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf;
25
40
  };
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RUnaryOp = void 0;
4
+ const model_1 = require("../model");
4
5
  const type_1 = require("../type");
5
6
  const operators_1 = require("../operators");
6
7
  /**
7
8
  * Helper for working with {@link RUnaryOp} AST nodes.
8
9
  */
9
10
  exports.RUnaryOp = {
11
+ ...model_1.RNode,
10
12
  name: 'RUnaryOp',
11
13
  /**
12
14
  * Type guard for {@link RUnaryOp} nodes.
@@ -1,4 +1,5 @@
1
- import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
1
+ import type { RAstNodeBase, Location, NoInfo } from '../model';
2
+ import { RNode } from '../model';
2
3
  import { RType } from '../type';
3
4
  import type { RExpressionList } from './r-expression-list';
4
5
  /**
@@ -20,4 +21,18 @@ export declare const RWhileLoop: {
20
21
  * Type guard for {@link RWhileLoop} nodes.
21
22
  */
22
23
  readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RWhileLoop<Info>;
24
+ readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
25
+ readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
26
+ readonly getType: (this: void, node: RNode) => RType;
27
+ readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
28
+ readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
29
+ readonly directChildren: <OtherInfo>(this: void, node: RNode<OtherInfo>) => readonly (RNode<OtherInfo> | typeof import("./r-function-call").EmptyArgument)[];
30
+ readonly directParent: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: Map<import("../processing/node-id").NodeId, RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation> | undefined;
31
+ readonly iterateParents: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation> | undefined, idMap: Map<import("../processing/node-id").NodeId, RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Generator<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>;
32
+ readonly depth: (this: void, node: RNode<import("../processing/decorate").ParentInformation>, idMap: Map<import("../processing/node-id").NodeId, RNode<import("../processing/decorate").ParentInformation>>) => number;
33
+ readonly collectAllIdsWithStop: <OtherInfo>(this: void, nodes: import("../../../../../abstract-interpretation/normalized-ast-fold").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>, stop: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => Set<import("../processing/node-id").NodeId>;
34
+ readonly lexeme: <R extends RNode<import("../processing/decorate").ParentInformation>>(this: void, node: R | undefined) => R extends {
35
+ lexeme: string;
36
+ } ? string : string | undefined;
37
+ readonly documentation: typeof import("../../../../roxygen2/documentation-provider").getDocumentationOf;
23
38
  };
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RWhileLoop = void 0;
4
+ const model_1 = require("../model");
4
5
  const type_1 = require("../type");
5
6
  /**
6
7
  * Helper for working with {@link RWhileLoop} AST nodes.
7
8
  */
8
9
  exports.RWhileLoop = {
10
+ ...model_1.RNode,
9
11
  name: 'RWhileLoop',
10
12
  /**
11
13
  * Type guard for {@link RWhileLoop} nodes.
@@ -3,8 +3,8 @@ import { VertexType } from '../dataflow/graph/vertex';
3
3
  import type { ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
4
4
  import type { FlowrSearchElement } from './flowr-search';
5
5
  import { Enrichment } from './search-executor/search-enrichers';
6
- import type { BuiltInProcName } from '../dataflow/environments/built-in';
7
6
  import type { DataflowInformation } from '../dataflow/info';
7
+ import type { BuiltInProcName } from '../dataflow/environments/built-in-proc-name';
8
8
  export type FlowrFilterName = keyof typeof FlowrFilters;
9
9
  interface FlowrFilterWithArgs<Filter extends FlowrFilterName, Args extends FlowrFilterArgs<Filter>> {
10
10
  name: Filter;
@@ -4,10 +4,10 @@ exports.flowrSearchToMermaid = flowrSearchToMermaid;
4
4
  exports.flowrSearchToAscii = flowrSearchToAscii;
5
5
  exports.flowrSearchToCode = flowrSearchToCode;
6
6
  const flowr_search_traverse_1 = require("./flowr-search-traverse");
7
- const mermaid_1 = require("../util/mermaid/mermaid");
8
7
  const flowr_search_filters_1 = require("./flowr-search-filters");
9
8
  const vertex_1 = require("../dataflow/graph/vertex");
10
9
  const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
10
+ const mermaid_1 = require("../util/mermaid/mermaid");
11
11
  /**
12
12
  * Converts a {@link FlowrSearchLike} object to a mermaid flowchart.
13
13
  */
@@ -21,8 +21,8 @@ function argsToMermaidString(args) {
21
21
  if (args === undefined) {
22
22
  return '';
23
23
  }
24
- return Object.entries(args).map(([key, value]) => `${key}: ${(0, flowr_search_filters_1.isBinaryTree)(value) ? '_' + (0, mermaid_1.escapeMarkdown)((0, flowr_search_filters_1.binaryTreeToString)(value.tree)) + '_'
25
- : (0, mermaid_1.escapeMarkdown)(JSON.stringify(value))}`)
24
+ return Object.entries(args).map(([key, value]) => `${key}: ${(0, flowr_search_filters_1.isBinaryTree)(value) ? '_' + mermaid_1.Mermaid.escape((0, flowr_search_filters_1.binaryTreeToString)(value.tree)) + '_'
25
+ : mermaid_1.Mermaid.escape(JSON.stringify(value))}`)
26
26
  .join(', ');
27
27
  }
28
28
  function argsToAsciiString(args) {
@@ -6,13 +6,13 @@ exports.enrichElement = enrichElement;
6
6
  const objects_1 = require("../../util/objects");
7
7
  const vertex_1 = require("../../dataflow/graph/vertex");
8
8
  const assert_1 = require("../../util/assert");
9
- const dfg_get_origin_1 = require("../../dataflow/origin/dfg-get-origin");
10
9
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
11
10
  const cfg_simplification_1 = require("../../control-flow/cfg-simplification");
12
11
  const call_context_query_executor_1 = require("../../queries/catalog/call-context-query/call-context-query-executor");
13
12
  const cfg_kind_1 = require("../../project/cfg-kind");
14
13
  const identify_link_to_last_call_relation_1 = require("../../queries/catalog/call-context-query/identify-link-to-last-call-relation");
15
14
  const identifier_1 = require("../../dataflow/environments/identifier");
15
+ const df_helper_1 = require("../../dataflow/graph/df-helper");
16
16
  /**
17
17
  * An enumeration that stores the names of the available enrichments that can be applied to a set of search elements.
18
18
  * See {@link FlowrSearchBuilder.with} for more information on how to apply enrichments.
@@ -37,7 +37,7 @@ exports.Enrichments = {
37
37
  const n = await analyzer.normalize();
38
38
  const callVertex = df.graph.getVertex(e.node.info.id);
39
39
  if (callVertex?.tag === vertex_1.VertexType.FunctionCall) {
40
- const origins = (0, dfg_get_origin_1.getOriginInDfg)(df.graph, callVertex.id);
40
+ const origins = df_helper_1.Dataflow.origin(df.graph, callVertex.id);
41
41
  if (!origins || origins.length === 0) {
42
42
  content.targets = [(0, node_id_1.recoverName)(callVertex.id, n.idMap)];
43
43
  }
@@ -133,7 +133,7 @@ async function generateSyntax(input, args) {
133
133
  }
134
134
  async function generateCriterion(input, args) {
135
135
  const idMap = (await input.normalize()).idMap;
136
- return new flowr_search_1.FlowrSearchElements(args.criterion.map(c => ({ node: idMap.get((0, parse_1.slicingCriterionToId)(c, idMap)) })));
136
+ return new flowr_search_1.FlowrSearchElements(args.criterion.map(c => ({ node: idMap.get(parse_1.SlicingCriterion.parse(c, idMap)) })));
137
137
  }
138
138
  /**
139
139
  * Gets the search generator function for the given name
@@ -1,31 +1,56 @@
1
1
  import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
2
2
  import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
3
  /** Either `line:column`, `line@variable-name`, or `$id` */
4
- export type SingleSlicingCriterion = `${number}:${number}` | `${number}@${string}` | `$${NodeId | number}`;
5
- export type SlicingCriteria = SingleSlicingCriterion[];
4
+ export type SlicingCriterion = `${number}:${number}` | `${number}@${string}` | `$${NodeId | number}`;
6
5
  /**
7
- * Thrown if the given slicing criteria can not be found
8
- */
9
- export declare class CriteriaParseError extends Error {
10
- constructor(message: string);
11
- }
12
- /**
13
- * Takes a criterion in the form of `line:column` or `line@variable-name` and returns the corresponding node id
14
- * @see {@link tryResolveSliceCriterionToId} for a version that does not throw an error
6
+ * The helper object associated with {@link SlicingCriterion} which makes it easy
7
+ * to parse, validate and resolve slicing criteria.
15
8
  */
16
- export declare function slicingCriterionToId(criterion: SingleSlicingCriterion, idMap: AstIdMap): NodeId;
9
+ export declare const SlicingCriterion: {
10
+ readonly name: "SlicingCriterion";
11
+ /**
12
+ * Takes a criterion in the form of `line:column` or `line@variable-name` and returns the corresponding node id
13
+ * @see {@link SlicingCriterion.tryParse} for a version that does not throw an error
14
+ */
15
+ readonly parse: (this: void, criterion: SlicingCriterion, idMap: AstIdMap) => NodeId;
16
+ /**
17
+ * Tries to resolve a slicing criterion to an id, but does not throw an error if it fails.
18
+ * @see {@link SlicingCriterion.parse} for the version that throws an error
19
+ */
20
+ readonly tryParse: (this: void, criterion: SlicingCriterion | NodeId, idMap: AstIdMap) => NodeId | undefined;
21
+ /**
22
+ * Converts a node id to a slicing criterion in the form of `$id`
23
+ */
24
+ readonly fromId: (this: void, id: NodeId) => SlicingCriterion;
25
+ };
17
26
  /**
18
- * Tries to resolve a slicing criterion to an id, but does not throw an error if it fails.
19
- * @see {@link slicingCriterionToId} for the version that throws an error
27
+ * A slicing criterion is a list of single slicing criteria, which can be in the form of `line:column`, `line@variable-name`, or `$id`.
20
28
  */
21
- export declare function tryResolveSliceCriterionToId(criterion: string | NodeId, idMap: AstIdMap): NodeId | undefined;
29
+ export type SlicingCriteria = SlicingCriterion[];
22
30
  export interface DecodedCriterion {
23
- criterion: SingleSlicingCriterion;
31
+ criterion: SlicingCriterion;
24
32
  id: NodeId;
25
33
  }
26
34
  export type DecodedCriteria = ReadonlyArray<DecodedCriterion>;
27
35
  /**
28
- * Converts all slicing criteria to their corresponding node ids
29
- * @throws CriteriaParseError if any of the criteria can not be resolved
36
+ * The helper object associated with {@link SlicingCriteria} which makes it easy to parse, validate and resolve slicing criteria.
30
37
  */
31
- export declare function convertAllSlicingCriteriaToIds(criteria: SlicingCriteria, decorated: AstIdMap): DecodedCriteria;
38
+ export declare const SlicingCriteria: {
39
+ /**
40
+ * Decodes all slicing criteria to their corresponding node ids
41
+ * @throws CriteriaParseError if any of the criteria can not be resolved
42
+ * @see {@link SlicingCriteria.convertAll}
43
+ */
44
+ readonly decodeAll: (this: void, criteria: SlicingCriteria, decorated: AstIdMap) => DecodedCriteria;
45
+ /**
46
+ * Converts all criteria to their id in the AST if possible, this keeps the original criterion if it can not be resolved.
47
+ * @see {@link SlicingCriteria.decodeAll}
48
+ */
49
+ readonly convertAll: (this: void, criteria: SlicingCriteria, decorated: AstIdMap) => NodeId[];
50
+ };
51
+ /**
52
+ * Thrown if the given slicing criteria can not be found
53
+ */
54
+ export declare class CriteriaParseError extends Error {
55
+ constructor(message: string);
56
+ }
@@ -1,63 +1,84 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CriteriaParseError = void 0;
4
- exports.slicingCriterionToId = slicingCriterionToId;
5
- exports.tryResolveSliceCriterionToId = tryResolveSliceCriterionToId;
6
- exports.convertAllSlicingCriteriaToIds = convertAllSlicingCriteriaToIds;
3
+ exports.CriteriaParseError = exports.SlicingCriteria = exports.SlicingCriterion = void 0;
7
4
  const log_1 = require("../../util/log");
8
5
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
9
6
  const static_slicer_1 = require("../static/static-slicer");
10
7
  const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
11
8
  /**
12
- * Thrown if the given slicing criteria can not be found
9
+ * The helper object associated with {@link SlicingCriterion} which makes it easy
10
+ * to parse, validate and resolve slicing criteria.
13
11
  */
14
- class CriteriaParseError extends Error {
15
- constructor(message) {
16
- super(message);
17
- this.name = 'CriteriaParseError';
12
+ exports.SlicingCriterion = {
13
+ name: 'SlicingCriterion',
14
+ /**
15
+ * Takes a criterion in the form of `line:column` or `line@variable-name` and returns the corresponding node id
16
+ * @see {@link SlicingCriterion.tryParse} for a version that does not throw an error
17
+ */
18
+ parse(criterion, idMap) {
19
+ const resolved = exports.SlicingCriterion.tryParse(criterion, idMap);
20
+ if (resolved === undefined) {
21
+ throw new CriteriaParseError(`invalid slicing criterion ${criterion}`);
22
+ }
23
+ return resolved;
24
+ },
25
+ /**
26
+ * Tries to resolve a slicing criterion to an id, but does not throw an error if it fails.
27
+ * @see {@link SlicingCriterion.parse} for the version that throws an error
28
+ */
29
+ tryParse(criterion, idMap) {
30
+ criterion = criterion.toString(); // in case it's a number
31
+ if (criterion.startsWith('$')) {
32
+ return node_id_1.NodeId.normalize(criterion.substring(1));
33
+ }
34
+ else if (criterion.includes('@')) {
35
+ const at = criterion.indexOf('@');
36
+ const line = parseInt(criterion.substring(0, at));
37
+ const name = criterion.substring(at + 1);
38
+ return conventionalCriteriaToId(line, name, idMap);
39
+ }
40
+ else if (criterion.includes(':')) {
41
+ const [line, column] = criterion.split(':').map(c => parseInt(c));
42
+ return locationToId([line, column], idMap);
43
+ }
44
+ },
45
+ /**
46
+ * Converts a node id to a slicing criterion in the form of `$id`
47
+ */
48
+ fromId(id) {
49
+ return `$${id}`;
18
50
  }
19
- }
20
- exports.CriteriaParseError = CriteriaParseError;
51
+ };
21
52
  /**
22
- * Takes a criterion in the form of `line:column` or `line@variable-name` and returns the corresponding node id
23
- * @see {@link tryResolveSliceCriterionToId} for a version that does not throw an error
53
+ * The helper object associated with {@link SlicingCriteria} which makes it easy to parse, validate and resolve slicing criteria.
24
54
  */
25
- function slicingCriterionToId(criterion, idMap) {
26
- let resolved;
27
- if (criterion.startsWith('$')) {
28
- resolved = node_id_1.NodeId.normalize(criterion.substring(1));
29
- }
30
- else if (criterion.includes('@')) {
31
- const at = criterion.indexOf('@');
32
- const line = parseInt(criterion.substring(0, at));
33
- const name = criterion.substring(at + 1);
34
- resolved = conventionalCriteriaToId(line, name, idMap);
55
+ exports.SlicingCriteria = {
56
+ /**
57
+ * Decodes all slicing criteria to their corresponding node ids
58
+ * @throws CriteriaParseError if any of the criteria can not be resolved
59
+ * @see {@link SlicingCriteria.convertAll}
60
+ */
61
+ decodeAll(criteria, decorated) {
62
+ return criteria.map(l => ({ criterion: l, id: exports.SlicingCriterion.parse(l, decorated) }));
63
+ },
64
+ /**
65
+ * Converts all criteria to their id in the AST if possible, this keeps the original criterion if it can not be resolved.
66
+ * @see {@link SlicingCriteria.decodeAll}
67
+ */
68
+ convertAll(criteria, decorated) {
69
+ return criteria.map(l => exports.SlicingCriterion.tryParse(l, decorated) ?? l);
35
70
  }
36
- else if (criterion.includes(':')) {
37
- const [line, column] = criterion.split(':').map(c => parseInt(c));
38
- resolved = locationToId([line, column], idMap);
39
- }
40
- if (resolved === undefined) {
41
- throw new CriteriaParseError(`invalid slicing criterion ${criterion}`);
42
- }
43
- return resolved;
44
- }
71
+ };
45
72
  /**
46
- * Tries to resolve a slicing criterion to an id, but does not throw an error if it fails.
47
- * @see {@link slicingCriterionToId} for the version that throws an error
73
+ * Thrown if the given slicing criteria can not be found
48
74
  */
49
- function tryResolveSliceCriterionToId(criterion, idMap) {
50
- try {
51
- return slicingCriterionToId(criterion, idMap);
52
- }
53
- catch (e) {
54
- if (e instanceof CriteriaParseError) {
55
- (0, log_1.expensiveTrace)(static_slicer_1.slicerLogger, () => `could not resolve slicing criterion ${criterion}: ${e.message}`);
56
- return undefined;
57
- }
58
- throw e; // rethrow other errors
75
+ class CriteriaParseError extends Error {
76
+ constructor(message) {
77
+ super(message);
78
+ this.name = 'CriteriaParseError';
59
79
  }
60
80
  }
81
+ exports.CriteriaParseError = CriteriaParseError;
61
82
  function locationToId(location, dataflowIdMap) {
62
83
  let candidate;
63
84
  for (const [id, nodeInfo] of dataflowIdMap.entries()) {
@@ -71,36 +92,20 @@ function locationToId(location, dataflowIdMap) {
71
92
  }
72
93
  candidate = nodeInfo;
73
94
  }
74
- const id = candidate?.info.id;
75
- if (id) {
76
- (0, log_1.expensiveTrace)(static_slicer_1.slicerLogger, () => `resolve id ${id} (${JSON.stringify(candidate?.info)}) for location ${JSON.stringify(location)}`);
77
- }
78
- return id;
95
+ return candidate?.info.id;
79
96
  }
80
97
  function conventionalCriteriaToId(line, name, dataflowIdMap) {
81
98
  let candidate;
82
- for (const [id, nodeInfo] of dataflowIdMap.entries()) {
99
+ for (const nodeInfo of dataflowIdMap.values()) {
83
100
  if (nodeInfo.location === undefined || nodeInfo.location[0] !== line || nodeInfo.lexeme !== name) {
84
101
  continue;
85
102
  }
86
- static_slicer_1.slicerLogger.trace(`can resolve id ${id} (${JSON.stringify(nodeInfo)}) for line ${line} and name ${name}`);
87
103
  // function calls have the same location as the symbol they refer to, so we need to prefer the function call
88
104
  if (candidate !== undefined && nodeInfo.type !== type_1.RType.FunctionCall || nodeInfo.type === type_1.RType.Argument || nodeInfo.type === type_1.RType.ExpressionList) {
89
105
  continue;
90
106
  }
91
107
  candidate = nodeInfo;
92
108
  }
93
- const id = candidate?.info.id;
94
- if (id) {
95
- static_slicer_1.slicerLogger.trace(`resolve id ${id} (${JSON.stringify(candidate?.info)}) for line ${line} and name ${name}`);
96
- }
97
- return id;
98
- }
99
- /**
100
- * Converts all slicing criteria to their corresponding node ids
101
- * @throws CriteriaParseError if any of the criteria can not be resolved
102
- */
103
- function convertAllSlicingCriteriaToIds(criteria, decorated) {
104
- return criteria.map(l => ({ criterion: l, id: slicingCriterionToId(l, decorated) }));
109
+ return candidate?.info.id;
105
110
  }
106
111
  //# sourceMappingURL=parse.js.map
@@ -1,6 +1,5 @@
1
1
  import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
2
2
  import type { REnvironmentInformation } from '../../dataflow/environments/environment';
3
- import type { DecodedCriteria } from '../criterion/parse';
4
3
  /**
5
4
  * Represents a node during the slicing process, together with the environment it is traversed in
6
5
  * (modified by function calls) and whether it is only used for its side effects.
@@ -29,7 +28,7 @@ export interface SliceResult {
29
28
  */
30
29
  readonly result: ReadonlySet<NodeId>;
31
30
  /**
32
- * The mapping produced to decode the entered criteria
31
+ * The ids of the nodes in the normalized ast that were used as seed ids for slicing. This is a subset of {@link result}.
33
32
  */
34
- readonly decodedCriteria: DecodedCriteria;
33
+ readonly slicedFor: readonly NodeId[];
35
34
  }
@@ -2,12 +2,11 @@ import type { SliceResult } from './slicer-types';
2
2
  import { type Fingerprint } from './fingerprint';
3
3
  import { VisitingQueue } from './visiting-queue';
4
4
  import type { NormalizedAst } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
5
- import { type SlicingCriteria } from '../criterion/parse';
6
5
  import { type REnvironmentInformation } from '../../dataflow/environments/environment';
7
6
  import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
8
- import { SliceDirection } from '../../core/steps/all/static-slicing/00-slice';
9
7
  import type { DataflowInformation } from '../../dataflow/info';
10
8
  import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
9
+ import { SliceDirection } from '../../util/slice-direction';
11
10
  export declare const slicerLogger: import("tslog").Logger<import("tslog").ILogObj>;
12
11
  /**
13
12
  * This returns the ids to include in the static slice of the given type, when slicing with the given seed id's (must be at least one).
@@ -16,12 +15,12 @@ export declare const slicerLogger: import("tslog").Logger<import("tslog").ILogOb
16
15
  * @param ctx - The analyzer context used for slicing.
17
16
  * @param info - The dataflow information used for slicing.
18
17
  * @param idMap - The mapping from node ids to their information in the AST.
19
- * @param criteria - The criteria to slice on.
18
+ * @param ids - The seed ids to slice with. Must be at least one.
20
19
  * @param direction - The direction to slice in.
21
20
  * @param threshold - The maximum number of nodes to visit in the graph. If the threshold is reached, the slice will side with inclusion and drop its minimal guarantee. The limit ensures that the algorithm halts.
22
21
  * @param cache - A cache to store the results of the slice. If provided, the slice may use this cache to speed up the slicing process.
23
22
  */
24
- export declare function staticSlice(ctx: ReadOnlyFlowrAnalyzerContext, info: DataflowInformation, { idMap }: NormalizedAst, criteria: SlicingCriteria, direction: SliceDirection, threshold?: number, cache?: Map<Fingerprint, Set<NodeId>>): Readonly<SliceResult>;
23
+ export declare function staticSlice(ctx: ReadOnlyFlowrAnalyzerContext, info: DataflowInformation, { idMap }: NormalizedAst, ids: readonly NodeId[], direction: SliceDirection, threshold?: number, cache?: Map<Fingerprint, Set<NodeId>>): Readonly<SliceResult>;
25
24
  /**
26
25
  * Updates the potential addition for the given target node in the visiting queue.
27
26
  * This describes vertices that might be added *if* another path reaches them.
@@ -7,11 +7,11 @@ const assert_1 = require("../../util/assert");
7
7
  const log_1 = require("../../util/log");
8
8
  const visiting_queue_1 = require("./visiting-queue");
9
9
  const slice_call_1 = require("./slice-call");
10
- const parse_1 = require("../criterion/parse");
11
10
  const vertex_1 = require("../../dataflow/graph/vertex");
12
11
  const edge_1 = require("../../dataflow/graph/edge");
13
- const _00_slice_1 = require("../../core/steps/all/static-slicing/00-slice");
14
- const invert_dfg_1 = require("../../dataflow/graph/invert-dfg");
12
+ const df_helper_1 = require("../../dataflow/graph/df-helper");
13
+ const slice_direction_1 = require("../../util/slice-direction");
14
+ const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
15
15
  exports.slicerLogger = log_1.log.getSubLogger({ name: 'slicer' });
16
16
  /**
17
17
  * This returns the ids to include in the static slice of the given type, when slicing with the given seed id's (must be at least one).
@@ -20,18 +20,16 @@ exports.slicerLogger = log_1.log.getSubLogger({ name: 'slicer' });
20
20
  * @param ctx - The analyzer context used for slicing.
21
21
  * @param info - The dataflow information used for slicing.
22
22
  * @param idMap - The mapping from node ids to their information in the AST.
23
- * @param criteria - The criteria to slice on.
23
+ * @param ids - The seed ids to slice with. Must be at least one.
24
24
  * @param direction - The direction to slice in.
25
25
  * @param threshold - The maximum number of nodes to visit in the graph. If the threshold is reached, the slice will side with inclusion and drop its minimal guarantee. The limit ensures that the algorithm halts.
26
26
  * @param cache - A cache to store the results of the slice. If provided, the slice may use this cache to speed up the slicing process.
27
27
  */
28
- function staticSlice(ctx, info, { idMap }, criteria, direction, threshold = 75, cache) {
29
- (0, assert_1.guard)(criteria.length > 0, 'must have at least one seed id to calculate slice');
30
- const decodedCriteria = (0, parse_1.convertAllSlicingCriteriaToIds)(criteria, idMap);
31
- (0, log_1.expensiveTrace)(exports.slicerLogger, () => `calculating ${direction} slice for ${decodedCriteria.length} seed criteria: ${decodedCriteria.map(s => JSON.stringify(s)).join(', ')}`);
28
+ function staticSlice(ctx, info, { idMap }, ids, direction, threshold = 75, cache) {
29
+ (0, assert_1.guard)(ids.length > 0, 'must have at least one seed id to calculate slice');
32
30
  let { graph } = info;
33
- if (direction === _00_slice_1.SliceDirection.Forward) {
34
- graph = (0, invert_dfg_1.invertDfg)(graph, ctx.env.makeCleanEnv());
31
+ if (direction === slice_direction_1.SliceDirection.Forward) {
32
+ graph = df_helper_1.Dataflow.invertGraph(graph, ctx.env.makeCleanEnv());
35
33
  }
36
34
  const queue = new visiting_queue_1.VisitingQueue(threshold, cache);
37
35
  let minNesting = Number.MAX_SAFE_INTEGER;
@@ -40,7 +38,7 @@ function staticSlice(ctx, info, { idMap }, criteria, direction, threshold = 75,
40
38
  {
41
39
  const emptyEnv = ctx.env.makeCleanEnv();
42
40
  const basePrint = ctx.env.getCleanEnvFingerprint();
43
- for (const { id: startId } of decodedCriteria) {
41
+ for (const startId of ids) {
44
42
  queue.add(startId, emptyEnv, basePrint, false);
45
43
  // retrieve the minimum nesting of all nodes to only add control dependencies if they are "part" of the current execution
46
44
  minNesting = Math.min(minNesting, idMap.get(startId)?.info.nesting ?? minNesting);
@@ -102,7 +100,29 @@ function staticSlice(ctx, info, { idMap }, criteria, direction, threshold = 75,
102
100
  }
103
101
  }
104
102
  }
105
- return { ...queue.status(), decodedCriteria };
103
+ if (ctx.config.solver.slicer?.autoExtend) {
104
+ return { ...queue.status(), slicedFor: ids, result: extendSlices(queue.status().result, idMap) };
105
+ }
106
+ else {
107
+ return { ...queue.status(), slicedFor: ids };
108
+ }
109
+ }
110
+ function extendSlices(results, ast) {
111
+ const res = new Set();
112
+ for (const id of results) {
113
+ res.add(id);
114
+ let parent = ast.get(id);
115
+ while (parent && parent.info.role !== "root" /* RoleInParent.Root */ && parent.info.role !== "el-c" /* RoleInParent.ExpressionListChild */) {
116
+ parent = parent.info.parent ? ast.get(parent.info.parent) : undefined;
117
+ }
118
+ if (!parent) {
119
+ continue; // no parent, no need to extend
120
+ }
121
+ for (const id of model_1.RNode.collectAllIds(parent)) {
122
+ res.add(id);
123
+ }
124
+ }
125
+ return res;
106
126
  }
107
127
  /**
108
128
  * Updates the potential addition for the given target node in the visiting queue.