@eagleoutice/flowr 2.8.11 → 2.8.13
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 +23 -22
- package/control-flow/simple-visitor.js +3 -1
- package/dataflow/environments/default-builtin-config.d.ts +1 -1
- package/dataflow/environments/default-builtin-config.js +1 -1
- package/dataflow/extractor.js +1 -1
- package/dataflow/graph/graph.d.ts +1 -14
- package/dataflow/graph/graph.js +1 -10
- package/dataflow/internal/linker.d.ts +12 -0
- package/dataflow/internal/linker.js +24 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +16 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +3 -2
- package/dataflow/internal/process/functions/process-argument.js +2 -1
- package/dataflow/internal/process/functions/process-parameter.js +4 -3
- package/documentation/wiki-query.js +2 -3
- package/package.json +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +19 -0
- package/project/plugins/file-plugins/files/flowr-description-file.js +43 -12
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +2 -5
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +5 -6
- 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 +4 -3
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +21 -1
- package/queries/catalog/call-context-query/call-context-query-format.js +15 -7
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +11 -3
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +14 -1
- package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.d.ts +12 -0
- package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +30 -0
- package/queries/catalog/call-context-query/identify-link-to-relation.d.ts +10 -0
- package/queries/catalog/call-context-query/identify-link-to-relation.js +21 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +11 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
- package/queries/catalog/dependencies-query/function-info/test-functions.js +146 -12
- package/queries/query.js +1 -1
- package/search/search-executor/search-enrichers.d.ts +8 -40
- package/search/search-executor/search-enrichers.js +17 -13
- package/search/search-executor/search-generators.js +5 -7
- package/search/search-executor/search-transformer.js +1 -7
- package/util/schema.js +6 -8
- package/util/version.js +1 -1
|
@@ -1,19 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TestFunctions = void 0;
|
|
4
|
+
const ExpectFunctions = {
|
|
5
|
+
type: 'link-to-nested-call',
|
|
6
|
+
callName: new RegExp(/* testthat */ '^(expect_equal|expect_identical|expect_error|expect_warning|expect_message|expect_condition|' +
|
|
7
|
+
'expect_true|expect_false|expect_all_equal|expect_all_true|expect_all_false|expect_lt|expect_lte|expect_gt|expect_gte|' +
|
|
8
|
+
'expect_length|expect_shape|expect_match|expect_no_match|expect_named|expect_null|expect_setequal|expect_mapequal|' +
|
|
9
|
+
'expect_contains|expect_in|expect_disjoint|expect_type|expect_s3_class|expect_s4_class|expect_r6_class|expect_s7_class|' +
|
|
10
|
+
'expect_vector|expect_no_error|expect_no_warning|expect_no_message|expect_no_condition|expect_invisible|expect_visible|' +
|
|
11
|
+
'expect_output|expect_silent|expect_snapshot|expect_snapshot_value|expect_snapshot_file|announce_snapshot_file|' +
|
|
12
|
+
'compare_file_binary|compare_file_text|snapshot_accept|snapshot_reject|snapshot_review|' +
|
|
13
|
+
'fail|pass|expect_success|expect_failure|expect_snapshot_failure|show_failure|' +
|
|
14
|
+
/* tinytest */
|
|
15
|
+
'exit_file|exit_if_not|expect_equal|expect_identical|expect_equivalent|expect_true|expect_false|expect_silent|expect_null|' +
|
|
16
|
+
'expect_inherits|expect_error|expect_warning|expect_message|expect_stdout|expect_equal_to_reference|' +
|
|
17
|
+
'expect_equivalent_to_reference|expect_length|expect_match|ignore|report_side_effects|' +
|
|
18
|
+
/* RUnit */
|
|
19
|
+
'checkEquals|checkEqualsNumeric|checkIdentical|checkTrue|checkException|' +
|
|
20
|
+
/* checkmate */
|
|
21
|
+
'assertAccess|assert_access|assertArray|assert_array|assert_atomic|assertAtomic|assert_atomic_vector|assertAtomicVector|' +
|
|
22
|
+
'assert_character|assertCharacter|assert_choice|assertChoice|assert_class|assertClass|assert_complex|assertComplex|' +
|
|
23
|
+
'assert_count|assertCount|assert_data_frame|assertDataFrame|assert_data_table|assertDataTable|assert_date|assertDate|' +
|
|
24
|
+
'assert_directory|assertDirectory|assert_directory_exists|assertDirectoryExists|assert_disjunct|assertDisjunct|assert_double|' +
|
|
25
|
+
'assertDouble|assert_environment|assertEnvironment|assert_factor|assertFactor|assert_false|assertFalse|assert_file|assertFile|' +
|
|
26
|
+
'assert_file_exists|assertFileExists|assert_flag|assertFlag|assert_formula|assertFormula|assert_function|assertFunction|' +
|
|
27
|
+
'assert_int|assertInt|assert_integer|assertInteger|assert_list|assertList|assert_logical|assertLogical|assert_matrix|' +
|
|
28
|
+
'assertMatrix|assert_multi_class|assertMultiClass|assert_named|assertNamed|assert_names|assertNames|assert_null|assertNull|' +
|
|
29
|
+
'assert_number|assertNumber|assert_numeric|assertNumeric|assert_os|assertOs|assert_path_for_output|assertPathForOutput|' +
|
|
30
|
+
'assert_permutation|assertPermutation|assert_posixct|assertPOSIXct|assert_r6|assertR6|assert_raw|assertRaw|assert_scalar|' +
|
|
31
|
+
'assertScalar|assert_scalar_na|assertScalarNA|assert_set_equal|assertSetEqual|assert_string|assertString|assert_subset|' +
|
|
32
|
+
'assertSubset|assert_tibble|assertTibble|assert_true|assertTrue|assert_vector|assertVector' +
|
|
33
|
+
')$')
|
|
34
|
+
};
|
|
35
|
+
const ContextFunctions = {
|
|
36
|
+
type: 'link-to-last-call',
|
|
37
|
+
callName: new RegExp('^(context)$')
|
|
38
|
+
};
|
|
4
39
|
exports.TestFunctions = [
|
|
5
|
-
{ package: 'testthat', name: 'test_that' },
|
|
6
|
-
{ package: 'testthat', name: '
|
|
7
|
-
{ package: 'testthat', name: '
|
|
8
|
-
|
|
9
|
-
{ package: 'testthat', name: 'expect_warning' },
|
|
10
|
-
{ package: 'testthat', name: 'expect_message' },
|
|
11
|
-
{ package: 'testthat', name: 'expect_condition' },
|
|
12
|
-
{ package: 'testthat', name: 'expect_true' },
|
|
13
|
-
{ package: 'testthat', name: 'expect_false' },
|
|
14
|
-
{ package: 'testthat', name: 'expect_all_equal' },
|
|
15
|
-
{ package: 'testthat', name: 'expect_all_true' },
|
|
16
|
-
{ package: 'testthat', name: 'expect_all_false' },
|
|
40
|
+
{ package: 'testthat', name: 'test_that', argName: 'desc', argIdx: 0, resolveValue: true, linkTo: [ExpectFunctions, ContextFunctions] },
|
|
41
|
+
{ package: 'testthat', name: 'describe', argName: 'description', argIdx: 0, resolveValue: true, linkTo: [ExpectFunctions, ContextFunctions] },
|
|
42
|
+
{ package: 'testthat', name: 'it', argName: 'description', argIdx: 0, resolveValue: true, linkTo: [ExpectFunctions, ContextFunctions] },
|
|
43
|
+
/* for now we do not want to list them extra:
|
|
17
44
|
{ package: 'testthat', name: 'expect_lt' },
|
|
18
45
|
{ package: 'testthat', name: 'expect_lte' },
|
|
19
46
|
{ package: 'testthat', name: 'expect_gt' },
|
|
@@ -58,6 +85,7 @@ exports.TestFunctions = [
|
|
|
58
85
|
{ package: 'testthat', name: 'expect_failure' },
|
|
59
86
|
{ package: 'testthat', name: 'expect_snapshot_failure' },
|
|
60
87
|
{ package: 'testthat', name: 'show_failure' },
|
|
88
|
+
|
|
61
89
|
{ package: 'tinytest', name: 'exit_file', argName: 'msg', resolveValue: true },
|
|
62
90
|
{ package: 'tinytest', name: 'exit_if_not' },
|
|
63
91
|
{ package: 'tinytest', name: 'expect_equal', argName: 'info', resolveValue: true },
|
|
@@ -78,5 +106,111 @@ exports.TestFunctions = [
|
|
|
78
106
|
{ package: 'tinytest', name: 'expect_match', argName: 'info', resolveValue: true },
|
|
79
107
|
{ package: 'tinytest', name: 'ignore' },
|
|
80
108
|
{ package: 'tinytest', name: 'report_side_effects' },
|
|
109
|
+
|
|
110
|
+
{ package: 'RUnit', name: 'checkEquals', argName: 'msg', argIdx: 2, resolveValue: true },
|
|
111
|
+
{ package: 'RUnit', name: 'checkEqualsNumeric', argName: 'msg', argIdx: 2, resolveValue: true },
|
|
112
|
+
{ package: 'RUnit', name: 'checkIdentical', argName: 'msg', argIdx: 2, resolveValue: true },
|
|
113
|
+
{ package: 'RUnit', name: 'checkTrue', argName: 'msg', argIdx: 1, resolveValue: true },
|
|
114
|
+
{ package: 'RUnit', name: 'checkException', argName: 'msg', argIdx: 1, resolveValue: true },
|
|
115
|
+
|
|
116
|
+
{ package: 'checkmate', name: 'assertAccess' },
|
|
117
|
+
{ package: 'checkmate', name: 'assert_access' },
|
|
118
|
+
{ package: 'checkmate', name: 'assertArray' },
|
|
119
|
+
{ package: 'checkmate', name: 'assert_array' },
|
|
120
|
+
{ package: 'checkmate', name: 'assert_atomic' },
|
|
121
|
+
{ package: 'checkmate', name: 'assertAtomic' },
|
|
122
|
+
{ package: 'checkmate', name: 'assert_atomic_vector' },
|
|
123
|
+
{ package: 'checkmate', name: 'assertAtomicVector' },
|
|
124
|
+
{ package: 'checkmate', name: 'assert_character' },
|
|
125
|
+
{ package: 'checkmate', name: 'assertCharacter' },
|
|
126
|
+
{ package: 'checkmate', name: 'assert_choice' },
|
|
127
|
+
{ package: 'checkmate', name: 'assertChoice' },
|
|
128
|
+
{ package: 'checkmate', name: 'assert_class' },
|
|
129
|
+
{ package: 'checkmate', name: 'assertClass' },
|
|
130
|
+
{ package: 'checkmate', name: 'assert_complex' },
|
|
131
|
+
{ package: 'checkmate', name: 'assertComplex' },
|
|
132
|
+
{ package: 'checkmate', name: 'assert_count' },
|
|
133
|
+
{ package: 'checkmate', name: 'assertCount' },
|
|
134
|
+
{ package: 'checkmate', name: 'assert_data_frame' },
|
|
135
|
+
{ package: 'checkmate', name: 'assertDataFrame' },
|
|
136
|
+
{ package: 'checkmate', name: 'assert_data_table' },
|
|
137
|
+
{ package: 'checkmate', name: 'assertDataTable' },
|
|
138
|
+
{ package: 'checkmate', name: 'assert_date' },
|
|
139
|
+
{ package: 'checkmate', name: 'assertDate' },
|
|
140
|
+
{ package: 'checkmate', name: 'assert_directory' },
|
|
141
|
+
{ package: 'checkmate', name: 'assertDirectory' },
|
|
142
|
+
{ package: 'checkmate', name: 'assert_directory_exists' },
|
|
143
|
+
{ package: 'checkmate', name: 'assertDirectoryExists' },
|
|
144
|
+
{ package: 'checkmate', name: 'assert_disjunct' },
|
|
145
|
+
{ package: 'checkmate', name: 'assertDisjunct' },
|
|
146
|
+
{ package: 'checkmate', name: 'assert_double' },
|
|
147
|
+
{ package: 'checkmate', name: 'assertDouble' },
|
|
148
|
+
{ package: 'checkmate', name: 'assert_environment' },
|
|
149
|
+
{ package: 'checkmate', name: 'assertEnvironment' },
|
|
150
|
+
{ package: 'checkmate', name: 'assert_factor' },
|
|
151
|
+
{ package: 'checkmate', name: 'assertFactor' },
|
|
152
|
+
{ package: 'checkmate', name: 'assert_false' },
|
|
153
|
+
{ package: 'checkmate', name: 'assertFalse' },
|
|
154
|
+
{ package: 'checkmate', name: 'assert_file' },
|
|
155
|
+
{ package: 'checkmate', name: 'assertFile' },
|
|
156
|
+
{ package: 'checkmate', name: 'assert_file_exists' },
|
|
157
|
+
{ package: 'checkmate', name: 'assertFileExists' },
|
|
158
|
+
{ package: 'checkmate', name: 'assert_flag' },
|
|
159
|
+
{ package: 'checkmate', name: 'assertFlag' },
|
|
160
|
+
{ package: 'checkmate', name: 'assert_formula' },
|
|
161
|
+
{ package: 'checkmate', name: 'assertFormula' },
|
|
162
|
+
{ package: 'checkmate', name: 'assert_function' },
|
|
163
|
+
{ package: 'checkmate', name: 'assertFunction' },
|
|
164
|
+
{ package: 'checkmate', name: 'assert_int' },
|
|
165
|
+
{ package: 'checkmate', name: 'assertInt' },
|
|
166
|
+
{ package: 'checkmate', name: 'assert_integer' },
|
|
167
|
+
{ package: 'checkmate', name: 'assertInteger' },
|
|
168
|
+
{ package: 'checkmate', name: 'assert_list' },
|
|
169
|
+
{ package: 'checkmate', name: 'assertList' },
|
|
170
|
+
{ package: 'checkmate', name: 'assert_logical' },
|
|
171
|
+
{ package: 'checkmate', name: 'assertLogical' },
|
|
172
|
+
{ package: 'checkmate', name: 'assert_matrix' },
|
|
173
|
+
{ package: 'checkmate', name: 'assertMatrix' },
|
|
174
|
+
{ package: 'checkmate', name: 'assert_multi_class' },
|
|
175
|
+
{ package: 'checkmate', name: 'assertMultiClass' },
|
|
176
|
+
{ package: 'checkmate', name: 'assert_named' },
|
|
177
|
+
{ package: 'checkmate', name: 'assertNamed' },
|
|
178
|
+
{ package: 'checkmate', name: 'assert_names' },
|
|
179
|
+
{ package: 'checkmate', name: 'assertNames' },
|
|
180
|
+
{ package: 'checkmate', name: 'assert_null' },
|
|
181
|
+
{ package: 'checkmate', name: 'assertNull' },
|
|
182
|
+
{ package: 'checkmate', name: 'assert_number' },
|
|
183
|
+
{ package: 'checkmate', name: 'assertNumber' },
|
|
184
|
+
{ package: 'checkmate', name: 'assert_numeric' },
|
|
185
|
+
{ package: 'checkmate', name: 'assertNumeric' },
|
|
186
|
+
{ package: 'checkmate', name: 'assert_os' },
|
|
187
|
+
{ package: 'checkmate', name: 'assertOs' },
|
|
188
|
+
{ package: 'checkmate', name: 'assert_path_for_output' },
|
|
189
|
+
{ package: 'checkmate', name: 'assertPathForOutput' },
|
|
190
|
+
{ package: 'checkmate', name: 'assert_permutation' },
|
|
191
|
+
{ package: 'checkmate', name: 'assertPermutation' },
|
|
192
|
+
{ package: 'checkmate', name: 'assert_posixct' },
|
|
193
|
+
{ package: 'checkmate', name: 'assertPOSIXct' },
|
|
194
|
+
{ package: 'checkmate', name: 'assert_r6' },
|
|
195
|
+
{ package: 'checkmate', name: 'assertR6' },
|
|
196
|
+
{ package: 'checkmate', name: 'assert_raw' },
|
|
197
|
+
{ package: 'checkmate', name: 'assertRaw' },
|
|
198
|
+
{ package: 'checkmate', name: 'assert_scalar' },
|
|
199
|
+
{ package: 'checkmate', name: 'assertScalar' },
|
|
200
|
+
{ package: 'checkmate', name: 'assert_scalar_na' },
|
|
201
|
+
{ package: 'checkmate', name: 'assertScalarNA' },
|
|
202
|
+
{ package: 'checkmate', name: 'assert_set_equal' },
|
|
203
|
+
{ package: 'checkmate', name: 'assertSetEqual' },
|
|
204
|
+
{ package: 'checkmate', name: 'assert_string' },
|
|
205
|
+
{ package: 'checkmate', name: 'assertString' },
|
|
206
|
+
{ package: 'checkmate', name: 'assert_subset' },
|
|
207
|
+
{ package: 'checkmate', name: 'assertSubset' },
|
|
208
|
+
{ package: 'checkmate', name: 'assert_tibble' },
|
|
209
|
+
{ package: 'checkmate', name: 'assertTibble' },
|
|
210
|
+
{ package: 'checkmate', name: 'assert_true' },
|
|
211
|
+
{ package: 'checkmate', name: 'assertTrue' },
|
|
212
|
+
{ package: 'checkmate', name: 'assert_vector' },
|
|
213
|
+
{ package: 'checkmate', name: 'assertVector' }
|
|
214
|
+
*/
|
|
81
215
|
];
|
|
82
216
|
//# sourceMappingURL=test-functions.js.map
|
package/queries/query.js
CHANGED
|
@@ -149,7 +149,7 @@ function VirtualQuerySchema() {
|
|
|
149
149
|
* Produces a Joi schema representing any supported query (including virtual queries).
|
|
150
150
|
*/
|
|
151
151
|
function AnyQuerySchema() {
|
|
152
|
-
return joi_1.default.alternatives(SupportedQueriesSchema(), VirtualQuerySchema()).description('
|
|
152
|
+
return joi_1.default.alternatives(SupportedQueriesSchema(), VirtualQuerySchema()).description('A virtual or an active query!');
|
|
153
153
|
}
|
|
154
154
|
/**
|
|
155
155
|
* Produces a Joi schema representing an array of supported queries.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FlowrSearchElement, FlowrSearchElements } from '../flowr-search';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
3
|
import { type MergeableRecord } from '../../util/objects';
|
|
4
4
|
import type { Identifier } from '../../dataflow/environments/identifier';
|
|
5
5
|
import type { LinkToLastCall } from '../../queries/catalog/call-context-query/call-context-query-format';
|
|
@@ -9,18 +9,11 @@ import type { Query, QueryResult } from '../../queries/query';
|
|
|
9
9
|
import { type CfgSimplificationPassName } from '../../control-flow/cfg-simplification';
|
|
10
10
|
import type { AsyncOrSync } from 'ts-essentials';
|
|
11
11
|
import type { ReadonlyFlowrAnalysisProvider } from '../../project/flowr-analyzer';
|
|
12
|
-
import type { DataflowInformation } from '../../dataflow/info';
|
|
13
|
-
import type { FlowrConfigOptions } from '../../config';
|
|
14
12
|
export interface EnrichmentData<ElementContent extends MergeableRecord, ElementArguments = undefined, SearchContent extends MergeableRecord = never, SearchArguments = ElementArguments> {
|
|
15
13
|
/**
|
|
16
14
|
* A function that is applied to each element of the search to enrich it with additional data.
|
|
17
15
|
*/
|
|
18
|
-
readonly enrichElement?: (element: FlowrSearchElement<ParentInformation>, search: FlowrSearchElements<ParentInformation>,
|
|
19
|
-
dataflow: DataflowInformation;
|
|
20
|
-
normalize: NormalizedAst;
|
|
21
|
-
cfg: ControlFlowInformation;
|
|
22
|
-
config: FlowrConfigOptions;
|
|
23
|
-
}, args: ElementArguments | undefined, previousValue: ElementContent | undefined) => AsyncOrSync<ElementContent>;
|
|
16
|
+
readonly enrichElement?: (element: FlowrSearchElement<ParentInformation>, search: FlowrSearchElements<ParentInformation>, analyzer: ReadonlyFlowrAnalysisProvider, args: ElementArguments | undefined, previousValue: ElementContent | undefined) => AsyncOrSync<ElementContent>;
|
|
24
17
|
readonly enrichSearch?: (search: FlowrSearchElements<ParentInformation>, data: ReadonlyFlowrAnalysisProvider, args: SearchArguments | undefined, previousValue: SearchContent | undefined) => AsyncOrSync<SearchContent>;
|
|
25
18
|
/**
|
|
26
19
|
* The mapping function used by the {@link Mapper.Enrichment} mapper.
|
|
@@ -96,44 +89,24 @@ export interface QueryDataSearchContent extends MergeableRecord {
|
|
|
96
89
|
*/
|
|
97
90
|
export declare const Enrichments: {
|
|
98
91
|
readonly "call-targets": {
|
|
99
|
-
enrichElement: (e: FlowrSearchElement<ParentInformation>, _s: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>,
|
|
100
|
-
dataflow: DataflowInformation;
|
|
101
|
-
normalize: NormalizedAst;
|
|
102
|
-
cfg: ControlFlowInformation;
|
|
103
|
-
config: FlowrConfigOptions;
|
|
104
|
-
}, args: {
|
|
92
|
+
enrichElement: (e: FlowrSearchElement<ParentInformation>, _s: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, analyzer: ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>, args: {
|
|
105
93
|
onlyBuiltin?: boolean;
|
|
106
|
-
} | undefined, prev: CallTargetsContent | undefined) => CallTargetsContent
|
|
94
|
+
} | undefined, prev: CallTargetsContent | undefined) => Promise<CallTargetsContent>;
|
|
107
95
|
mapper: ({ targets }: CallTargetsContent) => FlowrSearchElement<ParentInformation>[];
|
|
108
96
|
};
|
|
109
97
|
readonly "last-call": {
|
|
110
|
-
enrichElement: (e: FlowrSearchElement<ParentInformation>, _s: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>,
|
|
111
|
-
dataflow: DataflowInformation;
|
|
112
|
-
normalize: NormalizedAst;
|
|
113
|
-
cfg: ControlFlowInformation;
|
|
114
|
-
config: FlowrConfigOptions;
|
|
115
|
-
}, args: Omit<LinkToLastCall<import("../../queries/catalog/call-context-query/call-context-query-format").CallNameTypes>, "type">[] | undefined, prev: LastCallContent | undefined) => LastCallContent;
|
|
98
|
+
enrichElement: (e: FlowrSearchElement<ParentInformation>, _s: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, analyzer: ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>, args: Omit<LinkToLastCall<import("../../queries/catalog/call-context-query/call-context-query-format").CallNameTypes>, "type">[] | undefined, prev: LastCallContent | undefined) => Promise<LastCallContent>;
|
|
116
99
|
mapper: ({ linkedIds }: LastCallContent) => FlowrSearchElement<ParentInformation>[];
|
|
117
100
|
};
|
|
118
101
|
readonly "cfg-information": {
|
|
119
|
-
enrichElement: (e: FlowrSearchElement<ParentInformation>, search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, _data: {
|
|
120
|
-
dataflow: DataflowInformation;
|
|
121
|
-
normalize: NormalizedAst;
|
|
122
|
-
cfg: ControlFlowInformation;
|
|
123
|
-
config: FlowrConfigOptions;
|
|
124
|
-
}, _args: CfgInformationArguments | undefined, prev: CfgInformationElementContent | undefined) => {
|
|
102
|
+
enrichElement: (e: FlowrSearchElement<ParentInformation>, search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, _data: ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>, _args: CfgInformationArguments | undefined, prev: CfgInformationElementContent | undefined) => {
|
|
125
103
|
isRoot: boolean;
|
|
126
104
|
isReachable: boolean | undefined;
|
|
127
105
|
};
|
|
128
106
|
enrichSearch: (_search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, data: ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>, args: CfgInformationArguments | undefined, prev: CfgInformationSearchContent | undefined) => Promise<CfgInformationSearchContent>;
|
|
129
107
|
};
|
|
130
108
|
readonly "query-data": {
|
|
131
|
-
enrichElement: (_e: FlowrSearchElement<ParentInformation>, _search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, _data:
|
|
132
|
-
dataflow: DataflowInformation;
|
|
133
|
-
normalize: NormalizedAst;
|
|
134
|
-
cfg: ControlFlowInformation;
|
|
135
|
-
config: FlowrConfigOptions;
|
|
136
|
-
}, args: QueryDataElementContent | undefined, prev: QueryDataElementContent | undefined) => QueryDataElementContent;
|
|
109
|
+
enrichElement: (_e: FlowrSearchElement<ParentInformation>, _search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, _data: ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>, args: QueryDataElementContent | undefined, prev: QueryDataElementContent | undefined) => QueryDataElementContent;
|
|
137
110
|
enrichSearch: (_search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, _data: ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>, args: QueryDataSearchContent | undefined, prev: QueryDataSearchContent | undefined) => Required<QueryDataSearchContent>;
|
|
138
111
|
};
|
|
139
112
|
};
|
|
@@ -147,9 +120,4 @@ export declare function enrichmentContent<E extends Enrichment>(e: FlowrSearchEl
|
|
|
147
120
|
/**
|
|
148
121
|
* Enriches the given search element with the given enrichment type, using the provided analysis data.
|
|
149
122
|
*/
|
|
150
|
-
export declare function enrichElement<Element extends FlowrSearchElement<ParentInformation>, E extends Enrichment>(e: Element, s: FlowrSearchElements<ParentInformation>,
|
|
151
|
-
dataflow: DataflowInformation;
|
|
152
|
-
normalize: NormalizedAst;
|
|
153
|
-
cfg: ControlFlowInformation;
|
|
154
|
-
config: FlowrConfigOptions;
|
|
155
|
-
}, enrichment: E, args?: EnrichmentElementArguments<E>): Promise<Element>;
|
|
123
|
+
export declare function enrichElement<Element extends FlowrSearchElement<ParentInformation>, E extends Enrichment>(e: Element, s: FlowrSearchElements<ParentInformation>, analyzer: ReadonlyFlowrAnalysisProvider, enrichment: E, args?: EnrichmentElementArguments<E>): Promise<Element>;
|
|
@@ -5,13 +5,13 @@ exports.enrichmentContent = enrichmentContent;
|
|
|
5
5
|
exports.enrichElement = enrichElement;
|
|
6
6
|
const objects_1 = require("../../util/objects");
|
|
7
7
|
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
8
|
-
const identify_link_to_last_call_relation_1 = require("../../queries/catalog/call-context-query/identify-link-to-last-call-relation");
|
|
9
8
|
const assert_1 = require("../../util/assert");
|
|
10
9
|
const dfg_get_origin_1 = require("../../dataflow/origin/dfg-get-origin");
|
|
11
10
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
12
11
|
const cfg_simplification_1 = require("../../control-flow/cfg-simplification");
|
|
13
12
|
const call_context_query_executor_1 = require("../../queries/catalog/call-context-query/call-context-query-executor");
|
|
14
13
|
const cfg_kind_1 = require("../../project/cfg-kind");
|
|
14
|
+
const identify_link_to_relation_1 = require("../../queries/catalog/call-context-query/identify-link-to-relation");
|
|
15
15
|
/**
|
|
16
16
|
* An enumeration that stores the names of the available enrichments that can be applied to a set of search elements.
|
|
17
17
|
* See {@link FlowrSearchBuilder.with} for more information on how to apply enrichments.
|
|
@@ -29,14 +29,16 @@ var Enrichment;
|
|
|
29
29
|
*/
|
|
30
30
|
exports.Enrichments = {
|
|
31
31
|
[Enrichment.CallTargets]: {
|
|
32
|
-
enrichElement: (e, _s,
|
|
32
|
+
enrichElement: async (e, _s, analyzer, args, prev) => {
|
|
33
33
|
// we don't resolve aliases here yet!
|
|
34
34
|
const content = { targets: [] };
|
|
35
|
-
const
|
|
35
|
+
const df = await analyzer.dataflow();
|
|
36
|
+
const n = await analyzer.normalize();
|
|
37
|
+
const callVertex = df.graph.getVertex(e.node.info.id);
|
|
36
38
|
if (callVertex?.tag === vertex_1.VertexType.FunctionCall) {
|
|
37
|
-
const origins = (0, dfg_get_origin_1.getOriginInDfg)(
|
|
39
|
+
const origins = (0, dfg_get_origin_1.getOriginInDfg)(df.graph, callVertex.id);
|
|
38
40
|
if (!origins || origins.length === 0) {
|
|
39
|
-
content.targets = [(0, node_id_1.recoverName)(callVertex.id,
|
|
41
|
+
content.targets = [(0, node_id_1.recoverName)(callVertex.id, n.idMap)];
|
|
40
42
|
}
|
|
41
43
|
else {
|
|
42
44
|
// find call targets in user code (which have ids!)
|
|
@@ -44,7 +46,7 @@ exports.Enrichments = {
|
|
|
44
46
|
switch (o.type) {
|
|
45
47
|
case 2 /* OriginType.FunctionCallOrigin */:
|
|
46
48
|
return {
|
|
47
|
-
node:
|
|
49
|
+
node: n.idMap.get(o.id),
|
|
48
50
|
};
|
|
49
51
|
case 3 /* OriginType.BuiltInFunctionOrigin */:
|
|
50
52
|
return o.fn.name;
|
|
@@ -53,7 +55,7 @@ exports.Enrichments = {
|
|
|
53
55
|
}
|
|
54
56
|
}).filter(assert_1.isNotUndefined));
|
|
55
57
|
if (content.targets.length === 0) {
|
|
56
|
-
content.targets = [(0, node_id_1.recoverName)(callVertex.id,
|
|
58
|
+
content.targets = [(0, node_id_1.recoverName)(callVertex.id, n.idMap)];
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
}
|
|
@@ -70,19 +72,21 @@ exports.Enrichments = {
|
|
|
70
72
|
mapper: ({ targets }) => targets.map(t => t).filter(t => t.node !== undefined)
|
|
71
73
|
},
|
|
72
74
|
[Enrichment.LastCall]: {
|
|
73
|
-
enrichElement: (e, _s,
|
|
75
|
+
enrichElement: async (e, _s, analyzer, args, prev) => {
|
|
74
76
|
(0, assert_1.guard)(args && args.length, `${Enrichment.LastCall} enrichment requires at least one argument`);
|
|
75
77
|
const content = prev ?? { linkedIds: [] };
|
|
76
|
-
const
|
|
78
|
+
const df = await analyzer.dataflow();
|
|
79
|
+
const n = await analyzer.normalize();
|
|
80
|
+
const vertex = df.graph.get(e.node.info.id);
|
|
77
81
|
if (vertex !== undefined && vertex[0].tag === vertex_1.VertexType.FunctionCall) {
|
|
78
82
|
for (const arg of args) {
|
|
79
|
-
const lastCalls = (0,
|
|
83
|
+
const lastCalls = await (0, identify_link_to_relation_1.identifyLinkToRelation)(vertex[0].id, analyzer, {
|
|
80
84
|
...arg,
|
|
81
85
|
callName: (0, call_context_query_executor_1.promoteCallName)(arg.callName),
|
|
82
86
|
type: 'link-to-last-call',
|
|
83
87
|
});
|
|
84
88
|
for (const lastCall of lastCalls) {
|
|
85
|
-
content.linkedIds.push({ node:
|
|
89
|
+
content.linkedIds.push({ node: n.idMap.get(lastCall) });
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
92
|
}
|
|
@@ -138,14 +142,14 @@ function enrichmentContent(e, enrichment) {
|
|
|
138
142
|
/**
|
|
139
143
|
* Enriches the given search element with the given enrichment type, using the provided analysis data.
|
|
140
144
|
*/
|
|
141
|
-
async function enrichElement(e, s,
|
|
145
|
+
async function enrichElement(e, s, analyzer, enrichment, args) {
|
|
142
146
|
const enrichmentData = exports.Enrichments[enrichment];
|
|
143
147
|
const prev = e?.enrichments;
|
|
144
148
|
return {
|
|
145
149
|
...e,
|
|
146
150
|
enrichments: {
|
|
147
151
|
...prev ?? {},
|
|
148
|
-
[enrichment]: await enrichmentData.enrichElement?.(e, s,
|
|
152
|
+
[enrichment]: await enrichmentData.enrichElement?.(e, s, analyzer, args, prev?.[enrichment])
|
|
149
153
|
}
|
|
150
154
|
};
|
|
151
155
|
}
|
|
@@ -82,15 +82,13 @@ async function generateFromQuery(input, args) {
|
|
|
82
82
|
nodesByQuery.set(query, nodes);
|
|
83
83
|
}
|
|
84
84
|
// enrich elements with query data
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
const elements = await new flowr_search_1.FlowrSearchElements([...nodesByQuery]
|
|
89
|
-
.flatMap(([_, nodes]) => [...nodes]))
|
|
85
|
+
const nodearr = [...nodesByQuery];
|
|
86
|
+
const elements = await new flowr_search_1.FlowrSearchElements(nodearr
|
|
87
|
+
.flatMap(([_, nodes]) => Array.from(nodes)))
|
|
90
88
|
.enrich(input, search_enrichers_1.Enrichment.QueryData, { queries: result });
|
|
91
89
|
return elements.mutate(s => Promise.all(s.map(async (e) => {
|
|
92
|
-
const [query, _] =
|
|
93
|
-
return await (0, search_enrichers_1.enrichElement)(e, elements,
|
|
90
|
+
const [query, _] = nodearr.find(([_, nodes]) => nodes.has(e));
|
|
91
|
+
return await (0, search_enrichers_1.enrichElement)(e, elements, input, search_enrichers_1.Enrichment.QueryData, { query });
|
|
94
92
|
})));
|
|
95
93
|
}
|
|
96
94
|
async function generateSyntax(input, args) {
|
|
@@ -100,13 +100,7 @@ async function getFilter(data, elements, { filter }) {
|
|
|
100
100
|
return elements.mutate(e => e.filter(e => (0, flowr_search_filters_1.evalFilter)(filter, { element: e, data: { dataflow } })));
|
|
101
101
|
}
|
|
102
102
|
async function getWith(input, elements, { info, args }) {
|
|
103
|
-
|
|
104
|
-
normalize: await input.normalize(),
|
|
105
|
-
dataflow: await input.dataflow(),
|
|
106
|
-
cfg: await input.controlflow(),
|
|
107
|
-
config: input.flowrConfig
|
|
108
|
-
};
|
|
109
|
-
return (await elements.enrich(input, info, args)).mutate(async (s) => await Promise.all(s.map(e => (0, search_enrichers_1.enrichElement)(e, elements, data, info, args))));
|
|
103
|
+
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))));
|
|
110
104
|
}
|
|
111
105
|
function getMap(data, elements, { mapper, args }) {
|
|
112
106
|
return elements.mutate(elements => elements.flatMap(e => (0, search_mappers_1.map)(e, data, mapper, args)));
|
package/util/schema.js
CHANGED
|
@@ -24,7 +24,7 @@ function genericDescription(level, formatter, name, desc) {
|
|
|
24
24
|
}
|
|
25
25
|
const lines = [...headerLine(level, formatter, name, desc.type ?? 'unknown', desc.flags)];
|
|
26
26
|
if ('allow' in desc) {
|
|
27
|
-
lines.push({ level: level + 1, text: `
|
|
27
|
+
lines.push({ level: level + 1, text: `Only allows: ${desc['allow'].map(v => "'" + v + "'").join(', ')}` });
|
|
28
28
|
}
|
|
29
29
|
switch (desc.type) {
|
|
30
30
|
case 'object':
|
|
@@ -57,18 +57,16 @@ function printFlags(flags) {
|
|
|
57
57
|
if ('presence' in flags) {
|
|
58
58
|
flagText += String(flags['presence']);
|
|
59
59
|
}
|
|
60
|
-
return flagText.trim().length > 0 ? '[' + flagText + ']' : '';
|
|
60
|
+
return flagText.trim().length > 0 ? '[' + flagText + '] ' : '';
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Creates the header line(s) for a schema description.
|
|
64
64
|
*/
|
|
65
65
|
function headerLine(level, formatter, name, type, flags) {
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
return [baseLine];
|
|
66
|
+
const fnam = name === '.' ? '' : (0, ansi_1.bold)(name, formatter) + ' ';
|
|
67
|
+
const fdesc = flags && 'description' in flags ? (0, ansi_1.italic)(flags['description'], formatter) + ' ' : '';
|
|
68
|
+
const text = `- ${fnam}${printFlags(flags)}${fdesc}(${formatter.format(type, { effect: ansi_1.ColorEffect.Foreground, color: 7 /* Colors.White */ })})`;
|
|
69
|
+
return [{ level, text }];
|
|
72
70
|
}
|
|
73
71
|
/**
|
|
74
72
|
* Describes a Joi object schema.
|
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.8.
|
|
9
|
+
const version = '2.8.13';
|
|
10
10
|
/**
|
|
11
11
|
* Retrieves the current flowR version as a new {@link SemVer} object.
|
|
12
12
|
*/
|