@eagleoutice/flowr 2.13.10 → 2.13.11
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 +40 -40
- package/dataflow/environments/environment.js +56 -20
- package/dataflow/environments/resolve-by-name.js +16 -6
- package/dataflow/environments/resolve-helper.d.ts +43 -0
- package/dataflow/environments/resolve-helper.js +47 -0
- package/dataflow/graph/df-helper.d.ts +48 -1
- package/dataflow/graph/df-helper.js +63 -0
- package/dataflow/graph/graph.js +24 -13
- package/documentation/data/faq/faqs.js +1 -1
- package/documentation/data/faq/wiki-faq-store.js +3 -2
- package/documentation/data/server/doc-data-server-messages.js +1 -1
- package/documentation/doc-readme.js +1 -1
- package/documentation/doc-util/doc-files.d.ts +5 -0
- package/documentation/doc-util/doc-files.js +13 -3
- package/documentation/wiki-analyzer.js +10 -10
- package/documentation/wiki-core.js +1 -1
- package/documentation/wiki-dataflow-graph.js +3 -3
- package/documentation/wiki-linting-and-testing.js +13 -13
- package/documentation/wiki-mk/doc-context.d.ts +1 -1
- package/documentation/wiki-mk/doc-context.js +9 -5
- package/documentation/wiki-normalized-ast.js +1 -1
- package/documentation/wiki-overview.js +2 -2
- package/documentation/wiki-query.js +1 -1
- package/documentation/wiki-setup.js +3 -3
- package/linter/linter-rules.d.ts +1 -1
- package/linter/rules/syntactically-valid.d.ts +12 -1
- package/linter/rules/syntactically-valid.js +88 -17
- package/package.json +7 -8
- package/project/context/flowr-analyzer-loading-order-context.d.ts +8 -0
- package/project/context/flowr-analyzer-loading-order-context.js +23 -2
- package/project/sigdb/reader.d.ts +20 -0
- package/project/sigdb/reader.js +93 -10
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +3 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +6 -0
- package/queries/catalog/dependencies-query/link-devices.d.ts +7 -3
- package/queries/catalog/dependencies-query/link-devices.js +56 -10
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +14 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.js +18 -2
- package/queries/catalog/slice-query-options.d.ts +11 -1
- package/queries/catalog/slice-query-options.js +8 -4
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +5 -1
- package/r-bridge/lang-4.x/ast/model/model.d.ts +9 -0
- package/r-bridge/lang-4.x/ast/model/model.js +12 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
- package/reconstruct/reconstruct.d.ts +9 -0
- package/reconstruct/reconstruct.js +1 -0
- package/search/flowr-search-filters.d.ts +8 -0
- package/search/flowr-search-filters.js +19 -7
- package/search/search-executor/search-generators.js +7 -2
- package/search/search-executor/search-transformer.js +4 -1
- package/slicing/static/slice-call.js +2 -2
- package/util/collections/bimap.d.ts +21 -1
- package/util/collections/bimap.js +43 -7
- package/util/version.js +1 -1
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.F = exports.FlowrFilterCombinator = exports.FlowrFilters = exports.ValidFlowrFiltersReverse = exports.ValidFlowrFilters = exports.FlowrFilter = void 0;
|
|
4
4
|
exports.binaryTreeToString = binaryTreeToString;
|
|
5
5
|
exports.isBinaryTree = isBinaryTree;
|
|
6
|
+
exports.prepareFilter = prepareFilter;
|
|
6
7
|
exports.evalFilter = evalFilter;
|
|
7
8
|
const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
|
|
8
9
|
const vertex_1 = require("../dataflow/graph/vertex");
|
|
@@ -231,24 +232,35 @@ function evalTree(tree, data) {
|
|
|
231
232
|
return evalVisit[tree.type](tree, data);
|
|
232
233
|
}
|
|
233
234
|
/**
|
|
234
|
-
*
|
|
235
|
+
* Resolve a filter expression to the function that tests one element.
|
|
236
|
+
* Nothing here depends on the element, so a search over `n` elements should do this once instead of `n` times:
|
|
237
|
+
* a bare {@link VertexType}/{@link RType} filter otherwise builds a {@link FlowrFilterCombinator} per element.
|
|
238
|
+
* @see {@link evalFilter} - the one-shot form, if you only test a single element
|
|
235
239
|
*/
|
|
236
|
-
function
|
|
240
|
+
function prepareFilter(filter) {
|
|
237
241
|
if (filter instanceof FlowrFilterCombinator) {
|
|
238
|
-
|
|
242
|
+
const tree = filter.get();
|
|
243
|
+
return data => evalTree(tree, data);
|
|
239
244
|
}
|
|
240
245
|
else if (typeof filter === 'string' && exports.ValidFlowrFilters.has(filter)) {
|
|
241
246
|
const handler = exports.FlowrFilters[filter];
|
|
242
|
-
return handler(data.element, undefined, data.data);
|
|
247
|
+
return data => handler(data.element, undefined, data.data);
|
|
243
248
|
}
|
|
244
249
|
else if (typeof filter === 'object' && 'name' in filter) {
|
|
245
250
|
const handler = exports.FlowrFilters[filter.name];
|
|
246
251
|
const args = ('args' in filter ? filter.args : undefined);
|
|
247
|
-
return handler(data.element, args, data.data);
|
|
252
|
+
return data => handler(data.element, args, data.data);
|
|
248
253
|
}
|
|
249
254
|
else {
|
|
250
|
-
const tree = FlowrFilterCombinator.is(filter);
|
|
251
|
-
return evalTree(tree
|
|
255
|
+
const tree = FlowrFilterCombinator.is(filter).get();
|
|
256
|
+
return data => evalTree(tree, data);
|
|
252
257
|
}
|
|
253
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Evaluates the given filter expression against the provided data.
|
|
261
|
+
* @see {@link prepareFilter} - resolve once when testing more than one element
|
|
262
|
+
*/
|
|
263
|
+
function evalFilter(filter, data) {
|
|
264
|
+
return prepareFilter(filter)(data);
|
|
265
|
+
}
|
|
254
266
|
//# sourceMappingURL=flowr-search-filters.js.map
|
|
@@ -28,8 +28,13 @@ async function generateAll(data) {
|
|
|
28
28
|
}
|
|
29
29
|
async function getAllNodes(data) {
|
|
30
30
|
const normalize = await data.normalize();
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
// the id map holds some nodes under more than one id, so dedup; filled in place to skip the two
|
|
32
|
+
// intermediate arrays a spread plus `map` would build
|
|
33
|
+
const byId = new Map();
|
|
34
|
+
for (const n of normalize.idMap.values()) {
|
|
35
|
+
byId.set(n.info.id, n);
|
|
36
|
+
}
|
|
37
|
+
return [...byId.values()];
|
|
33
38
|
}
|
|
34
39
|
async function generateGet(input, { filter: { line, column, id, name, nameIsRegex, filePathRegex, fuzzy, innermostOnly } }) {
|
|
35
40
|
const normalize = await input.normalize();
|
|
@@ -97,7 +97,10 @@ function getSkip(data, elements, { count }) {
|
|
|
97
97
|
}
|
|
98
98
|
async function getFilter(data, elements, { filter }) {
|
|
99
99
|
const dataflow = await data.dataflow();
|
|
100
|
-
|
|
100
|
+
// neither depends on the element, so build them once rather than n times
|
|
101
|
+
const test = (0, flowr_search_filters_1.prepareFilter)(filter);
|
|
102
|
+
const shared = { dataflow };
|
|
103
|
+
return elements.mutate(e => e.filter(e => test({ element: e, data: shared })));
|
|
101
104
|
}
|
|
102
105
|
async function getWith(input, elements, { info, args }) {
|
|
103
106
|
return (await elements.enrich(input, info, args)).mutate(async (s) => await Promise.all(s.map(e => (0, search_enrichers_1.enrichElement)(e, elements, input, info, args))));
|
|
@@ -30,7 +30,7 @@ function getAllFunctionCallTargetsForSlice(dataflowGraph, callerInfo, baseEnviro
|
|
|
30
30
|
const activeEnvironment = (0, built_in_function_definition_1.retrieveActiveEnvironment)(callerInfo.environment, baseEnvironment, ctx);
|
|
31
31
|
const name = callerInfo.name;
|
|
32
32
|
(0, assert_1.guard)(name !== undefined, () => `name of id: ${callerInfo.id} can not be found in id map`);
|
|
33
|
-
const functionCallDefs = (0, resolve_by_name_1.
|
|
33
|
+
const functionCallDefs = (0, resolve_by_name_1.resolveByNameAnyType)(name, activeEnvironment)?.filter(d => !node_id_1.NodeId.isBuiltIn(d.definedAt))?.map(d => d.nodeId) ?? [];
|
|
34
34
|
for (const [target, outgoingEdge] of outgoingEdges[1].entries()) {
|
|
35
35
|
if (edge_1.DfEdge.includesType(outgoingEdge, edge_1.EdgeType.Calls)) {
|
|
36
36
|
functionCallDefs.push(target);
|
|
@@ -56,7 +56,7 @@ function linkCallTargets(onlyForSideEffects, functionCallTargets, activeEnvironm
|
|
|
56
56
|
for (const openIn of functionCallTarget.subflow.in) {
|
|
57
57
|
// resolve them in the active env
|
|
58
58
|
if (openIn.name) {
|
|
59
|
-
const resolved = (0, resolve_by_name_1.
|
|
59
|
+
const resolved = (0, resolve_by_name_1.resolveByNameAnyType)(openIn.name, activeEnvironment);
|
|
60
60
|
for (const res of resolved ?? []) {
|
|
61
61
|
(0, static_slicer_1.updatePotentialAddition)(queue, functionCallTarget.id, res.nodeId, activeEnvironment, activeEnvironmentFingerprint);
|
|
62
62
|
}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When to fill the value -> key direction of a {@link BiMap}.
|
|
3
|
+
*
|
|
4
|
+
* - `lazy` (default) fills it on the first reverse lookup and maintains it from then on, so a map nobody asks in
|
|
5
|
+
* reverse never pays a write per entry.
|
|
6
|
+
* - `eager` fills it from the start, for a map written once and then asked in reverse from a hot path.
|
|
7
|
+
*
|
|
8
|
+
* Both answer {@link BiMap#getKey|getKey} and {@link BiMap#hasValue|hasValue} the same, they differ only in when
|
|
9
|
+
* the work happens.
|
|
10
|
+
*/
|
|
11
|
+
export type BiMapReverse = 'lazy' | 'eager';
|
|
1
12
|
/**
|
|
2
13
|
* Implementation of a bidirectional map
|
|
3
14
|
*
|
|
@@ -8,7 +19,12 @@ export declare class BiMap<K, V extends object> implements Map<K, V> {
|
|
|
8
19
|
size: number;
|
|
9
20
|
private readonly k2v;
|
|
10
21
|
private v2k;
|
|
11
|
-
|
|
22
|
+
private readonly eager;
|
|
23
|
+
/**
|
|
24
|
+
* @param base - the entries to fill the map with
|
|
25
|
+
* @param reverse - when to fill the value -> key direction; see {@link BiMapReverse}
|
|
26
|
+
*/
|
|
27
|
+
constructor(base?: Iterable<[K, V]>, reverse?: BiMapReverse);
|
|
12
28
|
[Symbol.iterator](): MapIterator<[K, V]>;
|
|
13
29
|
clear(): void;
|
|
14
30
|
delete(key: K): boolean;
|
|
@@ -20,5 +36,9 @@ export declare class BiMap<K, V extends object> implements Map<K, V> {
|
|
|
20
36
|
hasValue(value: V): boolean;
|
|
21
37
|
keys(): MapIterator<K>;
|
|
22
38
|
set(key: K, value: V): this;
|
|
39
|
+
/** the reverse direction can no longer be maintained in place, so re-derive it (at once if eager) */
|
|
40
|
+
private staleReverse;
|
|
23
41
|
values(): MapIterator<V>;
|
|
42
|
+
/** the value -> key direction, filled from the entries already present if this is its first use */
|
|
43
|
+
private reverse;
|
|
24
44
|
}
|
|
@@ -10,8 +10,18 @@ class BiMap {
|
|
|
10
10
|
[Symbol.toStringTag] = 'BiMap';
|
|
11
11
|
size = 0;
|
|
12
12
|
k2v = new Map();
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
/* see {@link BiMapReverse}: `undefined` until the first reverse lookup unless this map was asked to be eager */
|
|
14
|
+
v2k;
|
|
15
|
+
eager;
|
|
16
|
+
/**
|
|
17
|
+
* @param base - the entries to fill the map with
|
|
18
|
+
* @param reverse - when to fill the value -> key direction; see {@link BiMapReverse}
|
|
19
|
+
*/
|
|
20
|
+
constructor(base, reverse = 'lazy') {
|
|
21
|
+
this.eager = reverse === 'eager';
|
|
22
|
+
if (this.eager) {
|
|
23
|
+
this.v2k = new WeakMap();
|
|
24
|
+
}
|
|
15
25
|
if (base != null) {
|
|
16
26
|
for (const [k, v] of base) {
|
|
17
27
|
this.set(k, v);
|
|
@@ -24,7 +34,7 @@ class BiMap {
|
|
|
24
34
|
clear() {
|
|
25
35
|
this.size = 0;
|
|
26
36
|
this.k2v.clear();
|
|
27
|
-
this.v2k = new WeakMap();
|
|
37
|
+
this.v2k = this.eager ? new WeakMap() : undefined;
|
|
28
38
|
}
|
|
29
39
|
delete(key) {
|
|
30
40
|
const value = this.k2v.get(key);
|
|
@@ -32,7 +42,8 @@ class BiMap {
|
|
|
32
42
|
return false;
|
|
33
43
|
}
|
|
34
44
|
this.k2v.delete(key);
|
|
35
|
-
this
|
|
45
|
+
/* another key may still hold this value, so dropping just its entry would lose a live mapping */
|
|
46
|
+
this.staleReverse();
|
|
36
47
|
this.size = this.k2v.size;
|
|
37
48
|
return true;
|
|
38
49
|
}
|
|
@@ -46,26 +57,51 @@ class BiMap {
|
|
|
46
57
|
return this.k2v.get(key);
|
|
47
58
|
}
|
|
48
59
|
getKey(value) {
|
|
49
|
-
return this.
|
|
60
|
+
return this.reverse().get(value);
|
|
50
61
|
}
|
|
51
62
|
has(key) {
|
|
52
63
|
return this.k2v.has(key);
|
|
53
64
|
}
|
|
54
65
|
hasValue(value) {
|
|
55
|
-
return this.
|
|
66
|
+
return this.reverse().has(value);
|
|
56
67
|
}
|
|
57
68
|
keys() {
|
|
58
69
|
return this.k2v.keys();
|
|
59
70
|
}
|
|
60
71
|
set(key, value) {
|
|
72
|
+
const replaced = this.k2v.get(key);
|
|
61
73
|
this.k2v.set(key, value);
|
|
62
|
-
|
|
74
|
+
if (replaced !== undefined && replaced !== value) {
|
|
75
|
+
/* the value this key held may now be unreachable, so its reverse entry cannot stand */
|
|
76
|
+
this.staleReverse();
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.v2k?.set(value, key);
|
|
80
|
+
}
|
|
63
81
|
this.size = this.k2v.size;
|
|
64
82
|
return this;
|
|
65
83
|
}
|
|
84
|
+
/** the reverse direction can no longer be maintained in place, so re-derive it (at once if eager) */
|
|
85
|
+
staleReverse() {
|
|
86
|
+
this.v2k = undefined;
|
|
87
|
+
if (this.eager) {
|
|
88
|
+
this.reverse();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
66
91
|
values() {
|
|
67
92
|
return this.k2v.values();
|
|
68
93
|
}
|
|
94
|
+
/** the value -> key direction, filled from the entries already present if this is its first use */
|
|
95
|
+
reverse() {
|
|
96
|
+
if (this.v2k === undefined) {
|
|
97
|
+
const v2k = new WeakMap();
|
|
98
|
+
for (const [k, v] of this.k2v) {
|
|
99
|
+
v2k.set(v, k);
|
|
100
|
+
}
|
|
101
|
+
this.v2k = v2k;
|
|
102
|
+
}
|
|
103
|
+
return this.v2k;
|
|
104
|
+
}
|
|
69
105
|
}
|
|
70
106
|
exports.BiMap = BiMap;
|
|
71
107
|
//# sourceMappingURL=bimap.js.map
|
package/util/version.js
CHANGED
|
@@ -42,7 +42,7 @@ const assert_1 = require("./assert");
|
|
|
42
42
|
const sigdb_download_1 = require("../project/sigdb/sigdb-download");
|
|
43
43
|
const doc_files_1 = require("../documentation/doc-util/doc-files");
|
|
44
44
|
// this is automatically replaced with the current version by release-it
|
|
45
|
-
const version = '2.13.
|
|
45
|
+
const version = '2.13.11';
|
|
46
46
|
// this is automatically replaced with the release date by release-it (regex-bumper, see package.json)
|
|
47
47
|
const versionDate = '2026-07-15T07:13:44Z';
|
|
48
48
|
/**
|