@eagleoutice/flowr 2.13.9 → 2.13.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config.d.ts +50 -2
- package/config.js +37 -6
- package/dataflow/environments/apply-kill.js +4 -4
- package/dataflow/environments/built-in-props.d.ts +28 -4
- package/dataflow/environments/built-in-props.js +31 -8
- package/dataflow/environments/built-in.d.ts +7 -2
- package/dataflow/environments/built-in.js +10 -12
- package/dataflow/environments/default-builtin-config.d.ts +46 -6
- package/dataflow/environments/default-builtin-config.js +30 -16
- package/dataflow/environments/environment.d.ts +16 -0
- package/dataflow/environments/environment.js +70 -18
- package/dataflow/environments/identifier.d.ts +6 -0
- package/dataflow/environments/identifier.js +18 -5
- package/dataflow/environments/query-fn-props.js +34 -2
- package/dataflow/environments/reference-to-maybe.js +1 -1
- package/dataflow/eval/resolve/alias-tracking.js +45 -1
- package/dataflow/eval/resolve/resolve-argument.js +25 -17
- package/dataflow/eval/resolve/resolve-strings.d.ts +17 -0
- package/dataflow/eval/resolve/resolve-strings.js +16 -9
- package/dataflow/eval/resolve/resolve.js +3 -1
- package/dataflow/graph/call-graph.d.ts +7 -0
- package/dataflow/graph/call-graph.js +103 -0
- package/dataflow/graph/df-helper.d.ts +2 -0
- package/dataflow/graph/graph.d.ts +5 -8
- package/dataflow/internal/linker.d.ts +5 -5
- package/dataflow/internal/linker.js +31 -92
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +3 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +4 -30
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -6
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +32 -14
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +16 -4
- package/dataflow/internal/process/functions/call/known-call-handling.js +29 -8
- package/documentation/doc-util/doc-sigdb.d.ts +9 -0
- package/documentation/doc-util/doc-sigdb.js +32 -0
- package/documentation/wiki-interface.js +13 -2
- package/documentation/wiki-query.js +3 -0
- package/documentation/wiki-signature-database.js +2 -5
- package/gas.d.ts +6 -0
- package/gas.js +7 -1
- package/package.json +1 -1
- package/project/attached-packages.d.ts +13 -0
- package/project/attached-packages.js +30 -0
- package/project/context/flowr-analyzer-context.d.ts +15 -0
- package/project/context/flowr-analyzer-context.js +14 -3
- package/project/context/flowr-analyzer-files-context.d.ts +11 -0
- package/project/context/flowr-analyzer-files-context.js +3 -0
- package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +4 -0
- package/project/context/flowr-analyzer-incremental-analysis-context.js +69 -0
- package/project/dependency-version-space.d.ts +33 -11
- package/project/dependency-version-space.js +58 -32
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +52 -24
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.d.ts +22 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +101 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +30 -11
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +79 -37
- package/project/plugins/plugin-registry.d.ts +2 -1
- package/project/plugins/plugin-registry.js +2 -0
- package/project/sigdb/manifest.js +9 -5
- package/project/sigdb/signature-match.d.ts +5 -18
- package/project/sigdb/signature-match.js +5 -18
- package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +4 -0
- package/queries/catalog/call-graph-query/call-graph-query-format.js +4 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +10 -3
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +19 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +22 -2
- package/queries/catalog/dependencies-query/function-info/library-functions.js +7 -1
- package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -5
- package/queries/catalog/dependencies-query/function-info/remote-functions.d.ts +18 -0
- package/queries/catalog/dependencies-query/function-info/remote-functions.js +46 -0
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +52 -2
- package/queries/catalog/dependencies-query/function-info/write-functions.js +8 -4
- package/queries/catalog/dependencies-query/link-devices.d.ts +12 -0
- package/queries/catalog/dependencies-query/link-devices.js +58 -0
- package/queries/catalog/dice-query/dice-query-format.d.ts +2 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +25 -6
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +37 -6
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +17 -4
- package/queries/catalog/input-sources-query/input-sources-query-format.js +4 -0
- package/queries/catalog/input-sources-query/input-types.d.ts +10 -0
- package/queries/catalog/input-sources-query/input-types.js +10 -0
- package/queries/catalog/location-map-query/location-map-query-executor.js +16 -6
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +15 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +22 -5
- package/queries/catalog/signature-query/signature-query-executor.js +3 -0
- package/queries/catalog/signature-query/signature-query-format.d.ts +5 -0
- package/queries/query.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/model.d.ts +14 -2
- package/r-bridge/lang-4.x/ast/model/model.js +32 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +7 -8
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +9 -46
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +0 -5
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +6 -3
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
- package/search/flowr-search-filters.d.ts +17 -1
- package/search/flowr-search-filters.js +23 -0
- package/slicing/criterion/parse.d.ts +5 -25
- package/slicing/criterion/parse.js +15 -20
- package/slicing/static/fingerprint.js +18 -6
- package/slicing/static/slicer-types.d.ts +10 -0
- package/slicing/static/static-slicer.d.ts +1 -1
- package/slicing/static/static-slicer.js +29 -6
- package/slicing/static/visiting-queue.d.ts +12 -2
- package/slicing/static/visiting-queue.js +28 -3
- package/util/arg-matching.d.ts +18 -0
- package/util/arg-matching.js +70 -0
- package/util/r-regex.js +19 -1
- package/util/range.d.ts +7 -8
- package/util/range.js +10 -11
- package/util/version.js +1 -1
|
@@ -20,6 +20,8 @@ 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 span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
24
|
+
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
25
|
readonly getType: (this: void, node: RNode) => RType;
|
|
24
26
|
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
27
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -28,6 +28,8 @@ 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 span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
32
|
+
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
33
|
readonly getType: (this: void, node: RNode) => RType;
|
|
32
34
|
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
35
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -18,6 +18,8 @@ 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 span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
22
|
+
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
23
|
readonly getType: (this: void, node: RNode) => RType;
|
|
22
24
|
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
25
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -22,6 +22,8 @@ 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 span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
26
|
+
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
27
|
readonly getType: (this: void, node: RNode) => RType;
|
|
26
28
|
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
29
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -30,6 +30,8 @@ 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 span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
34
|
+
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
35
|
readonly getType: (this: void, node: RNode) => RType;
|
|
34
36
|
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
37
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -34,6 +34,8 @@ 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 span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
38
|
+
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
39
|
readonly getType: (this: void, node: RNode) => RType;
|
|
38
40
|
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
41
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -22,6 +22,8 @@ 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 span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
26
|
+
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
27
|
readonly getType: (this: void, node: RNode) => RType;
|
|
26
28
|
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
29
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -27,6 +27,8 @@ 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
|
+
span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
31
|
+
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
32
|
getType: (this: void, node: RNode) => RType;
|
|
31
33
|
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
34
|
collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -32,6 +32,8 @@ 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 span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../../util/range").SourceRange | undefined;
|
|
36
|
+
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
37
|
readonly getType: (this: void, node: RNode) => RType;
|
|
36
38
|
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
39
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -25,6 +25,8 @@ 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 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>;
|
|
28
30
|
readonly getType: (this: void, node: RNode) => RType;
|
|
29
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;
|
|
30
32
|
readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
|
|
@@ -23,6 +23,8 @@ 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 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>;
|
|
26
28
|
readonly getType: (this: void, node: RNode) => RType;
|
|
27
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;
|
|
28
30
|
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);
|
|
@@ -6,6 +6,7 @@ import type { Enrichment } from './search-executor/search-enrichers';
|
|
|
6
6
|
import type { DataflowInformation } from '../dataflow/info';
|
|
7
7
|
import type { BuiltInProcName } from '../dataflow/environments/built-in-proc-name';
|
|
8
8
|
import type { RoleInParent } from '../r-bridge/lang-4.x/ast/model/processing/role';
|
|
9
|
+
import type { CallProps } from '../dataflow/environments/built-in-props';
|
|
9
10
|
export type FlowrFilterName = keyof typeof FlowrFilters;
|
|
10
11
|
interface FlowrFilterWithArgs<Filter extends FlowrFilterName, Args extends FlowrFilterArgs<Filter>> {
|
|
11
12
|
name: Filter;
|
|
@@ -37,7 +38,13 @@ export declare enum FlowrFilter {
|
|
|
37
38
|
* Only returns search elements whose file path matches the given regular expression.
|
|
38
39
|
* This filter accepts {@link FilePathFilterArgs}, which includes the file path regex to test against.
|
|
39
40
|
*/
|
|
40
|
-
FilePathFilter = "file-path-filter"
|
|
41
|
+
FilePathFilter = "file-path-filter",
|
|
42
|
+
/**
|
|
43
|
+
* Only returns function calls whose {@link CallProp} bits match the given mask, so that _every call that asks
|
|
44
|
+
* the user_ or _every call that closes a device_ can be searched for without naming a single function.
|
|
45
|
+
* This filter accepts {@link CallPropsArgs}.
|
|
46
|
+
*/
|
|
47
|
+
CallProps = "call-props"
|
|
41
48
|
}
|
|
42
49
|
export type FlowrFilterFunction<T> = (e: FlowrSearchElement<ParentInformation>, args: T, data: {
|
|
43
50
|
dataflow: DataflowInformation;
|
|
@@ -56,6 +63,9 @@ export declare const FlowrFilters: {
|
|
|
56
63
|
roleInParent: RoleInParent;
|
|
57
64
|
}) => boolean;
|
|
58
65
|
readonly "file-path-filter": (e: FlowrSearchElement<ParentInformation>, args: FilePathFilterArgs) => boolean;
|
|
66
|
+
readonly "call-props": (e: FlowrSearchElement<ParentInformation>, args: CallPropsArgs, data: {
|
|
67
|
+
dataflow: DataflowInformation;
|
|
68
|
+
}) => boolean;
|
|
59
69
|
};
|
|
60
70
|
export type FlowrFilterArgs<F extends FlowrFilter> = typeof FlowrFilters[F] extends FlowrFilterFunction<infer Args> ? Args : never;
|
|
61
71
|
export interface MatchesEnrichmentArgs<E extends Enrichment> {
|
|
@@ -77,6 +87,12 @@ export interface OriginKindArgs {
|
|
|
77
87
|
export interface FilePathFilterArgs {
|
|
78
88
|
filePathRegex: string | RegExp;
|
|
79
89
|
}
|
|
90
|
+
export interface CallPropsArgs {
|
|
91
|
+
/** the {@link CallProp} bits to look for, e.g. `CallProp.User | CallProp.Closes` */
|
|
92
|
+
props: CallProps;
|
|
93
|
+
/** whether a call has to carry every bit of {@link props} or just one of them (the default) */
|
|
94
|
+
matchType?: 'some' | 'every';
|
|
95
|
+
}
|
|
80
96
|
type ValidFilterTypes<F extends FlowrFilter = FlowrFilter> = FlowrFilterName | FlowrFilterWithArgs<F, FlowrFilterArgs<F>> | RType | VertexType;
|
|
81
97
|
/**
|
|
82
98
|
* By default, we provide filter for every {@link RType} and {@link VertexType}.
|
|
@@ -9,6 +9,9 @@ const vertex_1 = require("../dataflow/graph/vertex");
|
|
|
9
9
|
const search_enrichers_1 = require("./search-executor/search-enrichers");
|
|
10
10
|
const objects_1 = require("../util/objects");
|
|
11
11
|
const search_generators_1 = require("./search-executor/search-generators");
|
|
12
|
+
const query_fn_props_1 = require("../dataflow/environments/query-fn-props");
|
|
13
|
+
const df_helper_1 = require("../dataflow/graph/df-helper");
|
|
14
|
+
const environment_1 = require("../dataflow/environments/environment");
|
|
12
15
|
var FlowrFilter;
|
|
13
16
|
(function (FlowrFilter) {
|
|
14
17
|
/**
|
|
@@ -37,6 +40,12 @@ var FlowrFilter;
|
|
|
37
40
|
* This filter accepts {@link FilePathFilterArgs}, which includes the file path regex to test against.
|
|
38
41
|
*/
|
|
39
42
|
FlowrFilter["FilePathFilter"] = "file-path-filter";
|
|
43
|
+
/**
|
|
44
|
+
* Only returns function calls whose {@link CallProp} bits match the given mask, so that _every call that asks
|
|
45
|
+
* the user_ or _every call that closes a device_ can be searched for without naming a single function.
|
|
46
|
+
* This filter accepts {@link CallPropsArgs}.
|
|
47
|
+
*/
|
|
48
|
+
FlowrFilter["CallProps"] = "call-props";
|
|
40
49
|
})(FlowrFilter || (exports.FlowrFilter = FlowrFilter = {}));
|
|
41
50
|
exports.ValidFlowrFilters = new Set(Object.values(FlowrFilter));
|
|
42
51
|
exports.ValidFlowrFiltersReverse = Object.fromEntries(Object.entries(FlowrFilter).map(([k, v]) => [v, k]));
|
|
@@ -66,6 +75,20 @@ exports.FlowrFilters = {
|
|
|
66
75
|
const file = e.node.info.file;
|
|
67
76
|
const rx = args.filePathRegex instanceof RegExp ? args.filePathRegex : new RegExp(args.filePathRegex);
|
|
68
77
|
return rx.test(file ?? '');
|
|
78
|
+
}),
|
|
79
|
+
[FlowrFilter.CallProps]: ((e, args, data) => {
|
|
80
|
+
const graph = data.dataflow.graph;
|
|
81
|
+
const vertex = graph.getVertex(e.node.info.id);
|
|
82
|
+
if (vertex?.tag !== vertex_1.VertexType.FunctionCall) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
/* what the call resolved to decides, as a definition in the analyzed code shadows the built-in; a call
|
|
86
|
+
* flowR settled on the built-ins keeps no environment, and a later redefinition must not speak for it */
|
|
87
|
+
const known = vertex.environment ?? data.dataflow.environment;
|
|
88
|
+
const environment = vertex.onlyBuiltin ? { level: 0, current: environment_1.REnvironment.findBuiltIn(known.current) } : known;
|
|
89
|
+
const name = df_helper_1.Dataflow.qualify(e.node.info.id, graph, false) ?? vertex.name;
|
|
90
|
+
const props = (0, query_fn_props_1.queryFnProps)(name, { environment })?.props ?? 0;
|
|
91
|
+
return args.matchType === 'every' ? (props & args.props) === args.props : (props & args.props) !== 0;
|
|
69
92
|
})
|
|
70
93
|
};
|
|
71
94
|
/**
|
|
@@ -2,10 +2,7 @@ import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
|
2
2
|
import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
3
|
/** An optional `(file-regex)` suffix restricting a criterion to nodes stemming from a matching file. */
|
|
4
4
|
type FileFilterSuffix = '' | `(${string})`;
|
|
5
|
-
/**
|
|
6
|
-
* Either `line:column`, `line~column`, `line@variable-name`, or `$id`; all but `$id` accept a trailing
|
|
7
|
-
* `(file-regex)`. See {@link SlicingCriterion.tryParse} for what each of them resolves to.
|
|
8
|
-
*/
|
|
5
|
+
/** see {@link SlicingCriterion.tryParse} for what each of these formats resolves to */
|
|
9
6
|
export type SlicingCriterion = `${number}:${number}${FileFilterSuffix}` | `${number}~${number}${FileFilterSuffix}` | `${number}^${FileFilterSuffix}` | `${number}@${string}` | `$${NodeId | number}`;
|
|
10
7
|
/**
|
|
11
8
|
* The helper object associated with {@link SlicingCriterion} which makes it easy
|
|
@@ -20,28 +17,14 @@ export declare const SlicingCriterion: {
|
|
|
20
17
|
*/
|
|
21
18
|
readonly isValid: (this: void, criterion: unknown) => criterion is SlicingCriterion;
|
|
22
19
|
/**
|
|
23
|
-
*
|
|
20
|
+
* Resolves a slicing criterion to the corresponding node id.
|
|
24
21
|
* @see {@link SlicingCriterion.tryParse} for a version that does not throw an error
|
|
25
22
|
*/
|
|
26
23
|
readonly parse: (this: void, criterion: SlicingCriterion, idMap: AstIdMap) => NodeId;
|
|
27
24
|
/**
|
|
28
25
|
* Tries to resolve a slicing criterion to an id, but does not throw an error if it fails.
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* | --------- | ----------- |
|
|
32
|
-
* | `2@x` | `x` in line 2, preferring a call over the symbol it refers to |
|
|
33
|
-
* | `2@[3]x` | the 3rd occurrence of `x` in line 2 (by column); `[-1]` for the last |
|
|
34
|
-
* | `2:5` | the element *starting* at line 2, column 5 |
|
|
35
|
-
* | `2~5` | the innermost element *containing* line 2, column 5 |
|
|
36
|
-
* | `2^` | the top-level statement line 2 belongs to, the first one when several share the line |
|
|
37
|
-
* | `$42` | the node with the normalized id 42 |
|
|
38
|
-
*
|
|
39
|
-
* A negative line counts from the end of the input (`-1` being the last line). Every criterion but `$id`
|
|
40
|
-
* accepts a trailing `(file-regex)` (e.g. `2@x(tmp/.*)`) restricting it to a matching file.
|
|
41
|
-
*
|
|
42
|
-
* Lines, columns, and the `[n]` occurrence are all *1-based*, so a `0` anywhere (`2:0`, `0@x`, `2@[0]x`)
|
|
43
|
-
* addresses nothing and resolves to `undefined` -- it is not a wildcard for the whole line. A criterion
|
|
44
|
-
* always denotes at most a single node; use one criterion per node to select several.
|
|
26
|
+
* The formats and what each of them resolves to are documented in the
|
|
27
|
+
* {@link https://github.com/flowr-analysis/flowr/wiki/Terminology#slicing-criterion|wiki}.
|
|
45
28
|
* @see {@link SlicingCriterion.parse} for the version that throws an error
|
|
46
29
|
*/
|
|
47
30
|
readonly tryParse: (this: void, criterion: SlicingCriterion | NodeId, idMap: AstIdMap) => NodeId | undefined;
|
|
@@ -50,10 +33,7 @@ export declare const SlicingCriterion: {
|
|
|
50
33
|
*/
|
|
51
34
|
readonly fromId: (this: void, id: NodeId) => SlicingCriterion;
|
|
52
35
|
};
|
|
53
|
-
/**
|
|
54
|
-
* A slicing criterion is a list of single slicing criteria, which can be in the form of `line:column`,
|
|
55
|
-
* `line~column`, `line@variable-name`, or `$id`.
|
|
56
|
-
*/
|
|
36
|
+
/** several {@link SlicingCriterion}s, all of which are sliced for at once */
|
|
57
37
|
export type SlicingCriteria = SlicingCriterion[];
|
|
58
38
|
export interface DecodedCriterion {
|
|
59
39
|
criterion: SlicingCriterion;
|
|
@@ -18,10 +18,18 @@ exports.SlicingCriterion = {
|
|
|
18
18
|
* @see {@link SlicingCriterion.parse} to parse a slicing criterion to a node ID
|
|
19
19
|
*/
|
|
20
20
|
isValid(criterion) {
|
|
21
|
-
|
|
21
|
+
if (typeof criterion !== 'string') {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
else if (criterion.startsWith('$')) {
|
|
25
|
+
return criterion.length > 1;
|
|
26
|
+
}
|
|
27
|
+
/* the file filter is optional on every form, so validate what remains once it is split off */
|
|
28
|
+
const split = splitFileFilter(criterion);
|
|
29
|
+
return split !== undefined && /^-?\d+([:~]\d+|\^|@.+)$/.test(split.rest);
|
|
22
30
|
},
|
|
23
31
|
/**
|
|
24
|
-
*
|
|
32
|
+
* Resolves a slicing criterion to the corresponding node id.
|
|
25
33
|
* @see {@link SlicingCriterion.tryParse} for a version that does not throw an error
|
|
26
34
|
*/
|
|
27
35
|
parse(criterion, idMap) {
|
|
@@ -33,22 +41,8 @@ exports.SlicingCriterion = {
|
|
|
33
41
|
},
|
|
34
42
|
/**
|
|
35
43
|
* Tries to resolve a slicing criterion to an id, but does not throw an error if it fails.
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* | --------- | ----------- |
|
|
39
|
-
* | `2@x` | `x` in line 2, preferring a call over the symbol it refers to |
|
|
40
|
-
* | `2@[3]x` | the 3rd occurrence of `x` in line 2 (by column); `[-1]` for the last |
|
|
41
|
-
* | `2:5` | the element *starting* at line 2, column 5 |
|
|
42
|
-
* | `2~5` | the innermost element *containing* line 2, column 5 |
|
|
43
|
-
* | `2^` | the top-level statement line 2 belongs to, the first one when several share the line |
|
|
44
|
-
* | `$42` | the node with the normalized id 42 |
|
|
45
|
-
*
|
|
46
|
-
* A negative line counts from the end of the input (`-1` being the last line). Every criterion but `$id`
|
|
47
|
-
* accepts a trailing `(file-regex)` (e.g. `2@x(tmp/.*)`) restricting it to a matching file.
|
|
48
|
-
*
|
|
49
|
-
* Lines, columns, and the `[n]` occurrence are all *1-based*, so a `0` anywhere (`2:0`, `0@x`, `2@[0]x`)
|
|
50
|
-
* addresses nothing and resolves to `undefined` -- it is not a wildcard for the whole line. A criterion
|
|
51
|
-
* always denotes at most a single node; use one criterion per node to select several.
|
|
44
|
+
* The formats and what each of them resolves to are documented in the
|
|
45
|
+
* {@link https://github.com/flowr-analysis/flowr/wiki/Terminology#slicing-criterion|wiki}.
|
|
52
46
|
* @see {@link SlicingCriterion.parse} for the version that throws an error
|
|
53
47
|
*/
|
|
54
48
|
tryParse(criterion, idMap) {
|
|
@@ -187,10 +181,11 @@ function topLevelStatementToId(line, idMap, file) {
|
|
|
187
181
|
}
|
|
188
182
|
/**
|
|
189
183
|
* Splits the optional trailing `(file-regex)` off a criterion (e.g. `2@x(tmp/.*)`), which restricts it to nodes
|
|
190
|
-
* originating from a matching file.
|
|
184
|
+
* originating from a matching file. The regex may contain escaped parentheses (`3^(a\(b\)\.R)`).
|
|
185
|
+
* Returns `undefined` if the regex is malformed.
|
|
191
186
|
*/
|
|
192
187
|
function splitFileFilter(criterion) {
|
|
193
|
-
const match = /^(
|
|
188
|
+
const match = /^([^()]*)\(((?:\\.|[^()])*)\)$/.exec(criterion);
|
|
194
189
|
if (match === null) {
|
|
195
190
|
return { rest: criterion, file: undefined };
|
|
196
191
|
}
|
|
@@ -15,9 +15,13 @@ const HashOptions = {
|
|
|
15
15
|
ignoreUnknown: true,
|
|
16
16
|
replacer: (v) => (0, environment_1.isDefaultBuiltInEnvironment)(v) ? undefined : v
|
|
17
17
|
};
|
|
18
|
-
/* definitions and frames are shared across the environments a slice builds, and a definition may
|
|
19
|
-
* environment of its own (`envState`), so each is hashed once instead of on every fingerprint
|
|
18
|
+
/* definitions, definition maps and frames are shared across the environments a slice builds, and a definition may
|
|
19
|
+
* hold a whole environment of its own (`envState`), so each is hashed once instead of on every fingerprint. The
|
|
20
|
+
* map is keyed separately from the frame because cloning a frame shares its definitions until one side writes
|
|
21
|
+
* (see {@link Environment#clone}): the graph holds many frames per distinct set of definitions, and hashing that
|
|
22
|
+
* set is what costs. */
|
|
20
23
|
const definitionHashes = new WeakMap();
|
|
24
|
+
const memoryHashes = new WeakMap();
|
|
21
25
|
const frameHashes = new WeakMap();
|
|
22
26
|
function definitionHash(definition) {
|
|
23
27
|
let hash = definitionHashes.get(definition);
|
|
@@ -27,15 +31,23 @@ function definitionHash(definition) {
|
|
|
27
31
|
}
|
|
28
32
|
return hash;
|
|
29
33
|
}
|
|
30
|
-
function
|
|
31
|
-
let hash =
|
|
34
|
+
function memoryHash(memory) {
|
|
35
|
+
let hash = memoryHashes.get(memory);
|
|
32
36
|
if (hash === undefined) {
|
|
33
37
|
const entries = [];
|
|
34
|
-
for (const [name, definitions] of
|
|
38
|
+
for (const [name, definitions] of memory) {
|
|
35
39
|
entries.push(`${String(name)}=${definitions.map(definitionHash).join(',')}`);
|
|
36
40
|
}
|
|
37
41
|
entries.sort();
|
|
38
|
-
hash = (0, object_hash_1.default)(
|
|
42
|
+
hash = (0, object_hash_1.default)(entries, HashOptions);
|
|
43
|
+
memoryHashes.set(memory, hash);
|
|
44
|
+
}
|
|
45
|
+
return hash;
|
|
46
|
+
}
|
|
47
|
+
function frameHash(frame) {
|
|
48
|
+
let hash = frameHashes.get(frame);
|
|
49
|
+
if (hash === undefined) {
|
|
50
|
+
hash = (0, object_hash_1.default)([frame.n, frame.t, frame.closure, frame.globalEnv === true, memoryHash(frame.memory)], HashOptions);
|
|
39
51
|
frameHashes.set(frame, hash);
|
|
40
52
|
}
|
|
41
53
|
return hash;
|
|
@@ -31,4 +31,14 @@ export interface SliceResult {
|
|
|
31
31
|
* The ids of the nodes in the normalized ast that were used as seed ids for slicing. This is a subset of {@link result}.
|
|
32
32
|
*/
|
|
33
33
|
readonly slicedFor: readonly NodeId[];
|
|
34
|
+
/**
|
|
35
|
+
* Set when the {@link GasFeatureKey.Slicer|gas guard} stopped the traversal before the queue drained, so
|
|
36
|
+
* {@link result} is what was reached until then and not the complete slice.
|
|
37
|
+
*/
|
|
38
|
+
readonly stoppedEarly?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The names the slice reads without defining them, so running it on its own would fail with
|
|
41
|
+
* `object 'x' not found`. Empty when the slice is closed under the names it uses.
|
|
42
|
+
*/
|
|
43
|
+
readonly freeNames?: readonly string[];
|
|
34
44
|
}
|
|
@@ -3,7 +3,7 @@ import type { Fingerprint } from './fingerprint';
|
|
|
3
3
|
import { VisitingQueue } from './visiting-queue';
|
|
4
4
|
import type { NormalizedAst } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
5
5
|
import type { REnvironmentInformation } from '../../dataflow/environments/environment';
|
|
6
|
-
import
|
|
6
|
+
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
7
|
import type { DataflowInformation } from '../../dataflow/info';
|
|
8
8
|
import type { DataflowGraph } from '../../dataflow/graph/graph';
|
|
9
9
|
import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
|
|
@@ -8,6 +8,7 @@ const assert_1 = require("../../util/assert");
|
|
|
8
8
|
const log_1 = require("../../util/log");
|
|
9
9
|
const visiting_queue_1 = require("./visiting-queue");
|
|
10
10
|
const slice_call_1 = require("./slice-call");
|
|
11
|
+
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
11
12
|
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
12
13
|
const edge_1 = require("../../dataflow/graph/edge");
|
|
13
14
|
const df_helper_1 = require("../../dataflow/graph/df-helper");
|
|
@@ -39,7 +40,7 @@ function staticSlice(options) {
|
|
|
39
40
|
graph = df_helper_1.Dataflow.invertGraph(graph, ctx.env.makeCleanEnv());
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
const queue = new visiting_queue_1.VisitingQueue(threshold, cache, id => graph.hasVertex(id));
|
|
43
|
+
const queue = new visiting_queue_1.VisitingQueue(threshold, cache, id => graph.hasVertex(id), ctx.gas);
|
|
43
44
|
let minNesting = Number.MAX_SAFE_INTEGER;
|
|
44
45
|
const sliceSeedIds = new Set();
|
|
45
46
|
// every node ships the call environment which registers the calling environment
|
|
@@ -139,12 +140,33 @@ function staticSlice(options) {
|
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
142
|
const status = queue.status();
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
const result = ctx.config.solver.slicer?.autoExtend ? extendSlices(status.result, idMap) : status.result;
|
|
144
|
+
return { ...status, slicedFor: ids, result, freeNames: freeNamesOf(result, info.graph) };
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The names the slice reads without defining them: a use whose definitions all stayed outside meets that name
|
|
148
|
+
* undefined, and so does one that reads nothing at all (a name the program never defines). Reading a built-in
|
|
149
|
+
* is no such case, as those are there whatever the slice contains.
|
|
150
|
+
*/
|
|
151
|
+
function freeNamesOf(slice, graph) {
|
|
152
|
+
const free = new Set();
|
|
153
|
+
for (const id of slice) {
|
|
154
|
+
if (graph.getVertex(id)?.tag !== vertex_1.VertexType.Use) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
let defined = false;
|
|
158
|
+
for (const [target, edge] of graph.outgoingEdges(id) ?? []) {
|
|
159
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads) && (slice.has(target) || node_id_1.NodeId.isBuiltIn(target))) {
|
|
160
|
+
defined = true;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const name = defined ? undefined : (0, node_id_1.recoverName)(id, graph.idMap);
|
|
165
|
+
if (name !== undefined) {
|
|
166
|
+
free.add(name);
|
|
167
|
+
}
|
|
147
168
|
}
|
|
169
|
+
return [...free].sort();
|
|
148
170
|
}
|
|
149
171
|
/**
|
|
150
172
|
* Computes a program dice: only those nodes reachable forward from `startIds` that are also in the backward slice of `endIds`.
|
|
@@ -171,6 +193,7 @@ function staticDice(ctx, info, ast, startIds, endIds, threshold = 75, includeCal
|
|
|
171
193
|
timesHitThreshold: forward.timesHitThreshold + backward.timesHitThreshold,
|
|
172
194
|
result,
|
|
173
195
|
slicedFor: [...startIds, ...endIds],
|
|
196
|
+
...(forward.stoppedEarly || backward.stoppedEarly ? { stoppedEarly: true } : {})
|
|
174
197
|
};
|
|
175
198
|
}
|
|
176
199
|
function extendSlices(results, ast) {
|
|
@@ -3,6 +3,7 @@ import type { NodeToSlice, SliceResult } from './slicer-types';
|
|
|
3
3
|
import type { REnvironmentInformation } from '../../dataflow/environments/environment';
|
|
4
4
|
import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
5
5
|
import type { DataflowGraphVertexInfo } from '../../dataflow/graph/vertex';
|
|
6
|
+
import type { ReadOnlyFlowrAnalyzerGasContext } from '../../project/context/flowr-analyzer-gas-context';
|
|
6
7
|
export declare class VisitingQueue {
|
|
7
8
|
private readonly threshold;
|
|
8
9
|
private timesHitThreshold;
|
|
@@ -15,7 +16,10 @@ export declare class VisitingQueue {
|
|
|
15
16
|
private cachedCallTargets;
|
|
16
17
|
/** whether the dataflow graph has a vertex for an id, i.e. whether the traversal could continue from it */
|
|
17
18
|
private readonly isGraphVertex?;
|
|
18
|
-
|
|
19
|
+
private readonly gas?;
|
|
20
|
+
private stoppedEarly;
|
|
21
|
+
private untilGasCheck;
|
|
22
|
+
constructor(threshold: number, cache?: Map<Fingerprint, Set<NodeId>>, isGraphVertex?: (id: NodeId) => boolean, gas?: ReadOnlyFlowrAnalyzerGasContext);
|
|
19
23
|
/**
|
|
20
24
|
* Adds a node to the queue if it has not been seen before.
|
|
21
25
|
* @param target - the node to add
|
|
@@ -25,8 +29,14 @@ export declare class VisitingQueue {
|
|
|
25
29
|
*/
|
|
26
30
|
add(target: NodeId, env: REnvironmentInformation, envFingerprint: string, onlyForSideEffects: boolean): void;
|
|
27
31
|
next(): NodeToSlice;
|
|
32
|
+
/** Whether there is anything left to visit, which the traversal is out of gas for as soon as it is exhausted. */
|
|
28
33
|
nonEmpty(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The traversal is synchronous, so a caller can only bound it from within. Gas is polled every
|
|
36
|
+
* {@link GasCheckEvery} nodes, which keeps even an enabled check off the per-node path.
|
|
37
|
+
*/
|
|
38
|
+
private outOfGas;
|
|
29
39
|
hasId(id: NodeId): boolean;
|
|
30
40
|
memoizeCallTargets(id: NodeId, targets: () => Set<DataflowGraphVertexInfo>): Set<DataflowGraphVertexInfo>;
|
|
31
|
-
status(): Readonly<Pick<SliceResult, 'timesHitThreshold' | 'result'>>;
|
|
41
|
+
status(): Readonly<Pick<SliceResult, 'timesHitThreshold' | 'result' | 'stoppedEarly'>>;
|
|
32
42
|
}
|
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VisitingQueue = void 0;
|
|
4
4
|
const fingerprint_1 = require("./fingerprint");
|
|
5
5
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
6
|
+
const gas_1 = require("../../gas");
|
|
7
|
+
const static_slicer_1 = require("./static-slicer");
|
|
8
|
+
/** How many nodes the traversal visits between two {@link GasFeatureKey.Slicer|gas} checks. */
|
|
9
|
+
const GasCheckEvery = 512;
|
|
6
10
|
class VisitingQueue {
|
|
7
11
|
threshold;
|
|
8
12
|
timesHitThreshold = 0;
|
|
@@ -17,10 +21,14 @@ class VisitingQueue {
|
|
|
17
21
|
cachedCallTargets = new Map();
|
|
18
22
|
/** whether the dataflow graph has a vertex for an id, i.e. whether the traversal could continue from it */
|
|
19
23
|
isGraphVertex;
|
|
20
|
-
|
|
24
|
+
gas;
|
|
25
|
+
stoppedEarly = false;
|
|
26
|
+
untilGasCheck = 0;
|
|
27
|
+
constructor(threshold, cache, isGraphVertex, gas) {
|
|
21
28
|
this.threshold = threshold;
|
|
22
29
|
this.cache = cache;
|
|
23
30
|
this.isGraphVertex = isGraphVertex;
|
|
31
|
+
this.gas = gas;
|
|
24
32
|
}
|
|
25
33
|
/**
|
|
26
34
|
* Adds a node to the queue if it has not been seen before.
|
|
@@ -58,8 +66,24 @@ class VisitingQueue {
|
|
|
58
66
|
next() {
|
|
59
67
|
return this.queue.pop();
|
|
60
68
|
}
|
|
69
|
+
/** Whether there is anything left to visit, which the traversal is out of gas for as soon as it is exhausted. */
|
|
61
70
|
nonEmpty() {
|
|
62
|
-
return this.queue.length > 0;
|
|
71
|
+
return this.queue.length > 0 && !this.outOfGas();
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The traversal is synchronous, so a caller can only bound it from within. Gas is polled every
|
|
75
|
+
* {@link GasCheckEvery} nodes, which keeps even an enabled check off the per-node path.
|
|
76
|
+
*/
|
|
77
|
+
outOfGas() {
|
|
78
|
+
if (this.gas === undefined || this.untilGasCheck-- > 0) {
|
|
79
|
+
return this.stoppedEarly;
|
|
80
|
+
}
|
|
81
|
+
this.untilGasCheck = GasCheckEvery - 1;
|
|
82
|
+
if (!this.stoppedEarly && this.gas.checkGas(gas_1.GasFeatureKey.Slicer) >= 2 /* GasLevel.Critical */) {
|
|
83
|
+
this.stoppedEarly = true;
|
|
84
|
+
static_slicer_1.slicerLogger.warn(`slicing ran out of gas, the slice is incomplete (${gas_1.GasWikiRef})`);
|
|
85
|
+
}
|
|
86
|
+
return this.stoppedEarly;
|
|
63
87
|
}
|
|
64
88
|
hasId(id) {
|
|
65
89
|
return this.idThreshold.has(id);
|
|
@@ -73,7 +97,8 @@ class VisitingQueue {
|
|
|
73
97
|
status() {
|
|
74
98
|
return {
|
|
75
99
|
timesHitThreshold: this.timesHitThreshold,
|
|
76
|
-
result: new Set([...this.seen.values(), ...this.seenByCache])
|
|
100
|
+
result: new Set([...this.seen.values(), ...this.seenByCache]),
|
|
101
|
+
...(this.stoppedEarly ? { stoppedEarly: true } : {})
|
|
77
102
|
};
|
|
78
103
|
}
|
|
79
104
|
}
|