@eagleoutice/flowr 2.14.2 → 2.14.4
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 +30 -42
- package/abstract-interpretation/absint-visitor.d.ts +45 -4
- package/abstract-interpretation/absint-visitor.js +252 -53
- package/config.d.ts +15 -8
- package/config.js +4 -1
- package/control-flow/semantic-cfg-guided-visitor.d.ts +7 -7
- package/control-flow/semantic-cfg-guided-visitor.js +23 -0
- package/dataflow/environments/default-builtin-config.d.ts +4 -13
- package/dataflow/environments/default-builtin-config.js +59 -23
- package/dataflow/environments/group-generics.d.ts +27 -0
- package/dataflow/environments/group-generics.js +39 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
- package/dataflow/eval/resolve/alias-tracking.js +1 -1
- package/dataflow/info.d.ts +1 -6
- package/dataflow/info.js +0 -17
- package/dataflow/internal/control-flow.d.ts +14 -2
- package/dataflow/internal/control-flow.js +24 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +10 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +11 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +21 -17
- package/documentation/doc-readme.js +0 -12
- package/documentation/wiki-absint.js +7 -2
- package/documentation/wiki-interface.js +1 -0
- package/documentation/wiki-signature-database.js +6 -1
- package/linter/rules/deprecated-functions.js +4 -2
- package/linter/rules/unused-definition.js +3 -3
- package/package.json +1 -1
- package/project/dependency-version-space.d.ts +1 -0
- package/project/dependency-version-space.js +1 -1
- package/project/flowr-analyzer-builder.d.ts +4 -4
- package/project/sigdb/reader.d.ts +6 -0
- package/project/sigdb/reader.js +2 -2
- package/project/sigdb/schema.d.ts +13 -1
- package/project/sigdb/schema.js +3 -1
- package/project/sigdb/signature-db.d.ts +4 -0
- package/project/sigdb/signature-db.js +8 -1
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +1 -1
- package/queries/catalog/signature-query/signature-query-executor.d.ts +7 -2
- package/queries/catalog/signature-query/signature-query-executor.js +24 -9
- package/queries/catalog/signature-query/signature-query-format.d.ts +14 -3
- package/queries/catalog/signature-query/signature-query-render.js +6 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +7 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +7 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +5 -1
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +0 -5
- package/search/search-executor/search-enrichers.d.ts +4 -0
- package/search/search-executor/search-enrichers.js +4 -4
- package/util/objects.d.ts +15 -4
- package/util/text/name-rank.js +8 -2
- package/util/version.js +1 -1
|
@@ -248,10 +248,15 @@ Per version the source also answers declared dependencies (${ctx.link('ResolvedD
|
|
|
248
248
|
|
|
249
249
|
Beyond the flags above, ${ctx.link('DecodedFunction::props')} also carry ${ctx.linkE('FnProp', 'NoDoc')} (a documented package has no help page for this name), ${ctx.linkE('FnProp', 'S3Method')} (a registered S3 method, from the package NAMESPACE or base R's method table), and ${ctx.linkE('FnProp', 'S3Owner')} (an exported constructor for an S3 class this package OWNS: it also registers at least one S3 method for that class). The owned classes of a version are ${ctx.link('LibraryExports::s3Classes')}, and ${ctx.linkM(reader_1.SigDatabase, 'classOwner')} answers, for a class name, which package owns it (backed by a reverse index built once). This lets ${ctx.linkPage('wiki/Query API', 'version guessing')} mark a package used when the analyzed project's own NAMESPACE registers an S3 method for a class it owns, even with no direct call, e.g. tseries's \`S3method("as.irts","zoo")\` marks \`zoo\` used.
|
|
250
250
|
|
|
251
|
+
The S4 side has ${ctx.linkE('FnProp', 'S4Owner')} for an exported class and ${ctx.linkE('FnProp', 'S4Method')} for a name a package exports because it answered a generic for one of its classes (\`setMethod("sin", "float32", ...)\` plus \`exportMethods(sin)\`), rather than because it defines a function of its own. Such a name is often documented only under its \`sin,float32-method\` Rd alias, so it also carries ${ctx.linkE('FnProp', 'NoDoc')}. Because \`setMethod("Math", ...)\` answers every member of a group at once, ${ctx.link('SignatureDb::functionOf')} falls back to the group entry for a member it finds nothing for: \`pkg::sin\` is served by \`pkg\`'s \`Math\`, which is what the call would dispatch to. ${ctx.link('groupGenericOf')} maps a member to its group.
|
|
252
|
+
|
|
253
|
+
${ctx.linkE('FnProp', 'Value')} says the export binds a value rather than a function (\`pi\`, \`LETTERS\`, ggplot2's \`class_gg\`). Only the extractor can tell: an entry without a definition location is as likely to be a function nothing wrote down, an S4 generic \`setGeneric\` builds or a \`Vectorize\` result, so a reader that has only the location to go on can say no more than that there is none.
|
|
254
|
+
|
|
251
255
|
These are derived on demand by the ${ctx.linkPage('wiki/Query API', 'signature query')}, not stored:
|
|
252
|
-
- the
|
|
256
|
+
- the documentation link ${ctx.link('SignatureFunctionView::docUrl')}, omitted for a ${ctx.linkE('FnProp', 'NoDoc')} function: R's own manual for a base package, rdrr.io's \`/cran/<pkg>/man/<topic>\` for CRAN. rdrr.io serves an older R, so everything R has gained since (\`sort_by\`, \`array2DF\`, ...) is a dead link there
|
|
253
257
|
- ${ctx.link('SignatureFunctionView::sourceUrl')} and ${ctx.link('SignatureFunctionView::manUrl')}: the definition and its \`.Rd\` help page at the queried version, on \`github.com/cran/<pkg>\` (CRAN) or \`github.com/wch/r-source\` (base R)
|
|
254
258
|
- the S3 method to generic backlink ${ctx.link('SignatureFunctionView::s3method')}, for a ${ctx.linkE('FnProp', 'S3Method')} function, resolving its generic
|
|
259
|
+
- the S4 group ${ctx.link('SignatureFunctionView::s4group')}, for a name that is a member of one (\`sin\` of \`Math\`), saying whether the view was answered by the package's entry for the group rather than by one for the name itself
|
|
255
260
|
- the transitive call graph ${ctx.linkM(reader_1.SigDatabase, 'transitiveCallees')}, expanding the stored local callees inside one version
|
|
256
261
|
|
|
257
262
|
## Reading It From an Analyzer
|
|
@@ -28,8 +28,10 @@ var DeprecationState;
|
|
|
28
28
|
/** No longer works and is removed and replaced by another function {@link https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/Defunct} */
|
|
29
29
|
DeprecationState["Defunct"] = "defunct";
|
|
30
30
|
})(DeprecationState || (exports.DeprecationState = DeprecationState = {}));
|
|
31
|
-
/**
|
|
32
|
-
|
|
31
|
+
/**
|
|
32
|
+
* `size` names the stroke width of every line-based geom until ggplot2 4.0.0 renamed it: it gained
|
|
33
|
+
* `linewidth` beside it in 3.4.0, and 4.0.0 drops `size`.
|
|
34
|
+
*/
|
|
33
35
|
const GgplotLinewidth = {
|
|
34
36
|
whenArgs: [{ argName: 'size', state: DeprecationState.Deprecated, replacedBy: 'linewidth', sinceVersion: r_version_1.RRange.parse('>= 3.4.0') }]
|
|
35
37
|
};
|
|
@@ -15,7 +15,7 @@ const identifier_1 = require("../../dataflow/environments/identifier");
|
|
|
15
15
|
const retriever_1 = require("../../r-bridge/retriever");
|
|
16
16
|
const query_fn_props_1 = require("../../dataflow/environments/query-fn-props");
|
|
17
17
|
const built_in_props_1 = require("../../dataflow/environments/built-in-props");
|
|
18
|
-
const
|
|
18
|
+
const group_generics_1 = require("../../dataflow/environments/group-generics");
|
|
19
19
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
20
20
|
const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
|
|
21
21
|
const graph_1 = require("../../dataflow/graph/graph");
|
|
@@ -37,13 +37,13 @@ let knownS3Generics;
|
|
|
37
37
|
* (`print(x)` on an object of that class), so it is used without a textual call.
|
|
38
38
|
*/
|
|
39
39
|
function isKnownS3Generic(name) {
|
|
40
|
-
knownS3Generics ??= new Set([...OtherKnownS3Generics, ...Object.keys(
|
|
40
|
+
knownS3Generics ??= new Set([...OtherKnownS3Generics, ...Object.keys(group_generics_1.RGroupGenerics),
|
|
41
41
|
...query_fn_props_1.BuiltInIndex.default().with(built_in_props_1.CallProp.Generic).map(g => identifier_1.Identifier.getName(g))]);
|
|
42
42
|
return knownS3Generics.has(name);
|
|
43
43
|
}
|
|
44
44
|
/** Whether `generic`, or any member of it when it is a group generic (`Ops.cls` dispatches on `+`), is called. */
|
|
45
45
|
function isDispatched(generic, called) {
|
|
46
|
-
const group =
|
|
46
|
+
const group = group_generics_1.RGroupGenerics[generic];
|
|
47
47
|
return called.has(generic) || (group?.some(member => called.has(member)) ?? false);
|
|
48
48
|
}
|
|
49
49
|
/**
|
package/package.json
CHANGED
|
@@ -121,6 +121,7 @@ export interface VersionAssignment {
|
|
|
121
121
|
*/
|
|
122
122
|
readonly unverified?: readonly string[];
|
|
123
123
|
}
|
|
124
|
+
/** default safety cap on how many assignments {@link explodeDependencyVersions} yields */
|
|
124
125
|
export declare const DefaultExplodeLimit = 256;
|
|
125
126
|
/** the date cutoff (end of the named day/month/year) for a `YYYY.MM.DD` spec, or `undefined` if malformed */
|
|
126
127
|
export declare function dateCutoff(spec: string): Date | undefined;
|
|
@@ -43,13 +43,13 @@ const r_string_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
|
43
43
|
const arrays_1 = require("../util/collections/arrays");
|
|
44
44
|
/** the pseudo-package standing for the analyzed project itself, never one of its own dependencies */
|
|
45
45
|
exports.ProjectPackage = 'current';
|
|
46
|
-
/** default safety cap on how many assignments {@link explodeDependencyVersions} yields */
|
|
47
46
|
/** the dependency kinds a load has to satisfy, as `Suggests`/`Enhances` are not enforced when a package is attached */
|
|
48
47
|
const LoadRelevantDeps = new Set([0 /* DepType.Depends */, 1 /* DepType.Imports */, 2 /* DepType.LinkingTo */]);
|
|
49
48
|
/** The requirements `pkg@version` places on other packages that a load has to satisfy (see {@link LoadRelevantDeps}). */
|
|
50
49
|
function loadRequirements(src, pkg, version) {
|
|
51
50
|
return (src?.dependencies(pkg, version) ?? []).filter(d => LoadRelevantDeps.has(d.type));
|
|
52
51
|
}
|
|
52
|
+
/** default safety cap on how many assignments {@link explodeDependencyVersions} yields */
|
|
53
53
|
exports.DefaultExplodeLimit = 256;
|
|
54
54
|
/** the date cutoff (end of the named day/month/year) for a `YYYY.MM.DD` spec, or `undefined` if malformed */
|
|
55
55
|
function dateCutoff(spec) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type EngineConfig, FlowrConfig } from '../config';
|
|
2
|
-
import type { DeepWritable
|
|
1
|
+
import { type EngineConfig, FlowrConfig, type ValidFlowrConfigPaths } from '../config';
|
|
2
|
+
import type { DeepWritable } from 'ts-essentials';
|
|
3
3
|
import { FlowrAnalyzer } from './flowr-analyzer';
|
|
4
4
|
import type { KnownParser } from '../r-bridge/parser';
|
|
5
5
|
import type { FlowrAnalyzerPlugin } from './plugins/flowr-analyzer-plugin';
|
|
6
6
|
import type { NormalizeRequiredInput } from '../core/steps/all/core/10-normalize';
|
|
7
7
|
import type { BuiltInFlowrPluginName, PluginToRegister } from './plugins/plugin-registry';
|
|
8
|
-
import type {
|
|
8
|
+
import type { ValueAtPath } from '../util/objects';
|
|
9
9
|
/**
|
|
10
10
|
* Builder for the {@link FlowrAnalyzer}, use it to configure all analysis aspects before creating the analyzer instance
|
|
11
11
|
* with {@link FlowrAnalyzerBuilder#build|`.build()`} or {@link FlowrAnalyzerBuilder#buildSync|`.buildSync()`}.
|
|
@@ -62,7 +62,7 @@ export declare class FlowrAnalyzerBuilder {
|
|
|
62
62
|
/**
|
|
63
63
|
* Set a specific value in the configuration used by the resulting analyzer.
|
|
64
64
|
*/
|
|
65
|
-
configure<K extends
|
|
65
|
+
configure<K extends ValidFlowrConfigPaths>(key: K, value: ValueAtPath<FlowrConfig, K>): this;
|
|
66
66
|
/**
|
|
67
67
|
* Set the parser instance used by the analyzer.
|
|
68
68
|
* This is an alternative to {@link FlowrAnalyzerBuilder#setEngine} if you already have a parser instance.
|
|
@@ -170,6 +170,12 @@ export interface OpenSyncOptions {
|
|
|
170
170
|
export interface OpenSyncFromOptions extends SigDbOpenOptions, OpenSyncOptions {
|
|
171
171
|
hash?: string;
|
|
172
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Fast, partial reader for a single bundle. `open()`/`openSync()` load the string dictionary + `.idx`
|
|
175
|
+
* once (a single ranged read of the dictionary section, no full parse), then every query seeks straight
|
|
176
|
+
* to one package blob on demand. `open()` additionally decompresses a `.br`/`.gz` source into a
|
|
177
|
+
* hash-keyed cache and reuses it on later startups. Implements {@link PackageSignatureSource}.
|
|
178
|
+
*/
|
|
173
179
|
export declare class SigDatabase implements PackageSignatureSource {
|
|
174
180
|
private closed;
|
|
175
181
|
/** parsed blobs by blob index so repeated lookups skip the re-read + JSON.parse; FIFO-bounded to cap memory */
|
package/project/sigdb/reader.js
CHANGED
|
@@ -259,14 +259,14 @@ function sourceForPackage(sources, pkg) {
|
|
|
259
259
|
const having = sources.filter(s => s.has(pkg));
|
|
260
260
|
return having.length === 0 ? undefined : having.length === 1 ? having[0] : new MergedSignatureSource(having);
|
|
261
261
|
}
|
|
262
|
+
/** the {@link SigDatabase.fd} of a database that has no file behind it (see {@link SigDatabase.fromMemory}) */
|
|
263
|
+
const NoFile = -1;
|
|
262
264
|
/**
|
|
263
265
|
* Fast, partial reader for a single bundle. `open()`/`openSync()` load the string dictionary + `.idx`
|
|
264
266
|
* once (a single ranged read of the dictionary section, no full parse), then every query seeks straight
|
|
265
267
|
* to one package blob on demand. `open()` additionally decompresses a `.br`/`.gz` source into a
|
|
266
268
|
* hash-keyed cache and reuses it on later startups. Implements {@link PackageSignatureSource}.
|
|
267
269
|
*/
|
|
268
|
-
/** the {@link SigDatabase.fd} of a database that has no file behind it (see {@link SigDatabase.fromMemory}) */
|
|
269
|
-
const NoFile = -1;
|
|
270
270
|
class SigDatabase {
|
|
271
271
|
closed = false;
|
|
272
272
|
/** parsed blobs by blob index so repeated lookups skip the re-read + JSON.parse; FIFO-bounded to cap memory */
|
|
@@ -63,7 +63,19 @@ export declare const enum FnProp {
|
|
|
63
63
|
* Set on the name of an S4 class this package OWNS: it exports the class via its NAMESPACE `exportClasses()`
|
|
64
64
|
* (see {@link LibraryExports.s4Classes}, derived from this bit by {@link deriveLibraryExports}).
|
|
65
65
|
*/
|
|
66
|
-
S4Owner = 2048
|
|
66
|
+
S4Owner = 2048,
|
|
67
|
+
/**
|
|
68
|
+
* A registered S4 method: the name is exported because the package answers a generic for one of its classes
|
|
69
|
+
* (`setMethod('sin', 'float32', ...)`, `exportMethods(sin)`), not because it defines a function of its own.
|
|
70
|
+
* The S4 analogue of {@link FnProp.S3Method}.
|
|
71
|
+
*/
|
|
72
|
+
S4Method = 4096,
|
|
73
|
+
/**
|
|
74
|
+
* The export binds a value rather than a function: a constant, a dataset, a class object (`pi`, `LETTERS`,
|
|
75
|
+
* ggplot2's `class_gg`). Only the extractor can tell: an entry without a definition location may equally be
|
|
76
|
+
* a function built at load time, an S4 generic or a `Vectorize` result, which has no source to point at.
|
|
77
|
+
*/
|
|
78
|
+
Value = 8192
|
|
67
79
|
}
|
|
68
80
|
/** the {@link FnProp} bit to its name (for decoding); integer keys iterate in ascending bit order */
|
|
69
81
|
export declare const FnPropNames: Readonly<Record<FnProp, string>>;
|
package/project/sigdb/schema.js
CHANGED
|
@@ -30,7 +30,9 @@ exports.FnPropNames = {
|
|
|
30
30
|
[256 /* FnProp.NoDoc */]: 'no-doc',
|
|
31
31
|
[512 /* FnProp.S3Method */]: 's3-method',
|
|
32
32
|
[1024 /* FnProp.S3Owner */]: 's3-owner',
|
|
33
|
-
[2048 /* FnProp.S4Owner */]: 's4-owner'
|
|
33
|
+
[2048 /* FnProp.S4Owner */]: 's4-owner',
|
|
34
|
+
[4096 /* FnProp.S4Method */]: 's4-method',
|
|
35
|
+
[8192 /* FnProp.Value */]: 'value'
|
|
34
36
|
};
|
|
35
37
|
/** the {@link DepType} values in order, with their names (for decoding) */
|
|
36
38
|
exports.DepTypeNames = ['depends', 'imports', 'linkingTo', 'suggests', 'enhances'];
|
|
@@ -40,6 +40,10 @@ export interface SignatureDb {
|
|
|
40
40
|
/**
|
|
41
41
|
* The database entry for a *qualified* call, i.e. a `pkg::fn` {@link Identifier}. Decodes only that one
|
|
42
42
|
* function rather than the whole package.
|
|
43
|
+
*
|
|
44
|
+
* A name the package answers only as part of an S4 group falls back to the group: `Matrix::sin` is served by
|
|
45
|
+
* `Matrix`'s `Math` entry when there is no `sin` of its own, because that is what an `sin(x)` call dispatches
|
|
46
|
+
* to. The result then carries the group's name, not the one that was asked for.
|
|
43
47
|
* @param id - The qualified identifier of the function.
|
|
44
48
|
* @param version - The version to answer for, {@link versionOf} of its package if omitted.
|
|
45
49
|
*/
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.signatureDbOf = signatureDbOf;
|
|
4
4
|
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
5
|
+
const group_generics_1 = require("../../dataflow/environments/group-generics");
|
|
5
6
|
const reader_1 = require("./reader");
|
|
6
7
|
const log_1 = require("../../util/log");
|
|
7
8
|
const signatureDbLog = log_1.log.getSubLogger({ name: 'signature-db' });
|
|
@@ -38,7 +39,13 @@ function signatureDbOf(deps) {
|
|
|
38
39
|
return undefined; // without a package there is nothing to look the function up in
|
|
39
40
|
}
|
|
40
41
|
const name = identifier_1.Identifier.getName(id);
|
|
41
|
-
|
|
42
|
+
const found = answerFor(pkg, version, (src, v) => src.functionByName(pkg, name, v));
|
|
43
|
+
if (found !== undefined) {
|
|
44
|
+
return found;
|
|
45
|
+
}
|
|
46
|
+
/* `setMethod('Math', 'cls', ...)` answers every member of the group at once, so the group is the entry */
|
|
47
|
+
const group = (0, group_generics_1.groupGenericOf)(name);
|
|
48
|
+
return group === undefined ? undefined : answerFor(pkg, version, (src, v) => src.functionByName(pkg, group, v));
|
|
42
49
|
};
|
|
43
50
|
return {
|
|
44
51
|
available: () => deps.signatureSources().length > 0,
|
|
@@ -348,7 +348,7 @@ exports.GuessDepVersionsQueryDefinition = {
|
|
|
348
348
|
const reasons = [evs.some(e => !e.parameter) ? 'new' : undefined, params.length > 0 ? `params: [${truncatedList(params)}]` : undefined,
|
|
349
349
|
at ? `at ${at}` : undefined].filter(Boolean).join(', ');
|
|
350
350
|
const name = identifier_1.Identifier.getName(identifier_1.Identifier.parse(fn));
|
|
351
|
-
const url = (0, signature_query_executor_1.
|
|
351
|
+
const url = (0, signature_query_executor_1.helpPageUrl)(dep.package, name, { base: dep.base, cran: !dep.base });
|
|
352
352
|
const label = (url ? formatter.hyperlink(name, url, true) : name) + (reasons ? ` (${reasons})` : '');
|
|
353
353
|
const redundant = !(geVer !== undefined && geVer === tightestGe) && !(leVer !== undefined && leVer === tightestLe);
|
|
354
354
|
return { bounds: [ge, le].filter(Boolean).join(' '), label, redundant, geVer, leVer };
|
|
@@ -15,8 +15,13 @@ export declare function cranMirrorSourceUrl(pkg: string, version: string | undef
|
|
|
15
15
|
export declare function rSourceRef(version: string | undefined): string;
|
|
16
16
|
/** deep-link a base-R definition into the R sources mirror at the release series of `version` */
|
|
17
17
|
export declare function rSourceUrl(pkg: string, version: string | undefined, file: string, line?: number): string;
|
|
18
|
-
/**
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Best-effort documentation link: R's own manual for a base package, rdrr.io's `/cran/<pkg>/man/<fn>` for CRAN.
|
|
20
|
+
*
|
|
21
|
+
* Base R does not go to rdrr.io because that serves an older release, so everything R has gained since (`sort_by`,
|
|
22
|
+
* `array2DF`, `chooseOpsMethod`, ...) is a dead link there.
|
|
23
|
+
*/
|
|
24
|
+
export declare function helpPageUrl(pkg: string, fn: string, opts: {
|
|
20
25
|
base: boolean;
|
|
21
26
|
cran: boolean;
|
|
22
27
|
}): string | undefined;
|
|
@@ -4,7 +4,7 @@ exports.cranPageUrl = cranPageUrl;
|
|
|
4
4
|
exports.cranMirrorSourceUrl = cranMirrorSourceUrl;
|
|
5
5
|
exports.rSourceRef = rSourceRef;
|
|
6
6
|
exports.rSourceUrl = rSourceUrl;
|
|
7
|
-
exports.
|
|
7
|
+
exports.helpPageUrl = helpPageUrl;
|
|
8
8
|
exports.signatureFunctionInfo = signatureFunctionInfo;
|
|
9
9
|
exports.signaturePackageInfo = signaturePackageInfo;
|
|
10
10
|
exports.signatureQueryCompleter = signatureQueryCompleter;
|
|
@@ -22,6 +22,7 @@ const r_version_1 = require("../../../util/r-version");
|
|
|
22
22
|
const r_base_packages_1 = require("../../../util/r-base-packages");
|
|
23
23
|
const mermaid_1 = require("../../../util/mermaid/mermaid");
|
|
24
24
|
const resolve_helper_1 = require("../../../dataflow/environments/resolve-helper");
|
|
25
|
+
const group_generics_1 = require("../../../dataflow/environments/group-generics");
|
|
25
26
|
const arrays_1 = require("../../../util/collections/arrays");
|
|
26
27
|
/** the CRAN package landing page (only meaningful for CRAN packages, not base R) */
|
|
27
28
|
function cranPageUrl(pkg) {
|
|
@@ -125,13 +126,18 @@ function rSourceUrl(pkg, version, file, line) {
|
|
|
125
126
|
}
|
|
126
127
|
/** function/topic names that map cleanly to a man page (skip operators like `+.gg`, `[.data.frame`; Rd topics allow hyphens, e.g. `dplyr-package`) */
|
|
127
128
|
const RdrrTopicName = /^[A-Za-z.][A-Za-z0-9._-]*$/;
|
|
128
|
-
/**
|
|
129
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Best-effort documentation link: R's own manual for a base package, rdrr.io's `/cran/<pkg>/man/<fn>` for CRAN.
|
|
131
|
+
*
|
|
132
|
+
* Base R does not go to rdrr.io because that serves an older release, so everything R has gained since (`sort_by`,
|
|
133
|
+
* `array2DF`, `chooseOpsMethod`, ...) is a dead link there.
|
|
134
|
+
*/
|
|
135
|
+
function helpPageUrl(pkg, fn, opts) {
|
|
130
136
|
if (!RdrrTopicName.test(fn)) {
|
|
131
137
|
return undefined;
|
|
132
138
|
}
|
|
133
139
|
if (opts.base) {
|
|
134
|
-
return `https://
|
|
140
|
+
return `https://stat.ethz.ch/R-manual/R-devel/library/${pkg}/html/${fn}.html`;
|
|
135
141
|
}
|
|
136
142
|
if (opts.cran) {
|
|
137
143
|
return `https://rdrr.io/cran/${pkg}/man/${fn}.html`;
|
|
@@ -140,7 +146,7 @@ function rdrrDocUrl(pkg, fn, opts) {
|
|
|
140
146
|
}
|
|
141
147
|
/**
|
|
142
148
|
* The `.Rd` help source of a topic *at the queried version*, on the same mirrors the source links use. rdrr.io only
|
|
143
|
-
* serves a package's current release, so {@link
|
|
149
|
+
* serves a package's current release, so {@link helpPageUrl} silently answers for the wrong version whenever an older
|
|
144
150
|
* one was asked for; this link cannot drift.
|
|
145
151
|
*/
|
|
146
152
|
function manPageUrl(pkg, topic, version, opts) {
|
|
@@ -158,7 +164,7 @@ function docUrlsFor(pkg, fn, version, base, cran) {
|
|
|
158
164
|
return {};
|
|
159
165
|
}
|
|
160
166
|
const topic = fn.topic ?? fn.name;
|
|
161
|
-
const doc =
|
|
167
|
+
const doc = helpPageUrl(pkg, topic, { base, cran });
|
|
162
168
|
const man = manPageUrl(pkg, topic, version, { base, cran });
|
|
163
169
|
return { ...(doc ? { docUrl: doc } : {}), ...(man ? { manUrl: man } : {}) };
|
|
164
170
|
}
|
|
@@ -230,6 +236,7 @@ function flowrOnlyFunctionInfo(env, pkg, name) {
|
|
|
230
236
|
if (info === undefined || (info.props === undefined && info.sig === undefined)) {
|
|
231
237
|
return undefined;
|
|
232
238
|
}
|
|
239
|
+
const group = (0, group_generics_1.groupGenericOf)(name);
|
|
233
240
|
const namespace = definition.name === undefined ? undefined : identifier_1.Identifier.getNamespace(definition.name);
|
|
234
241
|
if (pkg !== undefined && namespace !== undefined && namespace !== pkg) {
|
|
235
242
|
return undefined;
|
|
@@ -243,7 +250,8 @@ function flowrOnlyFunctionInfo(env, pkg, name) {
|
|
|
243
250
|
/* flowR states no defaults, so `required` stays `false` throughout; whether R forces a parameter it does know */
|
|
244
251
|
parameters: (info.sig ?? []).map(([n, p]) => ({ name: n, required: false, forced: (p & built_in_props_1.ArgProp.Forced) !== 0 })),
|
|
245
252
|
callees: [],
|
|
246
|
-
flowr: flowrViewOf(info, [])
|
|
253
|
+
flowr: flowrViewOf(info, []),
|
|
254
|
+
...(group ? { s4group: { group } } : {})
|
|
247
255
|
};
|
|
248
256
|
}
|
|
249
257
|
/** the decoded view of one function, adding the CRAN-mirror source link */
|
|
@@ -272,7 +280,11 @@ function decodedToView(pkg, fn, version, opts) {
|
|
|
272
280
|
*/
|
|
273
281
|
function signatureFunctionInfo(src, pkg, fnName, version, env) {
|
|
274
282
|
const fns = src.functions(pkg, version) ?? src.functions(pkg);
|
|
275
|
-
const
|
|
283
|
+
const group = (0, group_generics_1.groupGenericOf)(fnName);
|
|
284
|
+
const own = fns?.find(f => f.name === fnName);
|
|
285
|
+
/* `setMethod('Math', 'cls', ...)` answers every member of the group at once, so the group entry is what a
|
|
286
|
+
call to a member it has none of its own for dispatches to */
|
|
287
|
+
const fn = own ?? (group === undefined ? undefined : fns?.find(f => f.name === group));
|
|
276
288
|
if (fn === undefined) {
|
|
277
289
|
return undefined;
|
|
278
290
|
}
|
|
@@ -288,9 +300,12 @@ function signatureFunctionInfo(src, pkg, fnName, version, env) {
|
|
|
288
300
|
const flowr = flowrView(env, pkg, fnName, view.parameters.map(p => p.name));
|
|
289
301
|
return {
|
|
290
302
|
...view,
|
|
303
|
+
/* the name that was asked for, which is not the entry's own when the group answered for it */
|
|
304
|
+
name: fnName,
|
|
291
305
|
...(flowr ? { flowr } : {}),
|
|
292
306
|
...(methods.length > 0 ? { s3generic: true, s3methods: methods } : {}),
|
|
293
|
-
...(s3method ? { s3method } : {})
|
|
307
|
+
...(s3method ? { s3method } : {}),
|
|
308
|
+
...(group ? { s4group: { group, ...(own === undefined ? { viaGroup: true } : {}) } } : {})
|
|
294
309
|
};
|
|
295
310
|
}
|
|
296
311
|
/** whether `fn` is an S3 generic: its body dispatches via `UseMethod`, so `<name>.<class>` functions can be its methods */
|
|
@@ -51,9 +51,9 @@ export interface SignatureFunctionView {
|
|
|
51
51
|
readonly line?: number;
|
|
52
52
|
/** deep link to the definition on the read-only GitHub mirror of the sources (CRAN, or R's own for a base package) */
|
|
53
53
|
readonly sourceUrl?: string;
|
|
54
|
-
/** best-effort rdrr.io
|
|
54
|
+
/** best-effort documentation link (R's own manual for base R, rdrr.io for CRAN), when the name maps to a documentable topic */
|
|
55
55
|
readonly docUrl?: string;
|
|
56
|
-
/** link to the `.Rd` help source *at the queried version*, which {@link docUrl} cannot offer (
|
|
56
|
+
/** link to the `.Rd` help source *at the queried version*, which {@link docUrl} cannot offer (it serves the current release alone) */
|
|
57
57
|
readonly manUrl?: string;
|
|
58
58
|
/** whether the function looks like an S3 generic (has `<generic>.<class>` dispatch targets in the same package) */
|
|
59
59
|
readonly s3generic?: boolean;
|
|
@@ -65,6 +65,17 @@ export interface SignatureFunctionView {
|
|
|
65
65
|
readonly class: string;
|
|
66
66
|
readonly package: string;
|
|
67
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* The S4 group generic the name belongs to (`sin` is in `Math`, `+` in `Arith`). `viaGroup` says the view was
|
|
70
|
+
* answered by the package's entry for the group rather than by one for the name itself: a
|
|
71
|
+
* `setMethod('Math', 'cls', ...)` answers every member of the group at once, and that is what a `sin(x)` call
|
|
72
|
+
* on such a class dispatches to. A member is often documented only under its `sin,cls-method` Rd alias, which
|
|
73
|
+
* is why such a name can carry `no-doc` and still have a help page.
|
|
74
|
+
*/
|
|
75
|
+
readonly s4group?: {
|
|
76
|
+
readonly group: string;
|
|
77
|
+
readonly viaGroup?: boolean;
|
|
78
|
+
};
|
|
68
79
|
/** a mermaid.live link visualizing the transitive call graph from this function (only when requested with `--cg`) */
|
|
69
80
|
readonly callGraph?: string;
|
|
70
81
|
/** what flowR itself states about the function, from the built-in environment of the analysis */
|
|
@@ -140,7 +151,7 @@ export interface SignatureMatchView {
|
|
|
140
151
|
readonly file?: string;
|
|
141
152
|
readonly line?: number;
|
|
142
153
|
readonly sourceUrl?: string;
|
|
143
|
-
/** best-effort
|
|
154
|
+
/** best-effort documentation link, see {@link SignatureFunctionView.docUrl} */
|
|
144
155
|
readonly docUrl?: string;
|
|
145
156
|
/** link to the `.Rd` help source at the queried version, see {@link SignatureFunctionView.manUrl} */
|
|
146
157
|
readonly manUrl?: string;
|
|
@@ -86,6 +86,12 @@ function pushFunction(result, f, fn) {
|
|
|
86
86
|
if (fn.s3method) {
|
|
87
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)}`);
|
|
88
88
|
}
|
|
89
|
+
if (fn.s4group) {
|
|
90
|
+
const said = fn.s4group.viaGroup
|
|
91
|
+
? `answered by ${fn.package}::${fn.s4group.group}, which covers the whole group`
|
|
92
|
+
: `a package may answer it for its own class with setMethod('${fn.s4group.group}', ...)`;
|
|
93
|
+
result.push(` ╰ ${(0, ansi_1.italic)('S4 group', f)} ${(0, ansi_1.color)(fn.s4group.group, 5 /* Colors.Magenta */, f)} ${(0, ansi_1.italic)(`(${said})`, f)}`);
|
|
94
|
+
}
|
|
89
95
|
if (fn.flowr) {
|
|
90
96
|
const args = (fn.flowr.args ?? []).map(a => `${a.name}${a.roles.length > 0 ? `: ${a.roles.join('+')}` : ''}`);
|
|
91
97
|
const props = fn.flowr.props.map(p => (0, ansi_1.color)(p, 4 /* Colors.Blue */, f)).join(', ');
|
|
@@ -29,6 +29,13 @@ export declare const RParameter: {
|
|
|
29
29
|
* @see {@link RParameter.is} - to check whether a node is a parameter at all
|
|
30
30
|
*/
|
|
31
31
|
readonly isDotDotDotDot: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RParameter<Info>;
|
|
32
|
+
/**
|
|
33
|
+
* Type guard for a parameter that names what it is worth when a call passes nothing for it.
|
|
34
|
+
* @see {@link RParameter.is} - to check whether a node is a parameter at all
|
|
35
|
+
*/
|
|
36
|
+
readonly isWithDefault: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RParameter<Info> & {
|
|
37
|
+
defaultValue: RNode<Info>;
|
|
38
|
+
};
|
|
32
39
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
33
40
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
34
41
|
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
@@ -23,6 +23,13 @@ exports.RParameter = {
|
|
|
23
23
|
*/
|
|
24
24
|
isDotDotDotDot(node) {
|
|
25
25
|
return exports.RParameter.is(node) && node.special;
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Type guard for a parameter that names what it is worth when a call passes nothing for it.
|
|
29
|
+
* @see {@link RParameter.is} - to check whether a node is a parameter at all
|
|
30
|
+
*/
|
|
31
|
+
isWithDefault(node) {
|
|
32
|
+
return exports.RParameter.is(node) && node.defaultValue !== undefined;
|
|
26
33
|
}
|
|
27
34
|
};
|
|
28
35
|
//# sourceMappingURL=r-parameter.js.map
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { AstIdMap } from './decorate';
|
|
2
2
|
import type { DataflowGraph } from '../../../../../dataflow/graph/graph';
|
|
3
3
|
import type { BuiltInProcName } from '../../../../../dataflow/environments/built-in-proc-name';
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* The type of the id assigned to each node. Branded to avoid problematic usages with other string or numeric types.
|
|
6
|
+
* The default ids are numeric, but we use a branded type to avoid confusion with other numeric types.
|
|
7
|
+
* Custom ids or scoped ids can be strings, but they will be normalized to numbers if they are numeric strings.
|
|
8
|
+
*/
|
|
5
9
|
export type NodeId<T extends string | number = string | number> = T & {
|
|
6
10
|
__brand?: 'node-id';
|
|
7
11
|
};
|
|
@@ -6,11 +6,6 @@ exports.recoverContent = recoverContent;
|
|
|
6
6
|
const vertex_1 = require("../../../../../dataflow/graph/vertex");
|
|
7
7
|
const retriever_1 = require("../../../../retriever");
|
|
8
8
|
const identifier_1 = require("../../../../../dataflow/environments/identifier");
|
|
9
|
-
/**
|
|
10
|
-
* The type of the id assigned to each node. Branded to avoid problematic usages with other string or numeric types.
|
|
11
|
-
* The default ids are numeric, but we use a branded type to avoid confusion with other numeric types.
|
|
12
|
-
* Custom ids or scoped ids can be strings, but they will be normalized to numbers if they are numeric strings.
|
|
13
|
-
*/
|
|
14
9
|
/** whether the id starts as a number does, which `+id` alone does not tell: it turns a blank string into `0` */
|
|
15
10
|
function startsNumeric(id) {
|
|
16
11
|
const c = id.charCodeAt(0);
|
|
@@ -113,6 +113,10 @@ export interface QueryDataSearchContent extends MergeableRecord {
|
|
|
113
113
|
[QueryType in Query['type']]: Awaited<QueryResult<QueryType>>;
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* The registry of enrichments that are currently supported by the search.
|
|
118
|
+
* See {@link FlowrSearchBuilder.with} for more information on how to apply enrichments.
|
|
119
|
+
*/
|
|
116
120
|
export declare const Enrichments: {
|
|
117
121
|
readonly "call-targets": {
|
|
118
122
|
enrichSearch: (_search: FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>, data: ReadonlyFlowrAnalysisProvider<import("../../r-bridge/parser").KnownParser>, _args: {
|
|
@@ -25,10 +25,6 @@ var Enrichment;
|
|
|
25
25
|
Enrichment["Roxygen"] = "roxygen";
|
|
26
26
|
Enrichment["QueryData"] = "query-data";
|
|
27
27
|
})(Enrichment || (exports.Enrichment = Enrichment = {}));
|
|
28
|
-
/**
|
|
29
|
-
* The registry of enrichments that are currently supported by the search.
|
|
30
|
-
* See {@link FlowrSearchBuilder.with} for more information on how to apply enrichments.
|
|
31
|
-
*/
|
|
32
28
|
/** Roles a node can have without ever being executed on its own, which is why the control flow ignores them. */
|
|
33
29
|
const StructuralRoles = new Set([
|
|
34
30
|
"call-name" /* RoleInParent.FunctionCallName */, "arg-n" /* RoleInParent.ArgumentName */, "param-n" /* RoleInParent.ParameterName */
|
|
@@ -67,6 +63,10 @@ function isReachedByControlFlow(node, alive) {
|
|
|
67
63
|
}
|
|
68
64
|
return false;
|
|
69
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* The registry of enrichments that are currently supported by the search.
|
|
68
|
+
* See {@link FlowrSearchBuilder.with} for more information on how to apply enrichments.
|
|
69
|
+
*/
|
|
70
70
|
exports.Enrichments = {
|
|
71
71
|
[Enrichment.CallTargets]: {
|
|
72
72
|
enrichSearch: async (_search, data, _args, prev) => prev ?? {
|
package/util/objects.d.ts
CHANGED
|
@@ -40,11 +40,22 @@ export declare function compactRecord(record: undefined): undefined;
|
|
|
40
40
|
export declare function compactRecord<T extends Record<string, unknown>>(record: T | undefined): DefinedRecord<T> | undefined;
|
|
41
41
|
type Primitive = string | number | boolean | bigint | symbol | null | undefined | Date | Function;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
* What sits at the given path of `T`, the counterpart of {@link AutocompletablePaths}.
|
|
44
|
+
* `never` whenever the path names nothing.
|
|
45
45
|
*/
|
|
46
|
-
export type
|
|
47
|
-
|
|
46
|
+
export type ValueAtPath<T, Path extends string> = Path extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? ValueAtPath<NonNullable<T[Key]>, Rest> : never : Path extends keyof T ? T[Path] : never;
|
|
47
|
+
/**
|
|
48
|
+
* Every path into `T`, as a union of string literals, so that an editor can complete them.
|
|
49
|
+
*
|
|
50
|
+
* The paths are built from the leaves up rather than by carrying a prefix down: a prefix that grows with the
|
|
51
|
+
* recursion costs enough instantiations that TypeScript gives up and hands back `any`, which type-checks
|
|
52
|
+
* everything and completes nothing. `Depth` bounds it whatever the shape of `T`.
|
|
53
|
+
*/
|
|
54
|
+
type OneLess = [never, 0, 1, 2, 3, 4, 5, 6, 7];
|
|
55
|
+
export type AutocompletablePaths<T, Depth extends number = 6> = [
|
|
56
|
+
Depth
|
|
57
|
+
] extends [never] ? never : T extends Primitive | readonly unknown[] ? never : {
|
|
58
|
+
[K in keyof T & string]: K | (NonNullable<T[K]> extends Primitive | readonly unknown[] ? never : `${K}.${AutocompletablePaths<NonNullable<T[K]>, OneLess[Depth]> & string}`);
|
|
48
59
|
}[keyof T & string];
|
|
49
60
|
/**
|
|
50
61
|
* This is a version of a deep clone that preserves unclonable values (like functions, symbols, ...) by keeping the same reference to them.
|
package/util/text/name-rank.js
CHANGED
|
@@ -6,8 +6,14 @@ exports.rankName = rankName;
|
|
|
6
6
|
* conditions, so a rule can be read, weighed against its neighbours, or added without touching the rest.
|
|
7
7
|
*/
|
|
8
8
|
const Adjustments = [
|
|
9
|
-
/*
|
|
10
|
-
|
|
9
|
+
/*
|
|
10
|
+
* What was typed, exactly, always comes first, and the bonus is large enough to mean it: everything else
|
|
11
|
+
* together (a known name in base R, well downloaded, one place closer in the match) is worth about 1600,
|
|
12
|
+
* so typing `Sin` used to be answered with base R's `sin` first. Several packages exporting the same exact
|
|
13
|
+
* name all earn it, so the rules below still decide which of them leads.
|
|
14
|
+
* The same spelling in another case comes next.
|
|
15
|
+
*/
|
|
16
|
+
[3000, ({ name, needle }) => name === needle],
|
|
11
17
|
[900, ({ name, needle }) => name !== needle && name.toLowerCase() === needle.toLowerCase()],
|
|
12
18
|
/* a real function from base R is what a reader usually means; a lone symbol almost never is */
|
|
13
19
|
[40, ({ name, baseR }) => baseR === true && name.length >= 3],
|
package/util/version.js
CHANGED
|
@@ -42,7 +42,7 @@ const assert_1 = require("./assert");
|
|
|
42
42
|
const sigdb_download_1 = require("../project/sigdb/sigdb-download");
|
|
43
43
|
const doc_files_1 = require("../documentation/doc-util/doc-files");
|
|
44
44
|
// this is automatically replaced with the current version by release-it
|
|
45
|
-
const version = '2.14.
|
|
45
|
+
const version = '2.14.4';
|
|
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
|
/**
|