@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.
- package/abstract-interpretation/domain.d.ts +27 -0
- package/abstract-interpretation/domain.js +146 -0
- package/abstract-interpretation/handler/binop/binop.d.ts +16 -0
- package/abstract-interpretation/handler/binop/binop.js +40 -0
- package/abstract-interpretation/handler/binop/operators.d.ts +2 -0
- package/abstract-interpretation/handler/binop/operators.js +42 -0
- package/abstract-interpretation/handler/handler.d.ts +6 -0
- package/abstract-interpretation/handler/handler.js +3 -0
- package/abstract-interpretation/processor.d.ts +10 -0
- package/abstract-interpretation/processor.js +78 -0
- package/benchmark/slicer.d.ts +6 -5
- package/benchmark/slicer.js +2 -0
- package/benchmark/stats/print.d.ts +1 -1
- package/benchmark/stats/stats.d.ts +4 -4
- package/benchmark/stats/stats.js +1 -1
- package/cli/common/features.d.ts +1 -1
- package/cli/common/options.d.ts +1 -1
- package/cli/common/script.d.ts +1 -1
- package/cli/common/scripts-info.d.ts +2 -2
- package/cli/repl/commands/cfg.d.ts +1 -1
- package/cli/repl/commands/cfg.js +1 -1
- package/cli/repl/commands/commands.d.ts +1 -1
- package/cli/repl/commands/dataflow.d.ts +1 -1
- package/cli/repl/commands/execute.d.ts +2 -2
- package/cli/repl/commands/main.d.ts +2 -2
- package/cli/repl/commands/normalize.d.ts +1 -1
- package/cli/repl/commands/parse.d.ts +1 -1
- package/cli/repl/commands/quit.d.ts +1 -1
- package/cli/repl/commands/version.d.ts +1 -1
- package/cli/repl/core.d.ts +1 -1
- package/cli/repl/execute.d.ts +1 -1
- package/cli/repl/server/connection.d.ts +2 -2
- package/cli/repl/server/connection.js +3 -2
- package/cli/repl/server/messages/analysis.d.ts +3 -3
- package/cli/repl/server/messages/analysis.js +12 -32
- package/cli/repl/server/messages/error.d.ts +1 -1
- package/cli/repl/server/messages/hello.d.ts +2 -2
- package/cli/repl/server/messages/messages.d.ts +5 -5
- package/cli/repl/server/messages/repl.d.ts +1 -1
- package/cli/repl/server/messages/slice.d.ts +3 -3
- package/cli/repl/server/net.d.ts +16 -0
- package/cli/repl/server/net.js +40 -1
- package/cli/repl/server/send.d.ts +2 -2
- package/cli/repl/server/server.d.ts +2 -2
- package/cli/repl/server/validate.d.ts +3 -3
- package/cli/statistics-helper-app.js +2 -2
- package/core/input.d.ts +6 -6
- package/core/output.d.ts +3 -2
- package/core/print/dataflow-printer.d.ts +3 -3
- package/core/print/normalize-printer.d.ts +2 -2
- package/core/print/parse-printer.d.ts +2 -2
- package/core/print/print.d.ts +1 -1
- package/core/print/slice-diff-ansi.d.ts +1 -1
- package/core/slicer.d.ts +5 -4
- package/core/slicer.js +6 -2
- package/core/steps.d.ts +22 -4
- package/core/steps.js +10 -2
- package/dataflow/environments/append.d.ts +1 -1
- package/dataflow/environments/environment.d.ts +4 -4
- package/dataflow/environments/overwrite.d.ts +1 -1
- package/dataflow/environments/register.d.ts +2 -2
- package/dataflow/environments/resolve-by-name.d.ts +2 -2
- package/dataflow/environments/scoping.d.ts +1 -1
- package/dataflow/extractor.d.ts +4 -4
- package/dataflow/graph/diff.d.ts +3 -3
- package/dataflow/graph/graph.d.ts +8 -7
- package/dataflow/graph/quads.d.ts +2 -2
- package/dataflow/graph/vertex.d.ts +5 -5
- package/dataflow/internal/info.d.ts +2 -2
- package/dataflow/internal/linker.d.ts +3 -3
- package/dataflow/internal/process/access.d.ts +3 -3
- package/dataflow/internal/process/expression-list.d.ts +3 -3
- package/dataflow/internal/process/expression-list.js +0 -4
- package/dataflow/internal/process/functions/argument.d.ts +4 -4
- package/dataflow/internal/process/functions/exit-points.d.ts +1 -1
- package/dataflow/internal/process/functions/function-call.d.ts +3 -3
- package/dataflow/internal/process/functions/function-definition.d.ts +3 -3
- package/dataflow/internal/process/functions/parameter.d.ts +3 -3
- package/dataflow/internal/process/if-then-else.d.ts +3 -3
- package/dataflow/internal/process/loops/for-loop.d.ts +3 -3
- package/dataflow/internal/process/loops/repeat-loop.d.ts +3 -3
- package/dataflow/internal/process/loops/while-loop.d.ts +3 -3
- package/dataflow/internal/process/operators/assignment.d.ts +3 -3
- package/dataflow/internal/process/operators/non-assignment-binary-op.d.ts +3 -3
- package/dataflow/internal/process/operators/pipe.d.ts +3 -3
- package/dataflow/internal/process/operators/unary-op.d.ts +3 -3
- package/dataflow/internal/process/symbol.d.ts +3 -3
- package/dataflow/internal/process/uninteresting-leaf.d.ts +2 -2
- package/dataflow/processor.d.ts +3 -3
- package/flowr.d.ts +3 -2
- package/flowr.js +5 -3
- package/package.json +11 -2
- package/r-bridge/lang-4.x/ast/model/collect.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/model.d.ts +6 -6
- package/r-bridge/lang-4.x/ast/model/nodes/info/index.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/operators.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/processing/fold.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/processing/visitor.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/xml/config.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/data.d.ts +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/hooks.d.ts +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/access.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/special.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/parser.d.ts +4 -4
- package/r-bridge/retriever.d.ts +2 -2
- package/r-bridge/shell-executor.d.ts +25 -0
- package/r-bridge/shell-executor.js +119 -0
- package/r-bridge/shell.d.ts +8 -5
- package/r-bridge/shell.js +6 -3
- package/reconstruct/reconstruct.d.ts +1 -1
- package/slicing/criterion/collect-all.d.ts +3 -3
- package/slicing/criterion/filters/all-variables.d.ts +1 -1
- package/slicing/criterion/parse.d.ts +1 -1
- package/slicing/static/static-slicer.d.ts +3 -3
- package/statistics/features/common-syntax-probability.d.ts +3 -2
- package/statistics/features/common-syntax-probability.js +0 -3
- package/statistics/features/feature.d.ts +6 -6
- package/statistics/features/post-processing.d.ts +2 -2
- package/statistics/features/supported/assignments/assignments.d.ts +2 -2
- package/statistics/features/supported/assignments/post-process.d.ts +2 -2
- package/statistics/features/supported/comments/comments.d.ts +2 -2
- package/statistics/features/supported/comments/post-process.d.ts +2 -2
- package/statistics/features/supported/control-flow/control-flow.d.ts +2 -2
- package/statistics/features/supported/control-flow/post-process.d.ts +2 -2
- package/statistics/features/supported/data-access/data-access.d.ts +3 -3
- package/statistics/features/supported/data-access/post-process.d.ts +2 -2
- package/statistics/features/supported/defined-functions/defined-functions.d.ts +4 -4
- package/statistics/features/supported/defined-functions/post-process.d.ts +2 -2
- package/statistics/features/supported/expression-list/expression-list.d.ts +2 -2
- package/statistics/features/supported/expression-list/post-process.d.ts +2 -2
- package/statistics/features/supported/loops/loops.d.ts +2 -2
- package/statistics/features/supported/loops/post-process.d.ts +2 -2
- package/statistics/features/supported/used-functions/post-process.d.ts +2 -2
- package/statistics/features/supported/used-functions/used-functions.d.ts +3 -3
- package/statistics/features/supported/used-packages/post-process.d.ts +2 -2
- package/statistics/features/supported/used-packages/used-packages.d.ts +2 -2
- package/statistics/features/supported/values/post-process.d.ts +2 -2
- package/statistics/features/supported/values/values.d.ts +2 -2
- package/statistics/features/supported/variables/post-process.d.ts +3 -3
- package/statistics/features/supported/variables/variables.d.ts +2 -2
- package/statistics/meta-statistics.d.ts +1 -1
- package/statistics/output/print-stats.d.ts +2 -2
- package/statistics/output/statistics-file.d.ts +1 -1
- package/statistics/statistics.d.ts +4 -4
- package/util/{cfg.d.ts → cfg/cfg.d.ts} +18 -6
- package/util/{cfg.js → cfg/cfg.js} +42 -37
- package/util/cfg/visitor.d.ts +14 -0
- package/util/cfg/visitor.js +64 -0
- package/util/diff.d.ts +1 -1
- package/util/files.d.ts +1 -1
- package/util/mermaid/ast.d.ts +1 -1
- package/util/mermaid/cfg.d.ts +2 -2
- package/util/mermaid/dfg.d.ts +3 -3
- package/util/objects.d.ts +1 -1
- package/util/quads.d.ts +2 -2
- package/util/summarizer/benchmark/data.d.ts +1 -1
- package/util/summarizer/benchmark/first-phase/process.d.ts +3 -3
- package/util/summarizer/benchmark/second-phase/graph.d.ts +1 -1
- package/util/summarizer/benchmark/second-phase/process.d.ts +1 -1
- package/util/summarizer/benchmark/summarizer.d.ts +3 -2
- package/util/summarizer/benchmark/summarizer.js +0 -4
- package/util/summarizer/statistics/post-process/clusterer.d.ts +2 -2
- package/util/summarizer/statistics/post-process/file-based-count.d.ts +1 -1
- package/util/summarizer/statistics/post-process/histogram.d.ts +2 -2
- package/util/summarizer/statistics/post-process/post-process-output.d.ts +2 -2
- package/util/summarizer/statistics/second-phase/process.d.ts +2 -2
- package/util/summarizer/statistics/summarizer.d.ts +3 -2
- 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 {
|
|
5
|
-
import {
|
|
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,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,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
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
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:
|
|
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,
|
|
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("
|
|
5
|
-
const set_1 = require("
|
|
6
|
-
const quads_1 = require("
|
|
7
|
-
const log_1 = require("
|
|
8
|
-
const json_1 = require("
|
|
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(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|