@eagleoutice/flowr 2.13.9 → 2.13.10
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/config.d.ts +50 -2
- package/config.js +37 -6
- package/dataflow/environments/apply-kill.js +4 -4
- package/dataflow/environments/built-in-props.d.ts +28 -4
- package/dataflow/environments/built-in-props.js +31 -8
- package/dataflow/environments/built-in.d.ts +7 -2
- package/dataflow/environments/built-in.js +10 -12
- package/dataflow/environments/default-builtin-config.d.ts +46 -6
- package/dataflow/environments/default-builtin-config.js +30 -16
- package/dataflow/environments/environment.d.ts +16 -0
- package/dataflow/environments/environment.js +70 -18
- package/dataflow/environments/identifier.d.ts +6 -0
- package/dataflow/environments/identifier.js +18 -5
- package/dataflow/environments/query-fn-props.js +34 -2
- package/dataflow/environments/reference-to-maybe.js +1 -1
- package/dataflow/eval/resolve/alias-tracking.js +45 -1
- package/dataflow/eval/resolve/resolve-argument.js +25 -17
- package/dataflow/eval/resolve/resolve-strings.d.ts +17 -0
- package/dataflow/eval/resolve/resolve-strings.js +16 -9
- package/dataflow/eval/resolve/resolve.js +3 -1
- package/dataflow/graph/call-graph.d.ts +7 -0
- package/dataflow/graph/call-graph.js +103 -0
- package/dataflow/graph/df-helper.d.ts +2 -0
- package/dataflow/graph/graph.d.ts +5 -8
- package/dataflow/internal/linker.d.ts +5 -5
- package/dataflow/internal/linker.js +31 -92
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +3 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +4 -30
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -6
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +32 -14
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +16 -4
- package/dataflow/internal/process/functions/call/known-call-handling.js +29 -8
- package/documentation/doc-util/doc-sigdb.d.ts +9 -0
- package/documentation/doc-util/doc-sigdb.js +32 -0
- package/documentation/wiki-interface.js +13 -2
- package/documentation/wiki-query.js +3 -0
- package/documentation/wiki-signature-database.js +2 -5
- package/gas.d.ts +6 -0
- package/gas.js +7 -1
- package/package.json +1 -1
- package/project/attached-packages.d.ts +13 -0
- package/project/attached-packages.js +30 -0
- package/project/context/flowr-analyzer-context.d.ts +15 -0
- package/project/context/flowr-analyzer-context.js +14 -3
- package/project/context/flowr-analyzer-files-context.d.ts +11 -0
- package/project/context/flowr-analyzer-files-context.js +3 -0
- package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +4 -0
- package/project/context/flowr-analyzer-incremental-analysis-context.js +69 -0
- package/project/dependency-version-space.d.ts +33 -11
- package/project/dependency-version-space.js +58 -32
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +52 -24
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.d.ts +22 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +101 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +30 -11
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +79 -37
- package/project/plugins/plugin-registry.d.ts +2 -1
- package/project/plugins/plugin-registry.js +2 -0
- package/project/sigdb/manifest.js +9 -5
- package/project/sigdb/signature-match.d.ts +5 -18
- package/project/sigdb/signature-match.js +5 -18
- package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +4 -0
- package/queries/catalog/call-graph-query/call-graph-query-format.js +4 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +10 -3
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +19 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +22 -2
- package/queries/catalog/dependencies-query/function-info/library-functions.js +7 -1
- package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -5
- package/queries/catalog/dependencies-query/function-info/remote-functions.d.ts +18 -0
- package/queries/catalog/dependencies-query/function-info/remote-functions.js +46 -0
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +52 -2
- package/queries/catalog/dependencies-query/function-info/write-functions.js +8 -4
- package/queries/catalog/dependencies-query/link-devices.d.ts +12 -0
- package/queries/catalog/dependencies-query/link-devices.js +58 -0
- package/queries/catalog/dice-query/dice-query-format.d.ts +2 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +25 -6
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +37 -6
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +17 -4
- package/queries/catalog/input-sources-query/input-sources-query-format.js +4 -0
- package/queries/catalog/input-sources-query/input-types.d.ts +10 -0
- package/queries/catalog/input-sources-query/input-types.js +10 -0
- package/queries/catalog/location-map-query/location-map-query-executor.js +16 -6
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +15 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +22 -5
- package/queries/catalog/signature-query/signature-query-executor.js +3 -0
- package/queries/catalog/signature-query/signature-query-format.d.ts +5 -0
- package/queries/query.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/model.d.ts +14 -2
- package/r-bridge/lang-4.x/ast/model/model.js +32 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +7 -8
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +9 -46
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +0 -5
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +6 -3
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
- package/search/flowr-search-filters.d.ts +17 -1
- package/search/flowr-search-filters.js +23 -0
- package/slicing/criterion/parse.d.ts +5 -25
- package/slicing/criterion/parse.js +15 -20
- package/slicing/static/fingerprint.js +18 -6
- package/slicing/static/slicer-types.d.ts +10 -0
- package/slicing/static/static-slicer.d.ts +1 -1
- package/slicing/static/static-slicer.js +29 -6
- package/slicing/static/visiting-queue.d.ts +12 -2
- package/slicing/static/visiting-queue.js +28 -3
- package/util/arg-matching.d.ts +18 -0
- package/util/arg-matching.js +70 -0
- package/util/r-regex.js +19 -1
- package/util/range.d.ts +7 -8
- package/util/range.js +10 -11
- package/util/version.js +1 -1
|
@@ -25,6 +25,7 @@ const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/node
|
|
|
25
25
|
const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
|
|
26
26
|
const general_1 = require("../../../../../eval/values/general");
|
|
27
27
|
const package_1 = require("../../../../../../project/plugins/package-version-plugins/package");
|
|
28
|
+
const attached_packages_1 = require("../../../../../../project/attached-packages");
|
|
28
29
|
const flowr_namespace_file_1 = require("../../../../../../project/plugins/file-plugins/files/flowr-namespace-file");
|
|
29
30
|
const common_1 = require("../common");
|
|
30
31
|
const linker_1 = require("../../../../linker");
|
|
@@ -406,7 +407,12 @@ function attachDependencyToEnvironment(dependency, envInfo, ctx, spec = {}, defi
|
|
|
406
407
|
importsEnv = recImports(importsEnv, dependency.namespaceInfo, ctx, new Set());
|
|
407
408
|
const namespaceEnv = new environment_1.Environment(importsEnv).asLibrary(pack, environment_1.EnvType.Namespace)
|
|
408
409
|
.defineAll(exports.map(exp => exportDefinition(pack, exp, definedAt)));
|
|
409
|
-
|
|
410
|
+
const attached = { level: envInfo.level, current: environment_1.REnvironment.attachAt(envInfo.current, namespaceEnv, importsEnv, spec.pos) };
|
|
411
|
+
/* whatever R puts on the search path with it, `pack` first so a dependency cycle stays finite (the guard above stops it) */
|
|
412
|
+
return (0, attached_packages_1.attachedAlongside)(pack, ctx.deps.signatureSources()).reduce((env, alongside) => {
|
|
413
|
+
const dependency = ctx.deps.getDependency(alongside);
|
|
414
|
+
return dependency === undefined ? env : attachDependencyToEnvironment(dependency, env, ctx, spec, definedAt);
|
|
415
|
+
}, attached);
|
|
410
416
|
}
|
|
411
417
|
/** A namespace-only load is subsumed by any layer for `pack`; a full attach ignores a mere {@link EnvType.LoadedNamespace}. */
|
|
412
418
|
function blocksAttach(layer, namespaceOnly) {
|
|
@@ -222,12 +222,12 @@ function sexpTypeToReferenceType(type) {
|
|
|
222
222
|
function getArguments(args, data) {
|
|
223
223
|
// prefer R's real `base::load` signature from the database, falling back to the known formals when it is absent
|
|
224
224
|
const loadParams = (0, built_in_envir_utils_1.signatureParamNames)(data, identifier_1.Identifier.make('load', "base" /* PkgName.Base */), ['file', 'envir', 'verbose']);
|
|
225
|
-
const bound =
|
|
225
|
+
const bound = r_function_call_1.RFunctionCall.matchArgsToParams(args, loadParams);
|
|
226
226
|
const fileArgBound = bound.get('file');
|
|
227
227
|
const envirArg = bound.get('envir');
|
|
228
228
|
const verboseArgBound = bound.get('verbose');
|
|
229
|
-
const fileArg = fileArgBound
|
|
230
|
-
const verboseArg = verboseArgBound
|
|
229
|
+
const fileArg = fileArgBound ? (0, unpack_argument_1.unpackArg)(fileArgBound) : undefined;
|
|
230
|
+
const verboseArg = verboseArgBound ? (0, unpack_argument_1.unpackArg)(verboseArgBound) : undefined;
|
|
231
231
|
return { fileArg, envirArg, verboseArg };
|
|
232
232
|
}
|
|
233
233
|
//# sourceMappingURL=built-in-load.js.map
|
|
@@ -2,7 +2,7 @@ import type { DataflowProcessorInformation } from '../../../../../processor';
|
|
|
2
2
|
import type { DataflowInformation } from '../../../../../info';
|
|
3
3
|
import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
4
4
|
import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
5
|
-
import
|
|
5
|
+
import { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
6
6
|
import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
7
|
import type { BrandedIdentifier } from '../../../../../environments/identifier';
|
|
8
8
|
/**
|
|
@@ -6,6 +6,7 @@ const assert_1 = require("../../../../../../util/assert");
|
|
|
6
6
|
const unpack_argument_1 = require("../argument/unpack-argument");
|
|
7
7
|
const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
8
8
|
const data_masking_functions_1 = require("../../../../../environments/data-masking-functions");
|
|
9
|
+
const r_symbol_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
|
|
9
10
|
const model_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/model");
|
|
10
11
|
const logger_1 = require("../../../../../logger");
|
|
11
12
|
const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
@@ -99,8 +100,11 @@ function processPipe(name, args, rootId, data, { pipePlaceholderName, assignLhs,
|
|
|
99
100
|
if (arg === r_function_call_1.EmptyArgument) {
|
|
100
101
|
continue;
|
|
101
102
|
}
|
|
103
|
+
/* only the symbols may name columns, the rest is evaluated in the caller's frame */
|
|
102
104
|
model_1.RNode.visitAst(arg, node => {
|
|
103
|
-
|
|
105
|
+
if (r_symbol_1.RSymbol.is(node)) {
|
|
106
|
+
information.graph.addEdge(rhs.info.id, node.info.id, edge_1.EdgeType.NonStandardEvaluation);
|
|
107
|
+
}
|
|
104
108
|
return false;
|
|
105
109
|
});
|
|
106
110
|
}
|
|
@@ -14,8 +14,8 @@ import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/proce
|
|
|
14
14
|
* - `with`: writes in `expr` are ephemeral (R's `with` uses a temporary scope and discards them).
|
|
15
15
|
* - `within`: writes in `expr` are persisted back into the tracked envState of `data`.
|
|
16
16
|
*
|
|
17
|
-
* Arguments are resolved
|
|
18
|
-
*
|
|
17
|
+
* Arguments are resolved with {@link RFunctionCall.matchArgsToParams}, so `with(expr=x, data=e)` and
|
|
18
|
+
* `with(dat=e, x)` are handled correctly.
|
|
19
19
|
*
|
|
20
20
|
* Falls back to a normal function-call analysis when the data argument cannot be resolved
|
|
21
21
|
* to a tracked environment.
|
|
@@ -15,7 +15,7 @@ const withParamsFallback = ['data', 'expr'];
|
|
|
15
15
|
/** Normal call analysis, marking the data-masked arguments (columns of the data) as NSE. */
|
|
16
16
|
function markAsMaskedFallback(name, args, rootId, data) {
|
|
17
17
|
const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.With });
|
|
18
|
-
(0, known_call_handling_1.markArgumentsAsNonStandardEvaluation)(information.graph, rootId, processedArguments, known_call_handling_1.NseArguments.AllButFirst);
|
|
18
|
+
(0, known_call_handling_1.markArgumentsAsNonStandardEvaluation)(information.graph, rootId, processedArguments, known_call_handling_1.NseArguments.AllButFirst, known_call_handling_1.NseKind.DataMasked);
|
|
19
19
|
return information;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
@@ -28,8 +28,8 @@ function markAsMaskedFallback(name, args, rootId, data) {
|
|
|
28
28
|
* - `with`: writes in `expr` are ephemeral (R's `with` uses a temporary scope and discards them).
|
|
29
29
|
* - `within`: writes in `expr` are persisted back into the tracked envState of `data`.
|
|
30
30
|
*
|
|
31
|
-
* Arguments are resolved
|
|
32
|
-
*
|
|
31
|
+
* Arguments are resolved with {@link RFunctionCall.matchArgsToParams}, so `with(expr=x, data=e)` and
|
|
32
|
+
* `with(dat=e, x)` are handled correctly.
|
|
33
33
|
*
|
|
34
34
|
* Falls back to a normal function-call analysis when the data argument cannot be resolved
|
|
35
35
|
* to a tracked environment.
|
|
@@ -40,13 +40,12 @@ function processWithEnv(name, args, rootId, data) {
|
|
|
40
40
|
}
|
|
41
41
|
// prefer R's real `base::with` signature from the database, falling back to the known formals when it is absent
|
|
42
42
|
// use the call's own name (`with` or `within`) qualified to base, so each gets its real signature
|
|
43
|
-
const bound =
|
|
43
|
+
const bound = r_function_call_1.RFunctionCall.matchArgsToParams(args, (0, built_in_envir_utils_1.signatureParamNames)(data, identifier_1.Identifier.make(identifier_1.Identifier.getName(name.content), "base" /* PkgName.Base */), withParamsFallback));
|
|
44
44
|
const dataArg = bound.get('data');
|
|
45
45
|
const exprArg = bound.get('expr');
|
|
46
46
|
// when we cannot resolve the data to a tracked environment, `expr` is still data-masked: its symbols name
|
|
47
47
|
// columns of `data`, not variables in scope, so mark the non-data arguments as non-standard-evaluated
|
|
48
|
-
if (dataArg ===
|
|
49
|
-
exprArg === r_function_call_1.EmptyArgument || exprArg?.value === undefined) {
|
|
48
|
+
if (dataArg?.value === undefined || exprArg?.value === undefined) {
|
|
50
49
|
return markAsMaskedFallback(name, args, rootId, data);
|
|
51
50
|
}
|
|
52
51
|
const envirResolution = (0, built_in_envir_utils_1.resolveArgToEnvir)(dataArg, data);
|
|
@@ -136,24 +136,37 @@ function attachedPackages(_id, fdef) {
|
|
|
136
136
|
}
|
|
137
137
|
return packages;
|
|
138
138
|
}
|
|
139
|
-
/** The
|
|
140
|
-
function
|
|
141
|
-
const defs = [];
|
|
142
|
-
// skip the function's own frame; outer-scope definitions escaped
|
|
139
|
+
/** The scopes outside a function's own frame, i.e. those a definition of its body can have escaped into. */
|
|
140
|
+
function* escapeTargetFrames(fdef) {
|
|
143
141
|
for (let e = fdef.subflow.environment.current.parent; e !== undefined && !e.builtInEnv; e = e.parent) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
yield e;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The non-built-in definitions a function body lets escape to an outer scope (e.g. a `<<-` super-assignment),
|
|
147
|
+
* as a callback for {@link computeCallGraphSummaries}. Nested definitions share their outer frames, and a frame is
|
|
148
|
+
* dominated by the built-ins it holds, so filtering each frame once per pass saves the bulk of the work.
|
|
149
|
+
*/
|
|
150
|
+
function escapedDefinitions() {
|
|
151
|
+
const perFrame = new Map();
|
|
152
|
+
return (_id, fdef) => {
|
|
153
|
+
const defs = [];
|
|
154
|
+
for (const e of escapeTargetFrames(fdef)) {
|
|
155
|
+
let escaped = perFrame.get(e.memory);
|
|
156
|
+
if (escaped === undefined) {
|
|
157
|
+
escaped = [...e.memory.values()].flatMap(ds => ds.filter(d => !node_id_1.NodeId.isBuiltIn(d.nodeId)).map(d => d.nodeId));
|
|
158
|
+
perFrame.set(e.memory, escaped);
|
|
159
|
+
}
|
|
160
|
+
for (const d of escaped) {
|
|
161
|
+
defs.push(d);
|
|
149
162
|
}
|
|
150
163
|
}
|
|
151
|
-
|
|
152
|
-
|
|
164
|
+
return defs;
|
|
165
|
+
};
|
|
153
166
|
}
|
|
154
167
|
/** Emits {@link EdgeType.SideEffectOnCall} edges for definitions that escape a function transitively. */
|
|
155
168
|
function propagateTransitiveDefinitions(graph, environment, ctx) {
|
|
156
|
-
const summary = computeCallGraphSummaries(graph, escapedDefinitions);
|
|
169
|
+
const summary = computeCallGraphSummaries(graph, escapedDefinitions());
|
|
157
170
|
for (const [id, vertex] of graph.vertices(true)) {
|
|
158
171
|
if (vertex.tag !== vertex_1.VertexType.FunctionCall) {
|
|
159
172
|
continue;
|
|
@@ -206,11 +219,16 @@ function propagateTransitivePackages(graph, environment, ctx) {
|
|
|
206
219
|
/** Maps each escaped definition's node id to its full (name-carrying) definition. */
|
|
207
220
|
function escapedDefinitionMap(graph) {
|
|
208
221
|
const map = new Map();
|
|
222
|
+
const seen = new Set();
|
|
209
223
|
for (const [, vertex] of graph.vertices(true)) {
|
|
210
224
|
if (vertex.tag !== vertex_1.VertexType.FunctionDefinition) {
|
|
211
225
|
continue;
|
|
212
226
|
}
|
|
213
|
-
for (
|
|
227
|
+
for (const e of escapeTargetFrames(vertex)) {
|
|
228
|
+
if (seen.has(e.memory)) {
|
|
229
|
+
continue; // a frame shared with an already-visited definition contributes the same entries
|
|
230
|
+
}
|
|
231
|
+
seen.add(e.memory);
|
|
214
232
|
for (const definitions of e.memory.values()) {
|
|
215
233
|
for (const def of definitions) {
|
|
216
234
|
if (!node_id_1.NodeId.isBuiltIn(def.nodeId) && def.name !== undefined) {
|
|
@@ -228,7 +246,7 @@ function escapedDefinitionMap(graph) {
|
|
|
228
246
|
* @returns the enriched environment and whether it grew (so the extractor can re-resolve open reads and re-run).
|
|
229
247
|
*/
|
|
230
248
|
function propagateTransitiveEscapedDefinitions(graph, environment) {
|
|
231
|
-
const summary = computeCallGraphSummaries(graph, escapedDefinitions);
|
|
249
|
+
const summary = computeCallGraphSummaries(graph, escapedDefinitions());
|
|
232
250
|
const defs = escapedDefinitionMap(graph);
|
|
233
251
|
const names = new Set();
|
|
234
252
|
let grew = false;
|
|
@@ -58,11 +58,23 @@ export declare enum NseArguments {
|
|
|
58
58
|
First = "first"
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* Besides the {@link NseArguments} shorthands, the positions may be listed explicitly.
|
|
61
|
+
* How an argument escapes standard evaluation, which decides what is marked
|
|
62
|
+
* {@link EdgeType.NonStandardEvaluation}.
|
|
64
63
|
*/
|
|
65
|
-
export declare
|
|
64
|
+
export declare enum NseKind {
|
|
65
|
+
/** the argument is not evaluated at all (`quote(x + y)`), so nothing within it is */
|
|
66
|
+
Quoted = "quoted",
|
|
67
|
+
/** the argument is evaluated in a data mask (`subset(d, a > k)`), where only its symbols may name columns */
|
|
68
|
+
DataMasked = "data-masked"
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Marks the selected arguments as {@link EdgeType.NonStandardEvaluation}, so they are recognised as not being
|
|
72
|
+
* evaluated the standard way. A {@link NseKind.Quoted|quoted} argument is marked entirely, as none of it is
|
|
73
|
+
* evaluated. A {@link NseKind.DataMasked|data-masked} one is evaluated in the caller's frame, with only the
|
|
74
|
+
* names the mask supplies (those that resolve to nothing else) taken from the data, so only those are marked.
|
|
75
|
+
* Besides the {@link NseArguments} shorthands, the positions may be listed explicitly, `undefined` marks nothing.
|
|
76
|
+
*/
|
|
77
|
+
export declare function markArgumentsAsNonStandardEvaluation(graph: DataflowGraph, rootId: NodeId, processedArguments: readonly (DataflowInformation | undefined)[], which: NseArguments | readonly number[] | undefined, kind?: NseKind): void;
|
|
66
78
|
/**
|
|
67
79
|
* Marks the given arguments as being involved in R's non-standard evaluation.
|
|
68
80
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NseArguments = void 0;
|
|
3
|
+
exports.NseKind = exports.NseArguments = void 0;
|
|
4
4
|
exports.markArgumentsAsNonStandardEvaluation = markArgumentsAsNonStandardEvaluation;
|
|
5
5
|
exports.markNonStandardEvaluationEdges = markNonStandardEvaluationEdges;
|
|
6
6
|
exports.processKnownFunctionCall = processKnownFunctionCall;
|
|
@@ -27,20 +27,41 @@ var NseArguments;
|
|
|
27
27
|
NseArguments["First"] = "first";
|
|
28
28
|
})(NseArguments || (exports.NseArguments = NseArguments = {}));
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* Besides the {@link NseArguments} shorthands, the positions may be listed explicitly.
|
|
30
|
+
* How an argument escapes standard evaluation, which decides what is marked
|
|
31
|
+
* {@link EdgeType.NonStandardEvaluation}.
|
|
33
32
|
*/
|
|
34
|
-
|
|
33
|
+
var NseKind;
|
|
34
|
+
(function (NseKind) {
|
|
35
|
+
/** the argument is not evaluated at all (`quote(x + y)`), so nothing within it is */
|
|
36
|
+
NseKind["Quoted"] = "quoted";
|
|
37
|
+
/** the argument is evaluated in a data mask (`subset(d, a > k)`), where only its symbols may name columns */
|
|
38
|
+
NseKind["DataMasked"] = "data-masked";
|
|
39
|
+
})(NseKind || (exports.NseKind = NseKind = {}));
|
|
40
|
+
/**
|
|
41
|
+
* Marks the selected arguments as {@link EdgeType.NonStandardEvaluation}, so they are recognised as not being
|
|
42
|
+
* evaluated the standard way. A {@link NseKind.Quoted|quoted} argument is marked entirely, as none of it is
|
|
43
|
+
* evaluated. A {@link NseKind.DataMasked|data-masked} one is evaluated in the caller's frame, with only the
|
|
44
|
+
* names the mask supplies (those that resolve to nothing else) taken from the data, so only those are marked.
|
|
45
|
+
* Besides the {@link NseArguments} shorthands, the positions may be listed explicitly, `undefined` marks nothing.
|
|
46
|
+
*/
|
|
47
|
+
function markArgumentsAsNonStandardEvaluation(graph, rootId, processedArguments, which, kind = NseKind.Quoted) {
|
|
48
|
+
if (which === undefined) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
35
51
|
const end = which === NseArguments.First ? 1 : processedArguments.length;
|
|
36
52
|
for (let i = which === NseArguments.AllButFirst ? 1 : 0; i < end; i++) {
|
|
37
53
|
const arg = processedArguments[i];
|
|
38
54
|
if (arg === undefined || (typeof which !== 'string' && !which.includes(i))) {
|
|
39
55
|
continue;
|
|
40
56
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
57
|
+
if (kind === NseKind.Quoted) {
|
|
58
|
+
graph.addEdge(rootId, arg.entryPoint, edge_1.EdgeType.NonStandardEvaluation);
|
|
59
|
+
}
|
|
60
|
+
for (const [vtx, info] of arg.graph.vertices(true)) {
|
|
61
|
+
/* a masked name the caller does not bind is the one the data supplies */
|
|
62
|
+
if (kind === NseKind.Quoted || (vertex_1.UseVertex.is(info) && !arg.graph.outgoingEdges(vtx)?.values().some(e => edge_1.DfEdge.includesType(e, edge_1.EdgeType.Reads)))) {
|
|
63
|
+
graph.addEdge(rootId, vtx, edge_1.EdgeType.NonStandardEvaluation);
|
|
64
|
+
}
|
|
44
65
|
}
|
|
45
66
|
}
|
|
46
67
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Whether a CRAN signature database is installed, i.e. more than the `base` shard every checkout ships. */
|
|
2
|
+
export declare function cranDatabaseAvailable(): boolean;
|
|
3
|
+
/** The warning shown when a page that documents the signature database is generated without one. */
|
|
4
|
+
export declare function missingSigDbWarning(target: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Warns that `target` documents the signature database while none is installed, so whatever it would write
|
|
7
|
+
* shows base R alone. Returns whether the database is missing, so a caller can skip the page instead.
|
|
8
|
+
*/
|
|
9
|
+
export declare function warnMissingSigDb(target: string): boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cranDatabaseAvailable = cranDatabaseAvailable;
|
|
4
|
+
exports.missingSigDbWarning = missingSigDbWarning;
|
|
5
|
+
exports.warnMissingSigDb = warnMissingSigDb;
|
|
6
|
+
const manifest_1 = require("../../project/sigdb/manifest");
|
|
7
|
+
const ansi_1 = require("../../util/text/ansi");
|
|
8
|
+
/** Whether a CRAN signature database is installed, i.e. more than the `base` shard every checkout ships. */
|
|
9
|
+
function cranDatabaseAvailable() {
|
|
10
|
+
return (0, manifest_1.defaultSigDbPath)('current') !== undefined || (0, manifest_1.defaultSigDbPath)('full') !== undefined;
|
|
11
|
+
}
|
|
12
|
+
/** The warning shown when a page that documents the signature database is generated without one. */
|
|
13
|
+
function missingSigDbWarning(target) {
|
|
14
|
+
const warn = (s) => ansi_1.ansiFormatter.format(s, { color: 3 /* Colors.Yellow */, effect: ansi_1.ColorEffect.Foreground });
|
|
15
|
+
return warn(`
|
|
16
|
+
${(0, ansi_1.bold)('!! no signature database installed !!', ansi_1.ansiFormatter)}
|
|
17
|
+
[${target}] documents the signature database, but only the bundled base shard is present.
|
|
18
|
+
Generating it now would replace the committed page with base-R-only numbers and examples.
|
|
19
|
+
Run ${(0, ansi_1.bold)('npm run sync:sigdb', ansi_1.ansiFormatter)} first (see wiki/Signature Database), or leave the page as it is.`);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Warns that `target` documents the signature database while none is installed, so whatever it would write
|
|
23
|
+
* shows base R alone. Returns whether the database is missing, so a caller can skip the page instead.
|
|
24
|
+
*/
|
|
25
|
+
function warnMissingSigDb(target) {
|
|
26
|
+
if (cranDatabaseAvailable()) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
console.warn(missingSigDbWarning(target));
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=doc-sigdb.js.map
|
|
@@ -301,8 +301,19 @@ ${(0, doc_code_1.codeBlock)('json', JSON.stringify({
|
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
},
|
|
304
|
-
|
|
305
|
-
|
|
304
|
+
incremental: {
|
|
305
|
+
alwaysIncremental: false,
|
|
306
|
+
parsing: {
|
|
307
|
+
activated: false,
|
|
308
|
+
heuristics: {
|
|
309
|
+
activated: true,
|
|
310
|
+
mtime: true,
|
|
311
|
+
linesFrom: 500,
|
|
312
|
+
bytesFrom: 50_000,
|
|
313
|
+
alwaysWithEdits: false,
|
|
314
|
+
minFiles: 1,
|
|
315
|
+
},
|
|
316
|
+
},
|
|
306
317
|
},
|
|
307
318
|
gas: {
|
|
308
319
|
thresholds: {
|
|
@@ -44,6 +44,7 @@ const absint_query_executor_1 = require("../queries/catalog/absint-query/absint-
|
|
|
44
44
|
const dice_query_executor_1 = require("../queries/catalog/dice-query/dice-query-executor");
|
|
45
45
|
const dataflow_lens_query_executor_1 = require("../queries/catalog/dataflow-lens-query/dataflow-lens-query-executor");
|
|
46
46
|
const signature_query_executor_1 = require("../queries/catalog/signature-query/signature-query-executor");
|
|
47
|
+
const doc_sigdb_1 = require("./doc-util/doc-sigdb");
|
|
47
48
|
const guess_dep_versions_query_executor_1 = require("../queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor");
|
|
48
49
|
(0, doc_query_1.registerQueryDocumentation)('call-context', {
|
|
49
50
|
type: 'active',
|
|
@@ -1046,6 +1047,8 @@ class WikiQuery extends doc_maker_1.DocMaker {
|
|
|
1046
1047
|
}
|
|
1047
1048
|
async text({ ctx, shell }) {
|
|
1048
1049
|
(0, doc_query_1.assertAllQueriesDocumented)();
|
|
1050
|
+
/* the signature query documented here answers from the database, so its examples need one */
|
|
1051
|
+
(0, doc_sigdb_1.warnMissingSigDb)(this.getTarget());
|
|
1049
1052
|
for (const [file, content] of Object.entries({
|
|
1050
1053
|
...await (0, doc_query_1.queryPages)(shell, ctx, 'active'),
|
|
1051
1054
|
...await (0, doc_query_1.queryPages)(shell, ctx, 'virtual')
|
|
@@ -18,9 +18,7 @@ const config_1 = require("../config");
|
|
|
18
18
|
const flowr_analyzer_package_versions_sigdb_plugin_1 = require("../project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin");
|
|
19
19
|
const flowr_analyzer_builder_1 = require("../project/flowr-analyzer-builder");
|
|
20
20
|
const flowr_analyzer_dependencies_context_1 = require("../project/context/flowr-analyzer-dependencies-context");
|
|
21
|
-
|
|
22
|
-
return (0, manifest_1.defaultSigDbPath)('current') !== undefined || (0, manifest_1.defaultSigDbPath)('full') !== undefined;
|
|
23
|
-
}
|
|
21
|
+
const doc_sigdb_1 = require("./doc-util/doc-sigdb");
|
|
24
22
|
/** point the resolver at your own database (a file path or manifest) */
|
|
25
23
|
function usePackageDatabase(parser) {
|
|
26
24
|
const sigdb = new flowr_analyzer_package_versions_sigdb_plugin_1.FlowrAnalyzerPackageVersionsSigDbPlugin('/path/to/sigs.manifest.json.br');
|
|
@@ -201,8 +199,7 @@ class WikiSignatureDatabase extends doc_maker_1.DocMaker {
|
|
|
201
199
|
* leaves the committed page untouched, so the workflow reports no change and publishes nothing.
|
|
202
200
|
*/
|
|
203
201
|
async make(args) {
|
|
204
|
-
if (
|
|
205
|
-
console.log(` [${this.getTarget()}] skipped: no CRAN sigdb present (not downloaded); keeping the committed page`);
|
|
202
|
+
if ((0, doc_sigdb_1.warnMissingSigDb)(this.getTarget())) {
|
|
206
203
|
return false;
|
|
207
204
|
}
|
|
208
205
|
return super.make(args);
|
package/gas.d.ts
CHANGED
|
@@ -25,6 +25,12 @@ export declare const GasFeatureKey: {
|
|
|
25
25
|
readonly SideEffectLinking: "side-effect-linking";
|
|
26
26
|
/** Gas key for the linter, checked once per linting rule. Under critical pressure, remaining rules are skipped. */
|
|
27
27
|
readonly Linter: "linter";
|
|
28
|
+
/**
|
|
29
|
+
* Gas key for the static slicer, checked while traversing the dataflow graph. Under critical pressure the
|
|
30
|
+
* traversal stops and the slice is returned as far as it got (`SliceResult.stoppedEarly`), which is the only
|
|
31
|
+
* way to bound the otherwise synchronous traversal from the outside.
|
|
32
|
+
*/
|
|
33
|
+
readonly Slicer: "slicer";
|
|
28
34
|
};
|
|
29
35
|
export type GasFeatureKey = typeof GasFeatureKey[keyof typeof GasFeatureKey];
|
|
30
36
|
/** Paired low/high thresholds used inside {@link FlowrGasThresholds}. */
|
package/gas.js
CHANGED
|
@@ -13,6 +13,12 @@ exports.GasFeatureKey = {
|
|
|
13
13
|
/** Gas key for the side-effect link resolution phase of the dataflow extractor, which matches unknown side effects against call sites via the CFG and can be expensive for large scripts. */
|
|
14
14
|
SideEffectLinking: 'side-effect-linking',
|
|
15
15
|
/** Gas key for the linter, checked once per linting rule. Under critical pressure, remaining rules are skipped. */
|
|
16
|
-
Linter: 'linter'
|
|
16
|
+
Linter: 'linter',
|
|
17
|
+
/**
|
|
18
|
+
* Gas key for the static slicer, checked while traversing the dataflow graph. Under critical pressure the
|
|
19
|
+
* traversal stops and the slice is returned as far as it got (`SliceResult.stoppedEarly`), which is the only
|
|
20
|
+
* way to bound the otherwise synchronous traversal from the outside.
|
|
21
|
+
*/
|
|
22
|
+
Slicer: 'slicer'
|
|
17
23
|
};
|
|
18
24
|
//# sourceMappingURL=gas.js.map
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PackageSignatureSource } from './sigdb/reader';
|
|
2
|
+
/**
|
|
3
|
+
* Packages that attach further packages from their `.onAttach` hook, which no package metadata records: their core
|
|
4
|
+
* set sits in `Imports`, indistinguishable from the packages they merely use. Whoever loads one of them gets the
|
|
5
|
+
* whole set on the search path, so `library(tidyverse)` has to resolve `ggplot()`.
|
|
6
|
+
* `Depends` is handled generally by {@link attachedAlongside} and hence not repeated here.
|
|
7
|
+
*/
|
|
8
|
+
export declare const MetaPackageCores: ReadonlyMap<string, readonly string[]>;
|
|
9
|
+
/**
|
|
10
|
+
* The packages that end up on the search path alongside `pack` when it is attached: everything it `Depends` on
|
|
11
|
+
* (which R attaches with it) and, for a {@link MetaPackageCores|meta-package}, the core set it attaches itself.
|
|
12
|
+
*/
|
|
13
|
+
export declare function attachedAlongside(pack: string, sources: readonly PackageSignatureSource[], version?: string): readonly string[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MetaPackageCores = void 0;
|
|
4
|
+
exports.attachedAlongside = attachedAlongside;
|
|
5
|
+
/**
|
|
6
|
+
* Packages that attach further packages from their `.onAttach` hook, which no package metadata records: their core
|
|
7
|
+
* set sits in `Imports`, indistinguishable from the packages they merely use. Whoever loads one of them gets the
|
|
8
|
+
* whole set on the search path, so `library(tidyverse)` has to resolve `ggplot()`.
|
|
9
|
+
* `Depends` is handled generally by {@link attachedAlongside} and hence not repeated here.
|
|
10
|
+
*/
|
|
11
|
+
exports.MetaPackageCores = new Map([
|
|
12
|
+
['tidyverse', ['ggplot2', 'tibble', 'tidyr', 'readr', 'purrr', 'dplyr', 'stringr', 'forcats', 'lubridate']],
|
|
13
|
+
['tidymodels', ['broom', 'dials', 'dplyr', 'ggplot2', 'infer', 'modeldata', 'parsnip', 'purrr', 'recipes',
|
|
14
|
+
'rsample', 'tailor', 'tibble', 'tidyr', 'tune', 'workflows', 'workflowsets', 'yardstick']],
|
|
15
|
+
['easystats', ['bayestestR', 'correlation', 'datawizard', 'effectsize', 'insight', 'modelbased', 'parameters',
|
|
16
|
+
'performance', 'report', 'see']],
|
|
17
|
+
['fpp3', ['tibble', 'dplyr', 'tidyr', 'lubridate', 'ggplot2', 'tsibble', 'tsibbledata', 'ggtime', 'feasts', 'fable']]
|
|
18
|
+
]);
|
|
19
|
+
/**
|
|
20
|
+
* The packages that end up on the search path alongside `pack` when it is attached: everything it `Depends` on
|
|
21
|
+
* (which R attaches with it) and, for a {@link MetaPackageCores|meta-package}, the core set it attaches itself.
|
|
22
|
+
*/
|
|
23
|
+
function attachedAlongside(pack, sources, version) {
|
|
24
|
+
const depends = sources
|
|
25
|
+
.flatMap(src => src.dependencies(pack, version) ?? [])
|
|
26
|
+
.filter(d => d.type === 0 /* DepType.Depends */ && d.name !== 'R')
|
|
27
|
+
.map(d => d.name);
|
|
28
|
+
return [...new Set([...depends, ...exports.MetaPackageCores.get(pack) ?? []])];
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=attached-packages.js.map
|
|
@@ -45,6 +45,8 @@ export interface ReadOnlyFlowrAnalyzerContext {
|
|
|
45
45
|
readonly resolvedRVersion: string;
|
|
46
46
|
/** Whether {@link resolvedRVersion} is a genuine signal (a config pin, project metadata, or an engine-detected version) rather than the fallback default. */
|
|
47
47
|
readonly rVersionKnown: boolean;
|
|
48
|
+
/** Where {@link resolvedRVersion} comes from, as only {@link RVersionOrigin.Config} and {@link RVersionOrigin.Metadata} say anything about the analyzed code. */
|
|
49
|
+
readonly rVersionOrigin: RVersionOrigin;
|
|
48
50
|
/** Classify the {@link ProjectKind} of the project, see {@link ReadOnlyFlowrAnalyzerFilesContext#projectKind}. */
|
|
49
51
|
projectKind(): ProjectKind;
|
|
50
52
|
/** The versions a dependency can possibly have, see {@link ReadOnlyFlowrAnalyzerDependenciesContext#inferredRange}. */
|
|
@@ -57,6 +59,17 @@ export interface ReadOnlyFlowrAnalyzerContext {
|
|
|
57
59
|
*/
|
|
58
60
|
readonly gas: ReadOnlyFlowrAnalyzerGasContext;
|
|
59
61
|
}
|
|
62
|
+
/** Where the R version an analysis assumes comes from, see {@link ReadOnlyFlowrAnalyzerContext.rVersionOrigin}. */
|
|
63
|
+
export declare const enum RVersionOrigin {
|
|
64
|
+
/** pinned via `solver.sigdb.assumedRVersion` */
|
|
65
|
+
Config = "config",
|
|
66
|
+
/** stated by the project itself (e.g. a `DESCRIPTION` `Depends: R (>= x)`) */
|
|
67
|
+
Metadata = "metadata",
|
|
68
|
+
/** detected from the R installation running the analysis, which says nothing about the analyzed code */
|
|
69
|
+
Engine = "engine",
|
|
70
|
+
/** nothing said anything, so the fallback default is used */
|
|
71
|
+
Default = "default"
|
|
72
|
+
}
|
|
60
73
|
/**
|
|
61
74
|
* This summarizes the other context layers used by the {@link FlowrAnalyzer}.
|
|
62
75
|
* Have a look at the attributes and layers listed below (e.g., {@link files} and {@link deps})
|
|
@@ -131,6 +144,8 @@ export declare class FlowrAnalyzerContext implements ReadOnlyFlowrAnalyzerContex
|
|
|
131
144
|
get resolvedRVersion(): string;
|
|
132
145
|
/** Whether {@link resolvedRVersion} is a genuine signal (a config pin, project metadata, or engine detection) rather than the fallback default. */
|
|
133
146
|
get rVersionKnown(): boolean;
|
|
147
|
+
/** Where {@link resolvedRVersion} comes from, which decides what it says about the analyzed code. */
|
|
148
|
+
get rVersionOrigin(): RVersionOrigin;
|
|
134
149
|
/** Classify the {@link ProjectKind} of the project (delegates to the cached {@link FlowrAnalyzerFilesContext#projectKind}). */
|
|
135
150
|
projectKind(): ProjectKind;
|
|
136
151
|
/** The versions a dependency can possibly have (delegates to {@link FlowrAnalyzerDependenciesContext#inferredRange}). */
|
|
@@ -175,10 +175,21 @@ class FlowrAnalyzerContext {
|
|
|
175
175
|
}
|
|
176
176
|
/** Whether {@link resolvedRVersion} is a genuine signal (a config pin, project metadata, or engine detection) rather than the fallback default. */
|
|
177
177
|
get rVersionKnown() {
|
|
178
|
+
return this.rVersionOrigin !== "default" /* RVersionOrigin.Default */;
|
|
179
|
+
}
|
|
180
|
+
/** Where {@link resolvedRVersion} comes from, which decides what it says about the analyzed code. */
|
|
181
|
+
get rVersionOrigin() {
|
|
178
182
|
const setting = this.config.solver.sigdb.assumedRVersion;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
183
|
+
if (setting !== undefined && setting !== 'auto') {
|
|
184
|
+
return "config" /* RVersionOrigin.Config */;
|
|
185
|
+
}
|
|
186
|
+
else if (this.meta.getRVersion() !== undefined) {
|
|
187
|
+
return "metadata" /* RVersionOrigin.Metadata */;
|
|
188
|
+
}
|
|
189
|
+
else if (this._detectedR !== undefined && this._detectedR !== 'none' && this._detectedR !== 'unknown') {
|
|
190
|
+
return "engine" /* RVersionOrigin.Engine */;
|
|
191
|
+
}
|
|
192
|
+
return "default" /* RVersionOrigin.Default */;
|
|
182
193
|
}
|
|
183
194
|
/** Classify the {@link ProjectKind} of the project (delegates to the cached {@link FlowrAnalyzerFilesContext#projectKind}). */
|
|
184
195
|
projectKind() {
|
|
@@ -122,6 +122,16 @@ export interface ReadOnlyFlowrAnalyzerFilesContext {
|
|
|
122
122
|
* folder for a single-file request. Useful to report back which inputs did not resolve to anything.
|
|
123
123
|
*/
|
|
124
124
|
getRequestedRoots(): readonly string[];
|
|
125
|
+
/**
|
|
126
|
+
* The total number of files known to this context (every file added via {@link addFile}, both disk-backed and inline).
|
|
127
|
+
*
|
|
128
|
+
* This is unrelated to {@link getFilesByRole}: A file counted here may have no role, one role, or several
|
|
129
|
+
* (summing `getFilesByRole(role).length` over all roles can both over-count (multi-role files) and under-count (roleless files) relative to this method).
|
|
130
|
+
*
|
|
131
|
+
* Files that were merely considered during dataflow analysis (see {@link consideredFilesList}) but never actually added to the context are not included.
|
|
132
|
+
* @returns The number of files currently held by this context.
|
|
133
|
+
*/
|
|
134
|
+
getFileCount(): number;
|
|
125
135
|
}
|
|
126
136
|
/**
|
|
127
137
|
* This is the analyzer file context to be modified by all plugins that affect the files.
|
|
@@ -210,4 +220,5 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
|
|
|
210
220
|
getFilesByRole<Role extends FileRole>(role: Role): RoleBasedFiles[Role];
|
|
211
221
|
getAllFiles(): FlowrFileProvider[];
|
|
212
222
|
getFileByPath(path: string): FlowrFileProvider | undefined;
|
|
223
|
+
getFileCount(): number;
|
|
213
224
|
}
|
|
@@ -379,6 +379,9 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
|
|
|
379
379
|
getFileByPath(path) {
|
|
380
380
|
return this.files.get(path) ?? this.inlineFiles.find(f => f.path() === path);
|
|
381
381
|
}
|
|
382
|
+
getFileCount() {
|
|
383
|
+
return this.files.size + this.inlineFiles.length;
|
|
384
|
+
}
|
|
382
385
|
}
|
|
383
386
|
exports.FlowrAnalyzerFilesContext = FlowrAnalyzerFilesContext;
|
|
384
387
|
//# sourceMappingURL=flowr-analyzer-files-context.js.map
|
|
@@ -22,12 +22,16 @@ export declare class FlowrAnalyzerIncrementalAnalysisContext implements ReadOnly
|
|
|
22
22
|
*/
|
|
23
23
|
private changedFilesWithOldContent;
|
|
24
24
|
private oldParseResults;
|
|
25
|
+
private readonly lastKnownMtime;
|
|
25
26
|
constructor(context: FlowrAnalyzerContext);
|
|
26
27
|
reset(): void;
|
|
27
28
|
handleFileInvalidate(filePath: FilePath, oldContent: string | undefined): void;
|
|
29
|
+
handleShouldReparse(filePath: FilePath, ctx: FlowrAnalyzerContext): boolean;
|
|
28
30
|
receive(event: InvalidationEvent): void;
|
|
29
31
|
storeOldParseResults(parseStepOutput: ParseStepOutput<Parser.Tree>): void;
|
|
30
32
|
getOldParseResultOf(filePath: FilePath): Parser.Tree | undefined;
|
|
31
33
|
getOldContentOf(filePath: FilePath): string | undefined;
|
|
32
34
|
deleteOldContentOf(filePath: FilePath): void;
|
|
35
|
+
getLastKnownMtime(filePath: FilePath): number | undefined;
|
|
36
|
+
setLastKnownMtime(filePath: FilePath, mtimeMs: number): void;
|
|
33
37
|
}
|