@eagleoutice/flowr 2.9.9 → 2.9.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 +57 -54
- package/abstract-interpretation/absint-visitor.d.ts +16 -14
- package/abstract-interpretation/absint-visitor.js +93 -47
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +1 -1
- package/abstract-interpretation/data-frame/mappers/arguments.js +2 -2
- package/abstract-interpretation/data-frame/shape-inference.d.ts +2 -5
- package/abstract-interpretation/data-frame/shape-inference.js +4 -5
- package/abstract-interpretation/domains/abstract-domain.d.ts +4 -4
- package/abstract-interpretation/domains/abstract-domain.js +8 -8
- package/abstract-interpretation/domains/mapped-abstract-domain.d.ts +12 -5
- package/abstract-interpretation/domains/mapped-abstract-domain.js +47 -23
- package/abstract-interpretation/domains/set-range-domain.js +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +30 -1
- package/abstract-interpretation/domains/state-abstract-domain.js +130 -4
- package/abstract-interpretation/normalized-ast-fold.d.ts +2 -2
- package/abstract-interpretation/normalized-ast-fold.js +4 -3
- package/benchmark/slicer.js +5 -5
- package/benchmark/summarizer/first-phase/process.js +4 -4
- package/cli/repl/commands/repl-normalize.js +2 -2
- package/cli/repl/core.js +2 -2
- package/config.js +1 -1
- package/control-flow/cfg-simplification.d.ts +1 -0
- package/control-flow/cfg-simplification.js +1 -0
- package/control-flow/control-flow-graph.d.ts +1 -1
- package/control-flow/control-flow-graph.js +1 -2
- package/control-flow/extract-cfg.js +34 -15
- package/control-flow/semantic-cfg-guided-visitor.js +1 -0
- package/dataflow/cluster.js +1 -1
- package/dataflow/environments/built-in.d.ts +6 -15
- package/dataflow/environments/built-in.js +25 -33
- package/dataflow/environments/default-builtin-config.d.ts +4 -8
- package/dataflow/environments/default-builtin-config.js +8 -5
- package/dataflow/environments/reference-to-maybe.d.ts +8 -0
- package/dataflow/environments/reference-to-maybe.js +46 -3
- package/dataflow/eval/resolve/alias-tracking.d.ts +2 -2
- package/dataflow/eval/resolve/alias-tracking.js +6 -6
- package/dataflow/eval/resolve/resolve.js +12 -10
- package/dataflow/fn/exceptions-of-function.d.ts +1 -1
- package/dataflow/fn/exceptions-of-function.js +2 -1
- package/dataflow/graph/call-graph.d.ts +1 -1
- package/dataflow/graph/call-graph.js +4 -3
- package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
- package/dataflow/graph/dataflowgraph-builder.js +21 -21
- package/dataflow/graph/graph.d.ts +5 -5
- package/dataflow/graph/graph.js +36 -32
- package/dataflow/graph/unknown-side-effect.js +3 -1
- package/dataflow/info.d.ts +4 -0
- package/dataflow/info.js +2 -2
- package/dataflow/internal/linker.d.ts +4 -4
- package/dataflow/internal/linker.js +59 -33
- package/dataflow/internal/process/functions/call/argument/make-argument.d.ts +2 -1
- package/dataflow/internal/process/functions/call/argument/make-argument.js +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +3 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +15 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +22 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +22 -19
- package/dataflow/internal/process/functions/call/common.d.ts +1 -1
- package/dataflow/internal/process/functions/call/common.js +43 -35
- package/dataflow/internal/process/functions/call/known-call-handling.js +0 -2
- package/dataflow/internal/process/functions/process-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/process-argument.js +3 -3
- package/dataflow/internal/process/functions/process-parameter.js +2 -2
- package/dataflow/origin/dfg-get-origin.d.ts +1 -1
- package/dataflow/origin/dfg-get-origin.js +2 -2
- package/documentation/doc-util/doc-types.js +1 -1
- package/documentation/wiki-absint.js +7 -8
- package/documentation/wiki-cfg.js +3 -3
- package/documentation/wiki-mk/doc-context.d.ts +8 -0
- package/documentation/wiki-mk/doc-context.js +4 -0
- package/documentation/wiki-normalized-ast.d.ts +1 -1
- package/documentation/wiki-normalized-ast.js +9 -6
- package/linter/linter-format.d.ts +10 -0
- package/linter/linter-format.js +15 -0
- package/linter/rules/absolute-path.js +3 -3
- package/linter/rules/dead-code.js +1 -1
- package/linter/rules/file-path-validity.js +1 -1
- package/linter/rules/seeded-randomness.js +1 -1
- package/linter/rules/unused-definition.js +1 -1
- package/package.json +7 -7
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +9 -0
- package/project/plugins/file-plugins/files/flowr-description-file.js +12 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +1 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +4 -5
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +6 -5
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-format.js +3 -3
- package/queries/catalog/does-call-query/does-call-query-executor.js +3 -3
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -1
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +1 -1
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +1 -1
- package/queries/query-print.d.ts +1 -1
- package/queries/query-print.js +4 -3
- package/r-bridge/lang-4.x/ast/model/model.d.ts +151 -4
- package/r-bridge/lang-4.x/ast/model/model.js +249 -0
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +11 -1
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +13 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +19 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +26 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +36 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +48 -13
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +21 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +11 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +8 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +11 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +23 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +32 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +11 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +19 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +26 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +11 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +11 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +12 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +20 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +26 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +12 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +8 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +11 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +17 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +22 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +22 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +45 -8
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +57 -16
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +12 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +14 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +15 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +21 -6
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +21 -6
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +22 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +16 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +21 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +11 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +14 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +23 -17
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +39 -2
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +52 -9
- package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +18 -17
- package/r-bridge/lang-4.x/ast/model/processing/visitor.d.ts +8 -7
- package/r-bridge/lang-4.x/ast/model/processing/visitor.js +6 -13
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +4 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +2 -2
- package/r-bridge/lang-4.x/convert-values.d.ts +14 -5
- package/r-bridge/lang-4.x/convert-values.js +76 -72
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +33 -15
- package/r-bridge/roxygen2/roxygen-parse.js +1 -1
- package/r-bridge/shell-executor.js +1 -1
- package/reconstruct/auto-select/magic-comments.js +4 -4
- package/reconstruct/reconstruct.js +2 -1
- package/search/search-executor/search-generators.js +2 -2
- package/slicing/criterion/filters/all-variables.js +1 -1
- package/slicing/criterion/parse.d.ts +1 -1
- package/slicing/criterion/parse.js +5 -3
- package/slicing/static/slice-call.d.ts +1 -1
- package/slicing/static/slice-call.js +2 -2
- package/statistics/features/supported/assignments/assignments.js +2 -2
- package/statistics/features/supported/control-flow/control-flow.js +2 -2
- package/statistics/features/supported/data-access/data-access.js +6 -5
- package/statistics/features/supported/defined-functions/defined-functions.js +9 -8
- package/statistics/features/supported/expression-list/statistics-expression-list.js +2 -2
- package/statistics/features/supported/loops/loops.js +6 -5
- package/statistics/features/supported/used-functions/used-functions.js +2 -2
- package/statistics/features/supported/variables/variables.js +8 -8
- package/util/mermaid/ast.js +3 -3
- package/util/mermaid/cfg.js +3 -4
- package/util/mermaid/dfg.d.ts +1 -1
- package/util/mermaid/dfg.js +13 -12
- package/util/simple-df/dfg-ascii.js +1 -1
- package/util/version.js +1 -1
- package/r-bridge/lang-4.x/ast/model/collect.d.ts +0 -10
- package/r-bridge/lang-4.x/ast/model/collect.js +0 -25
|
@@ -1,3 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RParameter = void 0;
|
|
4
|
+
const type_1 = require("../type");
|
|
5
|
+
/**
|
|
6
|
+
* Helper for working with {@link RParameter} AST nodes.
|
|
7
|
+
*/
|
|
8
|
+
exports.RParameter = {
|
|
9
|
+
name: 'RParameter',
|
|
10
|
+
/**
|
|
11
|
+
* Type guard for {@link RParameter} nodes.
|
|
12
|
+
* @see {@link RParameter.isDotDotDotDot} - to check whether a parameter is the special `...` parameter
|
|
13
|
+
*/
|
|
14
|
+
is(node) {
|
|
15
|
+
return node?.type === type_1.RType.Parameter;
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* Type guard for the special `...` parameter.
|
|
19
|
+
* @see {@link RParameter.is} - to check whether a node is a parameter at all
|
|
20
|
+
*/
|
|
21
|
+
isDotDotDotDot(node) {
|
|
22
|
+
return exports.RParameter.is(node) && node.special;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
3
25
|
//# sourceMappingURL=r-parameter.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
|
|
2
|
-
import
|
|
2
|
+
import { RType } from '../type';
|
|
3
|
+
import { SemVer } from 'semver';
|
|
3
4
|
/**
|
|
4
5
|
* Variant of the binary operator, specifically for the new, built-in pipe operator.
|
|
5
6
|
*/
|
|
@@ -8,3 +9,17 @@ export interface RPipe<Info = NoInfo> extends RAstNodeBase<Info>, Location {
|
|
|
8
9
|
readonly lhs: RNode<Info>;
|
|
9
10
|
readonly rhs: RNode<Info>;
|
|
10
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Helper for working with {@link RPipe} AST nodes.
|
|
14
|
+
*/
|
|
15
|
+
export declare const RPipe: {
|
|
16
|
+
readonly name: "RPipe";
|
|
17
|
+
/**
|
|
18
|
+
* Type guard for {@link RPipe} nodes.
|
|
19
|
+
*/
|
|
20
|
+
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RPipe<Info>;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the minimum R version that supports the pipe operator.
|
|
23
|
+
*/
|
|
24
|
+
readonly availableFromRVersion: (this: void) => SemVer;
|
|
25
|
+
};
|
|
@@ -1,3 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RPipe = void 0;
|
|
4
|
+
const type_1 = require("../type");
|
|
5
|
+
const semver_1 = require("semver");
|
|
6
|
+
const versions_1 = require("../versions");
|
|
7
|
+
/**
|
|
8
|
+
* Helper for working with {@link RPipe} AST nodes.
|
|
9
|
+
*/
|
|
10
|
+
exports.RPipe = {
|
|
11
|
+
name: 'RPipe',
|
|
12
|
+
/**
|
|
13
|
+
* Type guard for {@link RPipe} nodes.
|
|
14
|
+
*/
|
|
15
|
+
is(node) {
|
|
16
|
+
return node?.type === type_1.RType.Pipe;
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* Returns the minimum R version that supports the pipe operator.
|
|
20
|
+
*/
|
|
21
|
+
availableFromRVersion() {
|
|
22
|
+
return new semver_1.SemVer(versions_1.MIN_VERSION_PIPE);
|
|
23
|
+
},
|
|
24
|
+
};
|
|
3
25
|
//# sourceMappingURL=r-pipe.js.map
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { NoInfo } from '../model';
|
|
2
|
+
import { RNode } from '../model';
|
|
2
3
|
import { RType } from '../type';
|
|
3
4
|
import type { RExpressionList } from './r-expression-list';
|
|
4
5
|
import type { NodeId } from '../processing/node-id';
|
|
6
|
+
import type { OnEnter, OnExit } from '../processing/visitor';
|
|
7
|
+
import type { ParentInformation } from '../processing/decorate';
|
|
5
8
|
/**
|
|
6
9
|
* Holds a single R file starting with an expression list.
|
|
7
10
|
*/
|
|
@@ -11,8 +14,9 @@ export interface RProjectFile<Info = NoInfo> {
|
|
|
11
14
|
}
|
|
12
15
|
/**
|
|
13
16
|
* Holds a collection of files (started with the expression list)
|
|
17
|
+
* @see {@link RProject.visitAst} - to visit all nodes in the project and related helper functions
|
|
14
18
|
* @see {@link RExpressionList} - for the root of each file
|
|
15
|
-
* @see {@link
|
|
19
|
+
* @see {@link RProject.merge} - to merge multiple projects into a single one
|
|
16
20
|
* @see {@link RProjectFile} - for each file in the project
|
|
17
21
|
*/
|
|
18
22
|
export interface RProject<Info = NoInfo> {
|
|
@@ -23,11 +27,44 @@ export interface RProject<Info = NoInfo> {
|
|
|
23
27
|
};
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
26
|
-
*
|
|
30
|
+
* Helper object to identify RProject nodes by their type and to provide related functions.
|
|
31
|
+
* @see {@link RNode.visitAst} - to visit all nodes in the project
|
|
27
32
|
*/
|
|
28
|
-
export declare
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
export declare const RProject: {
|
|
34
|
+
readonly name: "RProject";
|
|
35
|
+
/**
|
|
36
|
+
* Visits all nodes in the project by visiting the root of each file.
|
|
37
|
+
* @param project - The project to visit file by file
|
|
38
|
+
* @param onVisit - Called before visiting the subtree of each node. Can be used to stop visiting the subtree starting with this node (return `true` stop)
|
|
39
|
+
* @param onExit - Called after the subtree of a node has been visited, called for leafs too (even though their subtree is empty)
|
|
40
|
+
*/
|
|
41
|
+
readonly visitAst: <OtherInfo>(this: void, project: RProject<OtherInfo>, onVisit?: OnEnter<OtherInfo>, onExit?: OnExit<OtherInfo>) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Collects all node ids within a project
|
|
44
|
+
* @param project - The project to collect ids from
|
|
45
|
+
* @see {@link RNode.collectAllIds} - to stop collecting at certain nodes
|
|
46
|
+
* @see {@link RProject.collectAllIdsWithStop} - to stop collecting at certain nodes
|
|
47
|
+
*/
|
|
48
|
+
readonly collectAllIds: <OtherInfo>(this: void, project: RProject<OtherInfo & ParentInformation>) => Set<NodeId>;
|
|
49
|
+
/**
|
|
50
|
+
* Collects all node ids within a project, but stops collecting at nodes where the given `stop` function returns `true`.
|
|
51
|
+
* @param project - The project to collect ids from
|
|
52
|
+
* @param stop - A function that determines whether to stop collecting at a given node, does not stop by default
|
|
53
|
+
* @see {@link RNode.collectAllIdsWithStop} - to collect all ids without stopping
|
|
54
|
+
* @see {@link RProject.collectAllIds} - to collect all ids without stopping
|
|
55
|
+
*/
|
|
56
|
+
readonly collectAllIdsWithStop: <OtherInfo>(this: void, project: RProject<OtherInfo & ParentInformation>, stop: (node: RNode<OtherInfo & ParentInformation>) => boolean) => Set<NodeId>;
|
|
57
|
+
/**
|
|
58
|
+
* Flattens the project to an array of nodes by collecting the root nodes of each file.
|
|
59
|
+
*/
|
|
60
|
+
readonly asNodes: <OtherInfo>(this: void, project: RProject<OtherInfo>) => RNode<OtherInfo>[];
|
|
61
|
+
/**
|
|
62
|
+
* Type guard for RProject nodes.
|
|
63
|
+
*/
|
|
64
|
+
readonly is: <OtherInfo = object>(this: void, node: unknown) => node is RProject<OtherInfo>;
|
|
65
|
+
/**
|
|
66
|
+
* Merge multiple projects into a single one by concatenating their files.
|
|
67
|
+
* This will remove the `info` property of the resulting project.
|
|
68
|
+
*/
|
|
69
|
+
readonly merge: <Info = object>(this: void, projects: readonly RProject<Info>[]) => RProject<Info>;
|
|
70
|
+
};
|
|
@@ -1,22 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.RProject = void 0;
|
|
4
|
+
const model_1 = require("../model");
|
|
5
5
|
const type_1 = require("../type");
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Helper object to identify RProject nodes by their type and to provide related functions.
|
|
8
|
+
* @see {@link RNode.visitAst} - to visit all nodes in the project
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
exports.RProject = {
|
|
11
|
+
name: 'RProject',
|
|
12
|
+
/**
|
|
13
|
+
* Visits all nodes in the project by visiting the root of each file.
|
|
14
|
+
* @param project - The project to visit file by file
|
|
15
|
+
* @param onVisit - Called before visiting the subtree of each node. Can be used to stop visiting the subtree starting with this node (return `true` stop)
|
|
16
|
+
* @param onExit - Called after the subtree of a node has been visited, called for leafs too (even though their subtree is empty)
|
|
17
|
+
*/
|
|
18
|
+
visitAst(project, onVisit, onExit) {
|
|
19
|
+
return model_1.RNode.visitAst(project.files.map(f => f.root), onVisit, onExit);
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* Collects all node ids within a project
|
|
23
|
+
* @param project - The project to collect ids from
|
|
24
|
+
* @see {@link RNode.collectAllIds} - to stop collecting at certain nodes
|
|
25
|
+
* @see {@link RProject.collectAllIdsWithStop} - to stop collecting at certain nodes
|
|
26
|
+
*/
|
|
27
|
+
collectAllIds(project) {
|
|
28
|
+
return model_1.RNode.collectAllIds(exports.RProject.asNodes(project));
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Collects all node ids within a project, but stops collecting at nodes where the given `stop` function returns `true`.
|
|
32
|
+
* @param project - The project to collect ids from
|
|
33
|
+
* @param stop - A function that determines whether to stop collecting at a given node, does not stop by default
|
|
34
|
+
* @see {@link RNode.collectAllIdsWithStop} - to collect all ids without stopping
|
|
35
|
+
* @see {@link RProject.collectAllIds} - to collect all ids without stopping
|
|
36
|
+
*/
|
|
37
|
+
collectAllIdsWithStop(project, stop) {
|
|
38
|
+
return model_1.RNode.collectAllIdsWithStop(exports.RProject.asNodes(project), stop);
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Flattens the project to an array of nodes by collecting the root nodes of each file.
|
|
42
|
+
*/
|
|
43
|
+
asNodes(project) {
|
|
44
|
+
return project.files.map(f => f.root);
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Type guard for RProject nodes.
|
|
48
|
+
*/
|
|
49
|
+
is(node) {
|
|
50
|
+
return typeof node === 'object' && node !== null && 'type' in node && node.type === type_1.RType.Project;
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Merge multiple projects into a single one by concatenating their files.
|
|
54
|
+
* This will remove the `info` property of the resulting project.
|
|
55
|
+
*/
|
|
56
|
+
merge(projects) {
|
|
57
|
+
return {
|
|
58
|
+
type: type_1.RType.Project,
|
|
59
|
+
files: projects.flatMap(p => p.files)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
};
|
|
22
63
|
//# sourceMappingURL=r-project.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RAstNodeBase, Location, NoInfo } from '../model';
|
|
2
|
-
import
|
|
1
|
+
import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
|
|
2
|
+
import { RType } from '../type';
|
|
3
3
|
import type { RExpressionList } from './r-expression-list';
|
|
4
4
|
/**
|
|
5
5
|
* ```r
|
|
@@ -10,3 +10,13 @@ export interface RRepeatLoop<Info = NoInfo> extends RAstNodeBase<Info>, Location
|
|
|
10
10
|
readonly type: RType.RepeatLoop;
|
|
11
11
|
body: RExpressionList<Info>;
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Helper for working with {@link RRepeatLoop} AST nodes.
|
|
15
|
+
*/
|
|
16
|
+
export declare const RRepeatLoop: {
|
|
17
|
+
readonly name: "RRepeatLoop";
|
|
18
|
+
/**
|
|
19
|
+
* Type guard for RRepeatLoop nodes.
|
|
20
|
+
*/
|
|
21
|
+
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RRepeatLoop<Info>;
|
|
22
|
+
};
|
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RRepeatLoop = void 0;
|
|
4
|
+
const type_1 = require("../type");
|
|
5
|
+
/**
|
|
6
|
+
* Helper for working with {@link RRepeatLoop} AST nodes.
|
|
7
|
+
*/
|
|
8
|
+
exports.RRepeatLoop = {
|
|
9
|
+
name: 'RRepeatLoop',
|
|
10
|
+
/**
|
|
11
|
+
* Type guard for RRepeatLoop nodes.
|
|
12
|
+
*/
|
|
13
|
+
is(node) {
|
|
14
|
+
return node?.type === type_1.RType.RepeatLoop;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
3
17
|
//# sourceMappingURL=r-repeat-loop.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Leaf, Location, NoInfo, RNode } from '../model';
|
|
2
2
|
import type { RStringValue } from '../../../convert-values';
|
|
3
3
|
import { RType } from '../type';
|
|
4
|
+
import { SemVer } from 'semver';
|
|
4
5
|
/**
|
|
5
6
|
* Represents a string like `"hello"`, including raw strings like `r"(hello)"`.
|
|
6
7
|
* @see {@link isRString} - to check whether a node is an R string
|
|
@@ -10,7 +11,18 @@ export interface RString<Info = NoInfo> extends Leaf<Info>, Location {
|
|
|
10
11
|
content: RStringValue;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @see {@link RString}
|
|
14
|
+
* Helper for working with {@link RString} AST nodes.
|
|
15
15
|
*/
|
|
16
|
-
export declare
|
|
16
|
+
export declare const RString: {
|
|
17
|
+
name: string;
|
|
18
|
+
/**
|
|
19
|
+
* Type guard for RString nodes.
|
|
20
|
+
* @see {@link RString}
|
|
21
|
+
*/
|
|
22
|
+
is<Info = object>(this: void, node: RNode<Info> | undefined): node is RString<Info>;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the minimum R version that supports raw strings (in a stable format).
|
|
25
|
+
* @see {@link RString}
|
|
26
|
+
*/
|
|
27
|
+
rawStringAvailableFromRVersion(): SemVer;
|
|
28
|
+
};
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.RString = void 0;
|
|
4
4
|
const type_1 = require("../type");
|
|
5
|
+
const semver_1 = require("semver");
|
|
6
|
+
const versions_1 = require("../versions");
|
|
5
7
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @see {@link RString}
|
|
8
|
+
* Helper for working with {@link RString} AST nodes.
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
exports.RString = {
|
|
11
|
+
name: 'RString',
|
|
12
|
+
/**
|
|
13
|
+
* Type guard for RString nodes.
|
|
14
|
+
* @see {@link RString}
|
|
15
|
+
*/
|
|
16
|
+
is(node) {
|
|
17
|
+
return node?.type === type_1.RType.String;
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* Returns the minimum R version that supports raw strings (in a stable format).
|
|
21
|
+
* @see {@link RString}
|
|
22
|
+
*/
|
|
23
|
+
rawStringAvailableFromRVersion() {
|
|
24
|
+
return new semver_1.SemVer(versions_1.MIN_VERSION_RAW_STABLE);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
12
27
|
//# sourceMappingURL=r-string.js.map
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { Leaf, Location, NoInfo } from '../model';
|
|
2
|
-
import
|
|
1
|
+
import type { Leaf, Location, NoInfo, RNode } from '../model';
|
|
2
|
+
import { RType } from '../type';
|
|
3
|
+
import { RNa, RNull } from '../../../convert-values';
|
|
3
4
|
import type { Identifier } from '../../../../../dataflow/environments/identifier';
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
export declare function isSpecialSymbol(symbol: RSymbol): boolean;
|
|
8
5
|
/**
|
|
9
6
|
* Represents identifiers (variables) such as `x` in `x <- 42` or `a::foo` in `a::foo()`.
|
|
10
7
|
* See {@link Identifier} for more information about how identifiers are represented.
|
|
@@ -15,3 +12,21 @@ export interface RSymbol<Info = NoInfo, T extends Identifier = Identifier> exten
|
|
|
15
12
|
readonly type: RType.Symbol;
|
|
16
13
|
content: T;
|
|
17
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Helper for working with {@link RSymbol} AST nodes.
|
|
17
|
+
*/
|
|
18
|
+
export declare const RSymbol: {
|
|
19
|
+
readonly name: "RSymbol";
|
|
20
|
+
/**
|
|
21
|
+
* Type guard for {@link RSymbol} nodes.
|
|
22
|
+
* @see {@link RSymbol.isSpecial} - to check whether a symbol is a special symbol like `NA` or `NULL`
|
|
23
|
+
*/
|
|
24
|
+
readonly is: <OtherInfo = object>(this: void, node: RNode<OtherInfo> | undefined) => node is RSymbol<OtherInfo>;
|
|
25
|
+
/**
|
|
26
|
+
* Type guard for special symbols, i.e. `NA` and `NULL`.
|
|
27
|
+
* @see {@link RNa} - for the value of `NA`
|
|
28
|
+
* @see {@link RNull} - for the value of `NULL`
|
|
29
|
+
* @see {@link RSymbol.is} - to check whether a node is a symbol at all
|
|
30
|
+
*/
|
|
31
|
+
readonly isSpecial: <OtherInfo = object>(this: void, node: RNode<OtherInfo> | undefined) => node is RSymbol<OtherInfo, typeof RNull | typeof RNa>;
|
|
32
|
+
};
|
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.RSymbol = void 0;
|
|
4
|
+
const type_1 = require("../type");
|
|
4
5
|
const convert_values_1 = require("../../../convert-values");
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
+
* Helper for working with {@link RSymbol} AST nodes.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
exports.RSymbol = {
|
|
10
|
+
name: 'RSymbol',
|
|
11
|
+
/**
|
|
12
|
+
* Type guard for {@link RSymbol} nodes.
|
|
13
|
+
* @see {@link RSymbol.isSpecial} - to check whether a symbol is a special symbol like `NA` or `NULL`
|
|
14
|
+
*/
|
|
15
|
+
is(node) {
|
|
16
|
+
return node?.type === type_1.RType.Symbol;
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* Type guard for special symbols, i.e. `NA` and `NULL`.
|
|
20
|
+
* @see {@link RNa} - for the value of `NA`
|
|
21
|
+
* @see {@link RNull} - for the value of `NULL`
|
|
22
|
+
* @see {@link RSymbol.is} - to check whether a node is a symbol at all
|
|
23
|
+
*/
|
|
24
|
+
isSpecial(node) {
|
|
25
|
+
return exports.RSymbol.is(node) && (node.content === convert_values_1.RNull || node.content === convert_values_1.RNa);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
11
28
|
//# sourceMappingURL=r-symbol.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
|
|
2
|
-
import
|
|
2
|
+
import { RType } from '../type';
|
|
3
|
+
import type { OperatorInformationValue } from '../operators';
|
|
3
4
|
/**
|
|
4
5
|
* Unary operations like `+` and `-`
|
|
5
6
|
*/
|
|
@@ -8,3 +9,17 @@ export interface RUnaryOp<Info = NoInfo> extends RAstNodeBase<Info>, Location {
|
|
|
8
9
|
operator: string;
|
|
9
10
|
operand: RNode<Info>;
|
|
10
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Helper for working with {@link RUnaryOp} AST nodes.
|
|
14
|
+
*/
|
|
15
|
+
export declare const RUnaryOp: {
|
|
16
|
+
readonly name: "RUnaryOp";
|
|
17
|
+
/**
|
|
18
|
+
* Type guard for {@link RUnaryOp} nodes.
|
|
19
|
+
*/
|
|
20
|
+
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RUnaryOp<Info>;
|
|
21
|
+
/**
|
|
22
|
+
* Get the operator information for a binary operator node.
|
|
23
|
+
*/
|
|
24
|
+
readonly getOperatorInfo: <Info = object>(node: RUnaryOp<Info>) => OperatorInformationValue | undefined;
|
|
25
|
+
};
|
|
@@ -1,3 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RUnaryOp = void 0;
|
|
4
|
+
const type_1 = require("../type");
|
|
5
|
+
const operators_1 = require("../operators");
|
|
6
|
+
/**
|
|
7
|
+
* Helper for working with {@link RUnaryOp} AST nodes.
|
|
8
|
+
*/
|
|
9
|
+
exports.RUnaryOp = {
|
|
10
|
+
name: 'RUnaryOp',
|
|
11
|
+
/**
|
|
12
|
+
* Type guard for {@link RUnaryOp} nodes.
|
|
13
|
+
*/
|
|
14
|
+
is(node) {
|
|
15
|
+
return node?.type === type_1.RType.UnaryOp;
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* Get the operator information for a binary operator node.
|
|
19
|
+
*/
|
|
20
|
+
getOperatorInfo(node) {
|
|
21
|
+
return operators_1.OperatorDatabase[node.operator];
|
|
22
|
+
}
|
|
23
|
+
};
|
|
3
24
|
//# sourceMappingURL=r-unary-op.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
|
|
2
|
-
import
|
|
2
|
+
import { RType } from '../type';
|
|
3
3
|
import type { RExpressionList } from './r-expression-list';
|
|
4
4
|
/**
|
|
5
5
|
* ```r
|
|
@@ -11,3 +11,13 @@ export interface RWhileLoop<Info = NoInfo> extends RAstNodeBase<Info>, Location
|
|
|
11
11
|
condition: RNode<Info>;
|
|
12
12
|
body: RExpressionList<Info>;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Helper for working with {@link RWhileLoop} AST nodes.
|
|
16
|
+
*/
|
|
17
|
+
export declare const RWhileLoop: {
|
|
18
|
+
readonly name: "RWhileLoop";
|
|
19
|
+
/**
|
|
20
|
+
* Type guard for {@link RWhileLoop} nodes.
|
|
21
|
+
*/
|
|
22
|
+
readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RWhileLoop<Info>;
|
|
23
|
+
};
|
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RWhileLoop = void 0;
|
|
4
|
+
const type_1 = require("../type");
|
|
5
|
+
/**
|
|
6
|
+
* Helper for working with {@link RWhileLoop} AST nodes.
|
|
7
|
+
*/
|
|
8
|
+
exports.RWhileLoop = {
|
|
9
|
+
name: 'RWhileLoop',
|
|
10
|
+
/**
|
|
11
|
+
* Type guard for {@link RWhileLoop} nodes.
|
|
12
|
+
*/
|
|
13
|
+
is(node) {
|
|
14
|
+
return node?.type === type_1.RType.WhileLoop;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
3
17
|
//# sourceMappingURL=r-while-loop.js.map
|
|
@@ -173,12 +173,12 @@ function createFoldForBinaryOp(info) {
|
|
|
173
173
|
rhsInfo.parent = id;
|
|
174
174
|
rhsInfo.index = 1;
|
|
175
175
|
if (data.type === type_1.RType.Pipe) {
|
|
176
|
-
lhsInfo.role = "pipe-
|
|
177
|
-
rhsInfo.role = "pipe-
|
|
176
|
+
lhsInfo.role = "pipe-l" /* RoleInParent.PipeLhs */;
|
|
177
|
+
rhsInfo.role = "pipe-r" /* RoleInParent.PipeRhs */;
|
|
178
178
|
}
|
|
179
179
|
else {
|
|
180
|
-
lhsInfo.role = "
|
|
181
|
-
rhsInfo.role = "
|
|
180
|
+
lhsInfo.role = "bin-l" /* RoleInParent.BinaryOperationLhs */;
|
|
181
|
+
rhsInfo.role = "bin-r" /* RoleInParent.BinaryOperationRhs */;
|
|
182
182
|
}
|
|
183
183
|
decorated.info.file = info.file;
|
|
184
184
|
return decorated;
|
|
@@ -203,7 +203,7 @@ function createFoldForAccess(info) {
|
|
|
203
203
|
info.idMap.set(id, decorated);
|
|
204
204
|
const accessedInfo = accessed.info;
|
|
205
205
|
accessedInfo.parent = id;
|
|
206
|
-
accessedInfo.role = "
|
|
206
|
+
accessedInfo.role = "acc" /* RoleInParent.Accessed */;
|
|
207
207
|
if (typeof access !== 'string') {
|
|
208
208
|
let idx = 0; // the first oe will be skipped in the first iter
|
|
209
209
|
for (const acc of access) {
|
|
@@ -212,7 +212,7 @@ function createFoldForAccess(info) {
|
|
|
212
212
|
const curInfo = acc.info;
|
|
213
213
|
curInfo.parent = id;
|
|
214
214
|
curInfo.index = idx;
|
|
215
|
-
curInfo.role = "
|
|
215
|
+
curInfo.role = "idx-acc" /* RoleInParent.IndexAccess */;
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
}
|
|
@@ -235,7 +235,7 @@ function createFoldForForLoop(info) {
|
|
|
235
235
|
const bodyInfo = body.info;
|
|
236
236
|
bodyInfo.parent = id;
|
|
237
237
|
bodyInfo.index = 2;
|
|
238
|
-
bodyInfo.role = "for-
|
|
238
|
+
bodyInfo.role = "for-b" /* RoleInParent.ForBody */;
|
|
239
239
|
decorated.info.file = info.file;
|
|
240
240
|
return decorated;
|
|
241
241
|
};
|
|
@@ -247,7 +247,7 @@ function createFoldForRepeatLoop(info) {
|
|
|
247
247
|
info.idMap.set(id, decorated);
|
|
248
248
|
const bodyInfo = body.info;
|
|
249
249
|
bodyInfo.parent = id;
|
|
250
|
-
bodyInfo.role = "repeat-
|
|
250
|
+
bodyInfo.role = "repeat-b" /* RoleInParent.RepeatBody */;
|
|
251
251
|
decorated.info.file = info.file;
|
|
252
252
|
return decorated;
|
|
253
253
|
};
|
|
@@ -259,11 +259,11 @@ function createFoldForWhileLoop(info) {
|
|
|
259
259
|
info.idMap.set(id, decorated);
|
|
260
260
|
const condInfo = condition.info;
|
|
261
261
|
condInfo.parent = id;
|
|
262
|
-
condInfo.role = "while-
|
|
262
|
+
condInfo.role = "while-c" /* RoleInParent.WhileCondition */;
|
|
263
263
|
const bodyInfo = body.info;
|
|
264
264
|
bodyInfo.parent = id;
|
|
265
265
|
bodyInfo.index = 1;
|
|
266
|
-
bodyInfo.role = "while-
|
|
266
|
+
bodyInfo.role = "while-b" /* RoleInParent.WhileBody */;
|
|
267
267
|
decorated.info.file = info.file;
|
|
268
268
|
return decorated;
|
|
269
269
|
};
|
|
@@ -275,7 +275,7 @@ function createFoldForIfThenElse(info) {
|
|
|
275
275
|
info.idMap.set(id, decorated);
|
|
276
276
|
const condInfo = condition.info;
|
|
277
277
|
condInfo.parent = id;
|
|
278
|
-
condInfo.role = "if-
|
|
278
|
+
condInfo.role = "if-c" /* RoleInParent.IfCondition */;
|
|
279
279
|
const thenInfo = then.info;
|
|
280
280
|
thenInfo.parent = id;
|
|
281
281
|
thenInfo.index = 1;
|
|
@@ -300,7 +300,13 @@ function createFoldForExprList(info) {
|
|
|
300
300
|
const childInfo = child.info;
|
|
301
301
|
childInfo.parent = id;
|
|
302
302
|
childInfo.index = i++;
|
|
303
|
-
childInfo.role = "
|
|
303
|
+
childInfo.role = "el-c" /* RoleInParent.ExpressionListChild */;
|
|
304
|
+
}
|
|
305
|
+
// assign role for grouping
|
|
306
|
+
if (grouping) {
|
|
307
|
+
const [open, close] = grouping;
|
|
308
|
+
open.info.role = "el-g" /* RoleInParent.ExpressionListGrouping */;
|
|
309
|
+
close.info.role = "el-g" /* RoleInParent.ExpressionListGrouping */;
|
|
304
310
|
}
|
|
305
311
|
decorated.info.file = info.file;
|
|
306
312
|
return decorated;
|
|
@@ -349,7 +355,7 @@ function createFoldForFunctionDefinition(info) {
|
|
|
349
355
|
const bodyInfo = body.info;
|
|
350
356
|
bodyInfo.parent = id;
|
|
351
357
|
bodyInfo.index = idx;
|
|
352
|
-
bodyInfo.role = "fun-
|
|
358
|
+
bodyInfo.role = "fun-b" /* RoleInParent.FunctionDefinitionBody */;
|
|
353
359
|
decorated.info.file = info.file;
|
|
354
360
|
return decorated;
|
|
355
361
|
};
|
|
@@ -361,12 +367,12 @@ function createFoldForFunctionParameter(info) {
|
|
|
361
367
|
info.idMap.set(id, decorated);
|
|
362
368
|
const nameInfo = name.info;
|
|
363
369
|
nameInfo.parent = id;
|
|
364
|
-
nameInfo.role = "param-
|
|
370
|
+
nameInfo.role = "param-n" /* RoleInParent.ParameterName */;
|
|
365
371
|
if (defaultValue) {
|
|
366
372
|
const defaultInfo = defaultValue.info;
|
|
367
373
|
defaultInfo.parent = id;
|
|
368
374
|
defaultInfo.index = 1;
|
|
369
|
-
defaultInfo.role = "param-
|
|
375
|
+
defaultInfo.role = "param-v" /* RoleInParent.ParameterDefaultValue */;
|
|
370
376
|
}
|
|
371
377
|
decorated.info.file = info.file;
|
|
372
378
|
return decorated;
|
|
@@ -381,14 +387,14 @@ function createFoldForFunctionArgument(info) {
|
|
|
381
387
|
if (name) {
|
|
382
388
|
const nameInfo = name.info;
|
|
383
389
|
nameInfo.parent = id;
|
|
384
|
-
nameInfo.role = "arg-
|
|
390
|
+
nameInfo.role = "arg-n" /* RoleInParent.ArgumentName */;
|
|
385
391
|
idx++; // adaptive, 0 for the value if there is no name!
|
|
386
392
|
}
|
|
387
393
|
if (value) {
|
|
388
394
|
const valueInfo = value.info;
|
|
389
395
|
valueInfo.parent = id;
|
|
390
396
|
valueInfo.index = idx;
|
|
391
|
-
valueInfo.role = "arg-
|
|
397
|
+
valueInfo.role = "arg-v" /* RoleInParent.ArgumentValue */;
|
|
392
398
|
}
|
|
393
399
|
decorated.info.file = info.file;
|
|
394
400
|
return decorated;
|