@eagleoutice/flowr 2.10.1 → 2.10.3
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 +31 -20
- package/abstract-interpretation/absint-visitor.d.ts +13 -8
- package/abstract-interpretation/absint-visitor.js +35 -26
- package/abstract-interpretation/data-frame/dataframe-domain.d.ts +1 -2
- package/abstract-interpretation/data-frame/dataframe-domain.js +14 -15
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +2 -15
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +11 -17
- package/abstract-interpretation/data-frame/mappers/arguments.js +18 -18
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +41 -15
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +74 -48
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +2 -1
- package/abstract-interpretation/data-frame/semantics.d.ts +1 -1
- package/abstract-interpretation/data-frame/semantics.js +31 -35
- package/abstract-interpretation/data-frame/shape-inference.js +1 -1
- package/abstract-interpretation/domains/interval-domain.d.ts +1 -0
- package/abstract-interpretation/domains/interval-domain.js +3 -0
- package/abstract-interpretation/domains/product-domain.d.ts +9 -0
- package/abstract-interpretation/domains/product-domain.js +26 -6
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +36 -22
- package/abstract-interpretation/domains/state-abstract-domain.js +169 -62
- package/abstract-interpretation/unsupported-functions.d.ts +10 -0
- package/abstract-interpretation/unsupported-functions.js +45 -0
- package/benchmark/slicer.js +10 -13
- package/cli/flowr.js +1 -1
- package/control-flow/control-flow-graph.js +13 -9
- package/control-flow/semantic-cfg-guided-visitor.d.ts +6 -0
- package/control-flow/semantic-cfg-guided-visitor.js +6 -0
- package/dataflow/environments/built-in-proc-name.d.ts +6 -0
- package/dataflow/environments/built-in-proc-name.js +6 -0
- package/dataflow/environments/built-in.d.ts +7 -5
- package/dataflow/environments/built-in.js +2 -0
- package/dataflow/environments/default-builtin-config.d.ts +442 -6
- package/dataflow/environments/default-builtin-config.js +158 -3
- package/dataflow/environments/overwrite.js +2 -5
- package/dataflow/graph/df-helper.d.ts +14 -4
- package/dataflow/graph/df-helper.js +36 -6
- package/dataflow/graph/graph.d.ts +10 -0
- package/dataflow/graph/graph.js +12 -0
- package/dataflow/instrument/instrument-dataflow-count.d.ts +10 -0
- package/dataflow/instrument/instrument-dataflow-count.js +10 -0
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +6 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +23 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +80 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +41 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +179 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +7 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +62 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.d.ts +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +15 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/common.d.ts +2 -2
- package/dataflow/internal/process/functions/call/common.js +4 -3
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +2 -2
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +2 -2
- package/documentation/wiki-absint.js +6 -5
- package/documentation/wiki-analyzer.js +0 -2
- package/documentation/wiki-cfg.js +3 -3
- package/documentation/wiki-linter.js +1 -0
- package/documentation/wiki-normalized-ast.js +7 -7
- package/documentation/wiki-query.js +29 -0
- package/linter/linter-rules.d.ts +24 -1
- package/linter/linter-rules.js +3 -1
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +3 -4
- package/linter/rules/roxygen-arguments.d.ts +35 -0
- package/linter/rules/roxygen-arguments.js +100 -0
- package/package.json +4 -5
- package/project/context/flowr-analyzer-context.d.ts +1 -8
- package/project/context/flowr-analyzer-context.js +1 -7
- package/project/context/flowr-analyzer-environment-context.d.ts +5 -0
- package/project/context/flowr-analyzer-environment-context.js +6 -0
- package/project/context/flowr-analyzer-files-context.d.ts +6 -0
- package/project/context/flowr-analyzer-files-context.js +4 -2
- package/project/flowr-analyzer-builder.js +1 -4
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +10 -5
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/library-functions.js +2 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.js +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-format.js +7 -2
- package/queries/catalog/files-query/files-query-executor.js +0 -1
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +2 -0
- package/queries/catalog/input-sources-query/simple-input-classifier.js +5 -3
- package/r-bridge/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +13 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +14 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +9 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +13 -0
- package/r-bridge/lang-4.x/ast/model/versions.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/versions.js +3 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
- package/r-bridge/roxygen2/documentation-provider.js +15 -6
- package/r-bridge/roxygen2/roxygen-ast.d.ts +3 -1
- package/search/flowr-search-builder.js +3 -2
- package/util/mermaid/ast.js +2 -1
- package/util/record.d.ts +23 -0
- package/util/record.js +33 -0
- package/util/version.js +1 -1
- package/abstract-interpretation/domains/mapped-abstract-domain.d.ts +0 -41
- package/abstract-interpretation/domains/mapped-abstract-domain.js +0 -213
|
@@ -23,5 +23,18 @@ exports.RPipe = {
|
|
|
23
23
|
availableFromRVersion() {
|
|
24
24
|
return new semver_1.SemVer(versions_1.MIN_VERSION_PIPE);
|
|
25
25
|
},
|
|
26
|
+
/**
|
|
27
|
+
* Returns the minimum R version that supports using the placeholder like '_'.
|
|
28
|
+
*/
|
|
29
|
+
hasPlaceHolderFromRVersion() {
|
|
30
|
+
return new semver_1.SemVer(versions_1.MIN_VERSION_PIPE_PLACEHOLDER);
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Returns the minimum R version that supports using the placeholder like '_' in access
|
|
34
|
+
* patterns: `_$a`
|
|
35
|
+
*/
|
|
36
|
+
hasAccessPlaceHolderFromRVersion() {
|
|
37
|
+
return new semver_1.SemVer(versions_1.MIN_VERSION_PIPE_PLACEHOLDER_EXTRACT);
|
|
38
|
+
}
|
|
26
39
|
};
|
|
27
40
|
//# sourceMappingURL=r-pipe.js.map
|
|
@@ -4,5 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const MIN_VERSION_PIPE = "4.1.0";
|
|
6
6
|
export declare const MIN_VERSION_LAMBDA = "4.1.0";
|
|
7
|
+
export declare const MIN_VERSION_PIPE_PLACEHOLDER = "4.2.0";
|
|
8
|
+
export declare const MIN_VERSION_PIPE_PLACEHOLDER_EXTRACT = "4.3.0";
|
|
7
9
|
/** between 4.0.0 and (i think) 4.1.0 the parser handled them differently. We ignore that for now. */
|
|
8
10
|
export declare const MIN_VERSION_RAW_STABLE = "4.1.0";
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.MIN_VERSION_RAW_STABLE = exports.MIN_VERSION_LAMBDA = exports.MIN_VERSION_PIPE = void 0;
|
|
7
|
+
exports.MIN_VERSION_RAW_STABLE = exports.MIN_VERSION_PIPE_PLACEHOLDER_EXTRACT = exports.MIN_VERSION_PIPE_PLACEHOLDER = exports.MIN_VERSION_LAMBDA = exports.MIN_VERSION_PIPE = void 0;
|
|
8
8
|
exports.MIN_VERSION_PIPE = '4.1.0';
|
|
9
9
|
exports.MIN_VERSION_LAMBDA = '4.1.0';
|
|
10
|
+
exports.MIN_VERSION_PIPE_PLACEHOLDER = '4.2.0';
|
|
11
|
+
exports.MIN_VERSION_PIPE_PLACEHOLDER_EXTRACT = '4.3.0';
|
|
10
12
|
/** between 4.0.0 and (i think) 4.1.0 the parser handled them differently. We ignore that for now. */
|
|
11
13
|
exports.MIN_VERSION_RAW_STABLE = '4.1.0';
|
|
12
14
|
//# sourceMappingURL=versions.js.map
|
|
@@ -4,7 +4,7 @@ import type { RParseRequest } from '../../retriever';
|
|
|
4
4
|
import type { SyncParser, TreeSitterInformation } from '../../parser';
|
|
5
5
|
import type { TreeSitterEngineConfig } from '../../../config';
|
|
6
6
|
import type { ReadonlyFlowrAnalysisProvider } from '../../../project/flowr-analyzer';
|
|
7
|
-
export declare const DEFAULT_TREE_SITTER_R_WASM_PATH = "./node_modules/@
|
|
7
|
+
export declare const DEFAULT_TREE_SITTER_R_WASM_PATH = "./node_modules/@davisvaughan/tree-sitter-r/tree-sitter-r.wasm";
|
|
8
8
|
export declare const DEFAULT_TREE_SITTER_WASM_PATH = "./node_modules/web-tree-sitter/tree-sitter.wasm";
|
|
9
9
|
/**
|
|
10
10
|
* Synchronous and (way) faster alternative to the {@link RShell} using tree-sitter.
|
|
@@ -7,7 +7,7 @@ exports.TreeSitterExecutor = exports.DEFAULT_TREE_SITTER_WASM_PATH = exports.DEF
|
|
|
7
7
|
const web_tree_sitter_1 = __importDefault(require("web-tree-sitter"));
|
|
8
8
|
const log_1 = require("../../../util/log");
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
|
-
exports.DEFAULT_TREE_SITTER_R_WASM_PATH = './node_modules/@
|
|
10
|
+
exports.DEFAULT_TREE_SITTER_R_WASM_PATH = './node_modules/@davisvaughan/tree-sitter-r/tree-sitter-r.wasm';
|
|
11
11
|
exports.DEFAULT_TREE_SITTER_WASM_PATH = './node_modules/web-tree-sitter/tree-sitter.wasm';
|
|
12
12
|
const wasmLog = log_1.log.getSubLogger({ name: 'tree-sitter-wasm' });
|
|
13
13
|
/**
|
|
@@ -85,30 +85,39 @@ function getDocumentationOfByName(name, idMap) {
|
|
|
85
85
|
return getDocumentationOf(node.info.id, idMap);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function filterDocumentationForParamsInherited(doc, filter) {
|
|
89
89
|
if (!doc) {
|
|
90
90
|
return doc;
|
|
91
91
|
}
|
|
92
92
|
if (Array.isArray(doc)) {
|
|
93
|
-
|
|
93
|
+
const ds = doc.filter(filter);
|
|
94
|
+
for (const d of ds) {
|
|
95
|
+
d.inherited = true;
|
|
96
|
+
}
|
|
97
|
+
return ds;
|
|
94
98
|
}
|
|
95
99
|
else {
|
|
96
|
-
|
|
100
|
+
const d = doc;
|
|
101
|
+
if (filter(d)) {
|
|
102
|
+
d.inherited = true;
|
|
103
|
+
return d;
|
|
104
|
+
}
|
|
105
|
+
return undefined;
|
|
97
106
|
}
|
|
98
107
|
}
|
|
99
108
|
function expandInheritOfTag(tag, otherTags, idMap) {
|
|
100
109
|
if (tag.type === roxygen_ast_1.KnownRoxygenTags.Inherit) {
|
|
101
110
|
const inheritDoc = getDocumentationOfByName(tag.value.source, idMap);
|
|
102
|
-
return
|
|
111
|
+
return filterDocumentationForParamsInherited(inheritDoc, t => tag.value.components.includes(t.type));
|
|
103
112
|
}
|
|
104
113
|
else if (tag.type === roxygen_ast_1.KnownRoxygenTags.InheritDotParams) {
|
|
105
114
|
const inheritDoc = getDocumentationOfByName(tag.value.source, idMap);
|
|
106
|
-
return
|
|
115
|
+
return filterDocumentationForParamsInherited(inheritDoc, t => t.type === roxygen_ast_1.KnownRoxygenTags.Param && t.value.name === '...');
|
|
107
116
|
}
|
|
108
117
|
else if (tag.type === roxygen_ast_1.KnownRoxygenTags.InheritParams) {
|
|
109
118
|
const inheritDoc = getDocumentationOfByName(tag.value, idMap);
|
|
110
119
|
const alreadyExplainedParams = new Set(otherTags.filter(t => t.type === roxygen_ast_1.KnownRoxygenTags.Param).map(t => t.value.name));
|
|
111
|
-
return
|
|
120
|
+
return filterDocumentationForParamsInherited(inheritDoc, t => t.type === roxygen_ast_1.KnownRoxygenTags.Param && !alreadyExplainedParams.has(t.value.name));
|
|
112
121
|
}
|
|
113
122
|
return tag;
|
|
114
123
|
}
|
|
@@ -196,7 +196,9 @@ export type RoxygenOtherTag = RoxygenTagAuthor | RoxygenUnknownTag | RoxygenDocT
|
|
|
196
196
|
/**
|
|
197
197
|
* All known Roxygen tag types.
|
|
198
198
|
*/
|
|
199
|
-
export type RoxygenTag = RoxygenCrossrefTag | RoxygenNamespaceTag | RoxygenFormattingTag | RoxygenDatasetDocumentationTag | RoxygenFunctionDocumentationTag | RoxygenReusingDocumentationTag | RoxygenOtherTag
|
|
199
|
+
export type RoxygenTag = (RoxygenCrossrefTag | RoxygenNamespaceTag | RoxygenFormattingTag | RoxygenDatasetDocumentationTag | RoxygenFunctionDocumentationTag | RoxygenReusingDocumentationTag | RoxygenOtherTag) & {
|
|
200
|
+
inherited?: boolean;
|
|
201
|
+
};
|
|
200
202
|
/**
|
|
201
203
|
* A roxygen comment block, consisting of multiple {@link RoxygenTag|roxygen tags}.
|
|
202
204
|
*/
|
|
@@ -5,6 +5,7 @@ exports.getFlowrSearch = getFlowrSearch;
|
|
|
5
5
|
const search_optimizer_1 = require("./search-optimizer/search-optimizer");
|
|
6
6
|
const assert_1 = require("../util/assert");
|
|
7
7
|
const search_mappers_1 = require("./search-executor/search-mappers");
|
|
8
|
+
const AllGeneratorObj = { type: 'generator', name: 'all', args: undefined };
|
|
8
9
|
/**
|
|
9
10
|
* This object holds all the methods to generate search queries.
|
|
10
11
|
* For compatibility, please use the {@link Q} identifier object to access these methods.
|
|
@@ -37,7 +38,7 @@ exports.FlowrSearchGenerator = {
|
|
|
37
38
|
* Returns all elements (nodes/dataflow vertices) from the given data.
|
|
38
39
|
*/
|
|
39
40
|
all() {
|
|
40
|
-
return new FlowrSearchBuilder(
|
|
41
|
+
return new FlowrSearchBuilder(AllGeneratorObj);
|
|
41
42
|
},
|
|
42
43
|
/**
|
|
43
44
|
* Returns all elements that match the given {@link FlowrSearchGetFilters|filters}.
|
|
@@ -46,7 +47,7 @@ exports.FlowrSearchGenerator = {
|
|
|
46
47
|
*/
|
|
47
48
|
get(filter) {
|
|
48
49
|
(0, assert_1.guard)(!filter.nameIsRegex || filter.name, 'If nameIsRegex is set, a name should be provided');
|
|
49
|
-
(0, assert_1.guard)(!filter.line || filter.line
|
|
50
|
+
(0, assert_1.guard)(!filter.line || filter.line !== 0, 'If line is set, it must be different from 0 as there is no 0 line');
|
|
50
51
|
(0, assert_1.guard)(!filter.column || filter.column > 0, 'If column is set, it must be greater than 0, but was ' + filter.column);
|
|
51
52
|
return new FlowrSearchBuilder({ type: 'generator', name: 'get', args: { filter } });
|
|
52
53
|
},
|
package/util/mermaid/ast.js
CHANGED
|
@@ -57,7 +57,8 @@ function normalizedAstToMermaid(ast, { prefix = 'flowchart TD\n', markStyle = in
|
|
|
57
57
|
// add a subgraph for each file
|
|
58
58
|
if (ast.files.length !== 1 || (f.filePath && f.filePath !== flowr_file_1.FlowrFile.INLINE_PATH)) {
|
|
59
59
|
const direction = identifyMermaidDirection(prefix);
|
|
60
|
-
output += ` subgraph "File: ${mermaid_1.Mermaid.escape(f.filePath ?? flowr_file_1.FlowrFile.INLINE_PATH)}"
|
|
60
|
+
output += ` subgraph "File: ${mermaid_1.Mermaid.escape(f.filePath ?? flowr_file_1.FlowrFile.INLINE_PATH)}"\n`;
|
|
61
|
+
output += ` direction ${direction}\n`;
|
|
61
62
|
showAst(f.root);
|
|
62
63
|
output += ' end\n';
|
|
63
64
|
}
|
package/util/record.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper for transforming records.
|
|
3
|
+
*/
|
|
4
|
+
export declare const Record: {
|
|
5
|
+
/**
|
|
6
|
+
* Transforms a record by applying a callback function to each key-value pair in the record.
|
|
7
|
+
* @param object - The record that should be transformed.
|
|
8
|
+
* @param callbackfn - The callback function that transforms each key-value pair of the record.
|
|
9
|
+
*/
|
|
10
|
+
map<K1 extends string, K2 extends string, V1, V2>(this: void, object: Record<K1, V1>, callbackfn: (entry: [K1, V1], index: number, entries: [K1, V1][]) => [K2, V2]): Record<K2, V2>;
|
|
11
|
+
/**
|
|
12
|
+
* Transforms a record by applying a callback function to each key in the record.
|
|
13
|
+
* @param object - The record that should be transformed.
|
|
14
|
+
* @param callbackfn - The callback function that transforms each key of the record.
|
|
15
|
+
*/
|
|
16
|
+
mapKeys<K1 extends string, K2 extends string, V>(this: void, object: Record<K1, V>, callbackfn: (key: K1, index: number, entries: [K1, V][]) => K2): Record<K2, V>;
|
|
17
|
+
/**
|
|
18
|
+
* Transforms a record by applying a callback function to each property value in the record.
|
|
19
|
+
* @param object - The record that should be transformed.
|
|
20
|
+
* @param callbackfn - The callback function that transforms each property value of the record.
|
|
21
|
+
*/
|
|
22
|
+
mapProperties<K extends string, V1, V2>(this: void, object: Record<K, V1>, callbackfn: (value: V1, index: number, entries: [K, V1][]) => V2): Record<K, V2>;
|
|
23
|
+
};
|
package/util/record.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Record = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Helper for transforming records.
|
|
6
|
+
*/
|
|
7
|
+
exports.Record = {
|
|
8
|
+
/**
|
|
9
|
+
* Transforms a record by applying a callback function to each key-value pair in the record.
|
|
10
|
+
* @param object - The record that should be transformed.
|
|
11
|
+
* @param callbackfn - The callback function that transforms each key-value pair of the record.
|
|
12
|
+
*/
|
|
13
|
+
map(object, callbackfn) {
|
|
14
|
+
return Object.fromEntries(Object.entries(object).map(callbackfn));
|
|
15
|
+
},
|
|
16
|
+
/**
|
|
17
|
+
* Transforms a record by applying a callback function to each key in the record.
|
|
18
|
+
* @param object - The record that should be transformed.
|
|
19
|
+
* @param callbackfn - The callback function that transforms each key of the record.
|
|
20
|
+
*/
|
|
21
|
+
mapKeys(object, callbackfn) {
|
|
22
|
+
return exports.Record.map(object, ([key, value], index, entries) => [callbackfn(key, index, entries), value]);
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* Transforms a record by applying a callback function to each property value in the record.
|
|
26
|
+
* @param object - The record that should be transformed.
|
|
27
|
+
* @param callbackfn - The callback function that transforms each property value of the record.
|
|
28
|
+
*/
|
|
29
|
+
mapProperties(object, callbackfn) {
|
|
30
|
+
return exports.Record.map(object, ([keys, value], index, entries) => [keys, callbackfn(value, index, entries)]);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=record.js.map
|
package/util/version.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.printVersionInformation = printVersionInformation;
|
|
|
6
6
|
const semver_1 = require("semver");
|
|
7
7
|
const assert_1 = require("./assert");
|
|
8
8
|
// this is automatically replaced with the current version by release-it
|
|
9
|
-
const version = '2.10.
|
|
9
|
+
const version = '2.10.3';
|
|
10
10
|
/**
|
|
11
11
|
* Retrieves the current flowR version as a new {@link SemVer} object.
|
|
12
12
|
*/
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { AbstractDomain, type AnyAbstractDomain, type ConcreteDomain } from './abstract-domain';
|
|
2
|
-
import { Top } from './lattice';
|
|
3
|
-
/** The type of the concrete mapping of the concrete domain of a mapped abstract domain mapping keys to a concrete value in the concrete domain */
|
|
4
|
-
export type ConcreteMap<Key, Domain extends AnyAbstractDomain> = ReadonlyMap<Key, ConcreteDomain<Domain>>;
|
|
5
|
-
/**
|
|
6
|
-
* A mapped abstract domain as mapping of keys to abstract values of an abstract domain.
|
|
7
|
-
* The Bottom element is defined as empty mapping and the Top element is defined as mapping every existing key to Top.
|
|
8
|
-
* @template Key - Type of the keys of the mapping to abstract values
|
|
9
|
-
* @template Domain - Type of the abstract domain to map the keys to
|
|
10
|
-
*/
|
|
11
|
-
export declare class MappedAbstractDomain<Key, Domain extends AnyAbstractDomain> extends AbstractDomain<ConcreteMap<Key, Domain>, ReadonlyMap<Key, Domain>, ReadonlyMap<Key, Domain>, ReadonlyMap<Key, Domain>> {
|
|
12
|
-
constructor(value: ReadonlyMap<Key, Domain>);
|
|
13
|
-
create(value: ReadonlyMap<Key, Domain>): this;
|
|
14
|
-
get(key: Key): Domain | undefined;
|
|
15
|
-
has(key: Key): boolean;
|
|
16
|
-
protected set(key: Key, value: Domain): void;
|
|
17
|
-
protected remove(key: Key): void;
|
|
18
|
-
bottom(): this;
|
|
19
|
-
top(): this;
|
|
20
|
-
equals(other: this): boolean;
|
|
21
|
-
leq(other: this): boolean;
|
|
22
|
-
join(other: this): this;
|
|
23
|
-
meet(other: this): this;
|
|
24
|
-
widen(other: this): this;
|
|
25
|
-
narrow(other: this): this;
|
|
26
|
-
concretize(limit: number): ReadonlySet<ConcreteMap<Key, Domain>> | typeof Top;
|
|
27
|
-
abstract(concrete: ReadonlySet<ConcreteMap<Key, Domain>> | typeof Top): this;
|
|
28
|
-
toJson(): unknown;
|
|
29
|
-
toString(): string;
|
|
30
|
-
isTop(): this is this;
|
|
31
|
-
isBottom(): this is this;
|
|
32
|
-
isValue(): this is this;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* A mutable version of the {@link MappedAbstractDomain} with {@link MutableMappedAbstractDomain#set|`set`} and {@link MutableMappedAbstractDomain#remove|`remove`}.
|
|
36
|
-
*/
|
|
37
|
-
export declare class MutableMappedAbstractDomain<Key, Domain extends AnyAbstractDomain> extends MappedAbstractDomain<Key, Domain> {
|
|
38
|
-
create(value: ReadonlyMap<Key, Domain>): this;
|
|
39
|
-
set(key: Key, value: Domain): void;
|
|
40
|
-
remove(key: Key): void;
|
|
41
|
-
}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MutableMappedAbstractDomain = exports.MappedAbstractDomain = void 0;
|
|
4
|
-
const abstract_domain_1 = require("./abstract-domain");
|
|
5
|
-
const lattice_1 = require("./lattice");
|
|
6
|
-
/**
|
|
7
|
-
* A mapped abstract domain as mapping of keys to abstract values of an abstract domain.
|
|
8
|
-
* The Bottom element is defined as empty mapping and the Top element is defined as mapping every existing key to Top.
|
|
9
|
-
* @template Key - Type of the keys of the mapping to abstract values
|
|
10
|
-
* @template Domain - Type of the abstract domain to map the keys to
|
|
11
|
-
*/
|
|
12
|
-
class MappedAbstractDomain extends abstract_domain_1.AbstractDomain {
|
|
13
|
-
constructor(value) {
|
|
14
|
-
super(new Map(value));
|
|
15
|
-
}
|
|
16
|
-
create(value) {
|
|
17
|
-
return new MappedAbstractDomain(value);
|
|
18
|
-
}
|
|
19
|
-
get(key) {
|
|
20
|
-
return this._value.get(key);
|
|
21
|
-
}
|
|
22
|
-
has(key) {
|
|
23
|
-
return this._value.has(key);
|
|
24
|
-
}
|
|
25
|
-
set(key, value) {
|
|
26
|
-
this._value.set(key, value);
|
|
27
|
-
}
|
|
28
|
-
remove(key) {
|
|
29
|
-
this._value.delete(key);
|
|
30
|
-
}
|
|
31
|
-
bottom() {
|
|
32
|
-
return this.create(new Map());
|
|
33
|
-
}
|
|
34
|
-
top() {
|
|
35
|
-
const result = this.create(this.value);
|
|
36
|
-
for (const [key, value] of result.value) {
|
|
37
|
-
result.set(key, value.top());
|
|
38
|
-
}
|
|
39
|
-
return result;
|
|
40
|
-
}
|
|
41
|
-
equals(other) {
|
|
42
|
-
if (this.value === other.value) {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
else if (this.value.size !== other.value.size) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
for (const [key, value] of this.value) {
|
|
49
|
-
const otherValue = other.get(key);
|
|
50
|
-
if (otherValue === undefined || !value.equals(otherValue)) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
leq(other) {
|
|
57
|
-
if (this.value === other.value) {
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
else if (this.value.size > other.value.size) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
for (const [key, value] of this.value) {
|
|
64
|
-
const otherValue = other.get(key);
|
|
65
|
-
if (otherValue === undefined || !value.leq(otherValue)) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
join(other) {
|
|
72
|
-
const result = this.create(this.value);
|
|
73
|
-
for (const [key, value] of other.value) {
|
|
74
|
-
const currValue = result.get(key);
|
|
75
|
-
if (currValue === undefined) {
|
|
76
|
-
result.set(key, value);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
result.set(key, currValue.join(value));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return result;
|
|
83
|
-
}
|
|
84
|
-
meet(other) {
|
|
85
|
-
const result = this.create(this.value);
|
|
86
|
-
for (const [key] of result.value) {
|
|
87
|
-
if (!other.has(key)) {
|
|
88
|
-
result.remove(key);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
for (const [key, value] of other.value) {
|
|
92
|
-
const currValue = result.get(key);
|
|
93
|
-
if (currValue !== undefined) {
|
|
94
|
-
result.set(key, currValue.meet(value));
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return result;
|
|
98
|
-
}
|
|
99
|
-
widen(other) {
|
|
100
|
-
const result = this.create(this.value);
|
|
101
|
-
for (const [key, value] of other.value) {
|
|
102
|
-
const currValue = result.get(key);
|
|
103
|
-
if (currValue === undefined) {
|
|
104
|
-
result.set(key, value);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
result.set(key, currValue.widen(value));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return result;
|
|
111
|
-
}
|
|
112
|
-
narrow(other) {
|
|
113
|
-
const result = this.create(this.value);
|
|
114
|
-
for (const [key] of this.value) {
|
|
115
|
-
if (!other.has(key)) {
|
|
116
|
-
result.remove(key);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
for (const [key, value] of other.value) {
|
|
120
|
-
const currValue = result.get(key);
|
|
121
|
-
if (currValue !== undefined) {
|
|
122
|
-
result.set(key, currValue.narrow(value));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return result;
|
|
126
|
-
}
|
|
127
|
-
concretize(limit) {
|
|
128
|
-
if (this.value.size === 0) {
|
|
129
|
-
return new Set();
|
|
130
|
-
}
|
|
131
|
-
let mappings = new Set([new Map()]);
|
|
132
|
-
for (const [key, value] of this.value) {
|
|
133
|
-
const concreteValues = value.concretize(limit);
|
|
134
|
-
if (concreteValues === lattice_1.Top) {
|
|
135
|
-
return lattice_1.Top;
|
|
136
|
-
}
|
|
137
|
-
const newMappings = new Set();
|
|
138
|
-
for (const state of mappings) {
|
|
139
|
-
for (const concrete of concreteValues) {
|
|
140
|
-
if (newMappings.size > limit) {
|
|
141
|
-
return lattice_1.Top;
|
|
142
|
-
}
|
|
143
|
-
const map = new Map(state);
|
|
144
|
-
map.set(key, concrete);
|
|
145
|
-
newMappings.add(map);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
mappings = newMappings;
|
|
149
|
-
}
|
|
150
|
-
return mappings;
|
|
151
|
-
}
|
|
152
|
-
abstract(concrete) {
|
|
153
|
-
if (concrete === lattice_1.Top) {
|
|
154
|
-
return this.top();
|
|
155
|
-
}
|
|
156
|
-
else if (concrete.size === 0) {
|
|
157
|
-
return this.bottom();
|
|
158
|
-
}
|
|
159
|
-
const domain = this.value.values().toArray()[0];
|
|
160
|
-
if (domain === undefined) {
|
|
161
|
-
return this.top();
|
|
162
|
-
}
|
|
163
|
-
const mapping = new Map();
|
|
164
|
-
for (const concreteMapping of concrete) {
|
|
165
|
-
for (const [key, value] of concreteMapping) {
|
|
166
|
-
const set = mapping.get(key);
|
|
167
|
-
if (set === undefined) {
|
|
168
|
-
mapping.set(key, new Set([value]));
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
set.add(value);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
const result = new Map();
|
|
176
|
-
for (const [key, values] of mapping) {
|
|
177
|
-
result.set(key, domain.abstract(values));
|
|
178
|
-
}
|
|
179
|
-
return this.create(result);
|
|
180
|
-
}
|
|
181
|
-
toJson() {
|
|
182
|
-
return Object.fromEntries(this.value.entries().map(([key, value]) => [key, value.toJson()]));
|
|
183
|
-
}
|
|
184
|
-
toString() {
|
|
185
|
-
return '(' + this.value.entries().toArray().map(([key, value]) => `${(0, abstract_domain_1.domainElementToString)(key)} -> ${value.toString()}`).join(', ') + ')';
|
|
186
|
-
}
|
|
187
|
-
isTop() {
|
|
188
|
-
return this.value.values().some(entry => entry.isTop());
|
|
189
|
-
}
|
|
190
|
-
isBottom() {
|
|
191
|
-
return this.value.size === 0;
|
|
192
|
-
}
|
|
193
|
-
isValue() {
|
|
194
|
-
return true;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
exports.MappedAbstractDomain = MappedAbstractDomain;
|
|
198
|
-
/**
|
|
199
|
-
* A mutable version of the {@link MappedAbstractDomain} with {@link MutableMappedAbstractDomain#set|`set`} and {@link MutableMappedAbstractDomain#remove|`remove`}.
|
|
200
|
-
*/
|
|
201
|
-
class MutableMappedAbstractDomain extends MappedAbstractDomain {
|
|
202
|
-
create(value) {
|
|
203
|
-
return new MutableMappedAbstractDomain(value);
|
|
204
|
-
}
|
|
205
|
-
set(key, value) {
|
|
206
|
-
super.set(key, value);
|
|
207
|
-
}
|
|
208
|
-
remove(key) {
|
|
209
|
-
super.remove(key);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
exports.MutableMappedAbstractDomain = MutableMappedAbstractDomain;
|
|
213
|
-
//# sourceMappingURL=mapped-abstract-domain.js.map
|