@eagleoutice/flowr 2.13.13 โ 2.13.15
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 +31 -28
- package/abstract-interpretation/data-frame/resolve-args.js +11 -12
- package/benchmark/calibration.d.ts +18 -0
- package/benchmark/calibration.js +63 -0
- package/benchmark/slicer.d.ts +19 -0
- package/benchmark/slicer.js +84 -1
- package/benchmark/stats/feature-counts.d.ts +6 -0
- package/benchmark/stats/feature-counts.js +61 -0
- package/benchmark/stats/print.js +20 -0
- package/benchmark/stats/sigdb-counts.d.ts +7 -0
- package/benchmark/stats/sigdb-counts.js +219 -0
- package/benchmark/stats/size-of.d.ts +6 -0
- package/benchmark/stats/size-of.js +8 -0
- package/benchmark/stats/stats.d.ts +79 -0
- package/benchmark/stats/stats.js +7 -1
- package/benchmark/stopwatch.d.ts +4 -0
- package/benchmark/stopwatch.js +12 -1
- package/benchmark/summarizer/data.d.ts +17 -1
- package/benchmark/summarizer/first-phase/input.js +5 -0
- package/benchmark/summarizer/first-phase/process.js +12 -2
- package/benchmark/summarizer/second-phase/graph.d.ts +24 -1
- package/benchmark/summarizer/second-phase/graph.js +249 -18
- package/benchmark/summarizer/second-phase/process.js +56 -0
- package/benchmark/summarizer/summarizer.js +1 -2
- package/cli/benchmark-app.d.ts +1 -0
- package/cli/benchmark-app.js +2 -1
- package/cli/benchmark-helper-app.d.ts +1 -0
- package/cli/benchmark-helper-app.js +12 -2
- package/cli/common/options.d.ts +10 -0
- package/cli/common/options.js +3 -1
- package/cli/common/scripts-info.d.ts +10 -0
- package/cli/repl/commands/repl-cfg.js +2 -42
- package/cli/repl/commands/repl-clipboard.d.ts +7 -0
- package/cli/repl/commands/repl-clipboard.js +53 -0
- package/cli/repl/commands/repl-dataflow.js +5 -70
- package/cli/repl/commands/repl-normalize.js +3 -51
- package/control-flow/cfg-builder.d.ts +30 -0
- package/control-flow/cfg-builder.js +79 -0
- package/control-flow/cfg-dead-code.js +5 -29
- package/control-flow/diff-cfg.js +2 -56
- package/control-flow/extract-cfg.js +17 -10
- package/control-flow/semantic-cfg-guided-visitor.d.ts +7 -0
- package/control-flow/semantic-cfg-guided-visitor.js +14 -0
- package/control-flow/useless-loop.js +4 -26
- package/core/steps/all/core/10-normalize.d.ts +8 -0
- package/core/steps/all/core/10-normalize.js +10 -8
- package/core/steps/all/core/11-normalize-tree-sitter.d.ts +5 -7
- package/core/steps/all/core/11-normalize-tree-sitter.js +2 -9
- package/data/r-base-packages.generated.d.ts +1 -0
- package/data/r-base-packages.generated.js +5 -3
- package/dataflow/environments/apply-kill.d.ts +3 -3
- package/dataflow/environments/apply-kill.js +60 -31
- package/dataflow/environments/built-in-config.d.ts +9 -1
- package/dataflow/environments/built-in-proc-name.d.ts +2 -0
- package/dataflow/environments/built-in-proc-name.js +2 -0
- package/dataflow/environments/built-in-props.d.ts +4 -0
- package/dataflow/environments/built-in-props.js +3 -3
- package/dataflow/environments/built-in.d.ts +4 -2
- package/dataflow/environments/built-in.js +53 -3
- package/dataflow/environments/data-masking-functions.d.ts +3 -4
- package/dataflow/environments/data-masking-functions.js +7 -8
- package/dataflow/environments/default-builtin-config.d.ts +92 -12
- package/dataflow/environments/default-builtin-config.js +86 -43
- package/dataflow/environments/environment.d.ts +5 -0
- package/dataflow/environments/environment.js +17 -12
- package/dataflow/environments/identifier.d.ts +3 -0
- package/dataflow/environments/reference-to-maybe.d.ts +5 -3
- package/dataflow/environments/reference-to-maybe.js +17 -52
- package/dataflow/environments/resolve-helper.d.ts +2 -1
- package/dataflow/environments/resolve-helper.js +2 -1
- package/dataflow/eval/resolve/alias-tracking.js +4 -7
- package/dataflow/eval/resolve/node-value.d.ts +51 -0
- package/dataflow/eval/resolve/node-value.js +71 -0
- package/dataflow/eval/resolve/resolve-argument.js +10 -7
- package/dataflow/eval/resolve/resolve-operators.js +1 -2
- package/dataflow/eval/values/general.d.ts +4 -0
- package/dataflow/eval/values/general.js +11 -0
- package/dataflow/eval/values/r-value.d.ts +15 -0
- package/dataflow/eval/values/r-value.js +27 -1
- package/dataflow/extractor.js +2 -0
- package/dataflow/fn/higher-order-function.js +2 -3
- package/dataflow/graph/df-helper.d.ts +2 -1
- package/dataflow/graph/diff-dataflow-graph.js +3 -55
- package/dataflow/graph/graph.d.ts +5 -0
- package/dataflow/graph/graph.js +27 -0
- package/dataflow/info.d.ts +7 -1
- package/dataflow/info.js +36 -7
- package/dataflow/internal/linker.d.ts +23 -0
- package/dataflow/internal/linker.js +70 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +4 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +8 -29
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +39 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +10 -22
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +29 -53
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +33 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +4 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +6 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +19 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +3 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +69 -52
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +2 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +5 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +23 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +7 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +20 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +6 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.d.ts +25 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +105 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +9 -28
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +1 -1
- package/dataflow/internal/process/functions/call/deferred.d.ts +41 -0
- package/dataflow/internal/process/functions/call/deferred.js +127 -0
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +13 -12
- package/dataflow/internal/process/functions/call/known-call-handling.js +35 -35
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +8 -4
- package/dataflow/internal/process/functions/call/nse.d.ts +28 -0
- package/dataflow/internal/process/functions/call/nse.js +87 -0
- package/dataflow/internal/process/functions/call/quoted.d.ts +29 -0
- package/dataflow/internal/process/functions/call/quoted.js +188 -0
- package/documentation/doc-readme.js +5 -2
- package/documentation/doc-util/doc-issue.d.ts +2 -0
- package/documentation/doc-util/doc-issue.js +3 -1
- package/documentation/doc-util/doc-types.js +15 -9
- package/documentation/wiki-dataflow-graph.js +4 -0
- package/documentation/wiki-faq.js +6 -2
- package/documentation/wiki-onboarding.js +11 -1
- package/documentation/wiki-setup.js +2 -1
- package/linter/rules/deprecated-functions.js +9 -3
- package/linter/rules/seeded-randomness.js +2 -3
- package/linter/rules/undefined-symbol.js +10 -1
- package/package.json +9 -4
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +6 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +17 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +2 -11
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +3 -15
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.d.ts +16 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.js +26 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -11
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +3 -15
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +4 -10
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +2 -9
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +2 -9
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +1 -1
- package/project/sigdb/reader.d.ts +9 -0
- package/project/sigdb/reader.js +30 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +0 -12
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -37
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +2 -23
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +2 -2
- package/queries/query-function-filter.d.ts +21 -0
- package/queries/query-function-filter.js +48 -0
- package/r-bridge/data/data.d.ts +13 -3
- package/r-bridge/data/data.js +15 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +4 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +11 -9
- package/search/flowr-search-filters.d.ts +5 -1
- package/search/flowr-search-filters.js +31 -21
- package/search/search-executor/search-enrichers.d.ts +24 -4
- package/search/search-executor/search-enrichers.js +22 -9
- package/search/search-executor/search-transformer.js +1 -1
- package/slicing/static/slice-call.js +4 -4
- package/util/diff-graph.d.ts +13 -0
- package/util/diff-graph.js +64 -1
- package/util/files.js +9 -8
- package/util/node-version.d.ts +4 -0
- package/util/node-version.js +29 -0
- package/util/r-base-packages.d.ts +2 -0
- package/util/r-base-packages.js +3 -1
- package/util/version.js +1 -1
|
@@ -30,11 +30,13 @@ function mergeInformation(info, newInfo) {
|
|
|
30
30
|
/**
|
|
31
31
|
* Marks the given function call node as only calling built-in functions.
|
|
32
32
|
*/
|
|
33
|
-
function markAsOnlyBuiltIn(graph, rootId) {
|
|
33
|
+
function markAsOnlyBuiltIn(graph, rootId, keepEnvironment = false) {
|
|
34
34
|
const v = graph.getVertex(rootId);
|
|
35
35
|
if (v?.tag === vertex_1.VertexType.FunctionCall) {
|
|
36
36
|
v.onlyBuiltin = true;
|
|
37
|
-
|
|
37
|
+
if (!keepEnvironment) {
|
|
38
|
+
v.environment = undefined;
|
|
39
|
+
}
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
@@ -44,8 +46,10 @@ function markAsOnlyBuiltIn(graph, rootId) {
|
|
|
44
46
|
function processNamedCall(name, args, rootId, data) {
|
|
45
47
|
const resolved = (0, resolve_by_name_1.resolveByName)(name.content, data.environment, identifier_1.ReferenceType.Function) ?? [];
|
|
46
48
|
let defaultProcessor = resolved.length === 0;
|
|
49
|
+
/* a call whose meaning a later pass looks up in its environment has to keep it */
|
|
50
|
+
const keepEnvironment = resolved.some(r => r.type === identifier_1.ReferenceType.BuiltInFunction && r.config?.keepEnvironment === true);
|
|
47
51
|
/* if this call will be marked as built-in only (see below), its vertex needs no environment snapshot */
|
|
48
|
-
if (resolved.length > 0
|
|
52
|
+
if (resolved.length > 0 && !keepEnvironment
|
|
49
53
|
&& resolved.every(r => r.type === identifier_1.ReferenceType.BuiltInFunction && typeof r.processor === 'function')
|
|
50
54
|
&& resolved.some(r => r.type === identifier_1.ReferenceType.BuiltInFunction && r.config?.libFn !== true)) {
|
|
51
55
|
data = { ...data, builtInNoEnv: rootId };
|
|
@@ -68,7 +72,7 @@ function processNamedCall(name, args, rootId, data) {
|
|
|
68
72
|
}
|
|
69
73
|
else if (information && builtIn) {
|
|
70
74
|
// mark the function call as built in only
|
|
71
|
-
markAsOnlyBuiltIn(information.graph, rootId);
|
|
75
|
+
markAsOnlyBuiltIn(information.graph, rootId, keepEnvironment);
|
|
72
76
|
}
|
|
73
77
|
// on demand: materialize the built-in vertex for any package export this call resolves to and, when we
|
|
74
78
|
// already know the loading call here, link to it (a function-local export is invisible to the later
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RNode } from '../../../../../r-bridge/lang-4.x/ast/model/model';
|
|
2
|
+
import type { NodeId } from '../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
3
|
+
import type { ParentInformation } from '../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
|
+
import { Identifier } from '../../../../environments/identifier';
|
|
5
|
+
import type { DataflowGraph } from '../../../../graph/graph';
|
|
6
|
+
import { type DataflowGraphVertexInfo } from '../../../../graph/vertex';
|
|
7
|
+
/** The escape a quoting function offers, a property of the function: `quote(!!x)` negates, `expr(!!x)` splices. */
|
|
8
|
+
export declare enum Unquote {
|
|
9
|
+
/** no escape at all, everything within the argument stays unevaluated */
|
|
10
|
+
None = "none",
|
|
11
|
+
/** rlang's `!!` and `!!!` splice in the value of their operand */
|
|
12
|
+
Rlang = "rlang",
|
|
13
|
+
/** `bquote`'s `.(x)` evaluates its operand */
|
|
14
|
+
Bquote = "bquote"
|
|
15
|
+
}
|
|
16
|
+
/** The parts of a call R does not evaluate the standard way. */
|
|
17
|
+
export declare const Nse: {
|
|
18
|
+
/** The ids an {@link Unquote} escape hands back to standard evaluation, the markers themselves excluded. */
|
|
19
|
+
readonly unquoted: <Info extends ParentInformation>(this: void, root: RNode<Info> | undefined, style: Unquote) => ReadonlySet<NodeId> | undefined;
|
|
20
|
+
/** Whether everything below `node` is unquoted. */
|
|
21
|
+
readonly isUnquote: <Info>(this: void, node: RNode<Info>, style: Unquote) => boolean;
|
|
22
|
+
/** Drops the mask mark from names the caller binds: while `filter(d, k)` is processed `k` has no read yet. */
|
|
23
|
+
readonly dropResolvedMask: (this: void, graph: DataflowGraph, id: NodeId, name: Identifier) => void;
|
|
24
|
+
/** Drops the non-standard-evaluation mark from the outgoing edges of `id` that `which` accepts. */
|
|
25
|
+
readonly unmark: (this: void, graph: DataflowGraph, id: NodeId, which?: (target: NodeId) => boolean) => void;
|
|
26
|
+
/** Whether `id` is a name the data mask supplies, i.e. a use the caller does not bind itself. */
|
|
27
|
+
readonly suppliedByMask: (this: void, graph: DataflowGraph, id: NodeId, vertex?: DataflowGraphVertexInfo | undefined) => boolean;
|
|
28
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Nse = exports.Unquote = void 0;
|
|
4
|
+
const model_1 = require("../../../../../r-bridge/lang-4.x/ast/model/model");
|
|
5
|
+
const r_unary_op_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-unary-op");
|
|
6
|
+
const r_function_call_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
7
|
+
const identifier_1 = require("../../../../environments/identifier");
|
|
8
|
+
const data_masking_functions_1 = require("../../../../environments/data-masking-functions");
|
|
9
|
+
const vertex_1 = require("../../../../graph/vertex");
|
|
10
|
+
const edge_1 = require("../../../../graph/edge");
|
|
11
|
+
/** The escape a quoting function offers, a property of the function: `quote(!!x)` negates, `expr(!!x)` splices. */
|
|
12
|
+
var Unquote;
|
|
13
|
+
(function (Unquote) {
|
|
14
|
+
/** no escape at all, everything within the argument stays unevaluated */
|
|
15
|
+
Unquote["None"] = "none";
|
|
16
|
+
/** rlang's `!!` and `!!!` splice in the value of their operand */
|
|
17
|
+
Unquote["Rlang"] = "rlang";
|
|
18
|
+
/** `bquote`'s `.(x)` evaluates its operand */
|
|
19
|
+
Unquote["Bquote"] = "bquote";
|
|
20
|
+
})(Unquote || (exports.Unquote = Unquote = {}));
|
|
21
|
+
/** `!!x` parses as `!(!x)`, so peel the run of `!` to reach the operand. */
|
|
22
|
+
function unquotedOperandOf(node, style) {
|
|
23
|
+
if (style === Unquote.Bquote) {
|
|
24
|
+
if (!r_function_call_1.RFunctionCall.isNamed(node) || identifier_1.Identifier.getName(node.functionName.content) !== '.' || node.arguments.length !== 1) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const arg = node.arguments[0];
|
|
28
|
+
return arg === r_function_call_1.EmptyArgument ? undefined : arg.value;
|
|
29
|
+
}
|
|
30
|
+
if (!isNegation(node) || !isNegation(node.operand)) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
let operand = node.operand;
|
|
34
|
+
while (isNegation(operand)) {
|
|
35
|
+
operand = operand.operand;
|
|
36
|
+
}
|
|
37
|
+
return operand;
|
|
38
|
+
}
|
|
39
|
+
function isNegation(node) {
|
|
40
|
+
return r_unary_op_1.RUnaryOp.is(node) && node.operator === '!';
|
|
41
|
+
}
|
|
42
|
+
/** The parts of a call R does not evaluate the standard way. */
|
|
43
|
+
exports.Nse = {
|
|
44
|
+
/** The ids an {@link Unquote} escape hands back to standard evaluation, the markers themselves excluded. */
|
|
45
|
+
unquoted(root, style) {
|
|
46
|
+
if (root === undefined || style === Unquote.None) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
const evaluated = new Set();
|
|
50
|
+
model_1.RNode.visitAst(root, node => {
|
|
51
|
+
const operand = unquotedOperandOf(node, style);
|
|
52
|
+
if (operand === undefined) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
model_1.RNode.visitAst(operand, inner => {
|
|
56
|
+
evaluated.add(inner.info.id);
|
|
57
|
+
return false;
|
|
58
|
+
});
|
|
59
|
+
return true;
|
|
60
|
+
});
|
|
61
|
+
return evaluated.size > 0 ? evaluated : undefined;
|
|
62
|
+
},
|
|
63
|
+
/** Whether everything below `node` is unquoted. */
|
|
64
|
+
isUnquote(node, style) {
|
|
65
|
+
return style !== Unquote.None && unquotedOperandOf(node, style) !== undefined;
|
|
66
|
+
},
|
|
67
|
+
/** Drops the mask mark from names the caller binds: while `filter(d, k)` is processed `k` has no read yet. */
|
|
68
|
+
dropResolvedMask(graph, id, name) {
|
|
69
|
+
if (data_masking_functions_1.DataMaskingFunctionNames.has(identifier_1.Identifier.getName(name))) {
|
|
70
|
+
exports.Nse.unmark(graph, id, target => !exports.Nse.suppliedByMask(graph, target));
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
/** Drops the non-standard-evaluation mark from the outgoing edges of `id` that `which` accepts. */
|
|
74
|
+
unmark(graph, id, which = () => true) {
|
|
75
|
+
const edges = graph.outgoingEdges(id);
|
|
76
|
+
for (const [target, edge] of [...edges ?? []]) {
|
|
77
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.NonStandardEvaluation) && which(target)) {
|
|
78
|
+
graph.removeEdgeType(id, target, edge_1.EdgeType.NonStandardEvaluation);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
/** Whether `id` is a name the data mask supplies, i.e. a use the caller does not bind itself. */
|
|
83
|
+
suppliedByMask(graph, id, vertex = graph.getVertex(id)) {
|
|
84
|
+
return vertex_1.UseVertex.is(vertex) && !graph.outgoingEdges(id)?.values().some(e => edge_1.DfEdge.includesType(e, edge_1.EdgeType.Reads));
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=nse.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ControlFlowGraph } from '../../../../../control-flow/control-flow-graph';
|
|
2
|
+
import type { AstIdMap, ParentInformation } from '../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
|
+
import { NodeId } from '../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
|
+
import type { DataflowGraph } from '../../../../graph/graph';
|
|
5
|
+
import { linkExpressionIn } from '../../../linker';
|
|
6
|
+
/**
|
|
7
|
+
* A language object reads nothing where it is written and everything where it reaches `eval`, with the bindings
|
|
8
|
+
* in effect there. Working on the finished graph makes assignments, branches, loops, and calls one traversal.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Quoted: {
|
|
11
|
+
/** The expression a capturing call holds on to. */
|
|
12
|
+
readonly capturedBy: (this: void, graph: DataflowGraph, id: NodeId) => NodeId | undefined;
|
|
13
|
+
/** Every expression the value at `id` may hold, with the call that captured it. Several is normal. */
|
|
14
|
+
readonly sourcesOf: (this: void, graph: DataflowGraph, id: NodeId) => readonly CapturedExpression[];
|
|
15
|
+
/** Links every name in `expr` against `environment` and hands back what stays unresolved. */
|
|
16
|
+
readonly evaluateIn: typeof linkExpressionIn;
|
|
17
|
+
/**
|
|
18
|
+
* The finishing pass over a complete graph: it settles what a call really evaluates, which the call itself
|
|
19
|
+
* could not know. A capture reaches the `eval` that forces it, a promise reaches the bindings it may be
|
|
20
|
+
* forced against, and a masked name the caller binds after all loses its mark.
|
|
21
|
+
*/
|
|
22
|
+
readonly finalize: <Info>(this: void, graph: DataflowGraph, idMap: AstIdMap<Info & ParentInformation>, controlFlow: () => ControlFlowGraph | undefined) => void;
|
|
23
|
+
};
|
|
24
|
+
interface CapturedExpression {
|
|
25
|
+
readonly expr: NodeId;
|
|
26
|
+
/** the capturing call, whose scope encloses `expr` */
|
|
27
|
+
readonly at: NodeId;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Quoted = void 0;
|
|
4
|
+
const r_function_call_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
5
|
+
const type_1 = require("../../../../../r-bridge/lang-4.x/ast/model/type");
|
|
6
|
+
const node_id_1 = require("../../../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
7
|
+
const identifier_1 = require("../../../../environments/identifier");
|
|
8
|
+
const built_in_proc_name_1 = require("../../../../environments/built-in-proc-name");
|
|
9
|
+
const edge_1 = require("../../../../graph/edge");
|
|
10
|
+
const graph_1 = require("../../../../graph/graph");
|
|
11
|
+
const vertex_1 = require("../../../../graph/vertex");
|
|
12
|
+
const linker_1 = require("../../../linker");
|
|
13
|
+
const nse_1 = require("./nse");
|
|
14
|
+
const deferred_1 = require("./deferred");
|
|
15
|
+
/** Calls capturing a language object. */
|
|
16
|
+
const CapturingProcessors = [built_in_proc_name_1.BuiltInProcName.Quote];
|
|
17
|
+
/** Calls capturing an expression as a promise, forced at some later read of the variable they bind. */
|
|
18
|
+
const DelayingCalls = new Set(['delayedAssign']);
|
|
19
|
+
/** Calls evaluating one. */
|
|
20
|
+
const EvaluatingProcessors = [built_in_proc_name_1.BuiltInProcName.Eval];
|
|
21
|
+
/** How a value reaches its use, `DefinedByOnCall` being the hop from a parameter to its argument. */
|
|
22
|
+
const ValueFlow = edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedBy | edge_1.EdgeType.DefinedByOnCall | edge_1.EdgeType.Returns;
|
|
23
|
+
function hasOrigin(vertex, of) {
|
|
24
|
+
return vertex.origin !== 'unnamed' && vertex.origin.some(o => of.includes(o));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A language object reads nothing where it is written and everything where it reaches `eval`, with the bindings
|
|
28
|
+
* in effect there. Working on the finished graph makes assignments, branches, loops, and calls one traversal.
|
|
29
|
+
*/
|
|
30
|
+
exports.Quoted = {
|
|
31
|
+
/** The expression a capturing call holds on to. */
|
|
32
|
+
capturedBy(graph, id) {
|
|
33
|
+
const vertex = graph.getVertex(id);
|
|
34
|
+
return vertex_1.FunctionCallVertex.is(vertex) && hasOrigin(vertex, CapturingProcessors) ? capturedArgumentOf(graph, id) : undefined;
|
|
35
|
+
},
|
|
36
|
+
/** Every expression the value at `id` may hold, with the call that captured it. Several is normal. */
|
|
37
|
+
sourcesOf(graph, id) {
|
|
38
|
+
const found = [];
|
|
39
|
+
const seen = new Set([id]);
|
|
40
|
+
const pending = [id];
|
|
41
|
+
while (pending.length > 0) {
|
|
42
|
+
const current = pending.pop();
|
|
43
|
+
const captured = exports.Quoted.capturedBy(graph, current);
|
|
44
|
+
if (captured !== undefined) {
|
|
45
|
+
found.push({ expr: captured, at: current });
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
for (const [target, edge] of graph.outgoingEdges(current) ?? []) {
|
|
49
|
+
if (edge_1.DfEdge.includesType(edge, ValueFlow) && !seen.has(target)) {
|
|
50
|
+
seen.add(target);
|
|
51
|
+
pending.push(target);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return found;
|
|
56
|
+
},
|
|
57
|
+
/** Links every name in `expr` against `environment` and hands back what stays unresolved. */
|
|
58
|
+
evaluateIn: linker_1.linkExpressionIn,
|
|
59
|
+
/**
|
|
60
|
+
* The finishing pass over a complete graph: it settles what a call really evaluates, which the call itself
|
|
61
|
+
* could not know. A capture reaches the `eval` that forces it, a promise reaches the bindings it may be
|
|
62
|
+
* forced against, and a masked name the caller binds after all loses its mark.
|
|
63
|
+
*/
|
|
64
|
+
finalize(graph, idMap, controlFlow) {
|
|
65
|
+
let names = undefined;
|
|
66
|
+
let cfg = null;
|
|
67
|
+
const cfgOnce = () => (cfg === null ? (cfg = controlFlow()) : cfg);
|
|
68
|
+
for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
69
|
+
nse_1.Nse.dropResolvedMask(graph, id, vertex.name);
|
|
70
|
+
if (DelayingCalls.has(identifier_1.Identifier.getName(vertex.name))) {
|
|
71
|
+
const promise = capturedArgumentOf(graph, id);
|
|
72
|
+
const binding = promise === undefined ? undefined : boundBy(graph, id);
|
|
73
|
+
if (promise !== undefined) {
|
|
74
|
+
names ??= deferred_1.Deferred.indexOf(graph, idMap);
|
|
75
|
+
const flow = binding === undefined ? undefined : cfgOnce();
|
|
76
|
+
const sites = flow === undefined || binding === undefined ? undefined : deferred_1.Deferred.forcedAt(graph, binding, flow);
|
|
77
|
+
deferred_1.Deferred.link(graph, promise, names, idMap, flow !== undefined && sites?.length && binding !== undefined ? { cfg: flow, sites, binding } : undefined);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else if (vertex.environment !== undefined && hasOrigin(vertex, EvaluatingProcessors) && !evaluatesElsewhere(idMap.get(id))) {
|
|
81
|
+
resolveEvaluation(graph, vertex, vertex.environment, idMap);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
for (const escaped of escapingArguments(graph, id)) {
|
|
85
|
+
names ??= deferred_1.Deferred.indexOf(graph, idMap);
|
|
86
|
+
deferred_1.Deferred.link(graph, escaped, names, idMap);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
/** The name a delaying call binds, which is the definition its reads have to go through. */
|
|
93
|
+
function boundBy(graph, id) {
|
|
94
|
+
for (const [target, edge] of graph.ingoingEdges(id) ?? []) {
|
|
95
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedBy) && vertex_1.VariableDefinitionVertex.is(graph.getVertex(target))) {
|
|
96
|
+
return target;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
/** The argument a call takes but does not evaluate, which is the one it captured. */
|
|
102
|
+
function capturedArgumentOf(graph, id) {
|
|
103
|
+
for (const [target, edge] of graph.outgoingEdges(id) ?? []) {
|
|
104
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Argument) && edge_1.DfEdge.includesType(edge, edge_1.EdgeType.NonStandardEvaluation)) {
|
|
105
|
+
return target;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
/** Links a capture handed to an evaluating call, in that call's scope. */
|
|
111
|
+
function resolveEvaluation(graph, call, environment, idMap) {
|
|
112
|
+
const id = call.id;
|
|
113
|
+
const argument = call.args.find(a => !graph_1.FunctionArgument.isEmpty(a));
|
|
114
|
+
const reference = argument === undefined ? undefined : unwrapArgument(graph_1.FunctionArgument.getReference(argument), idMap);
|
|
115
|
+
const sources = reference === undefined ? [] : exports.Quoted.sourcesOf(graph, reference);
|
|
116
|
+
for (const { expr, at } of sources) {
|
|
117
|
+
const open = (0, linker_1.linkExpressionIn)(graph, expr, environment, idMap);
|
|
118
|
+
/* R falls through to the enclosing scope for names the evaluating frame does not bind */
|
|
119
|
+
const enclosing = open.length > 0 ? graph.getVertex(at)?.environment : undefined;
|
|
120
|
+
if (enclosing !== undefined) {
|
|
121
|
+
(0, linker_1.linkInputs)(open, enclosing, [], graph, false);
|
|
122
|
+
}
|
|
123
|
+
graph.addEdge(id, expr, edge_1.EdgeType.Returns);
|
|
124
|
+
/* the capture said "not evaluated here", and being handed to `eval` settles that it is */
|
|
125
|
+
nse_1.Nse.unmark(graph, at);
|
|
126
|
+
}
|
|
127
|
+
if (sources.length > 0) {
|
|
128
|
+
forgetUnknownSideEffect(graph, id);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The arguments of `id` whose promise outlives the call: the callee hands back a closure and never reads the
|
|
133
|
+
* parameter outside it, so R forces them wherever that closure is called, not here. A parameter read in the
|
|
134
|
+
* body itself (what `force` is for) is settled during the call and stays where it is.
|
|
135
|
+
*/
|
|
136
|
+
function* escapingArguments(graph, id) {
|
|
137
|
+
for (const [target, edge] of graph.outgoingEdges(id) ?? []) {
|
|
138
|
+
if (!edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Calls)) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const callee = graph.getVertex(target);
|
|
142
|
+
if (callee?.tag !== vertex_1.VertexType.FunctionDefinition) {
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
for (const exit of callee.exitPoints) {
|
|
146
|
+
const closure = graph.getVertex(exit.nodeId);
|
|
147
|
+
if (closure?.tag !== vertex_1.VertexType.FunctionDefinition) {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
for (const key of Object.keys(callee.params)) {
|
|
151
|
+
const parameter = node_id_1.NodeId.normalize(key);
|
|
152
|
+
let escapes = true;
|
|
153
|
+
for (const [reader, edge] of graph.ingoingEdges(parameter) ?? []) {
|
|
154
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads) && !closure.subflow.graph.has(reader)) {
|
|
155
|
+
escapes = false;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (!escapes) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
for (const [argument, edge] of graph.outgoingEdges(parameter) ?? []) {
|
|
163
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedByOnCall)) {
|
|
164
|
+
yield argument;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/** The value an argument reference points at. */
|
|
172
|
+
function unwrapArgument(reference, idMap) {
|
|
173
|
+
const node = reference === undefined ? undefined : idMap.get(reference);
|
|
174
|
+
return node?.type === type_1.RType.Argument ? node.value?.info.id : reference;
|
|
175
|
+
}
|
|
176
|
+
/** `eval(expr, envir)` runs elsewhere, so the bindings here say nothing. */
|
|
177
|
+
function evaluatesElsewhere(call) {
|
|
178
|
+
return r_function_call_1.RFunctionCall.isNamed(call) && call.arguments.length > 1;
|
|
179
|
+
}
|
|
180
|
+
/** Drops the marker the call carries while we cannot say what it evaluates. */
|
|
181
|
+
function forgetUnknownSideEffect(graph, id) {
|
|
182
|
+
for (const unknown of graph.unknownSideEffects) {
|
|
183
|
+
if (graph_1.UnknownSideEffect.id(unknown) === id) {
|
|
184
|
+
graph.unknownSideEffects.delete(unknown);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=quoted.js.map
|
|
@@ -208,7 +208,7 @@ ${await (0, doc_repl_1.documentReplSession)(treeSitter, [{
|
|
|
208
208
|
`), ' ')}
|
|
209
209
|
|
|
210
210
|
* ๐ **fast call-graph, data-, and control-flow graphs**\\
|
|
211
|
-
Within just ${ctx.linkPage('flowr:benchmarks', `${'<i>' + (0, html_hover_over_1.textWithTooltip)((0, numbers_1.roundToDecimals)(await (0, doc_benchmarks_1.getLatestDfAnalysisTime)('"
|
|
211
|
+
Within just ${ctx.linkPage('flowr:benchmarks', `${'<i>' + (0, html_hover_over_1.textWithTooltip)((0, numbers_1.roundToDecimals)(await (0, doc_benchmarks_1.getLatestDfAnalysisTime)('"real-world" Benchmark Suite (tree-sitter)'), 1) + ' ms', 'This measurement is automatically fetched from the latest benchmark!') + '</i>'} (as of ${new Date(await (0, doc_benchmarks_1.getLastBenchmarkUpdate)()).toLocaleDateString('en-US', dateOptions)})`)},
|
|
212
212
|
_flowR_ can analyze the data- and control-flow of the average real-world R script. See the ${ctx.linkPage('flowr:benchmarks', 'benchmarks')} for more information,
|
|
213
213
|
and consult the ${ctx.linkPage('wiki/Dataflow Graph', 'wiki pages')} for more details on the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graphs')} as well as ${ctx.linkPage('wiki/Dataflow Graph', 'call graphs', 'perspectives-cg')}.
|
|
214
214
|
|
|
@@ -283,7 +283,10 @@ ${printPublications()}
|
|
|
283
283
|
|
|
284
284
|
## ๐ Contributing
|
|
285
285
|
|
|
286
|
-
We welcome every contribution!
|
|
286
|
+
We welcome every contribution! The ${ctx.linkPage('wiki/Onboarding', 'developer onboarding')} page has everything you need to get started.
|
|
287
|
+
With **R** and **Node.js** installed, \`npm run setup:dev\` checks your prerequisites, installs the dependencies, and configures the git hooks.
|
|
288
|
+
The [contributing guidelines](${doc_files_1.FlowrGithubBaseRef}/flowr/tree/main/.github/CONTRIBUTING.md) explain our commit conventions,
|
|
289
|
+
and ${ctx.linkPage('wiki/Linting and Testing')} shows how to run the tests.
|
|
287
290
|
|
|
288
291
|
### Contributors
|
|
289
292
|
|
|
@@ -1 +1,3 @@
|
|
|
1
1
|
export declare const NewIssueUrl = "https://github.com/flowr-analysis/flowr/issues/new/choose";
|
|
2
|
+
/** the question issue form, for everything the wiki does not answer */
|
|
3
|
+
export declare const NewQuestionUrl = "https://github.com/flowr-analysis/flowr/issues/new?template=question.yaml";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NewIssueUrl = void 0;
|
|
3
|
+
exports.NewQuestionUrl = exports.NewIssueUrl = void 0;
|
|
4
4
|
const doc_files_1 = require("./doc-files");
|
|
5
5
|
exports.NewIssueUrl = `${doc_files_1.FlowrGithubBaseRef}/flowr/issues/new/choose`;
|
|
6
|
+
/** the question issue form, for everything the wiki does not answer */
|
|
7
|
+
exports.NewQuestionUrl = `${doc_files_1.FlowrGithubBaseRef}/flowr/issues/new?template=question.yaml`;
|
|
6
8
|
//# sourceMappingURL=doc-issue.js.map
|
|
@@ -209,6 +209,16 @@ function followTypeReference(type, sourceFile) {
|
|
|
209
209
|
}
|
|
210
210
|
return [nodeLexeme, baseLexeme, ...args];
|
|
211
211
|
}
|
|
212
|
+
/** The base types a declaration extends or implements, with their generics dropped. */
|
|
213
|
+
function heritageTypeNames(node, sourceFile) {
|
|
214
|
+
return node.heritageClauses?.flatMap(clause => clause.types
|
|
215
|
+
.map(type => type.getText(sourceFile) ?? '')
|
|
216
|
+
.map(dropGenericsFromTypeName)) ?? [];
|
|
217
|
+
}
|
|
218
|
+
/** The names of the type parameters a declaration takes. */
|
|
219
|
+
function genericNames(node, sourceFile) {
|
|
220
|
+
return node.typeParameters?.map(param => param.getText(sourceFile) ?? '') ?? [];
|
|
221
|
+
}
|
|
212
222
|
function collectHierarchyInformation(sourceFiles, options) {
|
|
213
223
|
const hierarchyList = [];
|
|
214
224
|
const typeChecker = options.program.getTypeChecker();
|
|
@@ -218,10 +228,8 @@ function collectHierarchyInformation(sourceFiles, options) {
|
|
|
218
228
|
}
|
|
219
229
|
if (typescript_1.default.isInterfaceDeclaration(node)) {
|
|
220
230
|
const interfaceName = node.name?.getText(sourceFile) ?? '';
|
|
221
|
-
const baseTypes = node
|
|
222
|
-
|
|
223
|
-
.map(dropGenericsFromTypeName)) ?? [];
|
|
224
|
-
const generics = node.typeParameters?.map(param => param.getText(sourceFile) ?? '') ?? [];
|
|
231
|
+
const baseTypes = heritageTypeNames(node, sourceFile);
|
|
232
|
+
const generics = genericNames(node, sourceFile);
|
|
225
233
|
hierarchyList.push({
|
|
226
234
|
name: dropGenericsFromTypeName(interfaceName),
|
|
227
235
|
node,
|
|
@@ -246,7 +254,7 @@ function collectHierarchyInformation(sourceFiles, options) {
|
|
|
246
254
|
else if (typescript_1.default.isTypeReferenceNode(node.type)) {
|
|
247
255
|
baseTypes = followTypeReference(node.type, sourceFile).map(dropGenericsFromTypeName);
|
|
248
256
|
}
|
|
249
|
-
const generics = node
|
|
257
|
+
const generics = genericNames(node, sourceFile);
|
|
250
258
|
hierarchyList.push({
|
|
251
259
|
name: dropGenericsFromTypeName(typeName),
|
|
252
260
|
node,
|
|
@@ -288,10 +296,8 @@ function collectHierarchyInformation(sourceFiles, options) {
|
|
|
288
296
|
}
|
|
289
297
|
else if (typescript_1.default.isClassDeclaration(node)) {
|
|
290
298
|
const className = node.name?.getText(sourceFile) ?? '';
|
|
291
|
-
const baseTypes = node
|
|
292
|
-
|
|
293
|
-
.map(dropGenericsFromTypeName)) ?? [];
|
|
294
|
-
const generics = node.typeParameters?.map(param => param.getText(sourceFile) ?? '') ?? [];
|
|
299
|
+
const baseTypes = heritageTypeNames(node, sourceFile);
|
|
300
|
+
const generics = genericNames(node, sourceFile);
|
|
295
301
|
hierarchyList.push({
|
|
296
302
|
name: dropGenericsFromTypeName(className),
|
|
297
303
|
node,
|
|
@@ -46,6 +46,7 @@ const r_number_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-number");
|
|
|
46
46
|
const model_1 = require("../r-bridge/lang-4.x/ast/model/model");
|
|
47
47
|
const range_1 = require("../util/range");
|
|
48
48
|
const df_helper_1 = require("../dataflow/graph/df-helper");
|
|
49
|
+
const resolve_helper_1 = require("../dataflow/environments/resolve-helper");
|
|
49
50
|
const built_in_proc_name_1 = require("../dataflow/environments/built-in-proc-name");
|
|
50
51
|
async function subExplanation(parser, ctx, { description, code, expectedSubgraph }) {
|
|
51
52
|
expectedSubgraph = await (0, doc_dfg_1.verifyExpectedSubgraph)(parser, code, expectedSubgraph);
|
|
@@ -1097,6 +1098,9 @@ FlowR also provides various helper objects (with the same name as the correspond
|
|
|
1097
1098
|
* ${ctx.link(edge_1.DfEdge, undefined, { type: 'variable' })} to get helpful functions wrt. edges (see [below](#dfg-resolving-values))
|
|
1098
1099
|
* ${ctx.link(identifier_1.Identifier, undefined, { type: 'variable' })} to get helpful functions wrt. identifiers
|
|
1099
1100
|
* ${ctx.link(graph_1.FunctionArgument, undefined, { type: 'variable' })} to get helpful functions wrt. function arguments
|
|
1101
|
+
* ${ctx.link(resolve_helper_1.Resolve, undefined, { type: 'variable' })} (also reachable as \`Dataflow.resolve\`) to resolve a name against an environment or a node to its value.
|
|
1102
|
+
The entry points differ a lot in cost, so take the narrowest one that answers your question: \`byName\` walks the environment layers once and is served from the layer cache,
|
|
1103
|
+
\`byNameAndType\` additionally filters and merges the definitions of every layer it passes, and \`toValue\` as well as the \`argument\` family run the evaluator on top of a resolution.
|
|
1100
1104
|
|
|
1101
1105
|
Some of these functions have been explained in their respective wiki pages. However, some are part of the ${ctx.linkPage('wiki/Dataflow Graph', 'Dataflow Graph API')} and so we explain them here.
|
|
1102
1106
|
If you are interested in which features we support and which features are still to be worked on, please refer to our ${ctx.linkPage('wiki/Capabilities', 'capabilities')} page.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WikiFaq = void 0;
|
|
4
4
|
const faqs_1 = require("./data/faq/faqs");
|
|
5
|
+
const doc_issue_1 = require("./doc-util/doc-issue");
|
|
5
6
|
const doc_maker_1 = require("./wiki-mk/doc-maker");
|
|
6
7
|
/**
|
|
7
8
|
* https://github.com/flowr-analysis/flowr/wiki/FAQ
|
|
@@ -12,8 +13,11 @@ class WikiFaq extends doc_maker_1.DocMaker {
|
|
|
12
13
|
}
|
|
13
14
|
text({ ctx }) {
|
|
14
15
|
const faqs = (0, faqs_1.registerFaqs)(ctx);
|
|
15
|
-
return `
|
|
16
|
-
|
|
16
|
+
return `
|
|
17
|
+
Is your question not answered below? Please [ask it as an issue](${doc_issue_1.NewQuestionUrl}) and we will answer it.
|
|
18
|
+
Answers regularly end up on this page, so asking helps everyone who wonders the same thing later.
|
|
19
|
+
|
|
20
|
+
${faqs.toMarkdown()}
|
|
17
21
|
`.trim();
|
|
18
22
|
}
|
|
19
23
|
}
|
|
@@ -18,15 +18,25 @@ class WikiOnboarding extends doc_maker_1.DocMaker {
|
|
|
18
18
|
- ๐ [Contributing guidelines](${doc_files_1.FlowrGithubBaseRef}/flowr/tree/main/.github/CONTRIBUTING.md).\\
|
|
19
19
|
This page also includes information about how to set up **git-lfs** and several **git hooks**.
|
|
20
20
|
|
|
21
|
+
Once you are set up, these pages explain the parts you are most likely to touch:
|
|
22
|
+
- ๐ฌ ${ctx.linkPage('wiki/Core')} walks through the pipeline from parsing to the dataflow graph.
|
|
23
|
+
- ๐ฅ๏ธ ${ctx.linkPage('wiki/Interface')} covers the REPL, the server, and the API.
|
|
24
|
+
- ๐งช ${ctx.linkPage('wiki/Linting and Testing')} explains which tests exist and how to run them.
|
|
25
|
+
|
|
21
26
|
If you have any questions, please check out the ${ctx.linkPage('wiki/FAQ')} first, but if the question
|
|
22
27
|
is not answered there (or in the wiki in general), feel free to ask a question.
|
|
23
28
|
The ${ctx.linkPage('wiki/FAQ')} also includes information about how you can configure your editor.
|
|
24
29
|
|
|
25
30
|
## โ TL;DR
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
After installing **R** and **Node.js**, a single command sets everything up:
|
|
28
33
|
${(0, doc_code_1.codeBlock)('shell', 'npm run setup:dev')}
|
|
29
34
|
|
|
35
|
+
It installs the dependencies, checks your **node** version, tells you whether **R** and **git-lfs** are available,
|
|
36
|
+
configures the git hooks, tests them, and closes with the pages and commands you will need next.
|
|
37
|
+
Missing **R** or **git-lfs** are reported as notes instead of aborting the setup, so you can start with the
|
|
38
|
+
${ctx.linkPage('wiki/Engines', '`tree-sitter` engine')} right away and add them later.
|
|
39
|
+
|
|
30
40
|
If you want to execute the steps manually, please follow the instructions below:
|
|
31
41
|
|
|
32
42
|
${(0, doc_code_1.codeBlock)('shell', `
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WikiSetup = void 0;
|
|
4
4
|
const doc_maker_1 = require("./wiki-mk/doc-maker");
|
|
5
5
|
const doc_files_1 = require("./doc-util/doc-files");
|
|
6
|
+
const node_version_1 = require("../util/node-version");
|
|
6
7
|
/**
|
|
7
8
|
* https://github.com/flowr-analysis/flowr/wiki/Setup
|
|
8
9
|
*/
|
|
@@ -76,7 +77,7 @@ Again, you only require this for the ${ctx.linkPage('wiki/Engines', '`r-shell` e
|
|
|
76
77
|
### Installing Node.js
|
|
77
78
|
|
|
78
79
|
Furthermore, you need the [node package manager](https://www.npmjs.com/) (for Linux, we recommend using [nvm](https://github.com/nvm-sh/nvm)).
|
|
79
|
-
To work, we currently rely on node versions starting from \`
|
|
80
|
+
To work, we currently rely on node versions starting from \`${(0, node_version_1.minimumNodeMajor)()}.x\` (as declared by the \`engines.node\` field of the [package.json](${doc_files_1.RemoteFlowrFilePathBaseRef}package.json)).
|
|
80
81
|
|
|
81
82
|
### Installing _flowR_
|
|
82
83
|
|
|
@@ -29,6 +29,7 @@ exports.DEPRECATED_FUNCTIONS = {
|
|
|
29
29
|
// even when it is not part of the hardcoded `fns` list above
|
|
30
30
|
const graph = (await data.dataflow()).graph;
|
|
31
31
|
const alreadyFlagged = new Set(hardcoded.results.map(r => r.involvedId));
|
|
32
|
+
const deprecatedByName = new Map();
|
|
32
33
|
const sigdbFlagged = [];
|
|
33
34
|
for (const element of elements.getElements()) {
|
|
34
35
|
const id = element.node.info.id;
|
|
@@ -39,8 +40,13 @@ exports.DEPRECATED_FUNCTIONS = {
|
|
|
39
40
|
if (qualified === undefined) {
|
|
40
41
|
continue;
|
|
41
42
|
}
|
|
42
|
-
const
|
|
43
|
-
|
|
43
|
+
const name = identifier_1.Identifier.toString(qualified);
|
|
44
|
+
let deprecated = deprecatedByName.get(name);
|
|
45
|
+
if (deprecated === undefined) {
|
|
46
|
+
deprecated = deps.signatureOf(qualified)?.props.includes('deprecated') === true;
|
|
47
|
+
deprecatedByName.set(name, deprecated);
|
|
48
|
+
}
|
|
49
|
+
if (!deprecated) {
|
|
44
50
|
continue;
|
|
45
51
|
}
|
|
46
52
|
const loc = range_1.SourceLocation.fromNode(element.node);
|
|
@@ -51,7 +57,7 @@ exports.DEPRECATED_FUNCTIONS = {
|
|
|
51
57
|
sigdbFlagged.push({
|
|
52
58
|
certainty: linter_format_1.LintingResultCertainty.Certain,
|
|
53
59
|
involvedId: id,
|
|
54
|
-
function:
|
|
60
|
+
function: name,
|
|
55
61
|
loc
|
|
56
62
|
});
|
|
57
63
|
}
|
|
@@ -12,8 +12,7 @@ const graph_1 = require("../../dataflow/graph/graph");
|
|
|
12
12
|
const cascade_action_1 = require("../../queries/catalog/call-context-query/cascade-action");
|
|
13
13
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
14
14
|
const linter_tags_1 = require("../linter-tags");
|
|
15
|
-
const
|
|
16
|
-
const general_1 = require("../../dataflow/eval/values/general");
|
|
15
|
+
const node_value_1 = require("../../dataflow/eval/resolve/node-value");
|
|
17
16
|
const config_1 = require("../../config");
|
|
18
17
|
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
19
18
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
@@ -162,7 +161,7 @@ function getDefaultAssignments() {
|
|
|
162
161
|
}
|
|
163
162
|
function isConstantArgument(graph, call, argIndex, ctx) {
|
|
164
163
|
const args = call.args.filter(arg => arg !== r_function_call_1.EmptyArgument && !arg.name).map(graph_1.FunctionArgument.getReference);
|
|
165
|
-
const values =
|
|
164
|
+
const values = node_value_1.NodeValue.inGraph.setOf(args[argIndex], graph, ctx, { resolve: config_1.VariableResolve.Alias });
|
|
166
165
|
return values?.elements.every(v => v.type === 'number' ||
|
|
167
166
|
v.type === 'logical' ||
|
|
168
167
|
v.type === 'string' ||
|
|
@@ -75,6 +75,15 @@ exports.UNDEFINED_SYMBOL = {
|
|
|
75
75
|
...deps.getDependencies().map(p => deps.getDependency(p.name) ?? p),
|
|
76
76
|
...r_base_packages_1.AttachedBasePackages.map(n => deps.getDependency(n)).filter(assert_1.isNotUndefined)
|
|
77
77
|
];
|
|
78
|
+
const exportedByLoaded = new Map();
|
|
79
|
+
const isExportedByLoadedPackage = (name) => {
|
|
80
|
+
let known = exportedByLoaded.get(name);
|
|
81
|
+
if (known === undefined) {
|
|
82
|
+
known = loadedPackages.some(p => p.has(name));
|
|
83
|
+
exportedByLoaded.set(name, known);
|
|
84
|
+
}
|
|
85
|
+
return known;
|
|
86
|
+
};
|
|
78
87
|
// hint an unloaded package that exports `name` (e.g. `ggplot` -> `ggplot2`), from the package database
|
|
79
88
|
const attached = new Set(r_base_packages_1.AttachedBasePackages);
|
|
80
89
|
const hintPackagesFor = (name) => deps.packagesExporting(name).filter(p => !attached.has(p)).slice(0, MaxHintPackages);
|
|
@@ -132,7 +141,7 @@ exports.UNDEFINED_SYMBOL = {
|
|
|
132
141
|
return suppress('loadedPackage');
|
|
133
142
|
}
|
|
134
143
|
// exported by a package in scope (`pkg::fn`, a loaded package, or a default-attached base package)
|
|
135
|
-
if (namespace !== undefined ? deps.getDependency(namespace)?.has(name) === true :
|
|
144
|
+
if (namespace !== undefined ? deps.getDependency(namespace)?.has(name) === true : isExportedByLoadedPackage(name)) {
|
|
136
145
|
return suppress('loadedPackage');
|
|
137
146
|
}
|
|
138
147
|
// forward-referenced closure binding flowR's dataflow did not link (unconditional bindings only)
|