@eagleoutice/flowr 2.13.3 → 2.13.5
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 +32 -32
- package/abstract-interpretation/absint-visitor.js +2 -2
- package/abstract-interpretation/data-frame/mappers/arguments.js +2 -2
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +1 -1
- package/abstract-interpretation/unsupported-functions.js +1 -1
- package/cli/repl/core.js +10 -2
- package/config.d.ts +4 -1
- package/config.js +10 -1
- package/control-flow/cfg-dead-code.js +91 -15
- package/control-flow/extract-cfg.js +93 -8
- package/control-flow/semantic-cfg-guided-visitor.js +2 -0
- package/dataflow/environments/built-in-config.d.ts +6 -3
- package/dataflow/environments/built-in-eval-name.d.ts +20 -0
- package/dataflow/environments/built-in-eval-name.js +25 -0
- package/dataflow/environments/built-in-proc-name.d.ts +4 -0
- package/dataflow/environments/built-in-proc-name.js +4 -0
- package/dataflow/environments/built-in-props.d.ts +175 -0
- package/dataflow/environments/built-in-props.js +207 -0
- package/dataflow/environments/built-in.d.ts +28 -20
- package/dataflow/environments/built-in.js +39 -8
- package/dataflow/environments/default-builtin-config.d.ts +1094 -86
- package/dataflow/environments/default-builtin-config.js +496 -212
- package/dataflow/environments/identifier.d.ts +25 -1
- package/dataflow/environments/identifier.js +24 -2
- package/dataflow/environments/query-fn-props.d.ts +102 -0
- package/dataflow/environments/query-fn-props.js +188 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +2 -0
- package/dataflow/eval/resolve/alias-tracking.js +12 -2
- package/dataflow/eval/resolve/match-arguments.d.ts +15 -0
- package/dataflow/eval/resolve/match-arguments.js +77 -0
- package/dataflow/eval/resolve/resolve-numbers.d.ts +202 -0
- package/dataflow/eval/resolve/resolve-numbers.js +163 -0
- package/dataflow/eval/resolve/resolve-operators.d.ts +60 -0
- package/dataflow/eval/resolve/resolve-operators.js +115 -0
- package/dataflow/eval/resolve/resolve-strings.d.ts +98 -0
- package/dataflow/eval/resolve/resolve-strings.js +116 -0
- package/dataflow/eval/resolve/resolve.d.ts +5 -23
- package/dataflow/eval/resolve/resolve.js +56 -87
- package/dataflow/fn/higher-order-function.js +3 -3
- package/dataflow/fn/recursive-function.js +1 -1
- package/dataflow/graph/df-helper.js +1 -1
- package/dataflow/graph/vertex.d.ts +32 -25
- package/dataflow/graph/vertex.js +40 -36
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +14 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +28 -29
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +41 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +14 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +45 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +30 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +62 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +63 -16
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +29 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +35 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +46 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +3 -1
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +2 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +24 -0
- package/dataflow/internal/process/functions/process-parameter.js +2 -1
- package/documentation/data/faq/faqs.js +11 -0
- package/documentation/doc-util/doc-types.js +1 -1
- package/documentation/wiki-analyzer.js +75 -0
- package/documentation/wiki-core.js +65 -16
- package/documentation/wiki-interface.js +3 -0
- package/linter/linter-rules.d.ts +10 -11
- package/linter/rules/absolute-path.js +1 -1
- package/linter/rules/deprecated-functions.js +5 -3
- package/linter/rules/function-finder-util.d.ts +2 -2
- package/linter/rules/function-finder-util.js +11 -4
- package/linter/rules/network-functions.d.ts +25 -5
- package/linter/rules/network-functions.js +51 -11
- package/linter/rules/no-leaked-credentials.js +1 -1
- package/linter/rules/problematic-inputs.d.ts +1 -1
- package/linter/rules/problematic-inputs.js +7 -1
- package/linter/rules/seeded-randomness.d.ts +5 -8
- package/linter/rules/seeded-randomness.js +17 -9
- package/linter/rules/undefined-symbol.js +1 -1
- package/linter/rules/unused-definition.js +15 -10
- package/linter/rules/useless-loop.js +1 -1
- package/package.json +3 -2
- package/project/cache/flowr-analyzer-cache.d.ts +4 -3
- package/project/cache/flowr-analyzer-cache.js +32 -13
- package/project/cache/flowr-cache.d.ts +39 -12
- package/project/cache/flowr-cache.js +5 -3
- package/project/context/flowr-analyzer-context.d.ts +8 -1
- package/project/context/flowr-analyzer-context.js +11 -1
- package/project/context/flowr-analyzer-dependencies-context.d.ts +4 -2
- package/project/context/flowr-analyzer-dependencies-context.js +15 -1
- package/project/context/flowr-analyzer-files-context.d.ts +8 -4
- package/project/context/flowr-analyzer-files-context.js +20 -1
- package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +33 -0
- package/project/context/flowr-analyzer-incremental-analysis-context.js +63 -0
- package/project/context/flowr-analyzer-meta-context.d.ts +3 -1
- package/project/context/flowr-analyzer-meta-context.js +14 -0
- package/project/context/flowr-file.d.ts +25 -3
- package/project/context/flowr-file.js +24 -2
- package/project/dependency-version-space.d.ts +37 -0
- package/project/dependency-version-space.js +118 -26
- package/project/flowr-analyzer.d.ts +6 -0
- package/project/flowr-analyzer.js +6 -2
- package/project/incremental/incremental-parse/edit-computation.d.ts +7 -0
- package/project/incremental/incremental-parse/edit-computation.js +61 -0
- package/project/incremental/incremental-parse/incremental-parse.d.ts +12 -0
- package/project/incremental/incremental-parse/incremental-parse.js +37 -0
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +57 -0
- package/project/plugins/file-plugins/files/flowr-manifest-files.js +121 -0
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +2 -2
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
- package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.d.ts +33 -0
- package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.js +53 -0
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +3 -3
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-manifest-file-plugin.d.ts +27 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-manifest-file-plugin.js +47 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +7 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +31 -3
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +10 -4
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +17 -4
- package/project/plugins/plugin-registry.d.ts +4 -4
- package/project/plugins/plugin-registry.js +7 -4
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +4 -4
- package/project/sigdb/reader.d.ts +7 -0
- package/project/sigdb/reader.js +12 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +1 -1
- package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +1 -1
- package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +10 -0
- package/queries/catalog/dependencies-query/function-info/derived-functions.js +41 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +14 -13
- package/queries/catalog/dependencies-query/function-info/write-functions.js +28 -36
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +33 -3
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +31 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +9 -2
- package/queries/catalog/input-sources-query/input-source-functions.d.ts +9 -10
- package/queries/catalog/input-sources-query/input-source-functions.js +23 -394
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +11 -6
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +7 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.js +28 -10
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +14 -1
- package/queries/catalog/input-sources-query/simple-input-classifier.js +24 -0
- package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -1
- package/queries/catalog/signature-query/signature-query-executor.js +79 -3
- package/queries/catalog/signature-query/signature-query-format.d.ts +27 -0
- package/queries/catalog/signature-query/signature-query-render.js +21 -3
- package/r-bridge/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +6 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +21 -2
- package/r-bridge/parser.d.ts +11 -1
- package/r-bridge/parser.js +7 -4
- package/r-bridge/shell-executor.d.ts +1 -0
- package/r-bridge/shell-executor.js +1 -0
- package/r-bridge/shell.d.ts +1 -0
- package/r-bridge/shell.js +1 -0
- package/reconstruct/inline/source-inline-map.js +1 -1
- package/search/flowr-search-filters.d.ts +1 -6
- package/search/flowr-search-filters.js +1 -8
- package/search/search-executor/search-enrichers.d.ts +2 -0
- package/search/search-executor/search-enrichers.js +29 -12
- package/util/mermaid/dfg.js +1 -1
- package/util/version.js +1 -1
- package/project/plugins/file-plugins/files/flowr-rproject-file.d.ts +0 -31
- package/project/plugins/file-plugins/files/flowr-rproject-file.js +0 -66
- package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.d.ts +0 -22
- package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.js +0 -36
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.d.ts +0 -13
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.js +0 -32
|
@@ -13,6 +13,10 @@ const reader_1 = require("../../../project/sigdb/reader");
|
|
|
13
13
|
const sigdb_version_1 = require("../../../project/sigdb/sigdb-version");
|
|
14
14
|
const schema_1 = require("../../../project/sigdb/schema");
|
|
15
15
|
const manifest_1 = require("../../../project/sigdb/manifest");
|
|
16
|
+
const query_fn_props_1 = require("../../../dataflow/environments/query-fn-props");
|
|
17
|
+
const resolve_by_name_1 = require("../../../dataflow/environments/resolve-by-name");
|
|
18
|
+
const built_in_props_1 = require("../../../dataflow/environments/built-in-props");
|
|
19
|
+
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
16
20
|
const r_version_1 = require("../../../util/r-version");
|
|
17
21
|
const r_base_packages_1 = require("../../../util/r-base-packages");
|
|
18
22
|
const mermaid_1 = require("../../../util/mermaid/mermaid");
|
|
@@ -175,6 +179,66 @@ function locationFields(pkg, fn, version, base, cran) {
|
|
|
175
179
|
...docUrlsFor(pkg, fn, version, base, cran)
|
|
176
180
|
};
|
|
177
181
|
}
|
|
182
|
+
/** the {@link CallProp}/{@link ArgProp} bits of `props`, lowercased, as the names to print */
|
|
183
|
+
function propNames(props, of) {
|
|
184
|
+
return Object.entries(of).filter(([, v]) => typeof v === 'number' && (props & v) !== 0).map(([k]) => k.toLowerCase());
|
|
185
|
+
}
|
|
186
|
+
/** the view of one {@link BuiltInFnInfo}: every declared parameter with what it is used for, and what comes back */
|
|
187
|
+
function flowrViewOf(info, sigParams) {
|
|
188
|
+
/* every declared parameter, even one flowR says nothing about, so the answer is the whole signature */
|
|
189
|
+
const args = (info.sig ?? []).map(([n, p]) => ({ name: n, roles: propNames(p, built_in_props_1.ArgProp) }));
|
|
190
|
+
const params = args.map(a => a.name);
|
|
191
|
+
const returns = info.sig?.find(([, p]) => (p & built_in_props_1.ArgProp.Alias) !== 0)?.[0];
|
|
192
|
+
/* flowR usually declares only the parameters it models, which is no disagreement as long as they line up */
|
|
193
|
+
const same = params.every((n, i) => n === sigParams[i]);
|
|
194
|
+
return {
|
|
195
|
+
props: propNames(info.props ?? 0, built_in_props_1.CallProp),
|
|
196
|
+
...(args.length > 0 ? { args } : {}),
|
|
197
|
+
...(returns !== undefined ? { returns } : {}),
|
|
198
|
+
...(params.length > 0 && !same ? { parameters: params } : {})
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* What flowR states about `pkg::name` itself, resolved in `env` so that a configured built-in wins over the
|
|
203
|
+
* default one. The parameter names are only reported when they differ from the ones `sigParams` records.
|
|
204
|
+
*/
|
|
205
|
+
function flowrView(env, pkg, name, sigParams) {
|
|
206
|
+
const info = env === undefined ? undefined : (0, query_fn_props_1.queryFnProps)(identifier_1.Identifier.make(name, pkg), { environment: env });
|
|
207
|
+
if (info === undefined || (info.props === undefined && info.sig === undefined)) {
|
|
208
|
+
return undefined;
|
|
209
|
+
}
|
|
210
|
+
return flowrViewOf(info, sigParams);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* The view of a call flowR models itself but the signature database has no entry for: the primitives and
|
|
214
|
+
* operators (`+`, `[`, `if`) that never appear in a package's sources, and anything a flowR configuration
|
|
215
|
+
* adds. `pkg` narrows the lookup when the query named one, otherwise the built-in's own namespace is reported.
|
|
216
|
+
*/
|
|
217
|
+
function flowrOnlyFunctionInfo(env, pkg, name) {
|
|
218
|
+
if (env === undefined) {
|
|
219
|
+
return undefined;
|
|
220
|
+
}
|
|
221
|
+
const resolved = (0, resolve_by_name_1.resolveByName)(pkg === undefined ? name : identifier_1.Identifier.make(name, pkg), env, identifier_1.ReferenceType.Function);
|
|
222
|
+
const definition = resolved?.find(d => d.type === identifier_1.ReferenceType.BuiltInFunction);
|
|
223
|
+
if (definition === undefined) {
|
|
224
|
+
return undefined;
|
|
225
|
+
}
|
|
226
|
+
const info = (0, query_fn_props_1.queryFnProps)(definition.name ?? name, { environment: env });
|
|
227
|
+
if (info === undefined || (info.props === undefined && info.sig === undefined)) {
|
|
228
|
+
return undefined;
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
name,
|
|
232
|
+
package: pkg ?? (definition.name === undefined ? undefined : identifier_1.Identifier.getNamespace(definition.name)) ?? 'base',
|
|
233
|
+
flowrOnly: true,
|
|
234
|
+
exported: true,
|
|
235
|
+
properties: [],
|
|
236
|
+
/* flowR states no defaults, so `required` stays `false` throughout; whether R forces a parameter it does know */
|
|
237
|
+
parameters: (info.sig ?? []).map(([n, p]) => ({ name: n, required: false, forced: (p & built_in_props_1.ArgProp.Forced) !== 0 })),
|
|
238
|
+
callees: [],
|
|
239
|
+
flowr: flowrViewOf(info, [])
|
|
240
|
+
};
|
|
241
|
+
}
|
|
178
242
|
/** the decoded view of one function, adding the CRAN-mirror source link */
|
|
179
243
|
function decodedToView(pkg, fn, version, opts) {
|
|
180
244
|
return {
|
|
@@ -199,7 +263,7 @@ function decodedToView(pkg, fn, version, opts) {
|
|
|
199
263
|
* read-only CRAN GitHub mirror. `version` defaults to the source's latest; `undefined` when the source does
|
|
200
264
|
* not carry that function.
|
|
201
265
|
*/
|
|
202
|
-
function signatureFunctionInfo(src, pkg, fnName, version) {
|
|
266
|
+
function signatureFunctionInfo(src, pkg, fnName, version, env) {
|
|
203
267
|
const fns = src.functions(pkg, version) ?? src.functions(pkg);
|
|
204
268
|
const fn = fns?.find(f => f.name === fnName);
|
|
205
269
|
if (fn === undefined) {
|
|
@@ -214,8 +278,10 @@ function signatureFunctionInfo(src, pkg, fnName, version) {
|
|
|
214
278
|
.map(f => f.name)
|
|
215
279
|
.sort();
|
|
216
280
|
const s3method = s3MethodParts(src, pkg, fns, fn);
|
|
281
|
+
const flowr = flowrView(env, pkg, fnName, view.parameters.map(p => p.name));
|
|
217
282
|
return {
|
|
218
283
|
...view,
|
|
284
|
+
...(flowr ? { flowr } : {}),
|
|
219
285
|
...(methods.length > 0 ? { s3generic: true, s3methods: methods } : {}),
|
|
220
286
|
...(s3method ? { s3method } : {})
|
|
221
287
|
};
|
|
@@ -687,6 +753,8 @@ async function executeSignatureQuery({ analyzer }, queries) {
|
|
|
687
753
|
}
|
|
688
754
|
}
|
|
689
755
|
const meta = () => ({ '.meta': { timing: Date.now() - start }, databases, packageCount: packages.size, sourceCount: sources.length });
|
|
756
|
+
/* the built-in environment answers for the primitives no package's sources contain, see flowrOnlyFunctionInfo */
|
|
757
|
+
const builtIn = (pkg, name) => flowrOnlyFunctionInfo(analyzer.inspectContext().env.makeCleanEnv(), pkg, name);
|
|
690
758
|
if (!q.package) {
|
|
691
759
|
// shard load-state is only shown in the summary, so it is only worth its filesystem probes here
|
|
692
760
|
return { ...meta(), shards: collectShardStatus(sources) };
|
|
@@ -713,7 +781,10 @@ async function executeSignatureQuery({ analyzer }, queries) {
|
|
|
713
781
|
// version must be looked up in whichever source actually has it (not just the first one found)
|
|
714
782
|
const owning = sources.filter(s => s.has(q.package));
|
|
715
783
|
if (owning.length === 0) {
|
|
716
|
-
|
|
784
|
+
// `@signature +` names no package but a call flowR models itself, so answer for that instead of not-found
|
|
785
|
+
const own = q.function === undefined ? builtIn(undefined, q.package) : undefined;
|
|
786
|
+
return own ? { ...meta(), function: own }
|
|
787
|
+
: { ...meta(), message: `The signature database does not know the package '${q.package}'.`, suggestions: suggest(packages, q.package) };
|
|
717
788
|
}
|
|
718
789
|
// the version to resolve against: an explicit `@version`, else the version flowR inferred for the script's
|
|
719
790
|
// dependency (which may be an older release that only `history` carries)
|
|
@@ -725,11 +796,16 @@ async function executeSignatureQuery({ analyzer }, queries) {
|
|
|
725
796
|
}
|
|
726
797
|
const resolvedSrc = src ?? owning[0];
|
|
727
798
|
if (q.function) {
|
|
728
|
-
const fn = signatureFunctionInfo(resolvedSrc, q.package, q.function, version);
|
|
799
|
+
const fn = signatureFunctionInfo(resolvedSrc, q.package, q.function, version, analyzer.inspectContext().env.makeCleanEnv());
|
|
729
800
|
if (fn) {
|
|
730
801
|
const cg = q.callGraph ? signatureCallGraphUrl(resolvedSrc, q.package, version, fn.name) : undefined;
|
|
731
802
|
return { ...meta(), function: cg ? { ...fn, callGraph: cg } : fn };
|
|
732
803
|
}
|
|
804
|
+
// a primitive like `base::+` has no entry in the package's sources, but flowR models it itself
|
|
805
|
+
const own = builtIn(q.package, q.function);
|
|
806
|
+
if (own) {
|
|
807
|
+
return { ...meta(), function: own };
|
|
808
|
+
}
|
|
733
809
|
const exports = resolvedSrc.lookup(q.package, version) ?? resolvedSrc.lookup(q.package);
|
|
734
810
|
const universe = new Set([
|
|
735
811
|
...(exports?.exported ?? []),
|
|
@@ -67,6 +67,33 @@ export interface SignatureFunctionView {
|
|
|
67
67
|
};
|
|
68
68
|
/** a mermaid.live link visualizing the transitive call graph from this function (only when requested with `--cg`) */
|
|
69
69
|
readonly callGraph?: string;
|
|
70
|
+
/** what flowR itself states about the function, from the built-in environment of the analysis */
|
|
71
|
+
readonly flowr?: SignatureFlowrView;
|
|
72
|
+
/**
|
|
73
|
+
* whether the whole view comes from flowR's built-in definition because the database has no entry: the
|
|
74
|
+
* primitives and operators (`+`, `[`, `if`) that appear in no package's sources, and anything a flowR
|
|
75
|
+
* configuration adds. Everything the database would contribute (defaults, callees, location) is then empty,
|
|
76
|
+
* and since flowR records no defaults, every {@link SignatureParameterView.required} reads `false`.
|
|
77
|
+
*/
|
|
78
|
+
readonly flowrOnly?: boolean;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* What flowR knows about a function on its own, next to what the database records: the properties of the
|
|
82
|
+
* call and what it uses each argument for. Read from the built-in environment of the analysis, so a
|
|
83
|
+
* configured or overwritten built-in is what shows up here.
|
|
84
|
+
*/
|
|
85
|
+
export interface SignatureFlowrView {
|
|
86
|
+
/** the {@link CallProp} names the built-in definition carries, like `pure` or `reads` */
|
|
87
|
+
readonly props: readonly string[];
|
|
88
|
+
/** the {@link ArgProp} names of every parameter flowR declares, in order; a parameter it says nothing about has no roles */
|
|
89
|
+
readonly args?: readonly {
|
|
90
|
+
readonly name: string;
|
|
91
|
+
readonly roles: readonly string[];
|
|
92
|
+
}[];
|
|
93
|
+
/** the parameter handed back as the result ({@link ArgProp.Alias}), which is what draws the `Returns` edge */
|
|
94
|
+
readonly returns?: string;
|
|
95
|
+
/** flowR's own parameter names, only present when they disagree with the ones the database records */
|
|
96
|
+
readonly parameters?: readonly string[];
|
|
70
97
|
}
|
|
71
98
|
/** one declared dependency of a package */
|
|
72
99
|
export interface SignatureDependencyView {
|
|
@@ -63,9 +63,15 @@ function pushFunction(result, f, fn) {
|
|
|
63
63
|
const generic = fn.s3generic ? ` ${(0, ansi_1.color)('S3 generic', 5 /* Colors.Magenta */, f, { style: 1 /* FontStyles.Bold */ })}` : '';
|
|
64
64
|
result.push(` ╰ ${(0, ansi_1.color)(fn.package, 6 /* Colors.Cyan */, f, { style: 1 /* FontStyles.Bold */ })}::${(0, ansi_1.bold)(fn.name, f)}${fn.version ? ` ${(0, ansi_1.color)('v' + fn.version, 2 /* Colors.Green */, f)}` : ''}${generic}`);
|
|
65
65
|
result.push(` ╰ ${renderSignature(f, fn)}`);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
if (fn.flowrOnly) {
|
|
67
|
+
// nothing below comes from the database, so say so instead of rendering its empty fields as facts
|
|
68
|
+
result.push(` ╰ ${(0, ansi_1.italic)('only flowR knows this one, the signature database has no entry', f)}`);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
const tags = [fn.exported ? (0, ansi_1.color)('exported', 2 /* Colors.Green */, f) : (0, ansi_1.color)('internal', 3 /* Colors.Yellow */, f),
|
|
72
|
+
...fn.properties.filter(p => p !== 'exported').map(p => (0, ansi_1.italic)(p, f))];
|
|
73
|
+
result.push(` ╰ ${tags.join(' ')}`);
|
|
74
|
+
}
|
|
69
75
|
if (fn.file) {
|
|
70
76
|
const loc = `${fn.file}${fn.line !== undefined ? `:${fn.line}` : ''}`;
|
|
71
77
|
result.push(` ╰ ${(0, ansi_1.italic)('source', f)} ${fn.sourceUrl ? `${loc} ${f.hyperlink(fn.sourceUrl, fn.sourceUrl)}` : loc}`);
|
|
@@ -80,6 +86,18 @@ function pushFunction(result, f, fn) {
|
|
|
80
86
|
if (fn.s3method) {
|
|
81
87
|
result.push(` ╰ ${(0, ansi_1.italic)('S3 method of', f)} ${(0, ansi_1.color)(`${fn.s3method.package}::${fn.s3method.generic}`, 5 /* Colors.Magenta */, f)} ${(0, ansi_1.italic)(`(class ${fn.s3method.class})`, f)}`);
|
|
82
88
|
}
|
|
89
|
+
if (fn.flowr) {
|
|
90
|
+
const args = (fn.flowr.args ?? []).map(a => `${a.name}${a.roles.length > 0 ? `: ${a.roles.join('+')}` : ''}`);
|
|
91
|
+
const props = fn.flowr.props.map(p => (0, ansi_1.color)(p, 4 /* Colors.Blue */, f)).join(', ');
|
|
92
|
+
const returns = fn.flowr.returns ? (0, ansi_1.italic)(`returns ${fn.flowr.returns}`, f) : '';
|
|
93
|
+
const line = [props, args.length > 0 ? (0, ansi_1.italic)(`(${args.join(', ')})`, f) : '', returns].filter(s => s !== '').join(' ');
|
|
94
|
+
if (line !== '') {
|
|
95
|
+
result.push(` ╰ ${(0, ansi_1.italic)('flowR', f)} ${line}`);
|
|
96
|
+
}
|
|
97
|
+
if (fn.flowr.parameters && !fn.flowrOnly) {
|
|
98
|
+
result.push(` ╰ ${(0, ansi_1.italic)('flowR', f)} ${(0, ansi_1.italic)('reads it as', f)} ${(0, ansi_1.bold)(fn.name, f)}(${fn.flowr.parameters.join(', ')})`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
83
101
|
const listLine = (label, items, max) => {
|
|
84
102
|
if (!items.length) {
|
|
85
103
|
return;
|
package/r-bridge/data/data.d.ts
CHANGED
|
@@ -637,8 +637,8 @@ export declare const flowrCapabilities: {
|
|
|
637
637
|
readonly name: string;
|
|
638
638
|
readonly href: "https://adv-r.hadley.nz/r6.html";
|
|
639
639
|
}];
|
|
640
|
-
readonly supported: "
|
|
641
|
-
readonly description: "_Handle R6 classes and methods as one unit.
|
|
640
|
+
readonly supported: "partially";
|
|
641
|
+
readonly description: "_Handle R6 classes and methods as one unit. We do not support typing, inheritance, private/active bindings, or handling objects fully \"as units.\"";
|
|
642
642
|
}, {
|
|
643
643
|
readonly name: "R7/S7";
|
|
644
644
|
readonly id: "oop-r7-s7";
|
package/r-bridge/data/data.js
CHANGED
|
@@ -799,8 +799,8 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
|
|
|
799
799
|
url: [
|
|
800
800
|
{ name: AdvancedR('R6'), href: 'https://adv-r.hadley.nz/r6.html' }
|
|
801
801
|
],
|
|
802
|
-
supported: '
|
|
803
|
-
description: '_Handle R6 classes and methods as one unit.
|
|
802
|
+
supported: 'partially',
|
|
803
|
+
description: '_Handle R6 classes and methods as one unit. We do not support typing, inheritance, private/active bindings, or handling objects fully "as units."'
|
|
804
804
|
},
|
|
805
805
|
{
|
|
806
806
|
name: 'R7/S7',
|
|
@@ -4,6 +4,7 @@ import type { RParseRequest } from '../../retriever';
|
|
|
4
4
|
import type { SyncParser, TreeSitterInformation } from '../../parser';
|
|
5
5
|
import type { TreeSitterEngineConfig } from '../../../config';
|
|
6
6
|
import type { ReadonlyFlowrAnalysisProvider } from '../../../project/flowr-analyzer';
|
|
7
|
+
import type { FlowrAnalyzerContext } from '../../../project/context/flowr-analyzer-context';
|
|
7
8
|
export declare const DEFAULT_TREE_SITTER_R_WASM_PATH = "./node_modules/@davisvaughan/tree-sitter-r/tree-sitter-r.wasm";
|
|
8
9
|
export declare const DEFAULT_TREE_SITTER_WASM_PATH = "./node_modules/web-tree-sitter/tree-sitter.wasm";
|
|
9
10
|
/**
|
|
@@ -12,6 +13,7 @@ export declare const DEFAULT_TREE_SITTER_WASM_PATH = "./node_modules/web-tree-si
|
|
|
12
13
|
export declare class TreeSitterExecutor implements SyncParser<Parser.Tree> {
|
|
13
14
|
readonly name = "tree-sitter";
|
|
14
15
|
private readonly parser;
|
|
16
|
+
readonly incremental = true;
|
|
15
17
|
private static language;
|
|
16
18
|
/**
|
|
17
19
|
* Initializes the underlying tree-sitter parser. This only needs to be called once globally.
|
|
@@ -24,8 +26,10 @@ export declare class TreeSitterExecutor implements SyncParser<Parser.Tree> {
|
|
|
24
26
|
rVersion(): Promise<string | 'unknown' | 'none'>;
|
|
25
27
|
information(analyzer: ReadonlyFlowrAnalysisProvider): TreeSitterInformation;
|
|
26
28
|
treeSitterVersion(): number;
|
|
27
|
-
parse(request: RParseRequest
|
|
29
|
+
parse(request: RParseRequest & {
|
|
30
|
+
filePath?: string;
|
|
31
|
+
}, ctx: FlowrAnalyzerContext): Parser.Tree;
|
|
28
32
|
createQuery(source: string): Query;
|
|
29
|
-
query(source: Query | string, ...tree: Parser.Tree[]): QueryCapture[];
|
|
33
|
+
query(source: Query | string, ...tree: readonly Parser.Tree[]): QueryCapture[];
|
|
30
34
|
close(): void;
|
|
31
35
|
}
|
|
@@ -7,6 +7,7 @@ exports.TreeSitterExecutor = exports.DEFAULT_TREE_SITTER_WASM_PATH = exports.DEF
|
|
|
7
7
|
const web_tree_sitter_1 = __importDefault(require("web-tree-sitter"));
|
|
8
8
|
const log_1 = require("../../../util/log");
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const incremental_parse_1 = require("../../../project/incremental/incremental-parse/incremental-parse");
|
|
10
11
|
exports.DEFAULT_TREE_SITTER_R_WASM_PATH = './node_modules/@davisvaughan/tree-sitter-r/tree-sitter-r.wasm';
|
|
11
12
|
exports.DEFAULT_TREE_SITTER_WASM_PATH = './node_modules/web-tree-sitter/tree-sitter.wasm';
|
|
12
13
|
const wasmLog = log_1.log.getSubLogger({ name: 'tree-sitter-wasm' });
|
|
@@ -16,6 +17,7 @@ const wasmLog = log_1.log.getSubLogger({ name: 'tree-sitter-wasm' });
|
|
|
16
17
|
class TreeSitterExecutor {
|
|
17
18
|
name = 'tree-sitter';
|
|
18
19
|
parser;
|
|
20
|
+
incremental = true;
|
|
19
21
|
static language;
|
|
20
22
|
/**
|
|
21
23
|
* Initializes the underlying tree-sitter parser. This only needs to be called once globally.
|
|
@@ -60,7 +62,7 @@ class TreeSitterExecutor {
|
|
|
60
62
|
treeSitterVersion() {
|
|
61
63
|
return this.parser.getLanguage().version;
|
|
62
64
|
}
|
|
63
|
-
parse(request) {
|
|
65
|
+
parse(request, ctx) {
|
|
64
66
|
let sourceCode;
|
|
65
67
|
if (request.request === 'file') {
|
|
66
68
|
sourceCode = fs_1.default.readFileSync(request.content, 'utf8');
|
|
@@ -68,7 +70,24 @@ class TreeSitterExecutor {
|
|
|
68
70
|
else {
|
|
69
71
|
sourceCode = request.content;
|
|
70
72
|
}
|
|
71
|
-
|
|
73
|
+
if (request.filePath === undefined || !ctx.config.incrementalParsing.activated) {
|
|
74
|
+
return this.parser.parse(sourceCode);
|
|
75
|
+
}
|
|
76
|
+
const reparseInfo = (0, incremental_parse_1.computeReparseInfo)(ctx, request.filePath);
|
|
77
|
+
// `computeReparseInfo` needs the stored old content to compute the edit against the
|
|
78
|
+
// previous tree. Once that snapshot has been consumed, drop it so a later invalidation
|
|
79
|
+
// can record a fresh old-content baseline for the next stored tree.
|
|
80
|
+
ctx.inc.deleteOldContentOf(request.filePath);
|
|
81
|
+
if (!reparseInfo) {
|
|
82
|
+
// incremental parsing not possible
|
|
83
|
+
return this.parser.parse(sourceCode);
|
|
84
|
+
}
|
|
85
|
+
if (!reparseInfo.editRegion) {
|
|
86
|
+
return reparseInfo.previousTree;
|
|
87
|
+
}
|
|
88
|
+
const previousTree = reparseInfo.previousTree;
|
|
89
|
+
previousTree.edit(reparseInfo.editRegion);
|
|
90
|
+
return this.parser.parse(sourceCode, previousTree);
|
|
72
91
|
}
|
|
73
92
|
createQuery(source) {
|
|
74
93
|
return this.parser.getLanguage().query(source);
|
package/r-bridge/parser.d.ts
CHANGED
|
@@ -7,8 +7,18 @@ import type { FlowrAnalysisProvider } from '../project/flowr-analyzer';
|
|
|
7
7
|
import type { FlowrAnalyzerContext } from '../project/context/flowr-analyzer-context';
|
|
8
8
|
interface ParserContent<T> {
|
|
9
9
|
readonly name: string;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the parser has incremental parsing capabilities
|
|
12
|
+
*/
|
|
13
|
+
readonly incremental: boolean;
|
|
10
14
|
information(analyzer: FlowrAnalysisProvider): BaseParserInformation;
|
|
11
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Parses the given request and uses the provided context (only if the parser
|
|
17
|
+
* itself supports incrementality {@link ParserContent#incremental}).
|
|
18
|
+
*/
|
|
19
|
+
parse(request: RParseRequestFromText & {
|
|
20
|
+
filePath?: string;
|
|
21
|
+
}, inc: FlowrAnalyzerContext | undefined): T;
|
|
12
22
|
close(): void;
|
|
13
23
|
}
|
|
14
24
|
export interface BaseParserInformation {
|
package/r-bridge/parser.js
CHANGED
|
@@ -8,14 +8,15 @@ exports.parseRequests = parseRequests;
|
|
|
8
8
|
* @returns The parsed AST per request in the loading order obtained from the {@link FlowrAnalyzerFilesContext|files context} of the given {@link FlowrAnalyzerContext}.
|
|
9
9
|
*/
|
|
10
10
|
async function parseRequests(_results, input) {
|
|
11
|
-
const
|
|
11
|
+
const ctx = input.context;
|
|
12
|
+
const loadingOrder = ctx.files.loadingOrder.getLoadingOrder();
|
|
12
13
|
/* in the future, we want to expose all cases */
|
|
13
14
|
const translatedRequests = loadingOrder.map(r => input.context.files.resolveRequest(r));
|
|
14
15
|
if (input.parser?.async) {
|
|
15
16
|
/* sadly we cannot Promise.all with the Rshell as it has to process commands in order and is not thread safe */
|
|
16
17
|
const files = [];
|
|
17
18
|
for (const req of translatedRequests) {
|
|
18
|
-
const parsed = await (input.parser).parse(req.r);
|
|
19
|
+
const parsed = await (input.parser).parse(req.r, ctx);
|
|
19
20
|
files.push({
|
|
20
21
|
parsed,
|
|
21
22
|
filePath: req.path,
|
|
@@ -30,12 +31,14 @@ async function parseRequests(_results, input) {
|
|
|
30
31
|
const p = input.parser;
|
|
31
32
|
return {
|
|
32
33
|
files: translatedRequests.map(r => {
|
|
33
|
-
const
|
|
34
|
+
const withPath = r.r;
|
|
35
|
+
withPath.filePath = r.path;
|
|
36
|
+
const parsed = p.parse(withPath, ctx);
|
|
34
37
|
return {
|
|
35
38
|
parsed,
|
|
36
39
|
filePath: r.path,
|
|
37
40
|
'.parse-meta': typeof parsed === 'object' && 'rootNode' in parsed ? {
|
|
38
|
-
tokenCount: parsed.rootNode
|
|
41
|
+
tokenCount: parsed.rootNode?.descendantCount ?? 0,
|
|
39
42
|
} : undefined
|
|
40
43
|
};
|
|
41
44
|
})
|
|
@@ -14,6 +14,7 @@ import { type RParseRequest } from './retriever';
|
|
|
14
14
|
*/
|
|
15
15
|
export declare class RShellExecutor implements SyncParser<string> {
|
|
16
16
|
readonly name = "r-shell";
|
|
17
|
+
readonly incremental = false;
|
|
17
18
|
readonly options: Readonly<RShellExecutionOptions>;
|
|
18
19
|
private readonly prerequisites;
|
|
19
20
|
constructor(options?: Partial<RShellExecutionOptions>);
|
package/r-bridge/shell.d.ts
CHANGED
|
@@ -85,6 +85,7 @@ export declare class RShell implements AsyncParser<string> {
|
|
|
85
85
|
readonly name = "r-shell";
|
|
86
86
|
readonly async = true;
|
|
87
87
|
readonly options: Readonly<RShellOptions>;
|
|
88
|
+
readonly incremental = false;
|
|
88
89
|
private _session;
|
|
89
90
|
private readonly log;
|
|
90
91
|
private versionCache;
|
package/r-bridge/shell.js
CHANGED
|
@@ -50,7 +50,7 @@ exports.SourceInlineMap = {
|
|
|
50
50
|
const sourceArgs = new Map();
|
|
51
51
|
const firstVertexByCd = new Map();
|
|
52
52
|
for (const [id, vertex] of graph.vertices(true)) {
|
|
53
|
-
if (
|
|
53
|
+
if (vertex_1.FunctionCallVertex.is(vertex) && Array.isArray(vertex.origin) && vertex.origin.includes(built_in_proc_name_1.BuiltInProcName.Source)) {
|
|
54
54
|
sourceArgs.set(id, sourceArg(ast, id));
|
|
55
55
|
}
|
|
56
56
|
const cds = vertex.cds;
|
|
@@ -6,7 +6,6 @@ import type { Enrichment } from './search-executor/search-enrichers';
|
|
|
6
6
|
import type { DataflowInformation } from '../dataflow/info';
|
|
7
7
|
import type { BuiltInProcName } from '../dataflow/environments/built-in-proc-name';
|
|
8
8
|
import type { RoleInParent } from '../r-bridge/lang-4.x/ast/model/processing/role';
|
|
9
|
-
import type { Identifier } from '../dataflow/environments/identifier';
|
|
10
9
|
export type FlowrFilterName = keyof typeof FlowrFilters;
|
|
11
10
|
interface FlowrFilterWithArgs<Filter extends FlowrFilterName, Args extends FlowrFilterArgs<Filter>> {
|
|
12
11
|
name: Filter;
|
|
@@ -21,7 +20,7 @@ export declare enum FlowrFilter {
|
|
|
21
20
|
/**
|
|
22
21
|
* Only returns search elements whose enrichments' JSON representations match a given test regular expression.
|
|
23
22
|
* This filter accepts {@link MatchesEnrichmentArgs}, which includes the enrichment to match for, as well as the regular expression to test the enrichment's (non-pretty-printed) JSON representation for.
|
|
24
|
-
* To test for included function names in an enrichment like {@link Enrichment.CallTargets}, the helper function {@link
|
|
23
|
+
* To test for included function names in an enrichment like {@link Enrichment.CallTargets}, the helper function {@link matchIdentifiers} can be used.
|
|
25
24
|
*/
|
|
26
25
|
MatchesEnrichment = "matches-enrichment",
|
|
27
26
|
/**
|
|
@@ -78,10 +77,6 @@ export interface OriginKindArgs {
|
|
|
78
77
|
export interface FilePathFilterArgs {
|
|
79
78
|
filePathRegex: string | RegExp;
|
|
80
79
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Helper to create a regular expression that matches function names, ignoring their package.
|
|
83
|
-
*/
|
|
84
|
-
export declare function testFunctionsIgnoringPackage(functions: readonly Identifier[]): RegExp;
|
|
85
80
|
type ValidFilterTypes<F extends FlowrFilter = FlowrFilter> = FlowrFilterName | FlowrFilterWithArgs<F, FlowrFilterArgs<F>> | RType | VertexType;
|
|
86
81
|
/**
|
|
87
82
|
* By default, we provide filter for every {@link RType} and {@link VertexType}.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.F = exports.FlowrFilterCombinator = exports.FlowrFilters = exports.ValidFlowrFiltersReverse = exports.ValidFlowrFilters = exports.FlowrFilter = void 0;
|
|
4
|
-
exports.testFunctionsIgnoringPackage = testFunctionsIgnoringPackage;
|
|
5
4
|
exports.binaryTreeToString = binaryTreeToString;
|
|
6
5
|
exports.isBinaryTree = isBinaryTree;
|
|
7
6
|
exports.evalFilter = evalFilter;
|
|
@@ -20,7 +19,7 @@ var FlowrFilter;
|
|
|
20
19
|
/**
|
|
21
20
|
* Only returns search elements whose enrichments' JSON representations match a given test regular expression.
|
|
22
21
|
* This filter accepts {@link MatchesEnrichmentArgs}, which includes the enrichment to match for, as well as the regular expression to test the enrichment's (non-pretty-printed) JSON representation for.
|
|
23
|
-
* To test for included function names in an enrichment like {@link Enrichment.CallTargets}, the helper function {@link
|
|
22
|
+
* To test for included function names in an enrichment like {@link Enrichment.CallTargets}, the helper function {@link matchIdentifiers} can be used.
|
|
24
23
|
*/
|
|
25
24
|
FlowrFilter["MatchesEnrichment"] = "matches-enrichment";
|
|
26
25
|
/**
|
|
@@ -69,12 +68,6 @@ exports.FlowrFilters = {
|
|
|
69
68
|
return rx.test(file ?? '');
|
|
70
69
|
})
|
|
71
70
|
};
|
|
72
|
-
/**
|
|
73
|
-
* Helper to create a regular expression that matches function names, ignoring their package.
|
|
74
|
-
*/
|
|
75
|
-
function testFunctionsIgnoringPackage(functions) {
|
|
76
|
-
return new RegExp(`^(.+:::?)?(${functions.join('|')})$`);
|
|
77
|
-
}
|
|
78
71
|
/**
|
|
79
72
|
* @see {@link FlowrFilterCombinator.is}
|
|
80
73
|
* @see {@link evalFilter}
|
|
@@ -39,6 +39,7 @@ export interface CallTargetsContent extends MergeableRecord {
|
|
|
39
39
|
/**
|
|
40
40
|
* The call targets of the function call.
|
|
41
41
|
* For identifier call targets, the identifier is the name of the library function being called.
|
|
42
|
+
* If the `qualifyNames` argument is unset or `true`, the returned call targets will always be stringified fully-qualified identifiers.
|
|
42
43
|
*/
|
|
43
44
|
targets: (FlowrSearchElement<ParentInformation> | string)[];
|
|
44
45
|
}
|
|
@@ -100,6 +101,7 @@ export declare const Enrichments: {
|
|
|
100
101
|
readonly "call-targets": {
|
|
101
102
|
enrichElement: (e: FlowrSearchElement<ParentInformation>, _s: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, analyzer: ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>, args: {
|
|
102
103
|
onlyBuiltin?: boolean;
|
|
104
|
+
qualifyNames?: boolean;
|
|
103
105
|
} | undefined, prev: CallTargetsContent | undefined) => Promise<CallTargetsContent>;
|
|
104
106
|
mapper: ({ targets }: CallTargetsContent) => FlowrSearchElement<ParentInformation>[];
|
|
105
107
|
};
|
|
@@ -41,30 +41,38 @@ exports.Enrichments = {
|
|
|
41
41
|
if (callVertex?.tag === vertex_1.VertexType.FunctionCall) {
|
|
42
42
|
const origins = df_helper_1.Dataflow.origin(df.graph, callVertex.id);
|
|
43
43
|
if (!origins || origins.length === 0) {
|
|
44
|
-
|
|
44
|
+
const name = (0, node_id_1.recoverName)(callVertex.id, n.idMap);
|
|
45
|
+
// we don't have origin information here, so pass undefined
|
|
46
|
+
content.targets = [qualifyIdentifier(undefined, name)];
|
|
45
47
|
}
|
|
46
48
|
else {
|
|
47
49
|
// find call targets in user code (which have ids!)
|
|
48
|
-
content.targets =
|
|
50
|
+
content.targets = origins.map(o => {
|
|
49
51
|
switch (o.type) {
|
|
50
|
-
case 2 /* OriginType.FunctionCallOrigin */:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
case 2 /* OriginType.FunctionCallOrigin */: {
|
|
53
|
+
if (node_id_1.NodeId.isBuiltIn(o.id)) {
|
|
54
|
+
// a built-in target (e.g. a materialized package export from `library()`) has no
|
|
55
|
+
// user-code node, so surface it as a built-in identifier (see `onlyBuiltin` below)
|
|
56
|
+
const name = (0, node_id_1.recoverName)(o.id, n.idMap);
|
|
57
|
+
return qualifyIdentifier([o], name) ?? String(o.id);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return { node: n.idMap.get(o.id) };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
56
63
|
case 3 /* OriginType.BuiltInFunctionOrigin */:
|
|
57
|
-
return
|
|
64
|
+
return qualifyIdentifier([o], o.fn.name);
|
|
58
65
|
default:
|
|
59
66
|
return undefined;
|
|
60
67
|
}
|
|
61
|
-
}).filter(assert_1.isNotUndefined)
|
|
68
|
+
}).filter(assert_1.isNotUndefined);
|
|
62
69
|
if (content.targets.length === 0) {
|
|
63
|
-
|
|
70
|
+
const name = (0, node_id_1.recoverName)(callVertex.id, n.idMap);
|
|
71
|
+
content.targets = [qualifyIdentifier(origins, name)];
|
|
64
72
|
}
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
|
-
// keep only calls whose targets are all built-in; library/package exports arrive as
|
|
75
|
+
// keep only calls whose targets are all built-in; library/package exports arrive as an identifier
|
|
68
76
|
// targets and count as built-in, a target with a `node` is user code and disqualifies the call
|
|
69
77
|
if (args?.onlyBuiltin && content.targets.some(t => typeof t !== 'string')) {
|
|
70
78
|
content.targets = [];
|
|
@@ -73,6 +81,15 @@ exports.Enrichments = {
|
|
|
73
81
|
content.targets.push(...prev.targets);
|
|
74
82
|
}
|
|
75
83
|
return content;
|
|
84
|
+
function qualifyIdentifier(origins, name) {
|
|
85
|
+
if (args?.qualifyNames === undefined || args.qualifyNames) {
|
|
86
|
+
const qualified = identifier_1.Identifier.toQualified(origins, name);
|
|
87
|
+
if (qualified !== undefined) {
|
|
88
|
+
return identifier_1.Identifier.toString(qualified);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return name;
|
|
92
|
+
}
|
|
76
93
|
},
|
|
77
94
|
// as built-in call target enrichments are not nodes, we don't return them as part of the mapper!
|
|
78
95
|
mapper: ({ targets }) => targets.map(t => t).filter(t => t.node !== undefined)
|
package/util/mermaid/dfg.js
CHANGED
|
@@ -183,7 +183,7 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark, includeOnlyIds) {
|
|
|
183
183
|
const node = mermaid.rootGraph.idMap?.get(info.id);
|
|
184
184
|
const lexeme = node?.lexeme ?? (node?.type === type_1.RType.ExpressionList ? node?.grouping?.[0]?.lexeme : '') ?? '??';
|
|
185
185
|
let display = lexeme;
|
|
186
|
-
if (fCall &&
|
|
186
|
+
if (fCall && vertex_1.FunctionCallVertex.is(info)) {
|
|
187
187
|
const q = identifier_1.Identifier.toQualified((0, dfg_get_origin_1.getOriginInDfg)(mermaid.rootGraph, origId), info.name, mermaid.qualifyBaseR !== false);
|
|
188
188
|
const qs = q !== undefined ? identifier_1.Identifier.toString(q) : undefined;
|
|
189
189
|
if (qs !== undefined && qs !== lexeme) {
|
package/util/version.js
CHANGED
|
@@ -42,7 +42,7 @@ const assert_1 = require("./assert");
|
|
|
42
42
|
const sigdb_download_1 = require("../project/sigdb/sigdb-download");
|
|
43
43
|
const doc_files_1 = require("../documentation/doc-util/doc-files");
|
|
44
44
|
// this is automatically replaced with the current version by release-it
|
|
45
|
-
const version = '2.13.
|
|
45
|
+
const version = '2.13.5';
|
|
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
|
/**
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { type FlowrFileProvider, type FileRole, FlowrFile } from '../../../context/flowr-file';
|
|
2
|
-
import type { DeepReadonly } from 'ts-essentials';
|
|
3
|
-
import { Package } from '../../package-version-plugins/package';
|
|
4
|
-
export declare const rProjectFileLog: import("tslog").Logger<import("tslog").ILogObj>;
|
|
5
|
-
/** The `[project]` table of an `rproject.toml`, see https://a2-ai.github.io/rv-docs/config/ */
|
|
6
|
-
interface RvProject {
|
|
7
|
-
name?: unknown;
|
|
8
|
-
r_version?: unknown;
|
|
9
|
-
dependencies?: unknown;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Decorates the `rproject.toml` of an [rv](https://a2-ai.github.io/rv-docs/) project and provides access to the
|
|
13
|
-
* fields of its `[project]` table. Use the static {@link FlowrRProjectFile.from} method to create instances.
|
|
14
|
-
*/
|
|
15
|
-
export declare class FlowrRProjectFile extends FlowrFile<DeepReadonly<RvProject>> {
|
|
16
|
-
private readonly wrapped;
|
|
17
|
-
constructor(file: FlowrFileProvider);
|
|
18
|
-
protected loadContent(): RvProject;
|
|
19
|
-
/** rproject lifter, this does not re-create if already an rproject file */
|
|
20
|
-
static from(file: FlowrFileProvider | FlowrRProjectFile, role?: FileRole): FlowrRProjectFile;
|
|
21
|
-
/** The `name` of the project; unlike a `DESCRIPTION` `Package` this is no namespace, an rv project is not a package. */
|
|
22
|
-
projectName(): string | undefined;
|
|
23
|
-
/** The `r_version` the project targets, e.g. `4.5`. */
|
|
24
|
-
rVersion(): string | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* The declared `dependencies`, which are either a plain name or a table carrying the name alongside its
|
|
27
|
-
* origin (`{ name = "ggplot2", repository = "new-rspm" }`).
|
|
28
|
-
*/
|
|
29
|
-
dependencies(): Package[];
|
|
30
|
-
}
|
|
31
|
-
export {};
|