@eagleoutice/flowr 1.3.11 → 1.3.12

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 (125) hide show
  1. package/cli/common/scripts-info.d.ts +1 -1
  2. package/package.json +1 -1
  3. package/benchmark/benchmark-slicer.js +0 -223
  4. package/core/pipeline-executor.js +0 -221
  5. package/core/stepping-slicer.js +0 -160
  6. package/core/steps/all/00-parse.js +0 -19
  7. package/core/steps/all/10-normalize.js +0 -21
  8. package/core/steps/all/20-dataflow.js +0 -21
  9. package/core/steps/all/30-slice.js +0 -16
  10. package/core/steps/all/40-reconstruct.js +0 -16
  11. package/core/steps/all/core/00-parse.js +0 -24
  12. package/core/steps/all/core/10-normalize.js +0 -46
  13. package/core/steps/all/core/20-dataflow.js +0 -39
  14. package/core/steps/all/static-slicing/00-slice.js +0 -21
  15. package/core/steps/all/static-slicing/10-reconstruct.js +0 -21
  16. package/core/steps/index.js +0 -21
  17. package/core/steps/input.js +0 -3
  18. package/core/steps/output.js +0 -3
  19. package/core/steps/pipeline/create.js +0 -130
  20. package/core/steps/pipeline/default.js +0 -15
  21. package/core/steps/pipeline/dependency-checker.js +0 -76
  22. package/core/steps/pipeline/index.js +0 -20
  23. package/core/steps/pipeline/invalid-pipeline-error.js +0 -14
  24. package/core/steps/pipeline/pipeline.js +0 -28
  25. package/core/steps/step.js +0 -8
  26. package/core/steps/steps-provider.js +0 -3
  27. package/core/steps/steps.js +0 -35
  28. package/dataflow/common/environments/append.js +0 -48
  29. package/dataflow/common/environments/environment.js +0 -165
  30. package/dataflow/common/environments/index.js +0 -23
  31. package/dataflow/common/environments/overwrite.js +0 -82
  32. package/dataflow/common/environments/register.js +0 -49
  33. package/dataflow/common/environments/resolve-by-name.js +0 -35
  34. package/dataflow/common/environments/scopes.js +0 -6
  35. package/dataflow/common/environments/scoping.js +0 -27
  36. package/dataflow/graph/equal.js +0 -127
  37. package/dataflow/v1/extractor.js +0 -60
  38. package/dataflow/v1/graph/diff.js +0 -206
  39. package/dataflow/v1/graph/edge.js +0 -32
  40. package/dataflow/v1/graph/graph.js +0 -298
  41. package/dataflow/v1/graph/index.js +0 -21
  42. package/dataflow/v1/graph/quads.js +0 -27
  43. package/dataflow/v1/graph/vertex.js +0 -3
  44. package/dataflow/v1/index.js +0 -24
  45. package/dataflow/v1/internal/info.js +0 -16
  46. package/dataflow/v1/internal/linker.js +0 -255
  47. package/dataflow/v1/internal/process/access.js +0 -54
  48. package/dataflow/v1/internal/process/expression-list.js +0 -154
  49. package/dataflow/v1/internal/process/functions/argument.js +0 -46
  50. package/dataflow/v1/internal/process/functions/exit-points.js +0 -125
  51. package/dataflow/v1/internal/process/functions/function-call.js +0 -99
  52. package/dataflow/v1/internal/process/functions/function-definition.js +0 -176
  53. package/dataflow/v1/internal/process/functions/parameter.js +0 -47
  54. package/dataflow/v1/internal/process/if-then-else.js +0 -57
  55. package/dataflow/v1/internal/process/loops/for-loop.js +0 -54
  56. package/dataflow/v1/internal/process/loops/repeat-loop.js +0 -21
  57. package/dataflow/v1/internal/process/loops/while-loop.js +0 -31
  58. package/dataflow/v1/internal/process/operators/assignment.js +0 -129
  59. package/dataflow/v1/internal/process/operators/non-assignment-binary-op.js +0 -25
  60. package/dataflow/v1/internal/process/operators/pipe.js +0 -46
  61. package/dataflow/v1/internal/process/operators/unary-op.js +0 -10
  62. package/dataflow/v1/internal/process/symbol.js +0 -21
  63. package/dataflow/v1/internal/process/uninteresting-leaf.js +0 -9
  64. package/dataflow/v1/processor.js +0 -20
  65. package/dataflow/v2/entry.js +0 -11
  66. package/flowr-1.3.7.tgz +0 -0
  67. package/r-bridge/lang-4.x/ast/parser/xml/common/config.js +0 -16
  68. package/r-bridge/lang-4.x/ast/parser/xml/common/input-format.js +0 -42
  69. package/r-bridge/lang-4.x/ast/parser/xml/common/meta.js +0 -118
  70. package/r-bridge/lang-4.x/ast/parser/xml/common/xml-to-json.js +0 -58
  71. package/r-bridge/lang-4.x/ast/parser/xml/v1/data.js +0 -3
  72. package/r-bridge/lang-4.x/ast/parser/xml/v1/hooks.js +0 -136
  73. package/r-bridge/lang-4.x/ast/parser/xml/v1/index.js +0 -22
  74. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/access.js +0 -107
  75. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/control/if-then-else.js +0 -32
  76. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/control/if-then.js +0 -46
  77. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/control/index.js +0 -19
  78. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/expression/expression.js +0 -65
  79. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/expression/index.js +0 -18
  80. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/functions/argument.js +0 -74
  81. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/functions/call.js +0 -149
  82. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/functions/definition.js +0 -60
  83. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/functions/index.js +0 -20
  84. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/functions/parameter.js +0 -64
  85. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/index.js +0 -27
  86. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/loops/break.js +0 -24
  87. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/loops/for.js +0 -72
  88. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/loops/index.js +0 -22
  89. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/loops/next.js +0 -24
  90. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/loops/repeat.js +0 -42
  91. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/loops/while.js +0 -45
  92. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/operators/binary.js +0 -162
  93. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/operators/index.js +0 -20
  94. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/operators/special.js +0 -24
  95. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/operators/unary.js +0 -59
  96. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/other/comment.js +0 -34
  97. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/other/index.js +0 -18
  98. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/other/line-directive.js +0 -55
  99. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/structure/elements.js +0 -159
  100. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/structure/index.js +0 -20
  101. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/structure/root.js +0 -34
  102. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/structure/single-element.js +0 -64
  103. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/values/index.js +0 -20
  104. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/values/number.js +0 -56
  105. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/values/string.js +0 -41
  106. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/values/symbol.js +0 -56
  107. package/r-bridge/lang-4.x/ast/parser/xml/v1/normalize.js +0 -30
  108. package/r-bridge/lang-4.x/ast/parser/xml/v2/data.js +0 -3
  109. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.js +0 -95
  110. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/expression.js +0 -99
  111. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/functions/argument.js +0 -71
  112. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/operators/binary.js +0 -30
  113. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/operators/index.js +0 -19
  114. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/operators/unary.js +0 -35
  115. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/other/comment.js +0 -25
  116. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/other/index.js +0 -18
  117. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/other/line-directive.js +0 -38
  118. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/root.js +0 -26
  119. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/single-element.js +0 -63
  120. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/values/index.js +0 -18
  121. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/values/number.js +0 -46
  122. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/values/string.js +0 -33
  123. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/values/symbol.js +0 -63
  124. package/r-bridge/lang-4.x/ast/parser/xml/v2/normalize.js +0 -25
  125. package/util/summarizer/benchmark/benchmark-summarizer.js +0 -208
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LEGACY_STATIC_DATAFLOW = void 0;
4
- const print_1 = require("../../print/print");
5
- const dataflow_1 = require("../../../dataflow");
6
- const dataflow_printer_1 = require("../../print/dataflow-printer");
7
- exports.LEGACY_STATIC_DATAFLOW = {
8
- name: 'dataflow',
9
- description: 'Construct the dataflow graph',
10
- processor: dataflow_1.produceDataFlowGraph,
11
- required: 'once-per-file',
12
- printer: {
13
- [0 /* StepOutputFormat.Internal */]: print_1.internalPrinter,
14
- [2 /* StepOutputFormat.Json */]: dataflow_printer_1.dataflowGraphToJson,
15
- [5 /* StepOutputFormat.RdfQuads */]: dataflow_printer_1.dataflowGraphToQuads,
16
- [3 /* StepOutputFormat.Mermaid */]: dataflow_printer_1.dataflowGraphToMermaid,
17
- [4 /* StepOutputFormat.MermaidUrl */]: dataflow_printer_1.dataflowGraphToMermaidUrl
18
- },
19
- dependencies: ['normalize']
20
- };
21
- //# sourceMappingURL=20-dataflow.js.map
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STATIC_SLICE = void 0;
4
- const print_1 = require("../../print/print");
5
- const slicing_1 = require("../../../slicing");
6
- exports.STATIC_SLICE = {
7
- name: 'slice',
8
- description: 'Calculate the actual static slice from the dataflow graph and the given slicing criteria',
9
- processor: slicing_1.staticSlicing,
10
- required: 'once-per-slice',
11
- printer: {
12
- [0 /* StepOutputFormat.Internal */]: print_1.internalPrinter
13
- },
14
- dependencies: ['dataflow']
15
- };
16
- //# sourceMappingURL=30-slice.js.map
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NAIVE_RECONSTRUCT = void 0;
4
- const print_1 = require("../../print/print");
5
- const slicing_1 = require("../../../slicing");
6
- exports.NAIVE_RECONSTRUCT = {
7
- name: 'reconstruct',
8
- description: 'Reconstruct R code from the static slice',
9
- processor: slicing_1.reconstructToCode,
10
- required: 'once-per-slice',
11
- printer: {
12
- [0 /* StepOutputFormat.Internal */]: print_1.internalPrinter
13
- },
14
- dependencies: ['slice']
15
- };
16
- //# sourceMappingURL=40-reconstruct.js.map
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PARSE_WITH_R_SHELL_STEP = void 0;
4
- const print_1 = require("../../../print/print");
5
- const parse_printer_1 = require("../../../print/parse-printer");
6
- const r_bridge_1 = require("../../../../r-bridge");
7
- function processor(_results, input) {
8
- return (0, r_bridge_1.retrieveXmlFromRCode)(input.request, input.shell);
9
- }
10
- exports.PARSE_WITH_R_SHELL_STEP = {
11
- name: 'parse',
12
- humanReadableName: 'parse with R shell',
13
- description: 'Parse the given R code into an AST',
14
- processor,
15
- executed: 0 /* PipelineStepStage.OncePerFile */,
16
- printer: {
17
- [0 /* StepOutputFormat.Internal */]: print_1.internalPrinter,
18
- [2 /* StepOutputFormat.Json */]: text => text,
19
- [5 /* StepOutputFormat.RdfQuads */]: parse_printer_1.parseToQuads
20
- },
21
- dependencies: [],
22
- requiredInput: undefined
23
- };
24
- //# sourceMappingURL=00-parse.js.map
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DESUGAR_NORMALIZE = exports.NORMALIZE = void 0;
4
- const r_bridge_1 = require("../../../../r-bridge");
5
- const print_1 = require("../../../print/print");
6
- const normalize_printer_1 = require("../../../print/normalize-printer");
7
- const normalize_1 = require("../../../../r-bridge/lang-4.x/ast/parser/xml/v2/normalize");
8
- async function processor(results, input) {
9
- return (0, r_bridge_1.normalize)(results.parse, await input.shell.tokenMap(), input.hooks, input.getId);
10
- }
11
- exports.NORMALIZE = {
12
- name: 'normalize',
13
- humanReadableName: 'v1 normalize',
14
- description: 'Normalize the AST to flowR\'s AST',
15
- processor,
16
- executed: 0 /* PipelineStepStage.OncePerFile */,
17
- printer: {
18
- [0 /* StepOutputFormat.Internal */]: print_1.internalPrinter,
19
- [2 /* StepOutputFormat.Json */]: normalize_printer_1.normalizedAstToJson,
20
- [5 /* StepOutputFormat.RdfQuads */]: normalize_printer_1.normalizedAstToQuads,
21
- [3 /* StepOutputFormat.Mermaid */]: normalize_printer_1.printNormalizedAstToMermaid,
22
- [4 /* StepOutputFormat.MermaidUrl */]: normalize_printer_1.printNormalizedAstToMermaidUrl
23
- },
24
- dependencies: ['parse'],
25
- requiredInput: undefined
26
- };
27
- async function desugarProcessor(results, input) {
28
- return (0, normalize_1.normalize)(results.parse, await input.shell.tokenMap(), input.getId);
29
- }
30
- exports.DESUGAR_NORMALIZE = {
31
- name: 'normalize',
32
- humanReadableName: 'v2 normalize',
33
- description: 'Normalize the AST to flowR\'s AST (v2, with desugaring)',
34
- processor: desugarProcessor,
35
- executed: 0 /* PipelineStepStage.OncePerFile */,
36
- printer: {
37
- [0 /* StepOutputFormat.Internal */]: print_1.internalPrinter,
38
- [2 /* StepOutputFormat.Json */]: normalize_printer_1.normalizedAstToJson,
39
- [5 /* StepOutputFormat.RdfQuads */]: normalize_printer_1.normalizedAstToQuads,
40
- [3 /* StepOutputFormat.Mermaid */]: normalize_printer_1.printNormalizedAstToMermaid,
41
- [4 /* StepOutputFormat.MermaidUrl */]: normalize_printer_1.printNormalizedAstToMermaidUrl
42
- },
43
- dependencies: ['parse'],
44
- requiredInput: undefined
45
- };
46
- //# sourceMappingURL=10-normalize.js.map
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V2_STATIC_DATAFLOW = exports.LEGACY_STATIC_DATAFLOW = void 0;
4
- const print_1 = require("../../../print/print");
5
- const v1_1 = require("../../../../dataflow/v1");
6
- const dataflow_printer_1 = require("../../../print/dataflow-printer");
7
- const entry_1 = require("../../../../dataflow/v2/entry");
8
- const staticDataflowCommon = {
9
- name: 'dataflow',
10
- description: 'Construct the dataflow graph',
11
- executed: 0 /* PipelineStepStage.OncePerFile */,
12
- printer: {
13
- [0 /* StepOutputFormat.Internal */]: print_1.internalPrinter,
14
- [2 /* StepOutputFormat.Json */]: dataflow_printer_1.dataflowGraphToJson,
15
- [5 /* StepOutputFormat.RdfQuads */]: dataflow_printer_1.dataflowGraphToQuads,
16
- [3 /* StepOutputFormat.Mermaid */]: dataflow_printer_1.dataflowGraphToMermaid,
17
- [4 /* StepOutputFormat.MermaidUrl */]: dataflow_printer_1.dataflowGraphToMermaidUrl
18
- },
19
- dependencies: ['normalize'],
20
- };
21
- function legacyProcessor(results) {
22
- return (0, v1_1.produceDataFlowGraph)(results.normalize);
23
- }
24
- exports.LEGACY_STATIC_DATAFLOW = {
25
- ...staticDataflowCommon,
26
- humanReadableName: 'v1 dataflow',
27
- processor: legacyProcessor,
28
- requiredInput: {}
29
- };
30
- function v2Processor() {
31
- return (0, entry_1.produceDataFlowGraph)();
32
- }
33
- exports.V2_STATIC_DATAFLOW = {
34
- ...staticDataflowCommon,
35
- humanReadableName: 'v2 dataflow',
36
- processor: v2Processor,
37
- requiredInput: {}
38
- };
39
- //# sourceMappingURL=20-dataflow.js.map
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STATIC_SLICE = void 0;
4
- const print_1 = require("../../../print/print");
5
- const slicing_1 = require("../../../../slicing");
6
- function processor(results, input) {
7
- return (0, slicing_1.staticSlicing)(results.dataflow.graph, results.normalize, input.criterion, input.threshold);
8
- }
9
- exports.STATIC_SLICE = {
10
- name: 'slice',
11
- humanReadableName: 'static slice',
12
- description: 'Calculate the actual static slice from the dataflow graph and the given slicing criteria',
13
- processor,
14
- executed: 1 /* PipelineStepStage.OncePerRequest */,
15
- printer: {
16
- [0 /* StepOutputFormat.Internal */]: print_1.internalPrinter
17
- },
18
- dependencies: ['dataflow'],
19
- requiredInput: undefined
20
- };
21
- //# sourceMappingURL=00-slice.js.map
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NAIVE_RECONSTRUCT = void 0;
4
- const print_1 = require("../../../print/print");
5
- const slicing_1 = require("../../../../slicing");
6
- function processor(results, input) {
7
- return (0, slicing_1.reconstructToCode)(results.normalize, results.slice.result, input.autoSelectIf);
8
- }
9
- exports.NAIVE_RECONSTRUCT = {
10
- name: 'reconstruct',
11
- humanReadableName: 'static code reconstruction',
12
- description: 'Reconstruct R code from the static slice',
13
- processor,
14
- executed: 1 /* PipelineStepStage.OncePerRequest */,
15
- printer: {
16
- [0 /* StepOutputFormat.Internal */]: print_1.internalPrinter
17
- },
18
- dependencies: ['slice'],
19
- requiredInput: undefined
20
- };
21
- //# sourceMappingURL=10-reconstruct.js.map
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./output"), exports);
18
- __exportStar(require("./step"), exports);
19
- __exportStar(require("./steps"), exports);
20
- __exportStar(require("./input"), exports);
21
- //# sourceMappingURL=index.js.map
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=input.js.map
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=output.js.map
@@ -1,130 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verifyAndBuildPipeline = void 0;
4
- const invalid_pipeline_error_1 = require("./invalid-pipeline-error");
5
- const json_1 = require("../../../util/json");
6
- const arrays_1 = require("../../../util/arrays");
7
- /**
8
- * Given a set of {@link IPipelineStep|steps} with their dependencies, this function verifies all requirements of {@link createPipeline}.
9
- */
10
- function verifyAndBuildPipeline(steps) {
11
- if (steps.length === 0) {
12
- throw new invalid_pipeline_error_1.InvalidPipelineError('0) Pipeline is empty');
13
- }
14
- const [perFileSteps, perRequestSteps] = (0, arrays_1.partitionArray)(steps, s => s.executed === 0 /* PipelineStepStage.OncePerFile */);
15
- // we construct a map linking each name to its respective step
16
- const perFileStepMap = new Map();
17
- const initsPerFile = [];
18
- const visited = new Set();
19
- // we start by working on the per-file steps
20
- initializeSteps(perFileSteps, perFileStepMap, initsPerFile, visited);
21
- // first, we sort the per-file steps
22
- const sortedPerFile = topologicalSort(initsPerFile, perFileStepMap, visited);
23
- validateStepOutput(sortedPerFile, perFileStepMap, steps);
24
- const perRequestStepMap = new Map(perFileStepMap);
25
- // we track all elements without dependencies, i.e., those that start the pipeline
26
- const initsPerRequest = [];
27
- // now, we do the same for the per-request steps, keeping the per-file steps known
28
- initializeSteps(perRequestSteps, perRequestStepMap, initsPerRequest, visited);
29
- const sortedPerRequest = topologicalSort(initsPerRequest, perRequestStepMap, visited);
30
- const sorted = [...sortedPerFile, ...sortedPerRequest];
31
- validateStepOutput(sorted, perRequestStepMap, steps);
32
- return {
33
- steps: perRequestStepMap,
34
- order: sorted,
35
- firstStepPerRequest: sortedPerFile.length
36
- };
37
- }
38
- exports.verifyAndBuildPipeline = verifyAndBuildPipeline;
39
- function validateStepOutput(sorted, stepMap, steps) {
40
- if (sorted.length !== stepMap.size) {
41
- // check if any of the dependencies in the map are invalid
42
- checkForInvalidDependency(steps, stepMap);
43
- // otherwise, we assume a cycle
44
- throw new invalid_pipeline_error_1.InvalidPipelineError(`3) Pipeline contains at least one cycle; sorted: ${JSON.stringify(sorted)}, steps: ${JSON.stringify([...stepMap.keys()])}`);
45
- }
46
- }
47
- function allDependenciesAreVisited(step, visited) {
48
- return step.dependencies.every(d => visited.has(d));
49
- }
50
- function handleStep(step, init, visited, sorted, elem, decoratorsOfLastOthers, inits) {
51
- if (step.decorates === init) {
52
- if (allDependenciesAreVisited(step, visited)) {
53
- sorted.push(elem);
54
- visited.add(elem);
55
- }
56
- else {
57
- decoratorsOfLastOthers.add(elem);
58
- }
59
- }
60
- else if (step.decorates === undefined && allDependenciesAreVisited(step, visited)) {
61
- inits.push(elem);
62
- }
63
- }
64
- function topologicalSort(inits, stepMap, visited) {
65
- const sorted = [];
66
- while (inits.length > 0) {
67
- const init = inits.pop();
68
- sorted.push(init);
69
- visited.add(init);
70
- // these decorators still have dependencies open; we have to check if they can be satisfied by the other steps to add
71
- const decoratorsOfLastOthers = new Set();
72
- for (const [elem, step] of stepMap.entries()) {
73
- if (visited.has(elem)) {
74
- continue;
75
- }
76
- handleStep(step, init, visited, sorted, elem, decoratorsOfLastOthers, inits);
77
- }
78
- // for the other decorators we have to cycle until we find a solution, or know, that no solution exists
79
- topologicallyInsertDecoratorElements(decoratorsOfLastOthers, stepMap, visited, sorted);
80
- }
81
- return sorted;
82
- }
83
- function topologicallyInsertDecoratorElements(decoratorsOfLastOthers, stepMap, visited, sorted) {
84
- if (decoratorsOfLastOthers.size === 0) {
85
- return;
86
- }
87
- let changed = true;
88
- while (changed) {
89
- changed = false;
90
- for (const elem of [...decoratorsOfLastOthers]) {
91
- const step = stepMap.get(elem);
92
- if (allDependenciesAreVisited(step, visited)) {
93
- decoratorsOfLastOthers.delete(elem);
94
- sorted.push(elem);
95
- visited.add(elem);
96
- changed = true;
97
- }
98
- }
99
- }
100
- if (decoratorsOfLastOthers.size > 0) {
101
- throw new invalid_pipeline_error_1.InvalidPipelineError(`5) Pipeline contains at least one decoration cycle: ${JSON.stringify(decoratorsOfLastOthers, json_1.jsonReplacer)}`);
102
- }
103
- }
104
- function checkForInvalidDependency(steps, stepMap) {
105
- for (const step of steps) {
106
- for (const dep of step.dependencies) {
107
- if (!stepMap.has(dep)) {
108
- throw new invalid_pipeline_error_1.InvalidPipelineError(`2) Step "${step.name}" depends on step "${dep}" which does not exist`);
109
- }
110
- }
111
- if (step.decorates && !stepMap.has(step.decorates)) {
112
- throw new invalid_pipeline_error_1.InvalidPipelineError(`4) Step "${step.name}" decorates step "${step.decorates}" which does not exist`);
113
- }
114
- }
115
- }
116
- function initializeSteps(steps, stepMap, inits, visited) {
117
- for (const step of steps) {
118
- const name = step.name;
119
- // if the name is already in the map we have a duplicate
120
- if (stepMap.has(name)) {
121
- throw new invalid_pipeline_error_1.InvalidPipelineError(`1) Step name "${name}" is not unique in the pipeline`);
122
- }
123
- stepMap.set(name, step);
124
- // only steps that have no dependencies and do not decorate others can be initial steps
125
- if (allDependenciesAreVisited(step, visited) && (step.decorates === undefined || visited.has(step.decorates))) {
126
- inits.push(name);
127
- }
128
- }
129
- }
130
- //# sourceMappingURL=create.js.map
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V2_DATAFLOW_PIPELINE = exports.DEFAULT_SLICING_PIPELINE = void 0;
4
- /**
5
- * Contains the default pipeline for working with flowr
6
- */
7
- const pipeline_1 = require("./pipeline");
8
- const _00_parse_1 = require("../all/core/00-parse");
9
- const _10_normalize_1 = require("../all/core/10-normalize");
10
- const _20_dataflow_1 = require("../all/core/20-dataflow");
11
- const _00_slice_1 = require("../all/static-slicing/00-slice");
12
- const _10_reconstruct_1 = require("../all/static-slicing/10-reconstruct");
13
- exports.DEFAULT_SLICING_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.PARSE_WITH_R_SHELL_STEP, _10_normalize_1.NORMALIZE, _20_dataflow_1.LEGACY_STATIC_DATAFLOW, _00_slice_1.STATIC_SLICE, _10_reconstruct_1.NAIVE_RECONSTRUCT);
14
- exports.V2_DATAFLOW_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.PARSE_WITH_R_SHELL_STEP, _10_normalize_1.DESUGAR_NORMALIZE, _20_dataflow_1.V2_STATIC_DATAFLOW);
15
- //# sourceMappingURL=default.js.map
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verifyPipeline = void 0;
4
- const invalid_pipeline_error_1 = require("./invalid-pipeline-error");
5
- /**
6
- * Given a set of {@link IStep|steps} with their dependencies, this function verifies that
7
- * 1) all names of steps are unique for the given pipeline
8
- * 2) all dependencies of steps are valid (i.e., refer to existing steps)
9
- * 3) there are no cycles in the dependency graph
10
- * If successful, it returns the topologically sorted list of steps in order of desired execution.
11
- */
12
- function verifyPipeline(steps) {
13
- if (steps.length === 0) {
14
- throw new invalid_pipeline_error_1.InvalidPipelineError('Pipeline is empty');
15
- }
16
- // we construct a map linking each name to its respective step
17
- const stepMap = new Map();
18
- // we track all elements without dependencies, i.e. those that start the pipeline
19
- const inits = [];
20
- initializeSteps(steps, stepMap, inits);
21
- if (inits.length === 0) {
22
- throw new invalid_pipeline_error_1.InvalidPipelineError('Pipeline has no initial steps (i.e., it contains no step without dependencies)');
23
- }
24
- const sorted = topoSort(inits, stepMap);
25
- if (sorted.length !== stepMap.size) {
26
- // check if any of the dependencies in the map are invalid
27
- checkForInvalidDependency(steps, stepMap);
28
- // otherwise, we assume a cycle
29
- throw new invalid_pipeline_error_1.InvalidPipelineError('Pipeline contains at least one cycle');
30
- }
31
- return {
32
- steps: stepMap,
33
- order: sorted
34
- };
35
- }
36
- exports.verifyPipeline = verifyPipeline;
37
- function topoSort(inits, stepMap) {
38
- // now, we topo-sort the steps
39
- const sorted = [];
40
- const visited = new Set();
41
- while (inits.length > 0) {
42
- const init = inits.pop();
43
- sorted.push(init);
44
- visited.add(init);
45
- // TODO: improve this check, maybe really remove?
46
- for (const [key, step] of stepMap.entries()) {
47
- if (!visited.has(key) && step.dependencies.filter(dep => !visited.has(dep)).length === 0) {
48
- inits.push(key);
49
- }
50
- }
51
- }
52
- return sorted;
53
- }
54
- function checkForInvalidDependency(steps, stepMap) {
55
- for (const step of steps) {
56
- for (const dep of step.dependencies) {
57
- if (!stepMap.has(dep)) {
58
- throw new invalid_pipeline_error_1.InvalidPipelineError(`Step "${step.name}" depends on step "${dep}" which does not exist`);
59
- }
60
- }
61
- }
62
- }
63
- function initializeSteps(steps, stepMap, inits) {
64
- for (const step of steps) {
65
- const name = step.name;
66
- // if the name is already in the map we have a duplicate
67
- if (stepMap.has(name)) {
68
- throw new invalid_pipeline_error_1.InvalidPipelineError(`Step name "${name}" is not unique in the pipeline`);
69
- }
70
- stepMap.set(name, step);
71
- if (step.dependencies.length === 0) {
72
- inits.push(name);
73
- }
74
- }
75
- }
76
- //# sourceMappingURL=dependency-checker.js.map
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./pipeline"), exports);
18
- __exportStar(require("./invalid-pipeline-error"), exports);
19
- __exportStar(require("./default"), exports);
20
- //# sourceMappingURL=index.js.map
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InvalidPipelineError = void 0;
4
- /**
5
- * Thrown if for whatever reason, the pipeline is invalid.
6
- */
7
- class InvalidPipelineError extends Error {
8
- constructor(message) {
9
- super(message);
10
- this.name = 'InvalidPipelineError';
11
- }
12
- }
13
- exports.InvalidPipelineError = InvalidPipelineError;
14
- //# sourceMappingURL=invalid-pipeline-error.js.map
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createPipeline = void 0;
4
- const create_1 = require("./create");
5
- /**
6
- * Creates a {@link Pipeline|pipeline} from a given collection of {@link IPipelineStep|steps}.
7
- * In order to be valid, the collection of {@link IPipelineStep|steps} must satisfy the following set of constraints
8
- * (which should be logical, when you consider what a pipeline should accomplish):
9
- *
10
- * 0) the collection of {@link IPipelineStep|steps} is not empty
11
- * 1) all {@link IPipelineStepOrder#name|names} of {@link IPipelineStep|steps} are unique for the given pipeline
12
- * 2) all {@link IPipelineStepOrder#dependencies|dependencies} of all {@link IPipelineStep|steps} are exist
13
- * 3) there are no cycles in the dependency graph
14
- * 4) the target of a {@link IPipelineStepOrder#decorates|step's decoration} exists
15
- * 5) if a {@link IPipelineStepOrder#decorates|decoration} applies, all of its {@link IPipelineStepOrder#dependencies|dependencies} are already in the pipeline
16
- * 6) in the resulting {@link Pipeline|pipeline}, there is a strict cut between {@link IPipelineStep|steps} that are executed
17
- * {@link PipelineStepStage#OncePerFile|once per file} and {@link PipelineStepStage#OncePerRequest|once per request}.
18
- *
19
- * @returns The function will try to order your collection steps so that all the constraints hold.
20
- * If it succeeds it will return the resulting {@link Pipeline|pipeline}, otherwise it will throw an {@link InvalidPipelineError}.
21
- *
22
- * @throws InvalidPipelineError If any of the constraints listed above are not satisfied.
23
- */
24
- function createPipeline(...steps) {
25
- return (0, create_1.verifyAndBuildPipeline)(steps);
26
- }
27
- exports.createPipeline = createPipeline;
28
- //# sourceMappingURL=pipeline.js.map
@@ -1,8 +0,0 @@
1
- "use strict";
2
- /**
3
- * Defines the {@link IPipelineStep} interface which specifies all data available for a single step.
4
- *
5
- * @module
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- //# sourceMappingURL=step.js.map
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=steps-provider.js.map
@@ -1,35 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file defines *all* steps of the slicing process and the data they require.
4
- *
5
- * Note, that the order of elements here also describes the *desired* order of their desired execution for readability.
6
- * However, it is the {@link SteppingSlicer} which controls the order of execution and the steps required to achieve a given result.
7
- *
8
- * If you add a new step, you have to (at least) update the {@link SteppingSlicer} as well as the corresponding type predicate {@link SteppingSlicerInput}.
9
- * Furthermore, if your step is the new *last* step, please update {@link LAST_STEP}.
10
- *
11
- * Please note that the combination of `satisfies` and `as` seems to be required.
12
- * With `satisfies` we make sure that the respective element has all the keys it requires, and the `as` force the type to be exactly the given one
13
- *
14
- * @module
15
- */
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.LAST_STEP = exports.LAST_PER_FILE_STEP = exports.STEPS = exports.STEPS_PER_SLICE = exports.STEPS_PER_FILE = void 0;
18
- const _00_parse_1 = require("./all/core/00-parse");
19
- const _10_normalize_1 = require("./all/core/10-normalize");
20
- const _20_dataflow_1 = require("./all/core/20-dataflow");
21
- const _00_slice_1 = require("./all/static-slicing/00-slice");
22
- const _10_reconstruct_1 = require("./all/static-slicing/10-reconstruct");
23
- exports.STEPS_PER_FILE = {
24
- 'parse': _00_parse_1.PARSE_WITH_R_SHELL_STEP,
25
- 'normalize': _10_normalize_1.NORMALIZE,
26
- 'dataflow': _20_dataflow_1.LEGACY_STATIC_DATAFLOW
27
- };
28
- exports.STEPS_PER_SLICE = {
29
- 'slice': _00_slice_1.STATIC_SLICE,
30
- 'reconstruct': _10_reconstruct_1.NAIVE_RECONSTRUCT
31
- };
32
- exports.STEPS = { ...exports.STEPS_PER_FILE, ...exports.STEPS_PER_SLICE };
33
- exports.LAST_PER_FILE_STEP = 'dataflow';
34
- exports.LAST_STEP = 'reconstruct';
35
- //# sourceMappingURL=steps.js.map
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.appendEnvironments = void 0;
4
- const assert_1 = require("../../../util/assert");
5
- const environment_1 = require("./environment");
6
- function uniqueMergeValues(old, value) {
7
- const result = old;
8
- for (const v of value) {
9
- const find = result.findIndex(o => o.nodeId === v.nodeId && o.definedAt === v.definedAt);
10
- if (find < 0) {
11
- result.push(v);
12
- }
13
- }
14
- return result;
15
- }
16
- function appendIEnvironmentWith(base, next) {
17
- (0, assert_1.guard)(base !== undefined && next !== undefined, 'can not append environments with undefined');
18
- (0, assert_1.guard)(base.name === next.name, 'cannot overwrite environments with different names');
19
- const map = new Map(base.memory);
20
- for (const [key, value] of next.memory) {
21
- const old = map.get(key);
22
- if (old) {
23
- map.set(key, uniqueMergeValues(old, value));
24
- }
25
- else {
26
- map.set(key, value);
27
- }
28
- }
29
- const parent = base.parent === undefined ? undefined : appendIEnvironmentWith(base.parent, next.parent);
30
- const out = new environment_1.Environment(base.name, parent);
31
- out.memory = map;
32
- return out;
33
- }
34
- function appendEnvironments(base, next) {
35
- if (base === undefined) {
36
- return next;
37
- }
38
- else if (next === undefined) {
39
- return base;
40
- }
41
- (0, assert_1.guard)(base.level === next.level, 'environments must have the same level to be handled, it is up to the caller to ensure that');
42
- return {
43
- current: appendIEnvironmentWith(base.current, next.current),
44
- level: base.level,
45
- };
46
- }
47
- exports.appendEnvironments = appendEnvironments;
48
- //# sourceMappingURL=append.js.map