@eagleoutice/flowr 1.3.14 → 1.4.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 (218) hide show
  1. package/abstract-interpretation/domain.d.ts +27 -0
  2. package/abstract-interpretation/domain.js +146 -0
  3. package/abstract-interpretation/handler/binop/binop.d.ts +16 -0
  4. package/abstract-interpretation/handler/binop/binop.js +40 -0
  5. package/abstract-interpretation/handler/binop/operators.d.ts +2 -0
  6. package/abstract-interpretation/handler/binop/operators.js +42 -0
  7. package/abstract-interpretation/handler/handler.d.ts +6 -0
  8. package/abstract-interpretation/handler/handler.js +3 -0
  9. package/abstract-interpretation/processor.d.ts +10 -0
  10. package/abstract-interpretation/processor.js +78 -0
  11. package/benchmark/slicer.d.ts +6 -5
  12. package/benchmark/slicer.js +2 -0
  13. package/benchmark/stats/print.d.ts +1 -1
  14. package/benchmark/stats/stats.d.ts +4 -4
  15. package/benchmark/stats/stats.js +1 -1
  16. package/cli/common/features.d.ts +1 -1
  17. package/cli/common/options.d.ts +1 -1
  18. package/cli/common/script.d.ts +1 -1
  19. package/cli/common/scripts-info.d.ts +2 -2
  20. package/cli/repl/commands/cfg.d.ts +1 -1
  21. package/cli/repl/commands/cfg.js +1 -1
  22. package/cli/repl/commands/commands.d.ts +1 -1
  23. package/cli/repl/commands/dataflow.d.ts +1 -1
  24. package/cli/repl/commands/execute.d.ts +2 -2
  25. package/cli/repl/commands/main.d.ts +2 -2
  26. package/cli/repl/commands/normalize.d.ts +1 -1
  27. package/cli/repl/commands/parse.d.ts +1 -1
  28. package/cli/repl/commands/quit.d.ts +1 -1
  29. package/cli/repl/commands/version.d.ts +1 -1
  30. package/cli/repl/core.d.ts +1 -1
  31. package/cli/repl/execute.d.ts +1 -1
  32. package/cli/repl/server/connection.d.ts +2 -2
  33. package/cli/repl/server/connection.js +3 -2
  34. package/cli/repl/server/messages/analysis.d.ts +3 -3
  35. package/cli/repl/server/messages/analysis.js +12 -32
  36. package/cli/repl/server/messages/error.d.ts +1 -1
  37. package/cli/repl/server/messages/hello.d.ts +2 -2
  38. package/cli/repl/server/messages/messages.d.ts +5 -5
  39. package/cli/repl/server/messages/repl.d.ts +1 -1
  40. package/cli/repl/server/messages/slice.d.ts +3 -3
  41. package/cli/repl/server/net.d.ts +16 -0
  42. package/cli/repl/server/net.js +40 -1
  43. package/cli/repl/server/send.d.ts +2 -2
  44. package/cli/repl/server/server.d.ts +2 -2
  45. package/cli/repl/server/validate.d.ts +3 -3
  46. package/cli/statistics-helper-app.js +2 -2
  47. package/core/input.d.ts +6 -6
  48. package/core/output.d.ts +3 -2
  49. package/core/print/dataflow-printer.d.ts +3 -3
  50. package/core/print/normalize-printer.d.ts +2 -2
  51. package/core/print/parse-printer.d.ts +2 -2
  52. package/core/print/print.d.ts +1 -1
  53. package/core/print/slice-diff-ansi.d.ts +1 -1
  54. package/core/slicer.d.ts +5 -4
  55. package/core/slicer.js +6 -2
  56. package/core/steps.d.ts +22 -4
  57. package/core/steps.js +10 -2
  58. package/dataflow/environments/append.d.ts +1 -1
  59. package/dataflow/environments/environment.d.ts +4 -4
  60. package/dataflow/environments/overwrite.d.ts +1 -1
  61. package/dataflow/environments/register.d.ts +2 -2
  62. package/dataflow/environments/resolve-by-name.d.ts +2 -2
  63. package/dataflow/environments/scoping.d.ts +1 -1
  64. package/dataflow/extractor.d.ts +4 -4
  65. package/dataflow/graph/diff.d.ts +3 -3
  66. package/dataflow/graph/graph.d.ts +8 -7
  67. package/dataflow/graph/quads.d.ts +2 -2
  68. package/dataflow/graph/vertex.d.ts +5 -5
  69. package/dataflow/internal/info.d.ts +2 -2
  70. package/dataflow/internal/linker.d.ts +3 -3
  71. package/dataflow/internal/process/access.d.ts +3 -3
  72. package/dataflow/internal/process/expression-list.d.ts +3 -3
  73. package/dataflow/internal/process/expression-list.js +0 -4
  74. package/dataflow/internal/process/functions/argument.d.ts +4 -4
  75. package/dataflow/internal/process/functions/exit-points.d.ts +1 -1
  76. package/dataflow/internal/process/functions/function-call.d.ts +3 -3
  77. package/dataflow/internal/process/functions/function-definition.d.ts +3 -3
  78. package/dataflow/internal/process/functions/parameter.d.ts +3 -3
  79. package/dataflow/internal/process/if-then-else.d.ts +3 -3
  80. package/dataflow/internal/process/loops/for-loop.d.ts +3 -3
  81. package/dataflow/internal/process/loops/repeat-loop.d.ts +3 -3
  82. package/dataflow/internal/process/loops/while-loop.d.ts +3 -3
  83. package/dataflow/internal/process/operators/assignment.d.ts +3 -3
  84. package/dataflow/internal/process/operators/non-assignment-binary-op.d.ts +3 -3
  85. package/dataflow/internal/process/operators/pipe.d.ts +3 -3
  86. package/dataflow/internal/process/operators/unary-op.d.ts +3 -3
  87. package/dataflow/internal/process/symbol.d.ts +3 -3
  88. package/dataflow/internal/process/uninteresting-leaf.d.ts +2 -2
  89. package/dataflow/processor.d.ts +3 -3
  90. package/flowr.d.ts +3 -2
  91. package/flowr.js +5 -3
  92. package/package.json +11 -2
  93. package/r-bridge/lang-4.x/ast/model/collect.d.ts +2 -2
  94. package/r-bridge/lang-4.x/ast/model/model.d.ts +6 -6
  95. package/r-bridge/lang-4.x/ast/model/nodes/info/index.d.ts +2 -2
  96. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +3 -3
  97. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -3
  98. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -3
  99. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -3
  100. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -2
  101. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -2
  102. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -2
  103. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +4 -4
  104. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +4 -4
  105. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +4 -4
  106. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +3 -3
  107. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -2
  108. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -2
  109. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -2
  110. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -3
  111. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +3 -3
  112. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -2
  113. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +3 -3
  114. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -3
  115. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -2
  116. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -3
  117. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +3 -3
  118. package/r-bridge/lang-4.x/ast/model/operators.d.ts +1 -1
  119. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -2
  120. package/r-bridge/lang-4.x/ast/model/processing/fold.d.ts +3 -3
  121. package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +1 -1
  122. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +3 -3
  123. package/r-bridge/lang-4.x/ast/model/processing/visitor.d.ts +1 -1
  124. package/r-bridge/lang-4.x/ast/parser/xml/config.d.ts +2 -2
  125. package/r-bridge/lang-4.x/ast/parser/xml/data.d.ts +5 -5
  126. package/r-bridge/lang-4.x/ast/parser/xml/hooks.d.ts +5 -5
  127. package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +1 -1
  128. package/r-bridge/lang-4.x/ast/parser/xml/internal/access.d.ts +3 -3
  129. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.d.ts +3 -3
  130. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.d.ts +3 -3
  131. package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.d.ts +3 -3
  132. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.d.ts +3 -3
  133. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.d.ts +3 -3
  134. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.d.ts +3 -3
  135. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.d.ts +3 -3
  136. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.d.ts +3 -3
  137. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.d.ts +3 -3
  138. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.d.ts +3 -3
  139. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.d.ts +3 -3
  140. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.d.ts +3 -3
  141. package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.d.ts +4 -4
  142. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.d.ts +3 -3
  143. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/special.d.ts +1 -1
  144. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.d.ts +3 -3
  145. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.d.ts +3 -3
  146. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.d.ts +3 -3
  147. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.d.ts +4 -4
  148. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.d.ts +3 -3
  149. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.d.ts +4 -4
  150. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.d.ts +4 -4
  151. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.d.ts +3 -3
  152. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.d.ts +3 -3
  153. package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.d.ts +2 -2
  154. package/r-bridge/lang-4.x/ast/parser/xml/parser.d.ts +4 -4
  155. package/r-bridge/retriever.d.ts +2 -2
  156. package/r-bridge/shell-executor.d.ts +25 -0
  157. package/r-bridge/shell-executor.js +119 -0
  158. package/r-bridge/shell.d.ts +8 -5
  159. package/r-bridge/shell.js +6 -3
  160. package/reconstruct/reconstruct.d.ts +1 -1
  161. package/slicing/criterion/collect-all.d.ts +3 -3
  162. package/slicing/criterion/filters/all-variables.d.ts +1 -1
  163. package/slicing/criterion/parse.d.ts +1 -1
  164. package/slicing/static/static-slicer.d.ts +3 -3
  165. package/statistics/features/common-syntax-probability.d.ts +3 -2
  166. package/statistics/features/common-syntax-probability.js +0 -3
  167. package/statistics/features/feature.d.ts +6 -6
  168. package/statistics/features/post-processing.d.ts +2 -2
  169. package/statistics/features/supported/assignments/assignments.d.ts +2 -2
  170. package/statistics/features/supported/assignments/post-process.d.ts +2 -2
  171. package/statistics/features/supported/comments/comments.d.ts +2 -2
  172. package/statistics/features/supported/comments/post-process.d.ts +2 -2
  173. package/statistics/features/supported/control-flow/control-flow.d.ts +2 -2
  174. package/statistics/features/supported/control-flow/post-process.d.ts +2 -2
  175. package/statistics/features/supported/data-access/data-access.d.ts +3 -3
  176. package/statistics/features/supported/data-access/post-process.d.ts +2 -2
  177. package/statistics/features/supported/defined-functions/defined-functions.d.ts +4 -4
  178. package/statistics/features/supported/defined-functions/post-process.d.ts +2 -2
  179. package/statistics/features/supported/expression-list/expression-list.d.ts +2 -2
  180. package/statistics/features/supported/expression-list/post-process.d.ts +2 -2
  181. package/statistics/features/supported/loops/loops.d.ts +2 -2
  182. package/statistics/features/supported/loops/post-process.d.ts +2 -2
  183. package/statistics/features/supported/used-functions/post-process.d.ts +2 -2
  184. package/statistics/features/supported/used-functions/used-functions.d.ts +3 -3
  185. package/statistics/features/supported/used-packages/post-process.d.ts +2 -2
  186. package/statistics/features/supported/used-packages/used-packages.d.ts +2 -2
  187. package/statistics/features/supported/values/post-process.d.ts +2 -2
  188. package/statistics/features/supported/values/values.d.ts +2 -2
  189. package/statistics/features/supported/variables/post-process.d.ts +3 -3
  190. package/statistics/features/supported/variables/variables.d.ts +2 -2
  191. package/statistics/meta-statistics.d.ts +1 -1
  192. package/statistics/output/print-stats.d.ts +2 -2
  193. package/statistics/output/statistics-file.d.ts +1 -1
  194. package/statistics/statistics.d.ts +4 -4
  195. package/util/{cfg.d.ts → cfg/cfg.d.ts} +18 -6
  196. package/util/{cfg.js → cfg/cfg.js} +42 -37
  197. package/util/cfg/visitor.d.ts +14 -0
  198. package/util/cfg/visitor.js +64 -0
  199. package/util/diff.d.ts +1 -1
  200. package/util/files.d.ts +1 -1
  201. package/util/mermaid/ast.d.ts +1 -1
  202. package/util/mermaid/cfg.d.ts +2 -2
  203. package/util/mermaid/dfg.d.ts +3 -3
  204. package/util/objects.d.ts +1 -1
  205. package/util/quads.d.ts +2 -2
  206. package/util/summarizer/benchmark/data.d.ts +1 -1
  207. package/util/summarizer/benchmark/first-phase/process.d.ts +3 -3
  208. package/util/summarizer/benchmark/second-phase/graph.d.ts +1 -1
  209. package/util/summarizer/benchmark/second-phase/process.d.ts +1 -1
  210. package/util/summarizer/benchmark/summarizer.d.ts +3 -2
  211. package/util/summarizer/benchmark/summarizer.js +0 -4
  212. package/util/summarizer/statistics/post-process/clusterer.d.ts +2 -2
  213. package/util/summarizer/statistics/post-process/file-based-count.d.ts +1 -1
  214. package/util/summarizer/statistics/post-process/histogram.d.ts +2 -2
  215. package/util/summarizer/statistics/post-process/post-process-output.d.ts +2 -2
  216. package/util/summarizer/statistics/second-phase/process.d.ts +2 -2
  217. package/util/summarizer/statistics/summarizer.d.ts +3 -2
  218. package/util/summarizer/summarizer.d.ts +1 -1
@@ -1,6 +1,6 @@
1
- import { DataflowGraph } from '../../dataflow';
2
- import { NodeId, NormalizedAst } from '../../r-bridge';
3
- import { DecodedCriteria, SlicingCriteria } from '../criterion';
1
+ import type { DataflowGraph } from '../../dataflow';
2
+ import type { NodeId, NormalizedAst } from '../../r-bridge';
3
+ import type { DecodedCriteria, SlicingCriteria } from '../criterion';
4
4
  export declare const slicerLogger: import("tslog").Logger<import("tslog").ILogObj>;
5
5
  /**
6
6
  * The result of the slice step
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Defines the type of syntax constructs that we track (e.g., true, false, 0, 1, T, F, conditions...)
3
3
  */
4
- import { RFalse, RNodeWithParent, RTrue } from '../../r-bridge';
5
- import { SummarizedMeasurement } from '../../util/summarizer/benchmark/data';
4
+ import type { RNodeWithParent } from '../../r-bridge';
5
+ import { RFalse, RTrue } from '../../r-bridge';
6
+ import type { SummarizedMeasurement } from '../../util/summarizer/benchmark/data';
6
7
  export interface CommonSyntaxTypeCounts<Measurement = bigint> {
7
8
  total: Measurement;
8
9
  multiple: Measurement;
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.summarizeCommonSyntaxTypeCounter = exports.appendCommonSyntaxTypeCounter = exports.updateCommonSyntaxTypeCounts = exports.emptyCommonSyntaxTypeCounts = void 0;
4
- /**
5
- * Defines the type of syntax constructs that we track (e.g., true, false, 0, 1, T, F, conditions...)
6
- */
7
4
  const r_bridge_1 = require("../../r-bridge");
8
5
  const process_1 = require("../../util/summarizer/benchmark/first-phase/process");
9
6
  const numbers_1 = require("../../util/numbers");
@@ -1,9 +1,9 @@
1
- import { EvalOptions } from 'xpath-ts2/src/parse-api';
2
- import { MergeableRecord } from '../../util/objects';
3
- import { NormalizedAst } from '../../r-bridge';
4
- import { DataflowInformation } from '../../dataflow/internal/info';
5
- import { MetaStatistics } from '../meta-statistics';
6
- import { StatisticsSummarizerConfiguration } from '../../util/summarizer/statistics/summarizer';
1
+ import type { EvalOptions } from 'xpath-ts2/src/parse-api';
2
+ import type { MergeableRecord } from '../../util/objects';
3
+ import type { NormalizedAst } from '../../r-bridge';
4
+ import type { DataflowInformation } from '../../dataflow/internal/info';
5
+ import type { MetaStatistics } from '../meta-statistics';
6
+ import type { StatisticsSummarizerConfiguration } from '../../util/summarizer/statistics/summarizer';
7
7
  /**
8
8
  * Maps each sub-feature name to the number of occurrences of that sub-feature.
9
9
  * Allows for one nesting level to denote hierarchical features.
@@ -1,5 +1,5 @@
1
- import { MergeableRecord } from '../../util/objects';
2
- import { StatisticsSummarizerConfiguration } from '../../util/summarizer/statistics/summarizer';
1
+ import type { MergeableRecord } from '../../util/objects';
2
+ import type { StatisticsSummarizerConfiguration } from '../../util/summarizer/statistics/summarizer';
3
3
  export interface SummarizedWithProject<Uniques = Set<string>, Count = number[]> {
4
4
  uniqueProjects: Uniques;
5
5
  uniqueFiles: Uniques;
@@ -1,5 +1,5 @@
1
- import { Feature } from '../../feature';
2
- import { Writable } from 'ts-essentials';
1
+ import type { Feature } from '../../feature';
2
+ import type { Writable } from 'ts-essentials';
3
3
  declare const initialAssignmentInfo: {
4
4
  assignmentOperator: Record<string, bigint>;
5
5
  assigned: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
@@ -1,3 +1,3 @@
1
- import { FeatureStatisticsWithMeta } from '../../feature';
2
- import { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
1
+ import type { FeatureStatisticsWithMeta } from '../../feature';
2
+ import type { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
3
3
  export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
@@ -1,5 +1,5 @@
1
- import { Feature } from '../../feature';
2
- import { Writable } from 'ts-essentials';
1
+ import type { Feature } from '../../feature';
2
+ import type { Writable } from 'ts-essentials';
3
3
  export declare const initialCommentInfo: {
4
4
  totalAmount: number;
5
5
  roxygenComments: number;
@@ -1,3 +1,3 @@
1
- import { FeatureStatisticsWithMeta } from '../../feature';
2
- import { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
1
+ import type { FeatureStatisticsWithMeta } from '../../feature';
2
+ import type { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
3
3
  export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
@@ -1,5 +1,5 @@
1
- import { Feature } from '../../feature';
2
- import { Writable } from 'ts-essentials';
1
+ import type { Feature } from '../../feature';
2
+ import type { Writable } from 'ts-essentials';
3
3
  declare const initialControlflowInfo: {
4
4
  ifThen: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
5
5
  thenBody: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
@@ -1,3 +1,3 @@
1
- import { FeatureStatisticsWithMeta } from '../../feature';
2
- import { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
1
+ import type { FeatureStatisticsWithMeta } from '../../feature';
2
+ import type { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
3
3
  export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
@@ -1,6 +1,6 @@
1
- import { Feature } from '../../feature';
2
- import { Writable } from 'ts-essentials';
3
- import { CommonSyntaxTypeCounts } from '../../common-syntax-probability';
1
+ import type { Feature } from '../../feature';
2
+ import type { Writable } from 'ts-essentials';
3
+ import type { CommonSyntaxTypeCounts } from '../../common-syntax-probability';
4
4
  declare const initialDataAccessInfo: {
5
5
  singleBracket: Record<number, bigint | CommonSyntaxTypeCounts<bigint>>;
6
6
  doubleBracket: Record<number, bigint | CommonSyntaxTypeCounts<bigint>>;
@@ -1,3 +1,3 @@
1
- import { FeatureStatisticsWithMeta } from '../../feature';
2
- import { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
1
+ import type { FeatureStatisticsWithMeta } from '../../feature';
2
+ import type { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
3
3
  export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
@@ -1,7 +1,7 @@
1
- import { Feature } from '../../feature';
2
- import { Writable } from 'ts-essentials';
3
- import { SourcePosition } from '../../../../util/range';
4
- import { MergeableRecord } from '../../../../util/objects';
1
+ import type { Feature } from '../../feature';
2
+ import type { Writable } from 'ts-essentials';
3
+ import type { SourcePosition } from '../../../../util/range';
4
+ import type { MergeableRecord } from '../../../../util/objects';
5
5
  declare const initialFunctionDefinitionInfo: {
6
6
  /** all, anonymous, assigned, non-assigned, ... */
7
7
  total: number;
@@ -1,5 +1,5 @@
1
- import { FeatureStatisticsWithMeta } from '../../feature';
2
- import { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
1
+ import type { FeatureStatisticsWithMeta } from '../../feature';
2
+ import type { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
3
3
  /**
4
4
  * Note: the summary does not contain a 0 for each function that is _not_ called by a file. Hence, the minimum can not be 0 (division for mean etc. will still be performed on total file count)
5
5
  */
@@ -1,5 +1,5 @@
1
- import { Writable } from 'ts-essentials';
2
- import { Feature } from '../../feature';
1
+ import type { Writable } from 'ts-essentials';
2
+ import type { Feature } from '../../feature';
3
3
  declare const initialExpressionListInfo: {
4
4
  allExpressionLists: number;
5
5
  deepestNesting: number;
@@ -1,3 +1,3 @@
1
- import { FeatureStatisticsWithMeta } from '../../feature';
2
- import { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
1
+ import type { FeatureStatisticsWithMeta } from '../../feature';
2
+ import type { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
3
3
  export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
@@ -1,5 +1,5 @@
1
- import { Feature } from '../../feature';
2
- import { Writable } from 'ts-essentials';
1
+ import type { Feature } from '../../feature';
2
+ import type { Writable } from 'ts-essentials';
3
3
  declare const initialLoopInfo: {
4
4
  forLoops: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
5
5
  forLoopVar: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
@@ -1,3 +1,3 @@
1
- import { FeatureStatisticsWithMeta } from '../../feature';
2
- import { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
1
+ import type { FeatureStatisticsWithMeta } from '../../feature';
2
+ import type { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
3
3
  export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
@@ -1,5 +1,5 @@
1
- import { FeatureStatisticsWithMeta } from '../../feature';
2
- import { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
1
+ import type { FeatureStatisticsWithMeta } from '../../feature';
2
+ import type { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
3
3
  /**
4
4
  * Note: the summary does not contain a 0 for each function that is _not_ called by a file. Hence, the minimum can not be 0 (division for mean etc. will still be performed on total file count)
5
5
  */
@@ -1,6 +1,6 @@
1
- import { Feature } from '../../feature';
2
- import { Writable } from 'ts-essentials';
3
- import { CommonSyntaxTypeCounts } from '../../common-syntax-probability';
1
+ import type { Feature } from '../../feature';
2
+ import type { Writable } from 'ts-essentials';
3
+ import type { CommonSyntaxTypeCounts } from '../../common-syntax-probability';
4
4
  declare const initialFunctionUsageInfo: {
5
5
  allFunctionCalls: number;
6
6
  args: Record<number, bigint | CommonSyntaxTypeCounts<bigint>>;
@@ -1,3 +1,3 @@
1
- import { FeatureStatisticsWithMeta } from '../../feature';
2
- import { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
1
+ import type { FeatureStatisticsWithMeta } from '../../feature';
2
+ import type { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
3
3
  export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
@@ -1,5 +1,5 @@
1
- import { Feature } from '../../feature';
2
- import { Writable } from 'ts-essentials';
1
+ import type { Feature } from '../../feature';
2
+ import type { Writable } from 'ts-essentials';
3
3
  export declare const initialUsedPackageInfos: {
4
4
  library: number;
5
5
  require: number;
@@ -1,3 +1,3 @@
1
- import { FeatureStatisticsWithMeta } from '../../feature';
2
- import { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
1
+ import type { FeatureStatisticsWithMeta } from '../../feature';
2
+ import type { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
3
3
  export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
@@ -1,5 +1,5 @@
1
- import { Feature } from '../../feature';
2
- import { Writable } from 'ts-essentials';
1
+ import type { Feature } from '../../feature';
2
+ import type { Writable } from 'ts-essentials';
3
3
  declare const initialValueInfo: {
4
4
  allNumerics: number;
5
5
  imaginaryNumbers: number;
@@ -1,6 +1,6 @@
1
- import { FeatureStatisticsWithMeta } from '../../feature';
2
- import { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
3
- import { SummarizedWithProject } from '../../post-processing';
1
+ import type { FeatureStatisticsWithMeta } from '../../feature';
2
+ import type { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
3
+ import type { SummarizedWithProject } from '../../post-processing';
4
4
  export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
5
5
  type VariableInfoMap = Map<string, SummarizedWithProject & {
6
6
  linePercentageInFile: number[][];
@@ -1,5 +1,5 @@
1
- import { Feature } from '../../feature';
2
- import { Writable } from 'ts-essentials';
1
+ import type { Feature } from '../../feature';
2
+ import type { Writable } from 'ts-essentials';
3
3
  declare const initialVariableInfo: {
4
4
  numberOfVariableUses: number;
5
5
  numberOfDefinitions: number;
@@ -1,4 +1,4 @@
1
- import { RParseRequestFromFile, RParseRequestFromText } from '../r-bridge';
1
+ import type { RParseRequestFromFile, RParseRequestFromText } from '../r-bridge';
2
2
  /**
3
3
  * Statistics on skipped files, the time required, and more.
4
4
  *
@@ -1,5 +1,5 @@
1
- import { FeatureKey, FeatureStatistics } from '../features';
2
- import { MetaStatistics } from '../meta-statistics';
1
+ import type { FeatureKey, FeatureStatistics } from '../features';
2
+ import type { MetaStatistics } from '../meta-statistics';
3
3
  interface MinMaxAvgMedian {
4
4
  sum: number;
5
5
  min: number;
@@ -1,4 +1,4 @@
1
- import { DummyAppendMemoryMap, StatisticAppendProvider } from './file-provider';
1
+ import type { DummyAppendMemoryMap, StatisticAppendProvider } from './file-provider';
2
2
  /**
3
3
  * Requires source information to be attached on parsing!
4
4
  * <p>
@@ -1,7 +1,7 @@
1
- import { RParseRequestFromFile, RParseRequestFromText, RShell } from '../r-bridge';
2
- import { FeatureSelection, FeatureStatistics } from './features';
3
- import { MetaStatistics } from './meta-statistics';
4
- import { StepResults } from '../core';
1
+ import type { RParseRequestFromFile, RParseRequestFromText, RShell } from '../r-bridge';
2
+ import type { FeatureSelection, FeatureStatistics } from './features';
3
+ import type { MetaStatistics } from './meta-statistics';
4
+ import type { StepResults } from '../core';
5
5
  /**
6
6
  * By default, {@link extractUsageStatistics} requires a generator, but sometimes you already know all the files
7
7
  * that you want to process. This function simply reps your requests as a generator.
@@ -1,8 +1,20 @@
1
- import { NodeId, NormalizedAst, ParentInformation, RFalse, RTrue } from '../r-bridge';
2
- import { MergeableRecord } from './objects';
3
- import { QuadSerializationConfiguration } from './quads';
1
+ import type { NodeId, NormalizedAst, ParentInformation } from '../../r-bridge';
2
+ import { RFalse, RTrue } from '../../r-bridge';
3
+ import type { MergeableRecord } from '../objects';
4
+ import type { QuadSerializationConfiguration } from '../quads';
5
+ export declare const enum CfgVertexType {
6
+ /** Marks a break point in a construct (e.g., between the name and the value of an argument, or the formals and the body of a function) */
7
+ MidMarker = "mid-marker",
8
+ /** The explicit exit-nodes to ensure the hammock property */
9
+ EndMarker = "end-marker",
10
+ /** something like an if, assignment, ... even though in the classical sense of R they are still expressions */
11
+ Statement = "statement",
12
+ /** something like an addition, ... */
13
+ Expression = "expression"
14
+ }
4
15
  export interface CfgVertex {
5
16
  id: NodeId;
17
+ type: CfgVertexType;
6
18
  name: string;
7
19
  /** in case of a function definition */
8
20
  children?: NodeId[];
@@ -14,7 +26,7 @@ interface CfgControlDependencyEdge extends MergeableRecord {
14
26
  label: 'CD';
15
27
  when: typeof RTrue | typeof RFalse;
16
28
  }
17
- export type CFGEdge = CfgFlowDependencyEdge | CfgControlDependencyEdge;
29
+ export type CfgEdge = CfgFlowDependencyEdge | CfgControlDependencyEdge;
18
30
  /**
19
31
  * This class represents the control flow graph of an R program.
20
32
  * The control flow may be hierarchical when confronted with function definitions (see {@link CfgVertex} and {@link CFG#rootVertexIds|rootVertexIds()}).
@@ -24,10 +36,10 @@ export declare class ControlFlowGraph {
24
36
  private vertexInformation;
25
37
  private edgeInformation;
26
38
  addVertex(vertex: CfgVertex, rootVertex?: boolean): this;
27
- addEdge(from: NodeId, to: NodeId, edge: CFGEdge): this;
39
+ addEdge(from: NodeId, to: NodeId, edge: CfgEdge): this;
28
40
  rootVertexIds(): ReadonlySet<NodeId>;
29
41
  vertices(): ReadonlyMap<NodeId, CfgVertex>;
30
- edges(): ReadonlyMap<NodeId, ReadonlyMap<NodeId, CFGEdge>>;
42
+ edges(): ReadonlyMap<NodeId, ReadonlyMap<NodeId, CfgEdge>>;
31
43
  merge(other: ControlFlowGraph, forceNested?: boolean): this;
32
44
  }
33
45
  export interface ControlFlowInformation extends MergeableRecord {
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cfg2quads = exports.equalCfg = exports.extractCFG = exports.emptyControlFlowInformation = exports.ControlFlowGraph = void 0;
4
- const r_bridge_1 = require("../r-bridge");
5
- const set_1 = require("./set");
6
- const quads_1 = require("./quads");
7
- const log_1 = require("./log");
8
- const json_1 = require("./json");
4
+ const r_bridge_1 = require("../../r-bridge");
5
+ const set_1 = require("../set");
6
+ const quads_1 = require("../quads");
7
+ const log_1 = require("../log");
8
+ const json_1 = require("../json");
9
9
  /**
10
10
  * This class represents the control flow graph of an R program.
11
11
  * The control flow may be hierarchical when confronted with function definitions (see {@link CfgVertex} and {@link CFG#rootVertexIds|rootVertexIds()}).
@@ -65,10 +65,10 @@ function emptyControlFlowInformation() {
65
65
  }
66
66
  exports.emptyControlFlowInformation = emptyControlFlowInformation;
67
67
  const cfgFolds = {
68
- foldNumber: cfgLeaf,
69
- foldString: cfgLeaf,
70
- foldLogical: cfgLeaf,
71
- foldSymbol: cfgLeaf,
68
+ foldNumber: cfgLeaf("expression" /* CfgVertexType.Expression */),
69
+ foldString: cfgLeaf("expression" /* CfgVertexType.Expression */),
70
+ foldLogical: cfgLeaf("expression" /* CfgVertexType.Expression */),
71
+ foldSymbol: cfgLeaf("expression" /* CfgVertexType.Expression */),
72
72
  foldAccess: cfgAccess,
73
73
  binaryOp: {
74
74
  foldLogicalOp: cfgBinaryOp,
@@ -107,24 +107,29 @@ function extractCFG(ast) {
107
107
  return (0, r_bridge_1.foldAst)(ast.ast, cfgFolds);
108
108
  }
109
109
  exports.extractCFG = extractCFG;
110
- function cfgLeaf(leaf) {
111
- const graph = new ControlFlowGraph();
112
- graph.addVertex({ id: leaf.info.id, name: leaf.type });
113
- return { graph, breaks: [], nexts: [], returns: [], exitPoints: [leaf.info.id], entryPoints: [leaf.info.id] };
110
+ function cfgLeaf(type) {
111
+ return (leaf) => {
112
+ const graph = new ControlFlowGraph();
113
+ graph.addVertex({ id: leaf.info.id, name: leaf.type, type });
114
+ return { graph, breaks: [], nexts: [], returns: [], exitPoints: [leaf.info.id], entryPoints: [leaf.info.id] };
115
+ };
114
116
  }
115
117
  function cfgBreak(leaf) {
116
- return { ...cfgLeaf(leaf), breaks: [leaf.info.id] };
118
+ return { ...cfgLeaf("statement" /* CfgVertexType.Statement */)(leaf), breaks: [leaf.info.id] };
117
119
  }
118
120
  function cfgNext(leaf) {
119
- return { ...cfgLeaf(leaf), nexts: [leaf.info.id] };
121
+ return { ...cfgLeaf("statement" /* CfgVertexType.Statement */)(leaf), nexts: [leaf.info.id] };
120
122
  }
121
123
  function cfgIgnore(_leaf) {
122
124
  return { graph: new ControlFlowGraph(), breaks: [], nexts: [], returns: [], exitPoints: [], entryPoints: [] };
123
125
  }
126
+ function identifyMayStatementType(node) {
127
+ return node.info.role === "expr-list-child" /* RoleInParent.ExpressionListChild */ ? "statement" /* CfgVertexType.Statement */ : "expression" /* CfgVertexType.Expression */;
128
+ }
124
129
  function cfgIfThenElse(ifNode, condition, then, otherwise) {
125
130
  const graph = new ControlFlowGraph();
126
- graph.addVertex({ id: ifNode.info.id, name: ifNode.type });
127
- graph.addVertex({ id: ifNode.info.id + '-exit', name: 'if-exit' });
131
+ graph.addVertex({ id: ifNode.info.id, name: ifNode.type, type: identifyMayStatementType(ifNode) });
132
+ graph.addVertex({ id: ifNode.info.id + '-exit', name: 'if-exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
128
133
  graph.merge(condition.graph);
129
134
  graph.merge(then.graph);
130
135
  if (otherwise) {
@@ -160,8 +165,8 @@ function cfgIfThenElse(ifNode, condition, then, otherwise) {
160
165
  }
161
166
  function cfgRepeat(repeat, body) {
162
167
  const graph = body.graph;
163
- graph.addVertex({ id: repeat.info.id, name: repeat.type });
164
- graph.addVertex({ id: repeat.info.id + '-exit', name: 'repeat-exit' });
168
+ graph.addVertex({ id: repeat.info.id, name: repeat.type, type: identifyMayStatementType(repeat) });
169
+ graph.addVertex({ id: repeat.info.id + '-exit', name: 'repeat-exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
165
170
  for (const entryPoint of body.entryPoints) {
166
171
  graph.addEdge(repeat.info.id, entryPoint, { label: 'FD' });
167
172
  }
@@ -176,8 +181,8 @@ function cfgRepeat(repeat, body) {
176
181
  }
177
182
  function cfgWhile(whileLoop, condition, body) {
178
183
  const graph = condition.graph;
179
- graph.addVertex({ id: whileLoop.info.id, name: whileLoop.type });
180
- graph.addVertex({ id: whileLoop.info.id + '-exit', name: 'while-exit' });
184
+ graph.addVertex({ id: whileLoop.info.id, name: whileLoop.type, type: identifyMayStatementType(whileLoop) });
185
+ graph.addVertex({ id: whileLoop.info.id + '-exit', name: 'while-exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
181
186
  graph.merge(body.graph);
182
187
  for (const entry of condition.entryPoints) {
183
188
  graph.addEdge(entry, whileLoop.info.id, { label: 'FD' });
@@ -204,8 +209,8 @@ function cfgWhile(whileLoop, condition, body) {
204
209
  }
205
210
  function cfgFor(forLoop, variable, vector, body) {
206
211
  const graph = variable.graph;
207
- graph.addVertex({ id: forLoop.info.id, name: forLoop.type });
208
- graph.addVertex({ id: forLoop.info.id + '-exit', name: 'for-exit' });
212
+ graph.addVertex({ id: forLoop.info.id, name: forLoop.type, type: identifyMayStatementType(forLoop) });
213
+ graph.addVertex({ id: forLoop.info.id + '-exit', name: 'for-exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
209
214
  graph.merge(vector.graph);
210
215
  graph.merge(body.graph);
211
216
  for (const entry of vector.entryPoints) {
@@ -236,9 +241,9 @@ function cfgFor(forLoop, variable, vector, body) {
236
241
  function cfgFunctionDefinition(fn, params, body) {
237
242
  const graph = new ControlFlowGraph();
238
243
  const children = [fn.info.id + '-params', fn.info.id + '-exit'];
239
- graph.addVertex({ id: fn.info.id + '-params', name: 'function-parameters' }, false);
240
- graph.addVertex({ id: fn.info.id + '-exit', name: 'function-exit' }, false);
241
- graph.addVertex({ id: fn.info.id, name: fn.type, children });
244
+ graph.addVertex({ id: fn.info.id + '-params', name: 'function-parameters', type: "mid-marker" /* CfgVertexType.MidMarker */ }, false);
245
+ graph.addVertex({ id: fn.info.id + '-exit', name: 'function-exit', type: "end-marker" /* CfgVertexType.EndMarker */ }, false);
246
+ graph.addVertex({ id: fn.info.id, name: fn.type, children, type: identifyMayStatementType(fn) });
242
247
  graph.merge(body.graph, true);
243
248
  children.push(...body.graph.rootVertexIds());
244
249
  for (const param of params) {
@@ -263,15 +268,15 @@ function cfgFunctionDefinition(fn, params, body) {
263
268
  function cfgFunctionCall(call, name, args) {
264
269
  const graph = name.graph;
265
270
  const info = { graph, breaks: [...name.breaks], nexts: [...name.nexts], returns: [...name.returns], exitPoints: [call.info.id + '-exit'], entryPoints: [call.info.id] };
266
- graph.addVertex({ id: call.info.id, name: call.type });
271
+ graph.addVertex({ id: call.info.id, name: call.type, type: identifyMayStatementType(call) });
267
272
  for (const entryPoint of name.entryPoints) {
268
273
  graph.addEdge(entryPoint, call.info.id, { label: 'FD' });
269
274
  }
270
- graph.addVertex({ id: call.info.id + '-name', name: 'call-name' });
275
+ graph.addVertex({ id: call.info.id + '-name', name: 'call-name', type: "mid-marker" /* CfgVertexType.MidMarker */ });
271
276
  for (const exitPoint of name.exitPoints) {
272
277
  graph.addEdge(call.info.id + '-name', exitPoint, { label: 'FD' });
273
278
  }
274
- graph.addVertex({ id: call.info.id + '-exit', name: 'call-exit' });
279
+ graph.addVertex({ id: call.info.id + '-exit', name: 'call-exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
275
280
  let lastArgExits = [call.info.id + '-name'];
276
281
  for (const arg of args) {
277
282
  if (arg === undefined) {
@@ -297,7 +302,7 @@ function cfgFunctionCall(call, name, args) {
297
302
  function cfgArgumentOrParameter(node, name, value) {
298
303
  const graph = new ControlFlowGraph();
299
304
  const info = { graph, breaks: [], nexts: [], returns: [], exitPoints: [node.info.id + '-exit'], entryPoints: [node.info.id] };
300
- graph.addVertex({ id: node.info.id, name: node.type });
305
+ graph.addVertex({ id: node.info.id, name: node.type, type: "expression" /* CfgVertexType.Expression */ });
301
306
  let currentExitPoint = [node.info.id];
302
307
  if (name) {
303
308
  graph.merge(name.graph);
@@ -309,7 +314,7 @@ function cfgArgumentOrParameter(node, name, value) {
309
314
  }
310
315
  currentExitPoint = name.exitPoints;
311
316
  }
312
- graph.addVertex({ id: node.info.id + '-before-value', name: 'before-value' });
317
+ graph.addVertex({ id: node.info.id + '-before-value', name: 'before-value', type: "mid-marker" /* CfgVertexType.MidMarker */ });
313
318
  for (const exitPoints of currentExitPoint) {
314
319
  graph.addEdge(node.info.id + '-before-value', exitPoints, { label: 'FD' });
315
320
  }
@@ -326,7 +331,7 @@ function cfgArgumentOrParameter(node, name, value) {
326
331
  }
327
332
  currentExitPoint = value.exitPoints;
328
333
  }
329
- graph.addVertex({ id: node.info.id + '-exit', name: 'exit' });
334
+ graph.addVertex({ id: node.info.id + '-exit', name: 'exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
330
335
  for (const exit of currentExitPoint) {
331
336
  graph.addEdge(node.info.id + '-exit', exit, { label: 'FD' });
332
337
  }
@@ -335,8 +340,8 @@ function cfgArgumentOrParameter(node, name, value) {
335
340
  function cfgBinaryOp(binOp, lhs, rhs) {
336
341
  const graph = new ControlFlowGraph().merge(lhs.graph).merge(rhs.graph);
337
342
  const result = { graph, breaks: [...lhs.breaks, ...rhs.breaks], nexts: [...lhs.nexts, ...rhs.nexts], returns: [...lhs.returns, ...rhs.returns], entryPoints: [binOp.info.id], exitPoints: [binOp.info.id + '-exit'] };
338
- graph.addVertex({ id: binOp.info.id, name: binOp.type });
339
- graph.addVertex({ id: binOp.info.id + '-exit', name: 'binOp-exit' });
343
+ graph.addVertex({ id: binOp.info.id, name: binOp.type, type: binOp.flavor === 'assignment' ? "statement" /* CfgVertexType.Statement */ : "expression" /* CfgVertexType.Expression */ });
344
+ graph.addVertex({ id: binOp.info.id + '-exit', name: 'binOp-exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
340
345
  for (const exitPoint of lhs.exitPoints) {
341
346
  for (const entryPoint of rhs.entryPoints) {
342
347
  result.graph.addEdge(entryPoint, exitPoint, { label: 'FD' });
@@ -353,8 +358,8 @@ function cfgBinaryOp(binOp, lhs, rhs) {
353
358
  function cfgAccess(access, name, accessors) {
354
359
  const result = name;
355
360
  const graph = result.graph;
356
- graph.addVertex({ id: access.info.id, name: access.type });
357
- graph.addVertex({ id: access.info.id + '-exit', name: 'access-exit' });
361
+ graph.addVertex({ id: access.info.id, name: access.type, type: "expression" /* CfgVertexType.Expression */ });
362
+ graph.addVertex({ id: access.info.id + '-exit', name: 'access-exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
358
363
  for (const entry of name.entryPoints) {
359
364
  graph.addEdge(entry, access.info.id, { label: 'FD' });
360
365
  }
@@ -383,7 +388,7 @@ function cfgAccess(access, name, accessors) {
383
388
  function cfgUnaryOp(unary, operand) {
384
389
  const graph = operand.graph;
385
390
  const result = { ...operand, graph, exitPoints: [unary.info.id] };
386
- graph.addVertex({ id: unary.info.id, name: unary.type });
391
+ graph.addVertex({ id: unary.info.id, name: unary.type, type: "end-marker" /* CfgVertexType.EndMarker */ });
387
392
  return result;
388
393
  }
389
394
  function cfgExprList(_node, expressions) {
@@ -0,0 +1,14 @@
1
+ import type { NodeId } from '../../r-bridge';
2
+ import type { CfgEdge, CfgVertex, ControlFlowInformation } from './cfg';
3
+ export interface NodeVisitingContext {
4
+ parent: {
5
+ vertex: NodeId;
6
+ edge: CfgEdge;
7
+ } | 'root';
8
+ cfg: ControlFlowInformation;
9
+ visited: Set<NodeId>;
10
+ /** contains the current vertex as well */
11
+ siblings: NodeId[];
12
+ }
13
+ export type OnEnterVisitNode = (node: CfgVertex, context: NodeVisitingContext) => void;
14
+ export declare function visitCfg(cfg: ControlFlowInformation, onVisit: OnEnterVisitNode): void;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.visitCfg = void 0;
4
+ const assert_1 = require("../assert");
5
+ class ControlFlowGraphExecutionTraceVisitor {
6
+ onEnter;
7
+ constructor(onEnter) {
8
+ this.onEnter = onEnter;
9
+ }
10
+ visitSingle(node, context) {
11
+ if (context.visited.has(node.id)) {
12
+ return;
13
+ }
14
+ // only visit a node if we have visited all of its successors
15
+ const successorEdges = context.cfg.graph.edges().get(node.id);
16
+ if (successorEdges) {
17
+ for (const [target,] of successorEdges) {
18
+ if (!context.visited.has(target)) {
19
+ return;
20
+ }
21
+ }
22
+ }
23
+ context.visited.add(node.id);
24
+ this.onEnter(node, context);
25
+ // find all ingoing edges
26
+ const predecessors = this.retrieveAllPredecessors(context, node);
27
+ const siblings = predecessors.map(p => p.source);
28
+ for (const predecessor of predecessors) {
29
+ const { source, edge } = predecessor;
30
+ const sourceVertex = context.cfg.graph.vertices().get(source);
31
+ (0, assert_1.guard)(sourceVertex !== undefined, () => `Source vertex with id ${source} not found`);
32
+ this.visitSingle(sourceVertex, {
33
+ parent: { vertex: node.id, edge },
34
+ cfg: context.cfg,
35
+ visited: context.visited,
36
+ siblings
37
+ });
38
+ }
39
+ }
40
+ retrieveAllPredecessors(context, node) {
41
+ const predecessors = [];
42
+ for (const entry of context.cfg.graph.edges().entries()) {
43
+ const [source, targets] = entry;
44
+ const target = targets.get(node.id);
45
+ if (target) {
46
+ predecessors.push({ source, edge: target });
47
+ }
48
+ }
49
+ return predecessors;
50
+ }
51
+ visit(cfg) {
52
+ const visited = new Set;
53
+ for (const id of cfg.entryPoints) {
54
+ const node = cfg.graph.vertices().get(id);
55
+ (0, assert_1.guard)(node !== undefined, `Node with id ${id} not present`);
56
+ this.visitSingle(node, { parent: 'root', cfg, siblings: [...cfg.entryPoints], visited });
57
+ }
58
+ }
59
+ }
60
+ function visitCfg(cfg, onVisit) {
61
+ return new ControlFlowGraphExecutionTraceVisitor(onVisit).visit(cfg);
62
+ }
63
+ exports.visitCfg = visitCfg;
64
+ //# sourceMappingURL=visitor.js.map