@eagleoutice/flowr 2.8.15 → 2.9.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/README.md +20 -21
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +4 -3
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -3
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +2 -1
- package/abstract-interpretation/data-frame/mappers/arguments.js +2 -1
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +4 -3
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +13 -10
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +7 -6
- package/abstract-interpretation/data-frame/resolve-args.js +2 -1
- package/benchmark/slicer.d.ts +0 -16
- package/benchmark/slicer.js +1 -48
- package/benchmark/stats/print.js +0 -6
- package/benchmark/stats/stats.d.ts +0 -3
- package/benchmark/summarizer/first-phase/process.js +1 -1
- package/benchmark/summarizer/second-phase/process.js +0 -6
- package/cli/benchmark-app.d.ts +0 -1
- package/cli/benchmark-app.js +0 -1
- package/cli/benchmark-helper-app.d.ts +0 -1
- package/cli/benchmark-helper-app.js +1 -5
- package/cli/common/options.d.ts +0 -10
- package/cli/common/options.js +0 -2
- package/cli/common/scripts-info.d.ts +0 -10
- package/cli/repl/server/connection.js +1 -1
- package/config.d.ts +0 -15
- package/config.js +0 -21
- package/control-flow/cfg-dead-code.js +0 -3
- package/control-flow/extract-cfg.js +4 -0
- package/control-flow/semantic-cfg-guided-visitor.d.ts +32 -0
- package/control-flow/semantic-cfg-guided-visitor.js +36 -4
- package/dataflow/cluster.js +2 -2
- package/dataflow/environments/built-in-config.d.ts +1 -0
- package/dataflow/environments/built-in.d.ts +19 -3
- package/dataflow/environments/built-in.js +25 -7
- package/dataflow/environments/default-builtin-config.d.ts +59 -8
- package/dataflow/environments/default-builtin-config.js +20 -6
- package/dataflow/environments/define.d.ts +4 -11
- package/dataflow/environments/define.js +16 -96
- package/dataflow/environments/diff.js +3 -2
- package/dataflow/environments/environment.d.ts +17 -6
- package/dataflow/environments/environment.js +69 -18
- package/dataflow/environments/identifier.d.ts +95 -7
- package/dataflow/environments/identifier.js +161 -1
- package/dataflow/environments/resolve-by-name.d.ts +4 -4
- package/dataflow/environments/resolve-by-name.js +29 -10
- package/dataflow/eval/resolve/alias-tracking.js +8 -1
- package/dataflow/eval/resolve/resolve.d.ts +10 -6
- package/dataflow/eval/resolve/resolve.js +12 -7
- package/dataflow/eval/values/general.js +1 -1
- package/dataflow/eval/values/r-value.d.ts +4 -1
- package/dataflow/eval/values/r-value.js +2 -0
- package/dataflow/extractor.js +6 -3
- package/dataflow/fn/higher-order-function.js +4 -4
- package/dataflow/graph/call-graph.d.ts +1 -1
- package/dataflow/graph/call-graph.js +10 -8
- package/dataflow/graph/diff-dataflow-graph.js +6 -4
- package/dataflow/graph/edge.d.ts +48 -31
- package/dataflow/graph/edge.js +66 -60
- package/dataflow/graph/graph.d.ts +7 -7
- package/dataflow/graph/quads.js +1 -1
- package/dataflow/graph/resolve-graph.js +1 -1
- package/dataflow/graph/unknown-replacement.d.ts +2 -1
- package/dataflow/graph/vertex.d.ts +2 -103
- package/dataflow/graph/vertex.js +0 -44
- package/dataflow/internal/linker.d.ts +2 -2
- package/dataflow/internal/linker.js +35 -19
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +3 -65
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +4 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +18 -51
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +34 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +6 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +1 -69
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.d.ts +11 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +46 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +30 -72
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +12 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +27 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +204 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +25 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +1 -60
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +3 -3
- package/dataflow/internal/process/functions/call/common.d.ts +3 -1
- package/dataflow/internal/process/functions/call/common.js +4 -16
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +6 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +2 -3
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -0
- package/dataflow/internal/process/functions/call/named-call-handling.js +1 -0
- package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +2 -1
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -1
- package/dataflow/internal/process/functions/process-parameter.js +1 -1
- package/dataflow/internal/process/process-named-call.d.ts +2 -1
- package/dataflow/internal/process/process-named-call.js +0 -1
- package/dataflow/internal/process/process-symbol.d.ts +3 -1
- package/dataflow/internal/process/process-symbol.js +8 -5
- package/dataflow/origin/dfg-get-origin.d.ts +2 -2
- package/dataflow/origin/dfg-get-origin.js +4 -4
- package/dataflow/origin/dfg-get-symbol-refs.js +2 -2
- package/documentation/data/interface/doc-writing-code.d.ts +6 -0
- package/documentation/data/interface/doc-writing-code.js +175 -0
- package/documentation/doc-util/doc-types.d.ts +3 -1
- package/documentation/doc-util/doc-types.js +4 -2
- package/documentation/wiki-absint.js +2 -1
- package/documentation/wiki-analyzer.js +17 -2
- package/documentation/wiki-cfg.js +2 -2
- package/documentation/wiki-dataflow-graph.js +9 -8
- package/documentation/wiki-interface.js +8 -164
- package/documentation/wiki-mk/doc-context.d.ts +12 -1
- package/documentation/wiki-mk/doc-context.js +21 -4
- package/documentation/wiki-normalized-ast.js +5 -0
- package/linter/linter-rules.d.ts +3 -3
- package/linter/rules/absolute-path.js +23 -23
- package/linter/rules/dataframe-access-validation.js +2 -1
- package/linter/rules/deprecated-functions.d.ts +1 -1
- package/linter/rules/deprecated-functions.js +1 -1
- package/linter/rules/function-finder-util.d.ts +2 -2
- package/linter/rules/naming-convention.d.ts +9 -2
- package/linter/rules/naming-convention.js +38 -36
- package/linter/rules/network-functions.d.ts +1 -1
- package/linter/rules/seeded-randomness.d.ts +2 -2
- package/linter/rules/seeded-randomness.js +5 -4
- package/linter/rules/unused-definition.js +4 -4
- package/package.json +6 -5
- package/project/context/flowr-analyzer-context.d.ts +17 -1
- package/project/context/flowr-analyzer-context.js +17 -1
- package/project/context/flowr-analyzer-meta-context.d.ts +51 -0
- package/project/context/flowr-analyzer-meta-context.js +47 -0
- package/project/flowr-analyzer.d.ts +17 -1
- package/project/flowr-analyzer.js +18 -0
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +15 -0
- package/project/plugins/file-plugins/files/flowr-description-file.js +26 -0
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +40 -3
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +352 -9
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +2 -2
- package/project/plugins/flowr-analyzer-plugin-defaults.js +2 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.d.ts +12 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +42 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +2 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +2 -2
- package/project/plugins/plugin-registry.d.ts +2 -1
- package/project/plugins/plugin-registry.js +2 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +6 -4
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +3 -3
- package/queries/catalog/dependencies-query/dependencies-query-format.js +5 -3
- package/queries/catalog/does-call-query/does-call-query-executor.js +2 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -1
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +1 -1
- package/r-bridge/data/data.d.ts +12 -7
- package/r-bridge/data/data.js +13 -7
- package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -12
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +2 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +7 -3
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +2 -1
- package/r-bridge/lang-4.x/ast/model/type.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/type.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +5 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +4 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-break.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-for.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-next.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +2 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/other/normalize-comment.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/other/normalize-line-directive.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.d.ts +1 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +13 -14
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +24 -31
- package/r-bridge/roxygen2/roxygen-parse.js +1 -1
- package/reconstruct/auto-select/magic-comments.js +1 -1
- package/reconstruct/reconstruct.js +6 -5
- package/search/flowr-search-filters.js +2 -1
- package/search/search-executor/search-enrichers.d.ts +1 -2
- package/search/search-executor/search-enrichers.js +2 -1
- package/slicing/static/slice-call.d.ts +1 -1
- package/slicing/static/slice-call.js +8 -8
- package/slicing/static/static-slicer.js +2 -2
- package/statistics/features/common-syntax-probability.js +3 -2
- package/statistics/features/supported/defined-functions/defined-functions.js +3 -3
- package/statistics/features/supported/used-functions/used-functions.js +3 -2
- package/util/mermaid/dfg.js +3 -3
- package/util/r-value.d.ts +3 -2
- package/util/r-value.js +3 -0
- package/util/simple-df/dfg-ascii.js +5 -5
- package/util/version.js +1 -1
- package/util/containers.d.ts +0 -66
- package/util/containers.js +0 -143
|
@@ -25,7 +25,7 @@ function normalizeLineDirective(data, obj) {
|
|
|
25
25
|
lexeme: content,
|
|
26
26
|
info: {
|
|
27
27
|
fullRange: data.currentRange,
|
|
28
|
-
|
|
28
|
+
adToks: [],
|
|
29
29
|
fullLexeme: content
|
|
30
30
|
},
|
|
31
31
|
content: content.slice(1)
|
|
@@ -40,7 +40,7 @@ function normalizeLineDirective(data, obj) {
|
|
|
40
40
|
lexeme: content,
|
|
41
41
|
info: {
|
|
42
42
|
fullRange: data.currentRange,
|
|
43
|
-
|
|
43
|
+
adToks: [],
|
|
44
44
|
fullLexeme: content
|
|
45
45
|
}
|
|
46
46
|
};
|
|
@@ -131,7 +131,7 @@ function processBraces([start, end], processed, comments, data) {
|
|
|
131
131
|
lexeme: undefined,
|
|
132
132
|
location: undefined,
|
|
133
133
|
info: {
|
|
134
|
-
|
|
134
|
+
adToks: comments,
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
137
|
}
|
|
@@ -159,8 +159,8 @@ function normalizeExpressions(data, tokens) {
|
|
|
159
159
|
}
|
|
160
160
|
else if (processed.length > 0) {
|
|
161
161
|
if (parsedComments) {
|
|
162
|
-
processed[0].info.
|
|
163
|
-
processed[0].info.
|
|
162
|
+
processed[0].info.adToks ??= [];
|
|
163
|
+
processed[0].info.adToks.push(...parsedComments);
|
|
164
164
|
}
|
|
165
165
|
return processed;
|
|
166
166
|
}
|
|
@@ -18,7 +18,7 @@ function normalizeNumber(data, obj) {
|
|
|
18
18
|
lexeme: content,
|
|
19
19
|
info: {
|
|
20
20
|
fullRange: data.currentRange,
|
|
21
|
-
|
|
21
|
+
adToks: [],
|
|
22
22
|
fullLexeme: data.currentLexeme
|
|
23
23
|
}
|
|
24
24
|
};
|
|
@@ -26,7 +26,6 @@ function normalizeNumber(data, obj) {
|
|
|
26
26
|
if ((0, convert_values_1.isNA)(content)) {
|
|
27
27
|
return {
|
|
28
28
|
...common,
|
|
29
|
-
namespace: undefined,
|
|
30
29
|
type: type_1.RType.Symbol,
|
|
31
30
|
content
|
|
32
31
|
};
|
|
@@ -3,10 +3,9 @@ import type { RSymbol } from '../../../../model/nodes/r-symbol';
|
|
|
3
3
|
import type { NamedJsonEntry } from '../../../json/format';
|
|
4
4
|
/**
|
|
5
5
|
* Normalize the given object as an R symbol (incorporating namespace information).
|
|
6
|
-
* <p>
|
|
7
|
-
* The special symbols `T` and `F` are parsed as logic values.
|
|
8
6
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
9
7
|
* @param objs - The JSON object to extract the meta-information from
|
|
10
8
|
* @returns The parsed symbol (with populated namespace information) or `undefined` if the given object is not a symbol.
|
|
9
|
+
* @see {@link RSymbol} for more information about R symbols.
|
|
11
10
|
*/
|
|
12
11
|
export declare function tryNormalizeSymbol(data: NormalizerData, objs: readonly NamedJsonEntry[]): RSymbol | undefined;
|
|
@@ -3,44 +3,43 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.tryNormalizeSymbol = tryNormalizeSymbol;
|
|
4
4
|
const assert_1 = require("../../../../../../../util/assert");
|
|
5
5
|
const normalize_meta_1 = require("../../normalize-meta");
|
|
6
|
-
const strings_1 = require("../../../../../../../util/text/strings");
|
|
7
6
|
const type_1 = require("../../../../model/type");
|
|
7
|
+
const identifier_1 = require("../../../../../../../dataflow/environments/identifier");
|
|
8
8
|
/**
|
|
9
9
|
* Normalize the given object as an R symbol (incorporating namespace information).
|
|
10
|
-
* <p>
|
|
11
|
-
* The special symbols `T` and `F` are parsed as logic values.
|
|
12
10
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
13
11
|
* @param objs - The JSON object to extract the meta-information from
|
|
14
12
|
* @returns The parsed symbol (with populated namespace information) or `undefined` if the given object is not a symbol.
|
|
13
|
+
* @see {@link RSymbol} for more information about R symbols.
|
|
15
14
|
*/
|
|
16
15
|
function tryNormalizeSymbol(data, objs) {
|
|
17
16
|
(0, assert_1.guard)(objs.length > 0, 'to parse symbols we need at least one object to work on!');
|
|
18
|
-
let
|
|
17
|
+
let content, location;
|
|
18
|
+
let meta;
|
|
19
19
|
if (objs.length === 1 && (0, type_1.isSymbol)(objs[0].name)) {
|
|
20
|
-
|
|
20
|
+
meta = (0, normalize_meta_1.retrieveMetaStructure)(objs[0].content);
|
|
21
21
|
location = meta.location;
|
|
22
|
-
content = meta.content;
|
|
23
|
-
namespace = undefined;
|
|
22
|
+
content = identifier_1.Identifier.make(meta.content);
|
|
24
23
|
}
|
|
25
24
|
else if (objs.length === 3 && (0, type_1.isSymbol)(objs[2].name)) {
|
|
26
|
-
|
|
25
|
+
meta = (0, normalize_meta_1.retrieveMetaStructure)(objs[2].content);
|
|
27
26
|
location = meta.location;
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const namespace = objs[0].content.text;
|
|
28
|
+
const internal = objs[1].content.text === ':::';
|
|
29
|
+
content = identifier_1.Identifier.make(meta.content, namespace, internal);
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
32
|
return undefined;
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
35
35
|
type: type_1.RType.Symbol,
|
|
36
|
-
namespace,
|
|
37
36
|
location,
|
|
38
37
|
// remove backticks from symbol
|
|
39
|
-
content
|
|
40
|
-
lexeme: content,
|
|
38
|
+
content,
|
|
39
|
+
lexeme: meta.content,
|
|
41
40
|
info: {
|
|
42
41
|
fullRange: data.currentRange,
|
|
43
|
-
|
|
42
|
+
adToks: [],
|
|
44
43
|
fullLexeme: data.currentLexeme
|
|
45
44
|
}
|
|
46
45
|
};
|
|
@@ -15,6 +15,7 @@ const r_function_call_1 = require("../ast/model/nodes/r-function-call");
|
|
|
15
15
|
const strings_1 = require("../../../util/text/strings");
|
|
16
16
|
const log_1 = require("../../../util/log");
|
|
17
17
|
const parser_1 = require("../ast/parser/json/parser");
|
|
18
|
+
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
18
19
|
/**
|
|
19
20
|
* @param tree - The tree to normalize
|
|
20
21
|
* @param lax - Whether to use lax parsing (i.e., ignore errors) or strict parsing (i.e., fail on errors)
|
|
@@ -74,7 +75,7 @@ function convertTreeNode(node) {
|
|
|
74
75
|
grouping: undefined,
|
|
75
76
|
info: {
|
|
76
77
|
fullRange: (0, range_1.invalidRange)(),
|
|
77
|
-
|
|
78
|
+
adToks: [],
|
|
78
79
|
treeSitterId: -1,
|
|
79
80
|
}
|
|
80
81
|
};
|
|
@@ -86,7 +87,7 @@ function convertTreeNode(node) {
|
|
|
86
87
|
const defaultInfo = {
|
|
87
88
|
info: {
|
|
88
89
|
fullRange: range,
|
|
89
|
-
|
|
90
|
+
adToks: [],
|
|
90
91
|
fullLexeme: node.text,
|
|
91
92
|
treeSitterId: node.id
|
|
92
93
|
}
|
|
@@ -102,7 +103,7 @@ function convertTreeNode(node) {
|
|
|
102
103
|
grouping: undefined,
|
|
103
104
|
lexeme: undefined,
|
|
104
105
|
info: {
|
|
105
|
-
|
|
106
|
+
adToks: remainingComments.map(c => c[1]),
|
|
106
107
|
treeSitterId: node.id
|
|
107
108
|
}
|
|
108
109
|
};
|
|
@@ -125,19 +126,17 @@ function convertTreeNode(node) {
|
|
|
125
126
|
location: makeSourceRange(opening),
|
|
126
127
|
content: (0, retriever_1.removeRQuotes)(opening.text),
|
|
127
128
|
lexeme: opening.text,
|
|
128
|
-
namespace: undefined,
|
|
129
129
|
...defaultInfo
|
|
130
130
|
}, {
|
|
131
131
|
type: type_1.RType.Symbol,
|
|
132
132
|
location: makeSourceRange(closing),
|
|
133
133
|
content: (0, retriever_1.removeRQuotes)(closing.text),
|
|
134
134
|
lexeme: closing.text,
|
|
135
|
-
namespace: undefined,
|
|
136
135
|
...defaultInfo
|
|
137
136
|
}
|
|
138
137
|
],
|
|
139
138
|
info: {
|
|
140
|
-
|
|
139
|
+
adToks: remainingComments.map(c => c[1]),
|
|
141
140
|
treeSitterId: node.id
|
|
142
141
|
}
|
|
143
142
|
};
|
|
@@ -169,7 +168,6 @@ function convertTreeNode(node) {
|
|
|
169
168
|
location: opSource,
|
|
170
169
|
lexeme: op.text,
|
|
171
170
|
content: op.text,
|
|
172
|
-
namespace: undefined,
|
|
173
171
|
info: {
|
|
174
172
|
treeSitterId: op.id
|
|
175
173
|
}
|
|
@@ -187,7 +185,7 @@ function convertTreeNode(node) {
|
|
|
187
185
|
named: true,
|
|
188
186
|
infixSpecial: true,
|
|
189
187
|
info: {
|
|
190
|
-
|
|
188
|
+
adToks: comments,
|
|
191
189
|
treeSitterId: node.id
|
|
192
190
|
}
|
|
193
191
|
};
|
|
@@ -202,7 +200,7 @@ function convertTreeNode(node) {
|
|
|
202
200
|
...defaultInfo,
|
|
203
201
|
info: {
|
|
204
202
|
fullRange: range,
|
|
205
|
-
|
|
203
|
+
adToks: comments,
|
|
206
204
|
fullLexeme: node.text,
|
|
207
205
|
treeSitterId: node.id
|
|
208
206
|
}
|
|
@@ -217,7 +215,7 @@ function convertTreeNode(node) {
|
|
|
217
215
|
lexeme: op.text,
|
|
218
216
|
info: {
|
|
219
217
|
fullRange: range,
|
|
220
|
-
|
|
218
|
+
adToks: comments,
|
|
221
219
|
fullLexeme: node.text,
|
|
222
220
|
treeSitterId: node.id
|
|
223
221
|
}
|
|
@@ -236,13 +234,12 @@ function convertTreeNode(node) {
|
|
|
236
234
|
};
|
|
237
235
|
}
|
|
238
236
|
case tree_sitter_types_1.TreeSitterType.NamespaceOperator: {
|
|
239
|
-
const [lhs,
|
|
237
|
+
const [lhs, int, rhs] = nonErrorChildren(node);
|
|
240
238
|
return {
|
|
241
239
|
type: type_1.RType.Symbol,
|
|
242
240
|
location: makeSourceRange(rhs),
|
|
243
|
-
content: rhs.text,
|
|
241
|
+
content: identifier_1.Identifier.make(rhs.text, lhs.text, int.text === ':::'),
|
|
244
242
|
lexeme: rhs.text,
|
|
245
|
-
namespace: lhs.text,
|
|
246
243
|
...defaultInfo
|
|
247
244
|
};
|
|
248
245
|
}
|
|
@@ -259,7 +256,6 @@ function convertTreeNode(node) {
|
|
|
259
256
|
location: range,
|
|
260
257
|
content: (0, strings_1.startAndEndsWith)(node.text, '`') ? node.text.slice(1, -1) : (0, retriever_1.removeRQuotes)(node.text),
|
|
261
258
|
lexeme: node.text,
|
|
262
|
-
namespace: undefined,
|
|
263
259
|
...defaultInfo
|
|
264
260
|
};
|
|
265
261
|
case tree_sitter_types_1.TreeSitterType.IfStatement: {
|
|
@@ -290,10 +286,9 @@ function convertTreeNode(node) {
|
|
|
290
286
|
location: makeSourceRange(variableNode),
|
|
291
287
|
content: (0, retriever_1.removeRQuotes)(variableNode.text),
|
|
292
288
|
lexeme: variableNode.text,
|
|
293
|
-
namespace: undefined,
|
|
294
289
|
info: {
|
|
295
290
|
fullRange: undefined,
|
|
296
|
-
|
|
291
|
+
adToks: [],
|
|
297
292
|
fullLexeme: undefined,
|
|
298
293
|
treeSitterId: variableNode.id
|
|
299
294
|
}
|
|
@@ -304,7 +299,7 @@ function convertTreeNode(node) {
|
|
|
304
299
|
lexeme: forNode.text,
|
|
305
300
|
info: {
|
|
306
301
|
fullRange: range,
|
|
307
|
-
|
|
302
|
+
adToks: variableComments.concat(sequenceComments).map(c => c[1]),
|
|
308
303
|
fullLexeme: node.text,
|
|
309
304
|
treeSitterId: node.id
|
|
310
305
|
}
|
|
@@ -352,7 +347,7 @@ function convertTreeNode(node) {
|
|
|
352
347
|
...defaultInfo,
|
|
353
348
|
info: {
|
|
354
349
|
...defaultInfo.info,
|
|
355
|
-
|
|
350
|
+
adToks: comments.map(c => c[1]),
|
|
356
351
|
}
|
|
357
352
|
};
|
|
358
353
|
if (func.type === tree_sitter_types_1.TreeSitterType.Identifier || func.type === tree_sitter_types_1.TreeSitterType.String || func.type === tree_sitter_types_1.TreeSitterType.NamespaceOperator || func.type === tree_sitter_types_1.TreeSitterType.Return) {
|
|
@@ -361,7 +356,6 @@ function convertTreeNode(node) {
|
|
|
361
356
|
funcNode = {
|
|
362
357
|
...funcNode,
|
|
363
358
|
type: type_1.RType.Symbol,
|
|
364
|
-
namespace: undefined,
|
|
365
359
|
content: (0, retriever_1.removeRQuotes)(func.text)
|
|
366
360
|
};
|
|
367
361
|
}
|
|
@@ -372,7 +366,7 @@ function convertTreeNode(node) {
|
|
|
372
366
|
...funcNode,
|
|
373
367
|
info: {
|
|
374
368
|
fullRange: range,
|
|
375
|
-
|
|
369
|
+
adToks: [],
|
|
376
370
|
fullLexeme: node.text,
|
|
377
371
|
treeSitterId: node.id
|
|
378
372
|
}
|
|
@@ -401,7 +395,7 @@ function convertTreeNode(node) {
|
|
|
401
395
|
lexeme: name.text,
|
|
402
396
|
info: {
|
|
403
397
|
...defaultInfo.info,
|
|
404
|
-
|
|
398
|
+
adToks: comments.map(c => c[1]),
|
|
405
399
|
}
|
|
406
400
|
};
|
|
407
401
|
}
|
|
@@ -477,7 +471,7 @@ function convertTreeNode(node) {
|
|
|
477
471
|
lexeme: rhs?.text,
|
|
478
472
|
info: {
|
|
479
473
|
fullRange: rhsRange,
|
|
480
|
-
|
|
474
|
+
adToks: [],
|
|
481
475
|
fullLexeme: rhs?.text,
|
|
482
476
|
treeSitterId: rhs?.id
|
|
483
477
|
}
|
|
@@ -504,7 +498,7 @@ function convertTreeNode(node) {
|
|
|
504
498
|
lexeme: name.text,
|
|
505
499
|
info: {
|
|
506
500
|
fullRange: range,
|
|
507
|
-
|
|
501
|
+
adToks: [],
|
|
508
502
|
fullLexeme: name.text,
|
|
509
503
|
treeSitterId: name.id
|
|
510
504
|
}
|
|
@@ -515,7 +509,7 @@ function convertTreeNode(node) {
|
|
|
515
509
|
lexeme: name.text,
|
|
516
510
|
info: {
|
|
517
511
|
fullRange: range,
|
|
518
|
-
|
|
512
|
+
adToks: [],
|
|
519
513
|
fullLexeme: name.text,
|
|
520
514
|
treeSitterId: name.id
|
|
521
515
|
}
|
|
@@ -542,8 +536,7 @@ function convertTreeNode(node) {
|
|
|
542
536
|
name = {
|
|
543
537
|
...name,
|
|
544
538
|
type: type_1.RType.Symbol,
|
|
545
|
-
content: name.content.str
|
|
546
|
-
namespace: undefined
|
|
539
|
+
content: name.content.str
|
|
547
540
|
};
|
|
548
541
|
}
|
|
549
542
|
else if ((0, strings_1.startAndEndsWith)(name.content, '`')) {
|
|
@@ -558,7 +551,7 @@ function convertTreeNode(node) {
|
|
|
558
551
|
lexeme: nameNode.text,
|
|
559
552
|
info: {
|
|
560
553
|
fullRange: nameRange,
|
|
561
|
-
|
|
554
|
+
adToks: [],
|
|
562
555
|
fullLexeme: nameNode.text,
|
|
563
556
|
treeSitterId: nameNode.id
|
|
564
557
|
}
|
|
@@ -594,7 +587,7 @@ function convertTreeNode(node) {
|
|
|
594
587
|
grouping: undefined,
|
|
595
588
|
info: {
|
|
596
589
|
fullRange: (0, range_1.invalidRange)(),
|
|
597
|
-
|
|
590
|
+
adToks: [],
|
|
598
591
|
treeSitterId: -1,
|
|
599
592
|
}
|
|
600
593
|
};
|
|
@@ -629,7 +622,7 @@ function splitComments(nodes) {
|
|
|
629
622
|
location: makeSourceRange(node),
|
|
630
623
|
lexeme: node.text,
|
|
631
624
|
info: {
|
|
632
|
-
|
|
625
|
+
adToks: [],
|
|
633
626
|
fullLexeme: node.text,
|
|
634
627
|
treeSitterId: node.id
|
|
635
628
|
}
|
|
@@ -658,8 +651,8 @@ function linkCommentsToNextNodes(nodes, comments) {
|
|
|
658
651
|
// if there is no valid sibling, we just link the comment to the first node (see normalize-expressions.ts)
|
|
659
652
|
const [, node] = (sibling ? nodes.find(([s]) => s.equals(sibling)) : undefined) ?? nodes[0] ?? [];
|
|
660
653
|
if (node) {
|
|
661
|
-
node.info.
|
|
662
|
-
node.info.
|
|
654
|
+
node.info.adToks ??= [];
|
|
655
|
+
node.info.adToks.push(commentNode);
|
|
663
656
|
}
|
|
664
657
|
else {
|
|
665
658
|
remain.push([commentSyntaxNode, commentNode]);
|
|
@@ -35,7 +35,7 @@ function parseRoxygenCommentsOfNode(node, idMap) {
|
|
|
35
35
|
let comments;
|
|
36
36
|
let cur = node;
|
|
37
37
|
do {
|
|
38
|
-
comments = cur?.info.
|
|
38
|
+
comments = cur?.info.adToks
|
|
39
39
|
?.filter(r_comment_1.isRComment).filter(r => (0, assert_1.isNotUndefined)(r.lexeme));
|
|
40
40
|
cur = cur?.info.parent ? idMap?.get(cur.info.parent) : undefined;
|
|
41
41
|
} while ((comments === undefined || comments.length === 0) && cur !== undefined);
|
|
@@ -53,7 +53,7 @@ function makeMagicCommentHandler(and) {
|
|
|
53
53
|
lines = new Set();
|
|
54
54
|
const startLineStack = [];
|
|
55
55
|
(0, visitor_1.visitAst)(normalizedAst.ast.files.map(f => f.root), n => {
|
|
56
|
-
const comments = n.info.
|
|
56
|
+
const comments = n.info.adToks;
|
|
57
57
|
if (!comments) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
@@ -13,8 +13,9 @@ const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
|
|
|
13
13
|
const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
14
14
|
const stateful_fold_1 = require("../r-bridge/lang-4.x/ast/model/processing/stateful-fold");
|
|
15
15
|
const auto_select_defaults_1 = require("./auto-select/auto-select-defaults");
|
|
16
|
+
const identifier_1 = require("../dataflow/environments/identifier");
|
|
16
17
|
function plain(text) {
|
|
17
|
-
return [{ line: text, indent: 0 }];
|
|
18
|
+
return [{ line: Array.isArray(text) ? identifier_1.Identifier.toString(text) : text, indent: 0 }];
|
|
18
19
|
}
|
|
19
20
|
exports.reconstructLogger = log_1.log.getSubLogger({ name: 'reconstruct' });
|
|
20
21
|
function getLexeme(n) {
|
|
@@ -49,8 +50,8 @@ function reconstructExpressionList(exprList, _grouping, expressions, config) {
|
|
|
49
50
|
if (g && fst.length > 0) {
|
|
50
51
|
const start = g[0].content;
|
|
51
52
|
const end = g[1].content;
|
|
52
|
-
fst[0].line = `${start}${start === '{' ? ' ' : ''}${fst[0].line}`;
|
|
53
|
-
fst[fst.length - 1].line = `${fst[fst.length - 1].line}${end === '}' ? ' ' : ''}${end}`;
|
|
53
|
+
fst[0].line = `${identifier_1.Identifier.toString(start)}${start === '{' ? ' ' : ''}${fst[0].line}`;
|
|
54
|
+
fst[fst.length - 1].line = `${fst[fst.length - 1].line}${end === '}' ? ' ' : ''}${identifier_1.Identifier.toString(end)}`;
|
|
54
55
|
}
|
|
55
56
|
return fst;
|
|
56
57
|
}
|
|
@@ -323,13 +324,13 @@ function reconstructSpecialInfixFunctionCall(args, call) {
|
|
|
323
324
|
const lhsText = lhs.map(l => `${getIndentString(l.indent)}${l.line}`).join('\n');
|
|
324
325
|
if (rhs !== r_function_call_1.EmptyArgument && rhs.length > 0) {
|
|
325
326
|
const rhsText = rhs.map(l => `${getIndentString(l.indent)}${l.line}`).join('\n');
|
|
326
|
-
return plain(`${lhsText} ${call.functionName.content} ${rhsText}`);
|
|
327
|
+
return plain(`${lhsText} ${identifier_1.Identifier.toString(call.functionName.content)} ${rhsText}`);
|
|
327
328
|
}
|
|
328
329
|
else {
|
|
329
330
|
return plain(lhsText);
|
|
330
331
|
}
|
|
331
332
|
}
|
|
332
|
-
return plain(`${getLexeme(call.arguments[0])} ${call.functionName.content} ${getLexeme(call.arguments[1])}`);
|
|
333
|
+
return plain(`${getLexeme(call.arguments[0])} ${identifier_1.Identifier.toString(call.functionName.content)} ${getLexeme(call.arguments[1])}`);
|
|
333
334
|
}
|
|
334
335
|
function reconstructFunctionCall(call, functionName, args, configuration) {
|
|
335
336
|
const selected = isSelected(configuration, call);
|
|
@@ -8,6 +8,7 @@ exports.evalFilter = evalFilter;
|
|
|
8
8
|
const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
|
|
9
9
|
const vertex_1 = require("../dataflow/graph/vertex");
|
|
10
10
|
const search_enrichers_1 = require("./search-executor/search-enrichers");
|
|
11
|
+
const identifier_1 = require("../dataflow/environments/identifier");
|
|
11
12
|
var FlowrFilter;
|
|
12
13
|
(function (FlowrFilter) {
|
|
13
14
|
/**
|
|
@@ -43,7 +44,7 @@ exports.FlowrFilters = {
|
|
|
43
44
|
if (typeof fn === 'string' && args.test.test(fn)) {
|
|
44
45
|
return true;
|
|
45
46
|
}
|
|
46
|
-
if (typeof fn === 'object' && 'node' in fn && fn.node.type === type_1.RType.FunctionCall && fn.node.named && args.test.test(fn.node.functionName.content)) {
|
|
47
|
+
if (typeof fn === 'object' && 'node' in fn && fn.node.type === type_1.RType.FunctionCall && fn.node.named && args.test.test(identifier_1.Identifier.getName(fn.node.functionName.content))) {
|
|
47
48
|
return true;
|
|
48
49
|
}
|
|
49
50
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { FlowrSearchElement, FlowrSearchElements } from '../flowr-search';
|
|
2
2
|
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
3
|
import { type MergeableRecord } from '../../util/objects';
|
|
4
|
-
import type { Identifier } from '../../dataflow/environments/identifier';
|
|
5
4
|
import type { LinkToLastCall } from '../../queries/catalog/call-context-query/call-context-query-format';
|
|
6
5
|
import { type NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
6
|
import type { ControlFlowInformation } from '../../control-flow/control-flow-graph';
|
|
@@ -39,7 +38,7 @@ export interface CallTargetsContent extends MergeableRecord {
|
|
|
39
38
|
* The call targets of the function call.
|
|
40
39
|
* For identifier call targets, the identifier is the name of the library function being called.
|
|
41
40
|
*/
|
|
42
|
-
targets: (FlowrSearchElement<ParentInformation> |
|
|
41
|
+
targets: (FlowrSearchElement<ParentInformation> | string)[];
|
|
43
42
|
}
|
|
44
43
|
export interface LastCallContent extends MergeableRecord {
|
|
45
44
|
linkedIds: FlowrSearchElement<ParentInformation>[];
|
|
@@ -12,6 +12,7 @@ const cfg_simplification_1 = require("../../control-flow/cfg-simplification");
|
|
|
12
12
|
const call_context_query_executor_1 = require("../../queries/catalog/call-context-query/call-context-query-executor");
|
|
13
13
|
const cfg_kind_1 = require("../../project/cfg-kind");
|
|
14
14
|
const identify_link_to_last_call_relation_1 = require("../../queries/catalog/call-context-query/identify-link-to-last-call-relation");
|
|
15
|
+
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
15
16
|
/**
|
|
16
17
|
* An enumeration that stores the names of the available enrichments that can be applied to a set of search elements.
|
|
17
18
|
* See {@link FlowrSearchBuilder.with} for more information on how to apply enrichments.
|
|
@@ -49,7 +50,7 @@ exports.Enrichments = {
|
|
|
49
50
|
node: n.idMap.get(o.id),
|
|
50
51
|
};
|
|
51
52
|
case 3 /* OriginType.BuiltInFunctionOrigin */:
|
|
52
|
-
return o.fn.name;
|
|
53
|
+
return identifier_1.Identifier.toString(o.fn.name);
|
|
53
54
|
default:
|
|
54
55
|
return undefined;
|
|
55
56
|
}
|
|
@@ -10,7 +10,7 @@ import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-a
|
|
|
10
10
|
/**
|
|
11
11
|
* Returns the function call targets (definitions) by the given caller
|
|
12
12
|
*/
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function getAllFunctionCallTargetsForSlice(dataflowGraph: DataflowGraph, callerInfo: DataflowGraphVertexFunctionCall, baseEnvironment: REnvironmentInformation, queue: VisitingQueue, ctx: ReadOnlyFlowrAnalyzerContext): [Set<DataflowGraphVertexInfo>, REnvironmentInformation];
|
|
14
14
|
/** returns the new threshold hit count */
|
|
15
15
|
export declare function sliceForCall(current: NodeToSlice, callerInfo: DataflowGraphVertexFunctionCall, { graph }: DataflowInformation, queue: VisitingQueue, ctx: ReadOnlyFlowrAnalyzerContext): void;
|
|
16
16
|
/** Returns true if we found at least one return edge */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getAllFunctionCallTargetsForSlice = getAllFunctionCallTargetsForSlice;
|
|
4
4
|
exports.sliceForCall = sliceForCall;
|
|
5
5
|
exports.handleReturns = handleReturns;
|
|
6
6
|
const assert_1 = require("../../util/assert");
|
|
@@ -16,7 +16,7 @@ const static_slicer_1 = require("./static-slicer");
|
|
|
16
16
|
/**
|
|
17
17
|
* Returns the function call targets (definitions) by the given caller
|
|
18
18
|
*/
|
|
19
|
-
function
|
|
19
|
+
function getAllFunctionCallTargetsForSlice(dataflowGraph, callerInfo, baseEnvironment, queue, ctx) {
|
|
20
20
|
// bind with call-local environments during slicing
|
|
21
21
|
const outgoingEdges = dataflowGraph.get(callerInfo.id, true);
|
|
22
22
|
(0, assert_1.guard)(outgoingEdges !== undefined, () => `outgoing edges of id: ${callerInfo.id} must be in graph but can not be found, keep in slice to be sure`);
|
|
@@ -26,7 +26,7 @@ function getAllFunctionCallTargets(dataflowGraph, callerInfo, baseEnvironment, q
|
|
|
26
26
|
(0, assert_1.guard)(name !== undefined, () => `name of id: ${callerInfo.id} can not be found in id map`);
|
|
27
27
|
const functionCallDefs = (0, resolve_by_name_1.resolveByName)(name, activeEnvironment, identifier_1.ReferenceType.Unknown)?.filter(d => !(0, built_in_1.isBuiltIn)(d.definedAt))?.map(d => d.nodeId) ?? [];
|
|
28
28
|
for (const [target, outgoingEdge] of outgoingEdges[1].entries()) {
|
|
29
|
-
if (
|
|
29
|
+
if (edge_1.DfEdge.includesType(outgoingEdge, edge_1.EdgeType.Calls)) {
|
|
30
30
|
functionCallDefs.push(target);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -60,7 +60,7 @@ function linkCallTargets(onlyForSideEffects, functionCallTargets, activeEnvironm
|
|
|
60
60
|
}
|
|
61
61
|
/** returns the new threshold hit count */
|
|
62
62
|
function sliceForCall(current, callerInfo, { graph }, queue, ctx) {
|
|
63
|
-
const [functionCallTargets, activeEnvironment] =
|
|
63
|
+
const [functionCallTargets, activeEnvironment] = getAllFunctionCallTargetsForSlice(graph, callerInfo, current.baseEnvironment, queue, ctx);
|
|
64
64
|
if (functionCallTargets.size === 0) {
|
|
65
65
|
/*
|
|
66
66
|
* if we do not have any call to resolve this function, we have to assume that every function passed is actually called!
|
|
@@ -78,18 +78,18 @@ const PotentialFollowOnReturn = edge_1.EdgeType.DefinesOnCall | edge_1.EdgeType.
|
|
|
78
78
|
/** Returns true if we found at least one return edge */
|
|
79
79
|
function handleReturns(from, queue, currentEdges, baseEnvFingerprint, baseEnvironment) {
|
|
80
80
|
const e = Array.from(currentEdges.entries());
|
|
81
|
-
const found = e.filter(([_, edge]) =>
|
|
81
|
+
const found = e.filter(([_, edge]) => edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Returns));
|
|
82
82
|
if (found.length === 0) {
|
|
83
83
|
return false;
|
|
84
84
|
}
|
|
85
|
-
for (const [target
|
|
85
|
+
for (const [target] of found) {
|
|
86
86
|
queue.add(target, baseEnvironment, baseEnvFingerprint, false);
|
|
87
87
|
}
|
|
88
88
|
for (const [target, edge] of e) {
|
|
89
|
-
if (
|
|
89
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads)) {
|
|
90
90
|
queue.add(target, baseEnvironment, baseEnvFingerprint, false);
|
|
91
91
|
}
|
|
92
|
-
else if (
|
|
92
|
+
else if (edge_1.DfEdge.includesType(edge, PotentialFollowOnReturn)) {
|
|
93
93
|
(0, static_slicer_1.updatePotentialAddition)(queue, from, target, baseEnvironment, baseEnvFingerprint);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -83,8 +83,8 @@ function staticSlice(ctx, info, { idMap }, criteria, direction, threshold = 75,
|
|
|
83
83
|
continue;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
for (const [target,
|
|
87
|
-
const t = (0, edge_1.shouldTraverseEdge)(
|
|
86
|
+
for (const [target, e] of currentEdges) {
|
|
87
|
+
const t = (0, edge_1.shouldTraverseEdge)(e);
|
|
88
88
|
switch (t) {
|
|
89
89
|
case 0 /* TraverseEdge.Never */:
|
|
90
90
|
continue;
|
|
@@ -11,6 +11,7 @@ const numbers_1 = require("../../util/numbers");
|
|
|
11
11
|
const summarizer_1 = require("../../util/summarizer");
|
|
12
12
|
const convert_values_1 = require("../../r-bridge/lang-4.x/convert-values");
|
|
13
13
|
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
14
|
+
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
14
15
|
/**
|
|
15
16
|
*
|
|
16
17
|
*/
|
|
@@ -68,7 +69,7 @@ function updateCommonSyntaxTypeCounts(current, ...nodes) {
|
|
|
68
69
|
incrementEntry(current.string, node.content.str);
|
|
69
70
|
break;
|
|
70
71
|
case type_1.RType.Symbol:
|
|
71
|
-
incrementEntry(current.singleVar, node.content);
|
|
72
|
+
incrementEntry(current.singleVar, identifier_1.Identifier.getName(node.content));
|
|
72
73
|
break;
|
|
73
74
|
case type_1.RType.Logical:
|
|
74
75
|
incrementEntry(current.logical, node.content ? convert_values_1.RTrue : convert_values_1.RFalse);
|
|
@@ -89,7 +90,7 @@ function updateCommonSyntaxTypeCounts(current, ...nodes) {
|
|
|
89
90
|
current.unnamedCall++;
|
|
90
91
|
}
|
|
91
92
|
else {
|
|
92
|
-
incrementEntry(current.call, node.functionName.content);
|
|
93
|
+
incrementEntry(current.call, identifier_1.Identifier.getName(node.functionName.content));
|
|
93
94
|
}
|
|
94
95
|
break;
|
|
95
96
|
case type_1.RType.BinaryOp:
|
|
@@ -26,7 +26,7 @@ function retrieveAllCallsites(input, node, recursiveCalls) {
|
|
|
26
26
|
const dfStart = input.dataflow.graph.outgoingEdges(node.info.id);
|
|
27
27
|
const callsites = [];
|
|
28
28
|
for (const [target, edge] of dfStart ?? []) {
|
|
29
|
-
if (!
|
|
29
|
+
if (!edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Calls)) {
|
|
30
30
|
continue;
|
|
31
31
|
}
|
|
32
32
|
const loc = input.normalizedRAst.idMap.get(target)?.location;
|
|
@@ -83,7 +83,7 @@ function visitDefinitions(info, input) {
|
|
|
83
83
|
const edges = input.dataflow.graph.ingoingEdges(node.info.id);
|
|
84
84
|
if (edges !== undefined) {
|
|
85
85
|
for (const [targetId, edge] of edges) {
|
|
86
|
-
if (
|
|
86
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedBy)) {
|
|
87
87
|
const target = input.normalizedRAst.idMap.get(targetId);
|
|
88
88
|
(0, assert_1.guard)(target !== undefined, 'Dataflow edge points to unknown node');
|
|
89
89
|
const name = target.info.fullLexeme ?? target.lexeme;
|
|
@@ -93,7 +93,7 @@ function visitDefinitions(info, input) {
|
|
|
93
93
|
info.assignedFunctions++;
|
|
94
94
|
(0, statistics_file_1.appendStatisticsFile)(exports.definedFunctions.name, 'assignedFunctions', [name ?? '<unknown>'], input.filepath);
|
|
95
95
|
}
|
|
96
|
-
if (
|
|
96
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Calls)) {
|
|
97
97
|
const target = input.normalizedRAst.idMap.get(targetId);
|
|
98
98
|
(0, assert_1.guard)(target !== undefined, 'Dataflow edge points to unknown node');
|
|
99
99
|
}
|