@eagleoutice/flowr 2.13.9 → 2.13.11
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 +40 -40
- 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 +114 -26
- 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/environments/resolve-by-name.js +16 -6
- package/dataflow/environments/resolve-helper.d.ts +43 -0
- package/dataflow/environments/resolve-helper.js +47 -0
- 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 +50 -1
- package/dataflow/graph/df-helper.js +63 -0
- package/dataflow/graph/graph.d.ts +5 -8
- package/dataflow/graph/graph.js +24 -13
- 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/data/faq/faqs.js +1 -1
- package/documentation/data/faq/wiki-faq-store.js +3 -2
- package/documentation/data/server/doc-data-server-messages.js +1 -1
- package/documentation/doc-readme.js +1 -1
- package/documentation/doc-util/doc-files.d.ts +5 -0
- package/documentation/doc-util/doc-files.js +13 -3
- package/documentation/doc-util/doc-sigdb.d.ts +9 -0
- package/documentation/doc-util/doc-sigdb.js +32 -0
- package/documentation/wiki-analyzer.js +10 -10
- package/documentation/wiki-core.js +1 -1
- package/documentation/wiki-dataflow-graph.js +3 -3
- package/documentation/wiki-interface.js +13 -2
- package/documentation/wiki-linting-and-testing.js +13 -13
- package/documentation/wiki-mk/doc-context.d.ts +1 -1
- package/documentation/wiki-mk/doc-context.js +9 -5
- package/documentation/wiki-normalized-ast.js +1 -1
- package/documentation/wiki-overview.js +2 -2
- package/documentation/wiki-query.js +4 -1
- package/documentation/wiki-setup.js +3 -3
- package/documentation/wiki-signature-database.js +2 -5
- package/gas.d.ts +6 -0
- package/gas.js +7 -1
- package/linter/linter-rules.d.ts +1 -1
- package/linter/rules/syntactically-valid.d.ts +12 -1
- package/linter/rules/syntactically-valid.js +88 -17
- package/package.json +7 -8
- 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/context/flowr-analyzer-loading-order-context.d.ts +8 -0
- package/project/context/flowr-analyzer-loading-order-context.js +23 -2
- 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/reader.d.ts +20 -0
- package/project/sigdb/reader.js +93 -10
- package/project/sigdb/signature-match.d.ts +5 -18
- package/project/sigdb/signature-match.js +5 -18
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +1 -1
- 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 +11 -3
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +25 -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 +16 -0
- package/queries/catalog/dependencies-query/link-devices.js +104 -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/happens-before-query/happens-before-query-executor.js +2 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +14 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.js +18 -2
- 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/catalog/slice-query-options.d.ts +11 -1
- package/queries/catalog/slice-query-options.js +8 -4
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +5 -1
- package/queries/query.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/model.d.ts +23 -2
- package/r-bridge/lang-4.x/ast/model/model.js +44 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +8 -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 +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +3 -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/reconstruct/reconstruct.d.ts +9 -0
- package/reconstruct/reconstruct.js +1 -0
- package/search/flowr-search-filters.d.ts +25 -1
- package/search/flowr-search-filters.js +42 -7
- package/search/search-executor/search-generators.js +7 -2
- package/search/search-executor/search-transformer.js +4 -1
- 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/slice-call.js +2 -2
- 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/collections/bimap.d.ts +21 -1
- package/util/collections/bimap.js +43 -7
- 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
|
@@ -23,7 +23,9 @@ exports.SliceQueryOptionsSchema = {
|
|
|
23
23
|
noMagicComments: joi_1.default.boolean().optional().description('Should the magic comments (force-including lines within the slice) be ignored?'),
|
|
24
24
|
inlineSources: joi_1.default.boolean().optional().description('Inline resolvable source() calls into the reconstruction so the result is a single self-contained R text.'),
|
|
25
25
|
inlineFull: joi_1.default.alternatives(joi_1.default.boolean(), joi_1.default.string().valid('banner')).optional().description('Inline all files into the reconstruction, in flowR\'s loading order and independent of whether they are sourced explicitly; "banner" precedes every file with a banner comment naming it.'),
|
|
26
|
-
includeCallees: joi_1.default.boolean().optional().description('If set (and slicing backward), continue the slice past a function-definition boundary, also including the definition\'s binding and call sites.')
|
|
26
|
+
includeCallees: joi_1.default.boolean().optional().description('If set (and slicing backward), continue the slice past a function-definition boundary, also including the definition\'s binding and call sites.'),
|
|
27
|
+
perFile: joi_1.default.boolean().optional().description('Reconstruct the slice as the project\'s files, reported in `reconstruct.files` in loading order with their paths, instead of only the entry file.'),
|
|
28
|
+
reportPackages: joi_1.default.boolean().optional().description('Also report the packages the slice calls into, i.e. what this selection needs installed rather than what the whole program loads.')
|
|
27
29
|
};
|
|
28
30
|
/**
|
|
29
31
|
* Resolves the criteria to their node ids, reporting those that match no node: they would slice nothing,
|
|
@@ -37,14 +39,16 @@ function resolveSliceCriteria(criteria, ast) {
|
|
|
37
39
|
}
|
|
38
40
|
return ids;
|
|
39
41
|
}
|
|
40
|
-
/** Reconstruct the given `nodes` of `ast`, honoring the inlining and magic-comment options. */
|
|
42
|
+
/** Reconstruct the given `nodes` of `ast`, honoring the inlining, per-file and magic-comment options. */
|
|
41
43
|
function reconstructSlice(ast, graph, nodes, options) {
|
|
42
|
-
const { inlineSources, inlineFull, noMagicComments } = options;
|
|
44
|
+
const { inlineSources, inlineFull, perFile, noMagicComments } = options;
|
|
45
|
+
const inlining = inlineSources || inlineFull;
|
|
43
46
|
return (0, reconstruct_1.reconstructToCode)(ast, {
|
|
44
47
|
nodes,
|
|
45
48
|
inlineSources,
|
|
46
49
|
inlineFull,
|
|
47
|
-
|
|
50
|
+
reconstructFiles: perFile && !inlining ? 'all' : undefined,
|
|
51
|
+
sourceMap: inlining ? source_inline_map_1.SourceInlineMap.build(ast, graph) : undefined
|
|
48
52
|
}, noMagicComments ? auto_select_defaults_1.doNotAutoSelect : (0, magic_comments_1.makeMagicCommentHandler)(auto_select_defaults_1.doNotAutoSelect));
|
|
49
53
|
}
|
|
50
54
|
//# sourceMappingURL=slice-query-options.js.map
|
|
@@ -6,6 +6,7 @@ const static_slicer_1 = require("../../../slicing/static/static-slicer");
|
|
|
6
6
|
const slice_query_options_1 = require("../slice-query-options");
|
|
7
7
|
const log_1 = require("../../../util/log");
|
|
8
8
|
const slice_direction_1 = require("../../../util/slice-direction");
|
|
9
|
+
const df_helper_1 = require("../../../dataflow/graph/df-helper");
|
|
9
10
|
/**
|
|
10
11
|
* Produce a fingerprint string for a static slice query
|
|
11
12
|
*/
|
|
@@ -32,14 +33,16 @@ async function executeStaticSliceQuery({ analyzer }, queries) {
|
|
|
32
33
|
const df = await analyzer.dataflow();
|
|
33
34
|
const slice = (0, static_slicer_1.staticSlice)({ ctx: analyzer.inspectContext(), info: df, ast: n, ids: (0, slice_query_options_1.resolveSliceCriteria)(criteria, n), direction: query.direction ?? slice_direction_1.SliceDirection.Backward, threshold: analyzer.flowrConfig.solver.slicer?.threshold, includeCallees });
|
|
34
35
|
const sliceEnd = Date.now();
|
|
36
|
+
const packages = query.reportPackages ? [...df_helper_1.Dataflow.packagesOf(slice.result, df.graph)] : undefined;
|
|
35
37
|
if (noReconstruction) {
|
|
36
|
-
results[key] = { slice: { ...slice, '.meta': { timing: sliceEnd - sliceStart } } };
|
|
38
|
+
results[key] = { packages, slice: { ...slice, '.meta': { timing: sliceEnd - sliceStart } } };
|
|
37
39
|
}
|
|
38
40
|
else {
|
|
39
41
|
const reconstructStart = Date.now();
|
|
40
42
|
const reconstruct = (0, slice_query_options_1.reconstructSlice)(n, df.graph, slice.result, query);
|
|
41
43
|
const reconstructEnd = Date.now();
|
|
42
44
|
results[key] = {
|
|
45
|
+
packages,
|
|
43
46
|
slice: { ...slice, '.meta': { timing: sliceEnd - sliceStart } },
|
|
44
47
|
reconstruct: { ...reconstruct, '.meta': { timing: reconstructEnd - reconstructStart } }
|
|
45
48
|
};
|
|
@@ -27,7 +27,11 @@ export interface StaticSliceQueryResult extends BaseQueryResult {
|
|
|
27
27
|
* The keys are serialized versions of the used queries (i.e., the result of `JSON.stringify`).
|
|
28
28
|
* This implies that multiple slice queries with the same query configuration will _not_ be re-executed.
|
|
29
29
|
*/
|
|
30
|
-
results: Record<string, Omit<PipelineOutput<typeof DEFAULT_SLICING_PIPELINE>, keyof PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>> | Omit<PipelineOutput<typeof DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE>, keyof PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE
|
|
30
|
+
results: Record<string, (Omit<PipelineOutput<typeof DEFAULT_SLICING_PIPELINE>, keyof PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>> | Omit<PipelineOutput<typeof DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE>, keyof PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>>)
|
|
31
|
+
/** the packages the slice calls into, only set with {@link SliceQueryOptions#reportPackages} */
|
|
32
|
+
& {
|
|
33
|
+
packages?: readonly string[];
|
|
34
|
+
}>;
|
|
31
35
|
}
|
|
32
36
|
declare function sliceQueryLineParser(output: ReplOutput, line: readonly string[], _config: FlowrConfig): ParsedQueryLine<'static-slice'>;
|
|
33
37
|
export declare const StaticSliceQueryDefinition: {
|
package/queries/query.d.ts
CHANGED
|
@@ -219,7 +219,7 @@ export declare const SupportedQueries: {
|
|
|
219
219
|
readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: unknown, queryResults: BaseQueryResult, result: string[]) => true;
|
|
220
220
|
readonly fromLine: (_output: ReplOutput, line: readonly string[], _config: FlowrConfig) => ParsedQueryLine<"location-map">;
|
|
221
221
|
readonly completer: typeof import("../cli/repl/parser/slice-query-parser").criteriaQueryCompleter;
|
|
222
|
-
readonly syntax: "@location-map [(<crit>;...)] <code | file://path>";
|
|
222
|
+
readonly syntax: "@location-map [(<crit>;...)] [token|full|statement] <code | file://path>";
|
|
223
223
|
readonly schema: Joi.ObjectSchema<any>;
|
|
224
224
|
readonly flattenInvolvedNodes: () => never[];
|
|
225
225
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { SourceLocation } from '../../../../util/range';
|
|
1
|
+
import { SourceLocation, SourceRange } from '../../../../util/range';
|
|
3
2
|
import { RType } from './type';
|
|
4
3
|
import type { MergeableRecord } from '../../../../util/objects';
|
|
5
4
|
import type { RNumber } from './nodes/r-number';
|
|
@@ -235,6 +234,28 @@ export declare const RNode: {
|
|
|
235
234
|
* A helper function to retrieve the id of a given node, if available.
|
|
236
235
|
*/
|
|
237
236
|
readonly getId: (this: void, node: RNode<ParentInformation>) => NodeId;
|
|
237
|
+
/**
|
|
238
|
+
* An identity for `node` that two analyses of the same source agree on, unlike {@link RNode.getId|the numeric
|
|
239
|
+
* id}, which only means something within the analysis that handed it out. Made of the file the node came
|
|
240
|
+
* from, where it starts, and what it is: `<file>:<line>:<column>:<type>`.
|
|
241
|
+
*
|
|
242
|
+
* This survives re-analyzing the same text, not editing it -- an edit above the node moves it.
|
|
243
|
+
* `undefined` for a node that carries no location (an artificial node, e.g. a built-in).
|
|
244
|
+
*/
|
|
245
|
+
readonly stableId: (this: void, node: RNode<ParentInformation>) => string | undefined;
|
|
246
|
+
/**
|
|
247
|
+
* The source range the whole subtree of `node` covers, from the first position any of its nodes starts at to
|
|
248
|
+
* the last one any of them ends at. Unlike {@link SourceRange.fromNode} this does not stop at what the node
|
|
249
|
+
* itself is written as: the span of the `<-` in a multi-line assignment is the whole assignment.
|
|
250
|
+
* `undefined` if neither the node nor anything below it carries a location.
|
|
251
|
+
* @see {@link RNode.topLevelStatement} - for the node to ask this of when the whole statement is wanted
|
|
252
|
+
*/
|
|
253
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => SourceRange | undefined;
|
|
254
|
+
/**
|
|
255
|
+
* The top-level statement `node` belongs to: the ancestor that is a direct child of the root of its file
|
|
256
|
+
* (`node` itself if it already is one). A node with no parent is its own statement.
|
|
257
|
+
*/
|
|
258
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & ParentInformation>, idMap: AstIdMap<OtherInfo & ParentInformation>) => RNode<OtherInfo & ParentInformation>;
|
|
238
259
|
/**
|
|
239
260
|
* A helper function to retrieve the type of a given node.
|
|
240
261
|
*/
|
|
@@ -139,6 +139,50 @@ exports.RNode = {
|
|
|
139
139
|
getId(node) {
|
|
140
140
|
return node.info.id;
|
|
141
141
|
},
|
|
142
|
+
/**
|
|
143
|
+
* An identity for `node` that two analyses of the same source agree on, unlike {@link RNode.getId|the numeric
|
|
144
|
+
* id}, which only means something within the analysis that handed it out. Made of the file the node came
|
|
145
|
+
* from, where it starts, and what it is: `<file>:<line>:<column>:<type>`.
|
|
146
|
+
*
|
|
147
|
+
* This survives re-analyzing the same text, not editing it -- an edit above the node moves it.
|
|
148
|
+
* `undefined` for a node that carries no location (an artificial node, e.g. a built-in).
|
|
149
|
+
*/
|
|
150
|
+
stableId(node) {
|
|
151
|
+
const location = node.location;
|
|
152
|
+
return location === undefined ? undefined : `${node.info.file ?? ''}:${location[0]}:${location[1]}:${node.type}`;
|
|
153
|
+
},
|
|
154
|
+
/**
|
|
155
|
+
* The source range the whole subtree of `node` covers, from the first position any of its nodes starts at to
|
|
156
|
+
* the last one any of them ends at. Unlike {@link SourceRange.fromNode} this does not stop at what the node
|
|
157
|
+
* itself is written as: the span of the `<-` in a multi-line assignment is the whole assignment.
|
|
158
|
+
* `undefined` if neither the node nor anything below it carries a location.
|
|
159
|
+
* @see {@link RNode.topLevelStatement} - for the node to ask this of when the whole statement is wanted
|
|
160
|
+
*/
|
|
161
|
+
span(node) {
|
|
162
|
+
const ranges = [];
|
|
163
|
+
exports.RNode.visitAst(node, n => {
|
|
164
|
+
const range = range_1.SourceRange.fromNode(n);
|
|
165
|
+
if (range !== undefined) {
|
|
166
|
+
ranges.push(range);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
return ranges.length > 0 ? range_1.SourceRange.merge(ranges) : undefined;
|
|
170
|
+
},
|
|
171
|
+
/**
|
|
172
|
+
* The top-level statement `node` belongs to: the ancestor that is a direct child of the root of its file
|
|
173
|
+
* (`node` itself if it already is one). A node with no parent is its own statement.
|
|
174
|
+
*/
|
|
175
|
+
topLevelStatement(node, idMap) {
|
|
176
|
+
let current = node;
|
|
177
|
+
for (;;) {
|
|
178
|
+
const parent = current.info.parent === undefined ? undefined : idMap.get(current.info.parent);
|
|
179
|
+
/* the root of a file has no parent of its own, so the node below it is the statement */
|
|
180
|
+
if (parent?.info.parent === undefined) {
|
|
181
|
+
return current;
|
|
182
|
+
}
|
|
183
|
+
current = parent;
|
|
184
|
+
}
|
|
185
|
+
},
|
|
142
186
|
/**
|
|
143
187
|
* A helper function to retrieve the type of a given node.
|
|
144
188
|
*/
|
|
@@ -45,6 +45,9 @@ export declare const RAccess: {
|
|
|
45
45
|
readonly isIndex: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RIndexAccess<Info>;
|
|
46
46
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
47
47
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
48
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
49
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
50
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
48
51
|
readonly getType: (this: void, node: RNode) => RType;
|
|
49
52
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
50
53
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -64,6 +64,9 @@ export declare const RArgument: {
|
|
|
64
64
|
readonly getValue: <OtherInfo>(args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], id: NodeId | undefined) => RNode<OtherInfo> | undefined;
|
|
65
65
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
66
66
|
readonly getId: (this: void, node: RNode<ParentInformation>) => NodeId;
|
|
67
|
+
readonly stableId: (this: void, node: RNode<ParentInformation>) => string | undefined;
|
|
68
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
69
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & ParentInformation>) => RNode<OtherInfo & ParentInformation>;
|
|
67
70
|
readonly getType: (this: void, node: RNode) => RType;
|
|
68
71
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
69
72
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & ParentInformation>>) => Set<NodeId>;
|
|
@@ -26,6 +26,9 @@ export declare const RBinaryOp: {
|
|
|
26
26
|
readonly getOperatorInfo: <Info = object>(node: RBinaryOp<Info>) => OperatorInformationValue | undefined;
|
|
27
27
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
28
28
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
29
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
30
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
31
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
29
32
|
readonly getType: (this: void, node: RNode) => RType;
|
|
30
33
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
31
34
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -18,6 +18,9 @@ export declare const RBreak: {
|
|
|
18
18
|
readonly is: <Info = object>(this: void, node: unknown) => node is RBreak<Info>;
|
|
19
19
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
20
20
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
21
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
22
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
23
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
21
24
|
readonly getType: (this: void, node: RNode) => RType;
|
|
22
25
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
23
26
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -20,6 +20,9 @@ export declare const RComment: {
|
|
|
20
20
|
readonly is: <Info = object>(this: void, node: unknown) => node is RComment<Info>;
|
|
21
21
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
22
22
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
23
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
24
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
25
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
23
26
|
readonly getType: (this: void, node: RNode) => RType;
|
|
24
27
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
25
28
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -34,6 +34,9 @@ export declare const RExpressionList: {
|
|
|
34
34
|
readonly groupEnd: <Info = object>(this: void, node: RExpressionList<Info>) => RSymbol<Info> | undefined;
|
|
35
35
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
36
36
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
37
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
38
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
39
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
37
40
|
readonly getType: (this: void, node: RNode) => RType;
|
|
38
41
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
39
42
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -28,6 +28,9 @@ export declare const RForLoop: {
|
|
|
28
28
|
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RForLoop<Info>;
|
|
29
29
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
30
30
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
31
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
32
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
33
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
31
34
|
readonly getType: (this: void, node: RNode) => RType;
|
|
32
35
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
33
36
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -48,17 +48,17 @@ export declare const RFunctionCall: {
|
|
|
48
48
|
*/
|
|
49
49
|
readonly isUnnamed: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RUnnamedFunctionCall<Info>;
|
|
50
50
|
/**
|
|
51
|
-
* Bind a call's `arguments` to the formal `paramNames`
|
|
52
|
-
*
|
|
53
|
-
* (
|
|
54
|
-
*
|
|
55
|
-
* `matchArgumentsToParameters(call.arguments, names).get('X')` answers "which argument is mapped to
|
|
56
|
-
* parameter `X`". Pass `paramNames` as the full formal list **excluding `...`** so ambiguous prefixes are
|
|
57
|
-
* rejected; this makes it exact when the signature is known (e.g. from the signature database).
|
|
51
|
+
* Bind a call's `arguments` to the formal `paramNames` with {@link matchArgumentsToParameters}, R's argument
|
|
52
|
+
* matching. Returns a map from parameter name to the argument bound to it, so
|
|
53
|
+
* `matchArgsToParams(call.arguments, names).get('X')` answers "which argument is mapped to parameter `X`".
|
|
54
|
+
* An empty argument (`f(1, ,3)`) takes its formal but never appears in the map, as there is nothing to bind.
|
|
58
55
|
*/
|
|
59
|
-
readonly matchArgsToParams: <Info = object>(this: void, args: readonly PotentiallyEmptyRArgument<Info>[], paramNames: readonly string[]) => ReadonlyMap<string,
|
|
56
|
+
readonly matchArgsToParams: <Info = object>(this: void, args: readonly PotentiallyEmptyRArgument<Info>[], paramNames: readonly string[]) => ReadonlyMap<string, RArgument<Info>>;
|
|
60
57
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
61
58
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
59
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
60
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
61
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
62
62
|
readonly getType: (this: void, node: RNode) => RType;
|
|
63
63
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
64
64
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RFunctionCall = exports.EmptyArgument = void 0;
|
|
4
4
|
const model_1 = require("../model");
|
|
5
5
|
const type_1 = require("../type");
|
|
6
|
-
const
|
|
6
|
+
const arg_matching_1 = require("../../../../../util/arg-matching");
|
|
7
7
|
exports.EmptyArgument = '<>';
|
|
8
8
|
/**
|
|
9
9
|
* Helper for working with {@link RFunctionCall} AST nodes.
|
|
@@ -30,55 +30,18 @@ exports.RFunctionCall = {
|
|
|
30
30
|
return exports.RFunctionCall.is(node) && !node.named;
|
|
31
31
|
},
|
|
32
32
|
/**
|
|
33
|
-
* Bind a call's `arguments` to the formal `paramNames`
|
|
34
|
-
*
|
|
35
|
-
* (
|
|
36
|
-
*
|
|
37
|
-
* `matchArgumentsToParameters(call.arguments, names).get('X')` answers "which argument is mapped to
|
|
38
|
-
* parameter `X`". Pass `paramNames` as the full formal list **excluding `...`** so ambiguous prefixes are
|
|
39
|
-
* rejected; this makes it exact when the signature is known (e.g. from the signature database).
|
|
33
|
+
* Bind a call's `arguments` to the formal `paramNames` with {@link matchArgumentsToParameters}, R's argument
|
|
34
|
+
* matching. Returns a map from parameter name to the argument bound to it, so
|
|
35
|
+
* `matchArgsToParams(call.arguments, names).get('X')` answers "which argument is mapped to parameter `X`".
|
|
36
|
+
* An empty argument (`f(1, ,3)`) takes its formal but never appears in the map, as there is nothing to bind.
|
|
40
37
|
*/
|
|
41
38
|
matchArgsToParams(args, paramNames) {
|
|
39
|
+
const matched = (0, arg_matching_1.matchArgumentsToParameters)(args.map(a => a === exports.EmptyArgument ? undefined : a.name?.content), paramNames);
|
|
42
40
|
const bound = new Map();
|
|
43
|
-
const used = new Set();
|
|
44
|
-
// pass 1: exact name matches
|
|
45
41
|
for (let i = 0; i < args.length; i++) {
|
|
46
|
-
const arg = args[i];
|
|
47
|
-
if (arg
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
const n = arg.name.content;
|
|
51
|
-
if (paramNames.includes(n) && !bound.has(n)) {
|
|
52
|
-
bound.set(n, arg);
|
|
53
|
-
used.add(i);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
// pass 2: partial (pmatch) name matches on the still-unbound named arguments
|
|
57
|
-
for (let i = 0; i < args.length; i++) {
|
|
58
|
-
const arg = args[i];
|
|
59
|
-
if (used.has(i) || arg === exports.EmptyArgument || arg.name === undefined) {
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
const matched = (0, prefix_1.findByPrefixIfUnique)(arg.name.content, paramNames);
|
|
63
|
-
if (matched !== undefined && !bound.has(matched)) {
|
|
64
|
-
bound.set(matched, arg);
|
|
65
|
-
used.add(i);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// pass 3: remaining unnamed args fill the remaining formals left-to-right
|
|
69
|
-
let formalIdx = 0;
|
|
70
|
-
for (let i = 0; i < args.length; i++) {
|
|
71
|
-
const arg = args[i];
|
|
72
|
-
if (used.has(i) || arg === exports.EmptyArgument || arg.name !== undefined) {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
while (formalIdx < paramNames.length && bound.has(paramNames[formalIdx])) {
|
|
76
|
-
formalIdx++;
|
|
77
|
-
}
|
|
78
|
-
if (formalIdx < paramNames.length) {
|
|
79
|
-
bound.set(paramNames[formalIdx], arg);
|
|
80
|
-
used.add(i);
|
|
81
|
-
formalIdx++;
|
|
42
|
+
const arg = args[i], param = matched[i];
|
|
43
|
+
if (arg !== exports.EmptyArgument && param !== undefined) {
|
|
44
|
+
bound.set(paramNames[param], arg);
|
|
82
45
|
}
|
|
83
46
|
}
|
|
84
47
|
return bound;
|
|
@@ -41,6 +41,9 @@ export declare const RFunctionDefinition: {
|
|
|
41
41
|
readonly rootFunctionDefinition: <Info = object>(this: void, n: RNode<ParentInformation & Info> | undefined, idMap: AstIdMap<ParentInformation & Info>) => RFunctionDefinition<ParentInformation & Info> | undefined;
|
|
42
42
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
43
43
|
readonly getId: (this: void, node: RNode<ParentInformation>) => import("../processing/node-id").NodeId;
|
|
44
|
+
readonly stableId: (this: void, node: RNode<ParentInformation>) => string | undefined;
|
|
45
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
46
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & ParentInformation>, idMap: AstIdMap<OtherInfo & ParentInformation>) => RNode<OtherInfo & ParentInformation>;
|
|
44
47
|
readonly getType: (this: void, node: RNode) => RType;
|
|
45
48
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
46
49
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -24,6 +24,9 @@ export declare const RIfThenElse: {
|
|
|
24
24
|
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RIfThenElse<Info>;
|
|
25
25
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
26
26
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
27
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
28
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
29
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
27
30
|
readonly getType: (this: void, node: RNode) => RType;
|
|
28
31
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
29
32
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -20,6 +20,9 @@ export declare const RLineDirective: {
|
|
|
20
20
|
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RLineDirective<Info>;
|
|
21
21
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
22
22
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
23
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
24
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
25
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
23
26
|
readonly getType: (this: void, node: RNode) => RType;
|
|
24
27
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
25
28
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -28,6 +28,9 @@ export declare const RLogical: {
|
|
|
28
28
|
readonly isFalse: <Info = object>(this: void, node: RNode<Info> | undefined) => boolean;
|
|
29
29
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
30
30
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
31
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
32
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
33
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
31
34
|
readonly getType: (this: void, node: RNode) => RType;
|
|
32
35
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
33
36
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -18,6 +18,9 @@ export declare const RNext: {
|
|
|
18
18
|
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RNext<Info>;
|
|
19
19
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
20
20
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
21
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
22
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
23
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
21
24
|
readonly getType: (this: void, node: RNode) => RType;
|
|
22
25
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
23
26
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -22,6 +22,9 @@ export declare const RNumber: {
|
|
|
22
22
|
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RNumber<Info>;
|
|
23
23
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
24
24
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
25
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
26
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
27
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
25
28
|
readonly getType: (this: void, node: RNode) => RType;
|
|
26
29
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
27
30
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -30,6 +30,9 @@ export declare const RParameter: {
|
|
|
30
30
|
readonly isDotDotDotDot: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RParameter<Info>;
|
|
31
31
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
32
32
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
33
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
34
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
35
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
33
36
|
readonly getType: (this: void, node: RNode) => RType;
|
|
34
37
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
35
38
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -34,6 +34,9 @@ export declare const RPipe: {
|
|
|
34
34
|
readonly hasAccessPlaceHolderFromRVersion: (this: void) => SemVer;
|
|
35
35
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
36
36
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
37
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
38
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
39
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
37
40
|
readonly getType: (this: void, node: RNode) => RType;
|
|
38
41
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
39
42
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -22,6 +22,9 @@ export declare const RRepeatLoop: {
|
|
|
22
22
|
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RRepeatLoop<Info>;
|
|
23
23
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
24
24
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
25
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
26
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
27
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
25
28
|
readonly getType: (this: void, node: RNode) => RType;
|
|
26
29
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
27
30
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -27,6 +27,9 @@ export declare const RString: {
|
|
|
27
27
|
rawStringAvailableFromRVersion(): SemVer;
|
|
28
28
|
getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
29
29
|
getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
30
|
+
stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
31
|
+
span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
32
|
+
topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
30
33
|
getType: (this: void, node: RNode) => RType;
|
|
31
34
|
visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
32
35
|
collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -32,6 +32,9 @@ export declare const RSymbol: {
|
|
|
32
32
|
readonly isSpecial: <OtherInfo = object>(this: void, node: RNode<OtherInfo> | undefined) => node is RSymbol<OtherInfo, typeof RNull | typeof RNa>;
|
|
33
33
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
34
34
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
35
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
36
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
37
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
35
38
|
readonly getType: (this: void, node: RNode) => RType;
|
|
36
39
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
37
40
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -25,6 +25,9 @@ export declare const RUnaryOp: {
|
|
|
25
25
|
readonly getOperatorInfo: <Info = object>(node: RUnaryOp<Info>) => OperatorInformationValue | undefined;
|
|
26
26
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
27
27
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
28
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
29
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
30
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
28
31
|
readonly getType: (this: void, node: RNode) => RType;
|
|
29
32
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
30
33
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -23,6 +23,9 @@ export declare const RWhileLoop: {
|
|
|
23
23
|
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RWhileLoop<Info>;
|
|
24
24
|
readonly getLocation: (this: void, node: RNode) => import("../../../../../util/range").SourceLocation | undefined;
|
|
25
25
|
readonly getId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId;
|
|
26
|
+
readonly stableId: (this: void, node: RNode<import("../processing/decorate").ParentInformation>) => string | undefined;
|
|
27
|
+
readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
28
|
+
readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
|
|
26
29
|
readonly getType: (this: void, node: RNode) => RType;
|
|
27
30
|
readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
|
|
28
31
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -9,11 +9,6 @@ export type NodeId<T extends string | number = string | number> = T & {
|
|
|
9
9
|
* A variant of {@link NodeId} that represents built-in functions or operators. The string is prefixed with `built-in:` to avoid confusion with other node ids.
|
|
10
10
|
*/
|
|
11
11
|
export type BuiltIn<T extends string = string> = `built-in:${T}`;
|
|
12
|
-
/**
|
|
13
|
-
* The type of the id assigned to each node. Branded to avoid problematic usages with other string or numeric types.
|
|
14
|
-
* The default ids are numeric, but we use a branded type to avoid confusion with other numeric types.
|
|
15
|
-
* Custom ids or scoped ids can be strings, but they will be normalized to numbers if they are numeric strings.
|
|
16
|
-
*/
|
|
17
12
|
export declare const NodeId: {
|
|
18
13
|
readonly name: "NodeId";
|
|
19
14
|
/**
|
|
@@ -11,6 +11,11 @@ const identifier_1 = require("../../../../../dataflow/environments/identifier");
|
|
|
11
11
|
* The default ids are numeric, but we use a branded type to avoid confusion with other numeric types.
|
|
12
12
|
* Custom ids or scoped ids can be strings, but they will be normalized to numbers if they are numeric strings.
|
|
13
13
|
*/
|
|
14
|
+
/** whether the id starts as a number does, which `+id` alone does not tell: it turns a blank string into `0` */
|
|
15
|
+
function startsNumeric(id) {
|
|
16
|
+
const c = id.charCodeAt(0);
|
|
17
|
+
return c >= 48 && c <= 57 /* 0-9 */ || c === 45 /* - */ || c === 43 /* + */ || c === 46 /* . */;
|
|
18
|
+
}
|
|
14
19
|
exports.NodeId = {
|
|
15
20
|
name: 'NodeId',
|
|
16
21
|
/**
|
|
@@ -18,9 +23,7 @@ exports.NodeId = {
|
|
|
18
23
|
* This allows us to use numeric ids without storing them as strings, while still allowing custom string ids if needed.
|
|
19
24
|
*/
|
|
20
25
|
normalize(id) {
|
|
21
|
-
|
|
22
|
-
if (typeof id === 'string') {
|
|
23
|
-
/* typescript is a beautiful converter */
|
|
26
|
+
if (typeof id === 'string' && startsNumeric(id)) {
|
|
24
27
|
const num = +id;
|
|
25
28
|
if (!Number.isNaN(num)) {
|
|
26
29
|
return num;
|
|
@@ -70,7 +70,7 @@ class TreeSitterExecutor {
|
|
|
70
70
|
else {
|
|
71
71
|
sourceCode = request.content;
|
|
72
72
|
}
|
|
73
|
-
if (request.filePath === undefined || !ctx.
|
|
73
|
+
if (request.filePath === undefined || !ctx.inc.handleShouldReparse(request.filePath, ctx)) {
|
|
74
74
|
return this.parser.parse(sourceCode);
|
|
75
75
|
}
|
|
76
76
|
const reparseInfo = (0, incremental_parse_1.computeReparseInfo)(ctx, request.filePath);
|