@eagleoutice/flowr 2.14.0 → 2.14.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 +39 -28
- package/benchmark/calibration.d.ts +13 -11
- package/benchmark/calibration.js +25 -26
- package/benchmark/slicer.d.ts +2 -1
- package/benchmark/slicer.js +6 -3
- package/cli/benchmark-app.js +4 -1
- package/cli/benchmark-helper-app.d.ts +1 -0
- package/cli/benchmark-helper-app.js +2 -2
- package/cli/common/options.d.ts +5 -0
- package/cli/common/options.js +1 -0
- package/cli/common/scripts-info.d.ts +5 -0
- package/cli/repl/execute.d.ts +2 -2
- package/cli/repl/execute.js +2 -2
- package/config.js +5 -6
- package/dataflow/environments/apply-kill.js +1 -1
- package/dataflow/environments/built-in-props.d.ts +6 -2
- package/dataflow/environments/built-in-props.js +5 -1
- package/dataflow/environments/default-builtin-config.d.ts +76 -1
- package/dataflow/environments/default-builtin-config.js +30 -5
- package/dataflow/environments/environment.d.ts +9 -1
- package/dataflow/environments/environment.js +25 -7
- package/dataflow/environments/identifier.d.ts +1 -0
- package/dataflow/environments/query-fn-props.d.ts +6 -0
- package/dataflow/environments/query-fn-props.js +20 -0
- package/dataflow/environments/resolve-by-name.js +14 -2
- package/dataflow/eval/resolve/resolve-operators.js +1 -1
- package/dataflow/eval/resolve/resolve-working-directory.d.ts +1 -1
- package/dataflow/eval/resolve/resolve-working-directory.js +1 -2
- package/dataflow/fn/exceptions-of-function.d.ts +3 -1
- package/dataflow/fn/exceptions-of-function.js +85 -38
- package/dataflow/fn/strict-function.d.ts +40 -0
- package/dataflow/fn/strict-function.js +337 -0
- package/dataflow/graph/df-helper.d.ts +9 -1
- package/dataflow/graph/df-helper.js +19 -3
- package/dataflow/graph/graph.d.ts +28 -2
- package/dataflow/graph/graph.js +59 -2
- package/dataflow/info.d.ts +26 -0
- package/dataflow/info.js +28 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +27 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +29 -8
- package/documentation/wiki-core.js +1 -1
- package/documentation/wiki-dataflow-graph.js +1 -0
- package/documentation/wiki-linter.js +1 -0
- package/documentation/wiki-query.js +53 -0
- package/linter/linter-output.js +1 -1
- package/linter/linter-rules.d.ts +24 -0
- package/linter/linter-rules.js +3 -1
- package/linter/rules/network-functions.d.ts +1 -1
- package/linter/rules/unclosed-connection.d.ts +44 -0
- package/linter/rules/unclosed-connection.js +200 -0
- package/package.json +4 -7
- package/project/dependency-version-space.d.ts +3 -3
- package/project/dependency-version-space.js +2 -2
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.js +1 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +1 -1
- package/project/plugins/file-plugins/files/flowr-news-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-news-file.js +1 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +5 -5
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +33 -6
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
- package/project/sigdb/manifest.d.ts +3 -1
- package/project/sigdb/manifest.js +50 -9
- package/project/sigdb/reader.js +1 -1
- package/project/sigdb/schema.d.ts +2 -2
- package/project/sigdb/schema.js +2 -2
- package/queries/catalog/dependencies-query/link-devices.js +2 -8
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +6 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +25 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +31 -0
- package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +56 -0
- package/queries/catalog/slice-query-options.d.ts +1 -1
- package/queries/catalog/slice-query-options.js +1 -1
- package/queries/query-function-filter.d.ts +8 -2
- package/queries/query-function-filter.js +11 -1
- package/queries/query.d.ts +11 -1
- package/queries/query.js +2 -0
- package/r-bridge/lang-4.x/ast/model/model.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/model.js +4 -4
- package/search/flowr-search-filters.js +1 -13
- package/slicing/criterion/parse.d.ts +2 -2
- package/slicing/criterion/parse.js +2 -2
- package/slicing/static/fingerprint.js +1 -1
- package/util/objects.d.ts +12 -0
- package/util/objects.js +48 -0
- package/util/simple-df/dfg-ascii.js +14 -3
- package/util/text/name-rank.d.ts +1 -1
- package/util/text/name-rank.js +1 -1
- package/util/version.js +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.InspectStrictnessQueryDefinition = void 0;
|
|
7
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
8
|
+
const joi_1 = __importDefault(require("joi"));
|
|
9
|
+
const inspect_strictness_query_executor_1 = require("./inspect-strictness-query-executor");
|
|
10
|
+
const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
11
|
+
const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parser");
|
|
12
|
+
const range_1 = require("../../../util/range");
|
|
13
|
+
const logic_1 = require("../../../util/logic");
|
|
14
|
+
function inspectStrictLineParser(output, line, _config) {
|
|
15
|
+
const criteria = (0, slice_query_parser_1.sliceCriteriaParser)(line[0]);
|
|
16
|
+
return {
|
|
17
|
+
query: {
|
|
18
|
+
type: 'inspect-strictness',
|
|
19
|
+
filter: criteria
|
|
20
|
+
},
|
|
21
|
+
rCode: (0, slice_query_parser_1.queryLineCode)(line, criteria ? 1 : 0)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** How a verdict reads in a sentence, `always`, `never`, or `conditionally` strict. */
|
|
25
|
+
function phrase(value) {
|
|
26
|
+
return value === logic_1.Ternary.Maybe ? 'conditionally' : value;
|
|
27
|
+
}
|
|
28
|
+
exports.InspectStrictnessQueryDefinition = {
|
|
29
|
+
title: 'Inspect Strict Functions Query',
|
|
30
|
+
executor: inspect_strictness_query_executor_1.executeStrictnessQuery,
|
|
31
|
+
asciiSummarizer: async (formatter, processed, queryResults, result) => {
|
|
32
|
+
const out = queryResults;
|
|
33
|
+
result.push(`Query: ${(0, ansi_1.bold)('inspect-strictness', formatter)} (${out['.meta'].timing.toFixed(0)}ms)`);
|
|
34
|
+
const idMap = (await processed.normalize()).idMap;
|
|
35
|
+
for (const [id, info] of Object.entries(out.strictness)) {
|
|
36
|
+
const node = idMap.get(node_id_1.NodeId.normalize(id));
|
|
37
|
+
const loc = node ? range_1.SourceLocation.fromNode(node) : undefined;
|
|
38
|
+
const params = Object.entries(info.parameters)
|
|
39
|
+
.map(([param, value]) => `${idMap.get(node_id_1.NodeId.normalize(param))?.lexeme ?? param}: ${phrase(value)}`)
|
|
40
|
+
.join(', ');
|
|
41
|
+
result.push(` - Function ${(0, ansi_1.bold)(id, formatter)} (${range_1.SourceLocation.format(loc)}) is ${phrase(info.strict)} strict${params.length > 0 ? ` (${params})` : ''}`);
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
},
|
|
45
|
+
fromLine: inspectStrictLineParser,
|
|
46
|
+
syntax: '@inspect-strictness [(<crit>;...)] <code | file://path>',
|
|
47
|
+
schema: joi_1.default.object({
|
|
48
|
+
type: joi_1.default.string().valid('inspect-strictness').required().description('The type of the query.'),
|
|
49
|
+
filter: joi_1.default.array().items(joi_1.default.string().required()).optional().description('If given, only function definitions that match one of the given slicing criteria are considered. Each criterion can be either `line:column`, `line@variable-name`, or `$id`, where the latter directly specifies the node id of the function definition to be considered.')
|
|
50
|
+
}).description('Either returns all function definitions alongside whether they are strict, or just those matching the filters.'),
|
|
51
|
+
flattenInvolvedNodes: (queryResults) => {
|
|
52
|
+
const out = queryResults;
|
|
53
|
+
return Object.keys(out.strictness).filter(id => out.strictness[id].strict === logic_1.Ternary.Always);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=inspect-strictness-query-format.js.map
|
|
@@ -55,5 +55,5 @@ export declare const SliceQueryOptionsSchema: {
|
|
|
55
55
|
* as {@link SlicingCriteria.convertAll} keeps them verbatim.
|
|
56
56
|
*/
|
|
57
57
|
export declare function resolveSliceCriteria(criteria: SlicingCriteria, ast: NormalizedAst): NodeId[];
|
|
58
|
-
/** Reconstruct the given `nodes` of `ast`, honoring the inlining, per-file and magic-comment options. */
|
|
58
|
+
/** Reconstruct the given `nodes` of `ast`, honoring the inlining, per-file, and magic-comment options. */
|
|
59
59
|
export declare function reconstructSlice(ast: NormalizedAst, graph: DataflowGraph, nodes: ReadonlySet<NodeId>, options: SliceQueryOptions): ReconstructionResult;
|
|
@@ -39,7 +39,7 @@ function resolveSliceCriteria(criteria, ast) {
|
|
|
39
39
|
}
|
|
40
40
|
return ids;
|
|
41
41
|
}
|
|
42
|
-
/** Reconstruct the given `nodes` of `ast`, honoring the inlining, per-file and magic-comment options. */
|
|
42
|
+
/** Reconstruct the given `nodes` of `ast`, honoring the inlining, per-file, and magic-comment options. */
|
|
43
43
|
function reconstructSlice(ast, graph, nodes, options) {
|
|
44
44
|
const { inlineSources, inlineFull, perFile, noMagicComments } = options;
|
|
45
45
|
const inlining = inlineSources || inlineFull;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
2
|
import type { ReadonlyFlowrAnalysisProvider } from '../project/flowr-analyzer';
|
|
3
3
|
import { SlicingCriterion } from '../slicing/criterion/parse';
|
|
4
4
|
/** A query that may restrict the functions it inspects to a set of slicing criteria. */
|
|
@@ -10,12 +10,18 @@ interface FunctionFilteringQuery {
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const QueryFunctionFilter: {
|
|
12
12
|
readonly name: "QueryFunctionFilter";
|
|
13
|
+
/**
|
|
14
|
+
* Whether the definition is one the analyzed code writes. A deferred expression (`on.exit` and its
|
|
15
|
+
* relatives) is wrapped in a definition of its own, which carries an id no node of the ast does, and
|
|
16
|
+
* nobody asks about a function they never wrote.
|
|
17
|
+
*/
|
|
18
|
+
readonly written: (this: void, id: NodeId) => boolean;
|
|
13
19
|
/** The ids the given queries restrict themselves to; empty if at least one query wants all functions. */
|
|
14
20
|
readonly criteria: (this: void, queries: readonly FunctionFilteringQuery[], analyzer: ReadonlyFlowrAnalysisProvider) => Promise<ReadonlySet<NodeId>>;
|
|
15
21
|
/** The call graph together with the functions the given queries want to inspect. */
|
|
16
22
|
readonly inCallGraph: (this: void, queries: readonly FunctionFilteringQuery[], analyzer: ReadonlyFlowrAnalysisProvider, onlyDefinitions?: boolean) => Promise<{
|
|
17
23
|
cg: import("../dataflow/graph/call-graph").CallGraph;
|
|
18
|
-
fns:
|
|
24
|
+
fns: IteratorObject<[NodeId, Required<import("../dataflow/graph/vertex").DataflowGraphVertexFunctionDefinition | import("../dataflow/graph/vertex").DataflowGraphVertexFunctionCall>], undefined, unknown>;
|
|
19
25
|
}>;
|
|
20
26
|
};
|
|
21
27
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.QueryFunctionFilter = void 0;
|
|
4
|
+
const node_id_1 = require("../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
4
5
|
const parse_1 = require("../slicing/criterion/parse");
|
|
5
6
|
const vertex_1 = require("../dataflow/graph/vertex");
|
|
6
7
|
/**
|
|
@@ -8,6 +9,14 @@ const vertex_1 = require("../dataflow/graph/vertex");
|
|
|
8
9
|
*/
|
|
9
10
|
exports.QueryFunctionFilter = {
|
|
10
11
|
name: 'QueryFunctionFilter',
|
|
12
|
+
/**
|
|
13
|
+
* Whether the definition is one the analyzed code writes. A deferred expression (`on.exit` and its
|
|
14
|
+
* relatives) is wrapped in a definition of its own, which carries an id no node of the ast does, and
|
|
15
|
+
* nobody asks about a function they never wrote.
|
|
16
|
+
*/
|
|
17
|
+
written(id) {
|
|
18
|
+
return typeof node_id_1.NodeId.normalize(id) === 'number';
|
|
19
|
+
},
|
|
11
20
|
/** The ids the given queries restrict themselves to; empty if at least one query wants all functions. */
|
|
12
21
|
async criteria(queries, analyzer) {
|
|
13
22
|
let filters = undefined;
|
|
@@ -38,7 +47,8 @@ exports.QueryFunctionFilter = {
|
|
|
38
47
|
async inCallGraph(queries, analyzer, onlyDefinitions = true) {
|
|
39
48
|
const filterFor = await exports.QueryFunctionFilter.criteria(queries, analyzer);
|
|
40
49
|
const cg = await analyzer.callGraph();
|
|
41
|
-
let fns = (onlyDefinitions || filterFor.size === 0 ? cg.verticesOfType(vertex_1.VertexType.FunctionDefinition) : cg.vertices(true))
|
|
50
|
+
let fns = (onlyDefinitions || filterFor.size === 0 ? cg.verticesOfType(vertex_1.VertexType.FunctionDefinition) : cg.vertices(true))
|
|
51
|
+
.filter(([id]) => exports.QueryFunctionFilter.written(id));
|
|
42
52
|
if (filterFor.size > 0) {
|
|
43
53
|
fns = fns.filter(([id]) => filterFor.has(id));
|
|
44
54
|
}
|
package/queries/query.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ import type { CommandCompletions } from '../cli/repl/core';
|
|
|
31
31
|
import type { FilesQuery } from './catalog/files-query/files-query-format';
|
|
32
32
|
import type { CallGraphQuery } from './catalog/call-graph-query/call-graph-query-format';
|
|
33
33
|
import type { InspectRecursionQuery } from './catalog/inspect-recursion-query/inspect-recursion-query-format';
|
|
34
|
+
import type { InspectStrictnessQuery } from './catalog/inspect-strictness-query/inspect-strictness-query-format';
|
|
34
35
|
import type { DoesCallQuery } from './catalog/does-call-query/does-call-query-format';
|
|
35
36
|
import type { InspectExceptionQuery } from './catalog/inspect-exceptions-query/inspect-exception-query-format';
|
|
36
37
|
import type { InputSourcesQuery } from './catalog/input-sources-query/input-sources-query-format';
|
|
@@ -42,7 +43,7 @@ import { type AbsintQuery } from './catalog/absint-query/absint-query-format';
|
|
|
42
43
|
/**
|
|
43
44
|
* These are all queries that can be executed from within flowR
|
|
44
45
|
*/
|
|
45
|
-
export type Query = CallContextQuery | ConfigQuery | SearchQuery | DataflowQuery | DoesCallQuery | CallGraphQuery | ControlFlowQuery | DataflowLensQuery | FilesQuery | AbsintQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | DependenciesQuery | LocationMapQuery | HappensBeforeQuery | InspectExceptionQuery | InspectHigherOrderQuery | InspectRecursionQuery | ResolveValueQuery | ProjectQuery | SignatureQuery | OriginQuery | LinterQuery | ProvenanceQuery | InputSourcesQuery | DiceQuery | GuessDepVersionsQuery;
|
|
46
|
+
export type Query = CallContextQuery | ConfigQuery | SearchQuery | DataflowQuery | DoesCallQuery | CallGraphQuery | ControlFlowQuery | DataflowLensQuery | FilesQuery | AbsintQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | DependenciesQuery | LocationMapQuery | HappensBeforeQuery | InspectExceptionQuery | InspectHigherOrderQuery | InspectRecursionQuery | InspectStrictnessQuery | ResolveValueQuery | ProjectQuery | SignatureQuery | OriginQuery | LinterQuery | ProvenanceQuery | InputSourcesQuery | DiceQuery | GuessDepVersionsQuery;
|
|
46
47
|
export type QueryArgumentsWithType<QueryType extends BaseQueryFormat['type']> = Query & {
|
|
47
48
|
type: QueryType;
|
|
48
49
|
};
|
|
@@ -266,6 +267,15 @@ export declare const SupportedQueries: {
|
|
|
266
267
|
readonly schema: Joi.ObjectSchema<any>;
|
|
267
268
|
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
268
269
|
};
|
|
270
|
+
readonly 'inspect-strictness': {
|
|
271
|
+
readonly title: "Inspect Strict Functions Query";
|
|
272
|
+
readonly executor: typeof import("./catalog/inspect-strictness-query/inspect-strictness-query-executor").executeStrictnessQuery;
|
|
273
|
+
readonly asciiSummarizer: (formatter: OutputFormatter, processed: ReadonlyFlowrAnalysisProvider<import("../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => Promise<boolean>;
|
|
274
|
+
readonly fromLine: (output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"inspect-strictness">;
|
|
275
|
+
readonly syntax: "@inspect-strictness [(<crit>;...)] <code | file://path>";
|
|
276
|
+
readonly schema: Joi.ObjectSchema<any>;
|
|
277
|
+
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
278
|
+
};
|
|
269
279
|
readonly 'resolve-value': {
|
|
270
280
|
readonly title: "Resolve Value Query";
|
|
271
281
|
readonly executor: typeof import("./catalog/resolve-value-query/resolve-value-query-executor").executeResolveValueQuery;
|
package/queries/query.js
CHANGED
|
@@ -40,6 +40,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
40
40
|
const files_query_format_1 = require("./catalog/files-query/files-query-format");
|
|
41
41
|
const call_graph_query_format_1 = require("./catalog/call-graph-query/call-graph-query-format");
|
|
42
42
|
const inspect_recursion_query_format_1 = require("./catalog/inspect-recursion-query/inspect-recursion-query-format");
|
|
43
|
+
const inspect_strictness_query_format_1 = require("./catalog/inspect-strictness-query/inspect-strictness-query-format");
|
|
43
44
|
const does_call_query_format_1 = require("./catalog/does-call-query/does-call-query-format");
|
|
44
45
|
const inspect_exception_query_format_1 = require("./catalog/inspect-exceptions-query/inspect-exception-query-format");
|
|
45
46
|
const input_sources_query_format_1 = require("./catalog/input-sources-query/input-sources-query-format");
|
|
@@ -70,6 +71,7 @@ exports.SupportedQueries = {
|
|
|
70
71
|
'inspect-exception': inspect_exception_query_format_1.InspectExceptionQueryDefinition,
|
|
71
72
|
'inspect-higher-order': inspect_higher_order_query_format_1.InspectHigherOrderQueryDefinition,
|
|
72
73
|
'inspect-recursion': inspect_recursion_query_format_1.InspectRecursionQueryDefinition,
|
|
74
|
+
'inspect-strictness': inspect_strictness_query_format_1.InspectStrictnessQueryDefinition,
|
|
73
75
|
'resolve-value': resolve_value_query_format_1.ResolveValueQueryDefinition,
|
|
74
76
|
'project': project_query_format_1.ProjectQueryDefinition,
|
|
75
77
|
'signature': signature_query_format_1.SignatureQueryDefinition,
|
|
@@ -116,7 +116,7 @@ export declare const RConstant: {
|
|
|
116
116
|
*/
|
|
117
117
|
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RConstant<Info>;
|
|
118
118
|
/**
|
|
119
|
-
* A set of all types of constants in the normalized AST, i.e. number, string and logical constants.
|
|
119
|
+
* A set of all types of constants in the normalized AST, i.e. number, string, and logical constants.
|
|
120
120
|
*/
|
|
121
121
|
readonly constantTypes: ReadonlySet<RType>;
|
|
122
122
|
};
|
|
@@ -126,7 +126,7 @@ export declare const RConstant: {
|
|
|
126
126
|
*/
|
|
127
127
|
export type RSingleNode<Info> = RComment<Info> | RSymbol<Info> | RConstant<Info> | RBreak<Info> | RNext<Info> | RLineDirective<Info>;
|
|
128
128
|
/**
|
|
129
|
-
* Represents a leaf node in the normalized AST, i.e. a node that does not have any children. This includes comment, symbol, constant, break, next and line directive nodes.
|
|
129
|
+
* Represents a leaf node in the normalized AST, i.e. a node that does not have any children. This includes comment, symbol, constant, break, next, and line directive nodes.
|
|
130
130
|
*/
|
|
131
131
|
export declare const RSingleNode: {
|
|
132
132
|
readonly name: "RSingleNode";
|
|
@@ -136,7 +136,7 @@ export declare const RSingleNode: {
|
|
|
136
136
|
*/
|
|
137
137
|
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RSingleNode<Info>;
|
|
138
138
|
/**
|
|
139
|
-
* A set of all types of single nodes in the normalized AST, i.e. comment, symbol, constant, break, next and line directive nodes.
|
|
139
|
+
* A set of all types of single nodes in the normalized AST, i.e. comment, symbol, constant, break, next, and line directive nodes.
|
|
140
140
|
*/
|
|
141
141
|
readonly singleNodeTypes: ReadonlySet<RType>;
|
|
142
142
|
};
|
|
@@ -186,7 +186,7 @@ export declare const RFunctions: {
|
|
|
186
186
|
*/
|
|
187
187
|
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RFunctions<Info>;
|
|
188
188
|
/**
|
|
189
|
-
* A set of all types of function-related nodes in the normalized AST, i.e. function definitions, function calls, parameters and arguments.
|
|
189
|
+
* A set of all types of function-related nodes in the normalized AST, i.e. function definitions, function calls, parameters, and arguments.
|
|
190
190
|
*/
|
|
191
191
|
readonly functionTypes: ReadonlySet<RType>;
|
|
192
192
|
};
|
|
@@ -25,12 +25,12 @@ exports.RConstant = {
|
|
|
25
25
|
return t === type_1.RType.Number || t === type_1.RType.String || t === type_1.RType.Logical;
|
|
26
26
|
},
|
|
27
27
|
/**
|
|
28
|
-
* A set of all types of constants in the normalized AST, i.e. number, string and logical constants.
|
|
28
|
+
* A set of all types of constants in the normalized AST, i.e. number, string, and logical constants.
|
|
29
29
|
*/
|
|
30
30
|
constantTypes: new Set([type_1.RType.Number, type_1.RType.String, type_1.RType.Logical])
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
|
-
* Represents a leaf node in the normalized AST, i.e. a node that does not have any children. This includes comment, symbol, constant, break, next and line directive nodes.
|
|
33
|
+
* Represents a leaf node in the normalized AST, i.e. a node that does not have any children. This includes comment, symbol, constant, break, next, and line directive nodes.
|
|
34
34
|
*/
|
|
35
35
|
exports.RSingleNode = {
|
|
36
36
|
name: 'RSingleNode',
|
|
@@ -46,7 +46,7 @@ exports.RSingleNode = {
|
|
|
46
46
|
return t === type_1.RType.Comment || t === type_1.RType.Symbol || exports.RConstant.constantTypes.has(t) || t === type_1.RType.Break || t === type_1.RType.Next || t === type_1.RType.LineDirective;
|
|
47
47
|
},
|
|
48
48
|
/**
|
|
49
|
-
* A set of all types of single nodes in the normalized AST, i.e. comment, symbol, constant, break, next and line directive nodes.
|
|
49
|
+
* A set of all types of single nodes in the normalized AST, i.e. comment, symbol, constant, break, next, and line directive nodes.
|
|
50
50
|
*/
|
|
51
51
|
singleNodeTypes: new Set([type_1.RType.Comment, type_1.RType.Symbol, type_1.RType.Break, type_1.RType.Next, type_1.RType.LineDirective, ...exports.RConstant.constantTypes])
|
|
52
52
|
};
|
|
@@ -100,7 +100,7 @@ exports.RFunctions = {
|
|
|
100
100
|
return t === type_1.RType.FunctionDefinition || t === type_1.RType.FunctionCall || t === type_1.RType.Parameter || t === type_1.RType.Argument;
|
|
101
101
|
},
|
|
102
102
|
/**
|
|
103
|
-
* A set of all types of function-related nodes in the normalized AST, i.e. function definitions, function calls, parameters and arguments.
|
|
103
|
+
* A set of all types of function-related nodes in the normalized AST, i.e. function definitions, function calls, parameters, and arguments.
|
|
104
104
|
*/
|
|
105
105
|
functionTypes: new Set([type_1.RType.FunctionDefinition, type_1.RType.FunctionCall, type_1.RType.Parameter, type_1.RType.Argument])
|
|
106
106
|
};
|
|
@@ -11,8 +11,6 @@ const search_enrichers_1 = require("./search-executor/search-enrichers");
|
|
|
11
11
|
const objects_1 = require("../util/objects");
|
|
12
12
|
const search_generators_1 = require("./search-executor/search-generators");
|
|
13
13
|
const query_fn_props_1 = require("../dataflow/environments/query-fn-props");
|
|
14
|
-
const df_helper_1 = require("../dataflow/graph/df-helper");
|
|
15
|
-
const environment_1 = require("../dataflow/environments/environment");
|
|
16
14
|
var FlowrFilter;
|
|
17
15
|
(function (FlowrFilter) {
|
|
18
16
|
/**
|
|
@@ -78,17 +76,7 @@ exports.FlowrFilters = {
|
|
|
78
76
|
return rx.test(file ?? '');
|
|
79
77
|
}),
|
|
80
78
|
[FlowrFilter.CallProps]: ((e, args, data) => {
|
|
81
|
-
const
|
|
82
|
-
const vertex = graph.getVertex(e.node.info.id);
|
|
83
|
-
if (!vertex_1.FunctionCallVertex.is(vertex)) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
/* what the call resolved to decides, as a definition in the analyzed code shadows the built-in; a call
|
|
87
|
-
* flowR settled on the built-ins keeps no environment, and a later redefinition must not speak for it */
|
|
88
|
-
const known = vertex.environment ?? data.dataflow.environment;
|
|
89
|
-
const environment = vertex.onlyBuiltin ? { level: 0, current: environment_1.REnvironment.findBuiltIn(known.current) } : known;
|
|
90
|
-
const name = df_helper_1.Dataflow.qualify(e.node.info.id, graph, false) ?? vertex.name;
|
|
91
|
-
const props = (0, query_fn_props_1.queryFnProps)(name, { environment })?.props ?? 0;
|
|
79
|
+
const props = (0, query_fn_props_1.callFnProps)(e.node.info.id, data.dataflow)?.props ?? 0;
|
|
92
80
|
return args.matchType === 'every' ? (props & args.props) === args.props : (props & args.props) !== 0;
|
|
93
81
|
})
|
|
94
82
|
};
|
|
@@ -6,7 +6,7 @@ type FileFilterSuffix = '' | `(${string})`;
|
|
|
6
6
|
export type SlicingCriterion = `${number}:${number}${FileFilterSuffix}` | `${number}~${number}${FileFilterSuffix}` | `${number}^${FileFilterSuffix}` | `${number}@${string}` | `$${NodeId | number}`;
|
|
7
7
|
/**
|
|
8
8
|
* The helper object associated with {@link SlicingCriterion} which makes it easy
|
|
9
|
-
* to parse, validate and resolve slicing criteria.
|
|
9
|
+
* to parse, validate, and resolve slicing criteria.
|
|
10
10
|
*/
|
|
11
11
|
export declare const SlicingCriterion: {
|
|
12
12
|
readonly name: "SlicingCriterion";
|
|
@@ -41,7 +41,7 @@ export interface DecodedCriterion {
|
|
|
41
41
|
}
|
|
42
42
|
export type DecodedCriteria = ReadonlyArray<DecodedCriterion>;
|
|
43
43
|
/**
|
|
44
|
-
* The helper object associated with {@link SlicingCriteria} which makes it easy to parse, validate and resolve slicing criteria.
|
|
44
|
+
* The helper object associated with {@link SlicingCriteria} which makes it easy to parse, validate, and resolve slicing criteria.
|
|
45
45
|
*/
|
|
46
46
|
export declare const SlicingCriteria: {
|
|
47
47
|
readonly name: "SlicingCriteria";
|
|
@@ -8,7 +8,7 @@ const static_slicer_1 = require("../static/static-slicer");
|
|
|
8
8
|
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
9
9
|
/**
|
|
10
10
|
* The helper object associated with {@link SlicingCriterion} which makes it easy
|
|
11
|
-
* to parse, validate and resolve slicing criteria.
|
|
11
|
+
* to parse, validate, and resolve slicing criteria.
|
|
12
12
|
*/
|
|
13
13
|
exports.SlicingCriterion = {
|
|
14
14
|
name: 'SlicingCriterion',
|
|
@@ -89,7 +89,7 @@ exports.SlicingCriterion = {
|
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
/**
|
|
92
|
-
* The helper object associated with {@link SlicingCriteria} which makes it easy to parse, validate and resolve slicing criteria.
|
|
92
|
+
* The helper object associated with {@link SlicingCriteria} which makes it easy to parse, validate, and resolve slicing criteria.
|
|
93
93
|
*/
|
|
94
94
|
exports.SlicingCriteria = {
|
|
95
95
|
name: 'SlicingCriteria',
|
|
@@ -15,7 +15,7 @@ const HashOptions = {
|
|
|
15
15
|
ignoreUnknown: true,
|
|
16
16
|
replacer: (v) => (0, environment_1.isDefaultBuiltInEnvironment)(v) ? undefined : v
|
|
17
17
|
};
|
|
18
|
-
/* definitions, definition maps and frames are shared across the environments a slice builds, and a definition may
|
|
18
|
+
/* definitions, definition maps, and frames are shared across the environments a slice builds, and a definition may
|
|
19
19
|
* hold a whole environment of its own (`envState`), so each is hashed once instead of on every fingerprint. The
|
|
20
20
|
* map is keyed separately from the frame because cloning a frame shares its definitions until one side writes
|
|
21
21
|
* (see {@link Environment#clone}): the graph holds many frames per distinct set of definitions, and hashing that
|
package/util/objects.d.ts
CHANGED
|
@@ -58,4 +58,16 @@ export declare function deepClonePreserveUnclonable<T>(obj: T): T;
|
|
|
58
58
|
* @param logger - The logger to use for trace debugging.
|
|
59
59
|
*/
|
|
60
60
|
export declare function looselyCompareObjects(obj: Record<string, unknown>, expected: Record<string, unknown>, arrayMatch?: 'some' | 'every', logger?: Logger<ILogObj>): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Reads the value at the given dot-separated `path` of `obj` (e.g. `solver.sigdb.additionalPaths`),
|
|
63
|
+
* or `undefined` if any segment along the way is missing.
|
|
64
|
+
* @see {@link setOnPath} for the counterpart that writes such a path
|
|
65
|
+
*/
|
|
66
|
+
export declare function getOnPath(obj: unknown, path: string): unknown;
|
|
67
|
+
/**
|
|
68
|
+
* Writes `value` at the given dot-separated `path` of `obj`, creating the intermediate steps that do not exist yet.
|
|
69
|
+
* An intermediate is created as an array if the segment indexing it is a number, and as an object otherwise.
|
|
70
|
+
* @see {@link getOnPath} for the counterpart that reads such a path
|
|
71
|
+
*/
|
|
72
|
+
export declare function setOnPath(obj: object, path: string, value: unknown): void;
|
|
61
73
|
export {};
|
package/util/objects.js
CHANGED
|
@@ -7,6 +7,9 @@ exports.deepMergeObjectInPlace = deepMergeObjectInPlace;
|
|
|
7
7
|
exports.compactRecord = compactRecord;
|
|
8
8
|
exports.deepClonePreserveUnclonable = deepClonePreserveUnclonable;
|
|
9
9
|
exports.looselyCompareObjects = looselyCompareObjects;
|
|
10
|
+
exports.getOnPath = getOnPath;
|
|
11
|
+
exports.setOnPath = setOnPath;
|
|
12
|
+
const assert_1 = require("./assert");
|
|
10
13
|
const json_1 = require("./json");
|
|
11
14
|
const log_1 = require("./log");
|
|
12
15
|
/**
|
|
@@ -194,4 +197,49 @@ function looselyCompareObjects(obj, expected, arrayMatch, logger) {
|
|
|
194
197
|
(0, log_1.expensiveTrace)(logger, () => `Object ${JSON.stringify(obj)} matches ${JSON.stringify(expected)}`);
|
|
195
198
|
return true;
|
|
196
199
|
}
|
|
200
|
+
/** Segments that would let a dotted path reach into the prototype chain. */
|
|
201
|
+
const magicPathSegments = new Set(['__proto__', 'prototype', 'constructor']);
|
|
202
|
+
/**
|
|
203
|
+
* Splits a dot-separated path into its segments, turning integral segments into numbers
|
|
204
|
+
* so that `a.0.b` indexes an array rather than an object with the key `'0'`.
|
|
205
|
+
*/
|
|
206
|
+
function pathSegments(path) {
|
|
207
|
+
return path.split('.').map(segment => {
|
|
208
|
+
(0, assert_1.guard)(!magicPathSegments.has(segment), () => `refusing to walk the magic property '${segment}' in path '${path}'`);
|
|
209
|
+
const asInt = parseInt(segment);
|
|
210
|
+
return String(asInt) === segment ? asInt : segment;
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Reads the value at the given dot-separated `path` of `obj` (e.g. `solver.sigdb.additionalPaths`),
|
|
215
|
+
* or `undefined` if any segment along the way is missing.
|
|
216
|
+
* @see {@link setOnPath} for the counterpart that writes such a path
|
|
217
|
+
*/
|
|
218
|
+
function getOnPath(obj, path) {
|
|
219
|
+
let at = obj;
|
|
220
|
+
for (const segment of pathSegments(path)) {
|
|
221
|
+
if (at === null || typeof at !== 'object' || !Object.prototype.hasOwnProperty.call(at, segment)) {
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
224
|
+
at = at[segment];
|
|
225
|
+
}
|
|
226
|
+
return at;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Writes `value` at the given dot-separated `path` of `obj`, creating the intermediate steps that do not exist yet.
|
|
230
|
+
* An intermediate is created as an array if the segment indexing it is a number, and as an object otherwise.
|
|
231
|
+
* @see {@link getOnPath} for the counterpart that reads such a path
|
|
232
|
+
*/
|
|
233
|
+
function setOnPath(obj, path, value) {
|
|
234
|
+
const segments = pathSegments(path);
|
|
235
|
+
let at = obj;
|
|
236
|
+
for (let i = 0; i < segments.length - 1; i++) {
|
|
237
|
+
const segment = segments[i];
|
|
238
|
+
if (at[segment] === undefined) {
|
|
239
|
+
at[segment] = typeof segments[i + 1] === 'number' ? [] : {};
|
|
240
|
+
}
|
|
241
|
+
at = at[segment];
|
|
242
|
+
}
|
|
243
|
+
at[segments[segments.length - 1]] = value;
|
|
244
|
+
}
|
|
197
245
|
//# sourceMappingURL=objects.js.map
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dfgToAscii = dfgToAscii;
|
|
4
|
-
const dagre_1 = require("dagre");
|
|
5
4
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
6
5
|
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
7
6
|
const edge_1 = require("../../dataflow/graph/edge");
|
|
7
|
+
let dagreModule;
|
|
8
|
+
/* type-only import above, `dagre` is optional: the ascii layout is a side feature, so the package is resolved at call time */
|
|
9
|
+
function dagre() {
|
|
10
|
+
try {
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- loaded on demand, see above
|
|
12
|
+
return dagreModule ??= require('dagre');
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
throw new Error('the optional dependency `dagre` is required to render a dataflow graph as ascii, install it with `npm i dagre`');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
8
18
|
function combineAscii(has, add) {
|
|
9
19
|
if (has === ' ' || has === add) {
|
|
10
20
|
return add;
|
|
@@ -72,7 +82,8 @@ class AsciiCanvas {
|
|
|
72
82
|
* Converts the given dataflow graph to an ASCII representation.
|
|
73
83
|
*/
|
|
74
84
|
function dfgToAscii(dfg) {
|
|
75
|
-
const
|
|
85
|
+
const { graphlib: dagreGraphlib, layout } = dagre();
|
|
86
|
+
const g = new dagreGraphlib.Graph();
|
|
76
87
|
const verts = Array.from(dfg.vertices(true));
|
|
77
88
|
g.setGraph({
|
|
78
89
|
nodesep: 1,
|
|
@@ -106,7 +117,7 @@ function dfgToAscii(dfg) {
|
|
|
106
117
|
edgesDone.add(`${from}-${to}`);
|
|
107
118
|
}
|
|
108
119
|
}
|
|
109
|
-
|
|
120
|
+
layout(g, {
|
|
110
121
|
minlen: 2
|
|
111
122
|
});
|
|
112
123
|
const canvas = new AsciiCanvas();
|
package/util/text/name-rank.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What a reader most likely meant when typing a name: a well-used package first, base R ahead of CRAN, and
|
|
3
|
-
* the things one rarely reaches for last, which are S3 methods, `%operators
|
|
3
|
+
* the things one rarely reaches for last, which are S3 methods, `%operators%`, and names starting with a dot.
|
|
4
4
|
*
|
|
5
5
|
* The signature browser and the playground's completion both offer names out of the same database, so they
|
|
6
6
|
* order them with the same {@link rankName}, and what one of them learns the other one knows.
|
package/util/text/name-rank.js
CHANGED
|
@@ -22,7 +22,7 @@ const Adjustments = [
|
|
|
22
22
|
offer `ggplot` before `plotH`, because one of them is a function people actually call */
|
|
23
23
|
[500, ({ known }) => known === true],
|
|
24
24
|
[-30, ({ s3 }) => s3 === true],
|
|
25
|
-
/* operators, punctuation and SHOUTING names are rarely what someone is looking for */
|
|
25
|
+
/* operators, punctuation, and SHOUTING names are rarely what someone is looking for */
|
|
26
26
|
[-60, ({ name }) => /^%.*%$/.test(name) || /^[^\w.]/.test(name)],
|
|
27
27
|
[-30, ({ name, needle }) => name === name.toUpperCase() && /[A-Z]/.test(name) && name !== needle],
|
|
28
28
|
[-400, ({ name }) => name.startsWith('.')]
|
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.14.
|
|
45
|
+
const version = '2.14.1';
|
|
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
|
/**
|