@eagleoutice/flowr 2.17.9 → 2.17.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.
Files changed (116) hide show
  1. package/cli/repl/core.js +4 -0
  2. package/config.d.ts +10 -0
  3. package/config.js +8 -1
  4. package/control-flow/control-flow-graph.js +11 -1
  5. package/dataflow/environments/default-builtin-config/guards-primitive-lang.js +1 -1
  6. package/dataflow/environments/default-builtin-config/guards.js +6 -1
  7. package/dataflow/environments/default-builtin-config/index.d.ts +1 -1
  8. package/dataflow/environments/default-builtin-config/network-access.d.ts +1 -1
  9. package/dataflow/environments/default-builtin-config/network-access.js +2 -0
  10. package/dataflow/environments/environment.d.ts +2 -0
  11. package/dataflow/environments/environment.js +5 -0
  12. package/dataflow/environments/frame-memory.d.ts +9 -0
  13. package/dataflow/environments/frame-memory.js +37 -0
  14. package/dataflow/environments/group-generics.d.ts +2 -0
  15. package/dataflow/environments/group-generics.js +7 -0
  16. package/dataflow/environments/identifier.d.ts +2 -0
  17. package/dataflow/environments/identifier.js +16 -0
  18. package/dataflow/environments/pkg-name.d.ts +1 -0
  19. package/dataflow/environments/query-fn-props.d.ts +4 -0
  20. package/dataflow/environments/query-fn-props.js +21 -4
  21. package/dataflow/environments/resolve-by-name.js +5 -3
  22. package/dataflow/extractor.js +26 -4
  23. package/dataflow/fn/guards/call-contracts.js +8 -4
  24. package/dataflow/fn/guards/function-guards.d.ts +13 -4
  25. package/dataflow/fn/guards/function-guards.js +147 -52
  26. package/dataflow/fn/guards/guard-term.d.ts +6 -3
  27. package/dataflow/fn/guards/guard-term.js +12 -6
  28. package/dataflow/graph/graph.d.ts +2 -0
  29. package/dataflow/graph/graph.js +9 -5
  30. package/dataflow/internal/dispatch-linking.d.ts +6 -0
  31. package/dataflow/internal/dispatch-linking.js +25 -0
  32. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +32 -2
  33. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +52 -21
  34. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +28 -19
  35. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +75 -0
  36. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +20 -6
  37. package/dataflow/processor.d.ts +3 -0
  38. package/documentation/data/faq/faqs.js +4 -0
  39. package/documentation/wiki-analyzer.js +13 -2
  40. package/documentation/wiki-interface.js +1 -0
  41. package/documentation/wiki-linter.js +3 -0
  42. package/linter/linter-executor.js +4 -1
  43. package/linter/linter-format.d.ts +5 -5
  44. package/linter/linter-rules.d.ts +47 -13
  45. package/linter/linter-rules.js +3 -1
  46. package/linter/rules/absolute-file-paths.js +1 -1
  47. package/linter/rules/autoload-files.d.ts +33 -0
  48. package/linter/rules/autoload-files.js +94 -0
  49. package/linter/rules/cmd-check/description-metadata.d.ts +2 -2
  50. package/linter/rules/cmd-check/description-metadata.js +1 -1
  51. package/linter/rules/cmd-check/documentation-mismatch.d.ts +2 -2
  52. package/linter/rules/cmd-check/documentation-mismatch.js +1 -1
  53. package/linter/rules/cmd-check/file-checks.d.ts +6 -11
  54. package/linter/rules/cmd-check/file-checks.js +8 -3
  55. package/linter/rules/cmd-check/package-data.d.ts +2 -2
  56. package/linter/rules/cmd-check/package-data.js +1 -1
  57. package/linter/rules/cmd-check/package-metafiles.js +1 -1
  58. package/linter/rules/cmd-check/package-structure.d.ts +2 -2
  59. package/linter/rules/cmd-check/package-structure.js +1 -1
  60. package/linter/rules/cmd-check/rd-files.js +1 -1
  61. package/linter/rules/naming-convention.d.ts +9 -2
  62. package/linter/rules/process-state-in-session.js +4 -1
  63. package/linter/rules/software-has-license.d.ts +2 -2
  64. package/linter/rules/software-has-license.js +1 -2
  65. package/linter/rules/stop-call.d.ts +8 -3
  66. package/linter/rules/useless-loop.d.ts +1 -1
  67. package/package.json +1 -1
  68. package/project/cache/flowr-analyzer-cache.d.ts +3 -0
  69. package/project/cache/flowr-analyzer-cache.js +9 -0
  70. package/project/context/flowr-analyzer-context.d.ts +4 -3
  71. package/project/context/flowr-analyzer-context.js +18 -6
  72. package/project/context/flowr-analyzer-dependencies-context.d.ts +9 -0
  73. package/project/context/flowr-analyzer-dependencies-context.js +35 -6
  74. package/project/context/flowr-analyzer-environment-context.d.ts +1 -0
  75. package/project/context/flowr-analyzer-environment-context.js +1 -0
  76. package/project/context/flowr-analyzer-files-context.d.ts +4 -0
  77. package/project/context/flowr-analyzer-files-context.js +24 -0
  78. package/project/context/flowr-analyzer-functions-context.d.ts +1 -0
  79. package/project/context/flowr-analyzer-functions-context.js +6 -0
  80. package/project/context/flowr-analyzer-gas-context.d.ts +1 -0
  81. package/project/context/flowr-analyzer-gas-context.js +1 -0
  82. package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +24 -0
  83. package/project/context/flowr-analyzer-incremental-analysis-context.js +54 -0
  84. package/project/context/flowr-analyzer-loading-order-context.d.ts +1 -0
  85. package/project/context/flowr-analyzer-loading-order-context.js +14 -0
  86. package/project/context/flowr-analyzer-meta-context.d.ts +1 -0
  87. package/project/context/flowr-analyzer-meta-context.js +11 -0
  88. package/project/context/flowr-file.d.ts +2 -1
  89. package/project/context/flowr-file.js +5 -2
  90. package/project/flowr-analyzer.d.ts +22 -3
  91. package/project/flowr-analyzer.js +36 -0
  92. package/project/incremental/incremental-dataflow/incremental-dataflow.d.ts +142 -0
  93. package/project/incremental/incremental-dataflow/incremental-dataflow.js +330 -0
  94. package/project/plugins/flowr-analyzer-plugin.d.ts +22 -2
  95. package/project/plugins/flowr-analyzer-plugin.js +16 -1
  96. package/project/plugins/incremental/incremental-dataflow/flowr-analyzer-incremental-dataflow-heuristic-plugin.d.ts +52 -0
  97. package/project/plugins/incremental/incremental-dataflow/flowr-analyzer-incremental-dataflow-heuristic-plugin.js +50 -0
  98. package/project/plugins/incremental/incremental-dataflow/flowr-analyzer-incremental-dataflow-update-type-plugin.d.ts +77 -0
  99. package/project/plugins/incremental/incremental-dataflow/flowr-analyzer-incremental-dataflow-update-type-plugin.js +151 -0
  100. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +2 -0
  101. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +4 -0
  102. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +1 -0
  103. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +3 -0
  104. package/project/plugins/plugin-registry.d.ts +3 -1
  105. package/project/plugins/plugin-registry.js +6 -1
  106. package/project/sigdb/decode.js +4 -1
  107. package/project/sigdb/dict.d.ts +7 -4
  108. package/project/sigdb/dict.js +20 -6
  109. package/project/sigdb/guarded-source.js +10 -0
  110. package/project/sigdb/reader.d.ts +8 -2
  111. package/project/sigdb/reader.js +44 -30
  112. package/queries/catalog/input-sources-query/simple-input-classifier.js +84 -10
  113. package/util/flowr-version.d.ts +1 -1
  114. package/util/flowr-version.js +2 -2
  115. package/util/objects.d.ts +14 -0
  116. package/util/objects.js +100 -0
@@ -227,12 +227,16 @@ class DataflowGraph {
227
227
  }
228
228
  /** Whether `id` is quoted, i.e. affected by a {@link EdgeType.NonStandardEvaluation} edge that keeps it from being evaluated (a loop's own NSE-marked body still is evaluated, so that does not count). */
229
229
  isQuoted(id, withOutgoing = false) {
230
- /* an nse edge quotes iff it does not originate from a loop marking its body */
231
- const quotes = (source, e) => edge_1.DfEdge.includesType(e, edge_1.EdgeType.NonStandardEvaluation) && !model_1.RLoopConstructs.is(this.idMap?.get(source));
232
- if (this.edgesTo(id).entries().some(([source, e]) => quotes(source, e))) {
233
- return true;
230
+ for (const [source, e] of this.edgesTo(id)) {
231
+ if (this.quotes(source, e)) {
232
+ return true;
233
+ }
234
234
  }
235
- return withOutgoing && this.edgesFrom(id).values().some(e => quotes(id, e));
235
+ return withOutgoing && this.edgesFrom(id).values().some(e => this.quotes(id, e));
236
+ }
237
+ /** an nse edge quotes iff it does not originate from a loop marking its body */
238
+ quotes(source, e) {
239
+ return edge_1.DfEdge.includesType(e, edge_1.EdgeType.NonStandardEvaluation) && !model_1.RLoopConstructs.is(this._idMap?.get(source));
236
240
  }
237
241
  /**
238
242
  * The cached `pkg::fn` name of the call `id`, asking `resolve` only for a call the cache does not know yet.
@@ -67,6 +67,12 @@ export declare function s3ClassOfMethod(fn: NodeId, prefixes: readonly BrandedId
67
67
  export declare function linkedFunctionIds(ids: ReadonlySet<NodeId>, graph: DataflowGraph): NodeId[];
68
68
  /** The methods `environment` binds for the generics a built-in dispatches to on its own (see `dispatches` of a built-in): every `<generic>.<class>` and every function `setMethod` registers for one, whatever the class, as it may be that of a part. */
69
69
  export declare function internalGenericMethods(generics: readonly string[], environment: REnvironmentInformation, graph: DataflowGraph): IdentifierDefinition[];
70
+ /**
71
+ * {@link internalGenericMethods} per generic for the environments the calls of a program see. These differ in the few frames of the code but share
72
+ * the many attached packages below them, so what the packages bind for a generic is resolved once for all of them, and the frames are only walked
73
+ * where they bind the generic or a method of it.
74
+ */
75
+ export declare function internalGenericMethodsPerEnvironment(graph: DataflowGraph): (environment: REnvironmentInformation) => (generic: string) => readonly IdentifierDefinition[];
70
76
  /** Per target, the edges from `call` only its link to the method definitions `excluded` needs: the call and the returns of them, the reads of the definitions registering only them, and what only their bodies read on the call. */
71
77
  export declare function methodOnlyEdges(graph: DataflowGraph, call: NodeId, excluded: ReadonlySet<NodeId>): Map<NodeId, EdgeType>;
72
78
  /** Removes what linking `call` to the method definitions `excluded` added: the edges {@link methodOnlyEdges} names and the arguments bound to the parameters of the methods. */
@@ -7,6 +7,7 @@ exports.runsOnlyAfter = runsOnlyAfter;
7
7
  exports.s3ClassOfMethod = s3ClassOfMethod;
8
8
  exports.linkedFunctionIds = linkedFunctionIds;
9
9
  exports.internalGenericMethods = internalGenericMethods;
10
+ exports.internalGenericMethodsPerEnvironment = internalGenericMethodsPerEnvironment;
10
11
  exports.methodOnlyEdges = methodOnlyEdges;
11
12
  exports.unlinkExcludedMethods = unlinkExcludedMethods;
12
13
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
@@ -26,6 +27,8 @@ const built_in_proc_name_1 = require("../environments/built-in-proc-name");
26
27
  const function_semantics_1 = require("../fn/function-semantics");
27
28
  const dispatch_1 = require("../fn/dispatch");
28
29
  const linker_1 = require("./linker");
30
+ const group_generics_1 = require("../environments/group-generics");
31
+ const defaultmap_1 = require("../../util/collections/defaultmap");
29
32
  const identifier_1 = require("../environments/identifier");
30
33
  const resolve_helper_1 = require("../environments/resolve-helper");
31
34
  /** how many contexts of calls a dispatch is decided for on its own, beyond that all of them share one decision */
@@ -276,6 +279,28 @@ function internalGenericMethods(generics, environment, graph) {
276
279
  }) ?? []
277
280
  ]).filter(d => !node_id_1.NodeId.isBuiltIn(d.nodeId));
278
281
  }
282
+ /**
283
+ * {@link internalGenericMethods} per generic for the environments the calls of a program see. These differ in the few frames of the code but share
284
+ * the many attached packages below them, so what the packages bind for a generic is resolved once for all of them, and the frames are only walked
285
+ * where they bind the generic or a method of it.
286
+ */
287
+ function internalGenericMethodsPerEnvironment(graph) {
288
+ const inPackages = (0, defaultmap_1.memoize)((packages) => (0, defaultmap_1.memoize)((generic) => internalGenericMethods([generic], { current: packages, level: 0 }, graph)));
289
+ return (0, defaultmap_1.memoize)((environment) => {
290
+ const frames = [];
291
+ const withMethods = new Set();
292
+ let packages = environment.current;
293
+ for (; packages.t === undefined && !packages.builtInEnv; packages = packages.parent) {
294
+ frames.push(packages);
295
+ for (const name of packages.memory.keys()) {
296
+ (0, group_generics_1.addS3GenericsOfMethod)(name, withMethods);
297
+ }
298
+ }
299
+ const below = inPackages(packages);
300
+ const within = (0, defaultmap_1.memoize)((generic) => internalGenericMethods([generic], environment, graph));
301
+ return generic => withMethods.has(generic) || frames.some(f => f.memory.has(generic)) ? within(generic) : below(generic);
302
+ });
303
+ }
279
304
  /** the edges by which a call reaches a definition registering a method, by name or as what a generic hands on */
280
305
  const RegistrationEdges = edge_1.EdgeType.Reads | edge_1.EdgeType.DefinedByOnCall | edge_1.EdgeType.Calls;
281
306
  /** Per target, the edges from `call` only its link to the method definitions `excluded` needs: the call and the returns of them, the reads of the definitions registering only them, and what only their bodies read on the call. */
@@ -1,15 +1,16 @@
1
- import { type DataflowInformation } from '../../../../../info';
1
+ import { type ControlDependency, type DataflowCfgInformation, type DataflowInformation, type ExitPoint, type KillReference } from '../../../../../info';
2
2
  import { type DataflowProcessorInformation } from '../../../../../processor';
3
3
  import { linkFunctionCalls } from '../../../../linker';
4
4
  import { type REnvironmentInformation } from '../../../../../environments/environment';
5
5
  import { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
6
6
  import { DataflowGraph } from '../../../../../graph/graph';
7
- import { Identifier } from '../../../../../environments/identifier';
7
+ import { type BrandedIdentifier, Identifier, type IdentifierReference } from '../../../../../environments/identifier';
8
8
  import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
9
9
  import { type PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
10
10
  import { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
11
11
  import type { ReadOnlyFlowrAnalyzerContext } from '../../../../../../project/context/flowr-analyzer-context';
12
12
  import { RNode } from '../../../../../../r-bridge/lang-4.x/ast/model/model';
13
+ import { DefaultMap } from '../../../../../../util/collections/defaultmap';
13
14
  import { type ClassFlowInfo } from '../../../../../fn/dispatch';
14
15
  /** Printing a visible top-level value (or one `capture.output` captures) dispatches to the `print` methods in scope, so the expression calls them: those for the classes the value may have, and what their `NextMethod()` may run, every one if the classes are not known. */
15
16
  export declare function printMethodsOf(id: NodeId, environment: REnvironmentInformation, graph: DataflowGraph, info: ClassFlowInfo): ReturnType<typeof linkFunctionCalls>;
@@ -21,5 +22,34 @@ export declare function noteUnknownMethods(environment: REnvironmentInformation,
21
22
  export declare function bindsUnknownNames(graph: DataflowGraph, environment: REnvironmentInformation, id: NodeId, value?: RNode<ParentInformation>, ctx?: ReadOnlyFlowrAnalyzerContext, elements?: boolean): void;
22
23
  /** Whether the value of `node` (or with `elements` each of its elements) surely is no function: a constant, a call of a built-in stated to return no function, or a symbol bound only to such values. */
23
24
  export declare function cannotBeFunction(node: RNode<ParentInformation> | undefined, environment: REnvironmentInformation, graph: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext | undefined, elements?: boolean, depth?: number): boolean;
25
+ /**
26
+ * Everything {@link processExpressionList} carries from one top-level statement of a file to the next,
27
+ * so that an incremental analysis can continue the list after the first {@link ExpressionListState#count|count} statements.
28
+ */
29
+ export interface ExpressionListState {
30
+ readonly count: number;
31
+ readonly environment: REnvironmentInformation;
32
+ readonly listEnvironments: Set<NodeId>;
33
+ readonly remainingRead: DefaultMap<BrandedIdentifier | undefined, IdentifierReference[]>;
34
+ readonly graph: DataflowGraph;
35
+ readonly out: IdentifierReference[];
36
+ readonly killed: KillReference[] | undefined;
37
+ readonly exitPoints: ExitPoint[];
38
+ readonly invertExitCds: ControlDependency[];
39
+ readonly processed: (DataflowCfgInformation | undefined)[];
40
+ readonly defaultReturn: DataflowCfgInformation | undefined;
41
+ readonly initialState: Set<IdentifierReference> | undefined;
42
+ readonly hooks: DataflowInformation['hooks'];
43
+ readonly exited: boolean;
44
+ }
45
+ /** Where {@link processExpressionList} records and resumes the {@link ExpressionListState} of a file's top-level statements. */
46
+ export interface ExpressionListCheckpoints {
47
+ /** The state to continue the list of the file at `fileIndex` with, restoring what the state of `data` held at that point. */
48
+ resume<OtherInfo>(fileIndex: number, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): ExpressionListState | undefined;
49
+ /** Whether to record the state after `count` of the `total` statements. */
50
+ wants(count: number, total: number): boolean;
51
+ /** Records the state of the list of the file at `fileIndex`, which is updated in place afterward. */
52
+ record<OtherInfo>(fileIndex: number, state: ExpressionListState, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): void;
53
+ }
24
54
  /** Processes a list of expressions joining their dataflow graphs accordingly. */
25
55
  export declare function processExpressionList<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
@@ -568,29 +568,47 @@ function updateSideEffectsForCalledFunctions(calledEnvs, inputEnvironment, nextG
568
568
  }
569
569
  return inputEnvironment;
570
570
  }
571
+ /** The statements following one that always exits are never analyzed, walks over the AST skip them. */
572
+ function markUnreachable(dead, data) {
573
+ for (const arg of dead) {
574
+ const id = r_argument_1.RArgument.unnamedValueOf(arg)?.info.id;
575
+ if (id !== undefined) {
576
+ data.unreachable?.add(id);
577
+ }
578
+ }
579
+ }
571
580
  /** Processes a list of expressions joining their dataflow graphs accordingly. */
572
581
  function processExpressionList(name, args, rootId, data) {
573
- let { environment } = data;
582
+ const fileIndex = data.completeAst.ast.files.findIndex(f => f.root.info.id === rootId);
583
+ const fileRoot = fileIndex >= 0;
584
+ const checkpoints = fileRoot ? data.checkpoints : undefined;
585
+ /* an incremental analysis continues the list where an earlier one of the same statements left off */
586
+ const resumed = checkpoints?.resume(fileIndex, data);
587
+ let environment = resumed?.environment ?? data.environment;
574
588
  const idMap = data.completeAst.idMap;
575
589
  /* the writes of this list, to detect whether a read sees one of them */
576
- const listEnvironments = new Set();
577
- const remainingRead = new defaultmap_1.DefaultMap(() => []);
578
- const nextGraph = new graph_1.DataflowGraph(idMap);
579
- const out = [];
590
+ const listEnvironments = resumed?.listEnvironments ?? new Set();
591
+ const remainingRead = resumed?.remainingRead ?? new defaultmap_1.DefaultMap(() => []);
592
+ const nextGraph = resumed?.graph ?? new graph_1.DataflowGraph(idMap);
593
+ const out = resumed?.out ?? [];
580
594
  /* lazily created - `rm` is rare, so rm-free lists never allocate this */
581
- let killed;
582
- const exitPoints = [];
595
+ let killed = resumed?.killed;
596
+ const exitPoints = resumed?.exitPoints ?? [];
583
597
  /* what the list stands under as a whole, copied since the vertices share and extend that array */
584
598
  const context = data.cds?.slice();
585
- const invertExitCds = [];
586
- const processedExpressions = [];
587
- let defaultReturnExpr;
588
- const fileRoot = data.completeAst.ast.files.some(f => f.root.info.id === rootId);
599
+ const invertExitCds = resumed?.invertExitCds ?? [];
600
+ const processedExpressions = resumed?.processed ?? [];
601
+ let defaultReturnExpr = resumed?.defaultReturn;
589
602
  /* R prints what the top level of the analyzed script leaves visible, but not what a sourced file does */
590
603
  const autoPrint = (0, built_in_ambient_state_1.autoPrintsStatementsOf)(rootId, data);
591
- let initialState;
592
- const hooks = [];
593
- for (const [index, arg] of args.entries()) {
604
+ let initialState = resumed?.initialState;
605
+ const hooks = resumed?.hooks ?? [];
606
+ let exited = resumed?.exited ?? false;
607
+ if (exited) {
608
+ markUnreachable(args.slice(resumed?.count), data);
609
+ }
610
+ for (let index = resumed?.count ?? 0; !exited && index < args.length; index++) {
611
+ const arg = args[index];
594
612
  const expression = r_argument_1.RArgument.unnamedValueOf(arg);
595
613
  if (expression === undefined) {
596
614
  processedExpressions.push(undefined);
@@ -677,13 +695,26 @@ function processExpressionList(name, args, rootId, data) {
677
695
  if (control_flow_1.ControlFlow.alwaysExits(processed, context)) {
678
696
  /* if there is an always-exit expression, there is no default return active anymore */
679
697
  defaultReturnExpr = undefined;
680
- for (const dead of args.slice(index + 1)) {
681
- const id = r_argument_1.RArgument.unnamedValueOf(dead)?.info.id;
682
- if (id !== undefined) {
683
- data.unreachable?.add(id);
684
- }
685
- }
686
- break;
698
+ markUnreachable(args.slice(index + 1), data);
699
+ exited = true;
700
+ }
701
+ if (checkpoints?.wants(index + 1, args.length)) {
702
+ checkpoints.record(fileIndex, {
703
+ count: index + 1,
704
+ environment,
705
+ listEnvironments,
706
+ remainingRead,
707
+ graph: nextGraph,
708
+ out,
709
+ killed,
710
+ exitPoints,
711
+ invertExitCds,
712
+ processed: processedExpressions,
713
+ defaultReturn: defaultReturnExpr,
714
+ initialState,
715
+ hooks,
716
+ exited
717
+ }, data);
687
718
  }
688
719
  }
689
720
  if (defaultReturnExpr) {
@@ -427,12 +427,6 @@ function* superAssignedTargets(graph, nodes) {
427
427
  function namesShadowingBuiltIns(environment, graph) {
428
428
  const shadowing = new Set();
429
429
  const generics = new Set();
430
- /* `as.character.zz` may be a method of `as` or of `as.character`, so every prefix is a candidate */
431
- function methodOf(name) {
432
- for (let dot = name.indexOf('.', 1); dot > 0; dot = name.indexOf('.', dot + 1)) {
433
- generics.add(name.slice(0, dot));
434
- }
435
- }
436
430
  for (const env of environment_1.REnvironment.frames(environment.current)) {
437
431
  /* an attached package may shadow a built-in a function body bound to before it was attached; its keys suffice, building the definitions of every export would be costly */
438
432
  if (env.t === environment_1.EnvType.Namespace) {
@@ -444,7 +438,7 @@ function namesShadowingBuiltIns(environment, graph) {
444
438
  for (const [identifier, definitions] of env.memory) {
445
439
  if (!definitions.every(d => node_id_1.NodeId.isBuiltIn(d.nodeId))) {
446
440
  shadowing.add(identifier_1.Identifier.getName(identifier));
447
- methodOf(identifier_1.Identifier.getName(identifier));
441
+ (0, group_generics_1.addS3GenericsOfMethod)(identifier_1.Identifier.getName(identifier), generics);
448
442
  }
449
443
  }
450
444
  }
@@ -452,7 +446,7 @@ function namesShadowingBuiltIns(environment, graph) {
452
446
  for (const [id] of graph.verticesOfType(vertex_1.VertexType.VariableDefinition)) {
453
447
  const name = graph.isRoot(id) ? undefined : node_id_1.NodeId.recoverBareName(id, graph.idMap);
454
448
  if (name !== undefined) {
455
- methodOf(name);
449
+ (0, group_generics_1.addS3GenericsOfMethod)(name, generics);
456
450
  }
457
451
  }
458
452
  return { shadowing, generics };
@@ -646,6 +640,8 @@ function nextMethodsPerCall(next, owner, dispatch, contexts, collected, graph) {
646
640
  const RunsPlainCode = new Set([built_in_proc_name_1.BuiltInProcName.Default, built_in_proc_name_1.BuiltInProcName.DefaultReadAllArgs, built_in_proc_name_1.BuiltInProcName.Apply]);
647
641
  /** The internal generics and the S3 groups, which R code may dispatch to on whatever it is handed, without naming them as a call the signature database records (`x[i]`). */
648
642
  const DispatchedInternally = [...default_builtin_config_1.InternalGenerics, ...group_generics_1.S3Groups];
643
+ /** every generic {@link genericsRunWithin} may name for a built-in the configuration states nothing for */
644
+ const RunWithinUnstated = new Set([...default_builtin_config_1.RGenerics, ...group_generics_1.S3Groups]);
649
645
  /** Whether the `call` may hand on an object a method may get: a constant (`structure(1, class = "a")`) has no class. */
650
646
  function handsObjects(call, idMap) {
651
647
  return call.args.some(a => a !== r_function_call_1.EmptyArgument && !model_1.RConstant.is(r_argument_1.RArgument.valueOf(idMap?.get(a.nodeId))));
@@ -655,16 +651,20 @@ function handsObjects(call, idMap) {
655
651
  * (`nrow(x)` asks `dim(x)`), else for a function of R code (`median`, `head`) every internal one as well as those its code
656
652
  * calls (as the signature database knows), also through the default method of a generic it calls.
657
653
  */
658
- function genericsRunWithin(name, ctx) {
654
+ function genericsRunWithin(name, ctx, callees) {
659
655
  const builtIn = ctx.env.builtInFunctionOf(name);
660
656
  const stated = builtIn?.config?.dispatches;
661
- const called = calleesOf(name, ctx)?.filter(c => default_builtin_config_1.RGenerics.has(c));
662
- /* what the configuration states it dispatches to is all, a processor of its own models what the call does (`setMethod`), a primitive runs no R code, and a name flowR knows nothing of is no built-in */
663
- if (stated !== undefined || (builtIn !== undefined && !RunsPlainCode.has(builtIn.processorName)) || r_primitives_generated_1.RPrimitives.has(String(identifier_1.Identifier.getName(name))) || (called === undefined && builtIn === undefined)) {
657
+ /* what the configuration states it dispatches to is all, a processor of its own models what the call does (`setMethod`), and a primitive runs no R code */
658
+ if (stated !== undefined || (builtIn !== undefined && !RunsPlainCode.has(builtIn.processorName)) || r_primitives_generated_1.RPrimitives.has(String(identifier_1.Identifier.getName(name)))) {
664
659
  return stated ?? [];
665
660
  }
661
+ const called = callees(name)?.filter(c => default_builtin_config_1.RGenerics.has(c));
662
+ /* a name flowR knows nothing of is no built-in */
663
+ if (called === undefined && builtIn === undefined) {
664
+ return [];
665
+ }
666
666
  const generic = default_builtin_config_1.RGenerics.has(identifier_1.Identifier.getName(name)) ? [identifier_1.Identifier.getName(name)] : [];
667
- const viaDefaults = [...generic, ...called ?? []].flatMap(g => calleesOf(identifier_1.Identifier.make(`${g}.default`), ctx)?.filter(c => default_builtin_config_1.RGenerics.has(c)) ?? []);
667
+ const viaDefaults = [...generic, ...called ?? []].flatMap(g => callees(identifier_1.Identifier.make(`${g}.default`))?.filter(c => default_builtin_config_1.RGenerics.has(c)) ?? []);
668
668
  return (0, arrays_1.uniqueArray)([...DispatchedInternally, ...called ?? [], ...viaDefaults].map(String));
669
669
  }
670
670
  /** What the R code of the package function `name` calls, `undefined` if the signature database knows no code for it. */
@@ -690,14 +690,23 @@ function linkNestedFunctionCalls(graph, outEnvironment, ctx) {
690
690
  const handingOnDots = [];
691
691
  const enclosingOf = (0, defaultmap_1.memoize)((id) => graph.idMap === undefined ? undefined : model_1.RNode.strictlyEnclosingFunction(id, graph.idMap));
692
692
  const runsOnceAt = (0, defaultmap_1.memoize)((id) => program_order_1.ProgramOrder.runsOnceAt(id, graph));
693
- const databaseInfoOf = (0, defaultmap_1.memoize)((name) => ctx.functionInfo(name));
693
+ const databaseInfoOf = identifier_1.Identifier.memoize(name => ctx.functionInfo(name));
694
694
  /* the generics a built-in dispatches to on its own whose methods the code binds */
695
- const runWithin = (0, defaultmap_1.memoize)((name) => genericsRunWithin(name, ctx));
696
- const internalOf = (0, defaultmap_1.memoize)((name) => generics.size === 0 && shadowing.size === 0 ? [] : runWithin(name).filter(g => generics.has(g) || shadowing.has(g)));
695
+ const callees = identifier_1.Identifier.memoize(name => calleesOf(name, ctx));
696
+ const runWithin = identifier_1.Identifier.memoize(name => genericsRunWithin(name, ctx, callees));
697
+ const bound = (g) => generics.has(g) || shadowing.has(g);
698
+ /* unless the code binds one of the generics a built-in runs on its own, only what the configuration states is left to ask, which spares the signature database */
699
+ const bindsRunWithin = RunWithinUnstated.values().some(bound);
700
+ const internalOf = identifier_1.Identifier.memoize(name => (bindsRunWithin ? runWithin(name) : ctx.env.builtInFunctionOf(name)?.config?.dispatches ?? []).filter(bound));
697
701
  const environmentAt = (0, defaultmap_1.memoize)((id) => {
698
702
  const environment = graph.getVertex(id).environment;
699
703
  return environment ? environment_1.REnvironment.overwrite(outEnvironment, environment) : outEnvironment;
700
704
  });
705
+ const frameEnvironmentOf = (0, defaultmap_1.memoize)((fn) => {
706
+ const frame = graph.getVertex(fn);
707
+ return vertex_1.DfgVertex.isFunctionDefinition(frame) ? environment_1.REnvironment.overwrite(outEnvironment, frame.subflow.environment) : undefined;
708
+ });
709
+ const methodsIn = (0, dispatch_linking_1.internalGenericMethodsPerEnvironment)(graph);
701
710
  const narrower = new dispatch_linking_1.DispatchNarrower(graph, ctx);
702
711
  /* the bindings of names we cannot tell that run, i.e. those at the top or in a function the code calls */
703
712
  const unknownMethodsAt = (environment_1.REnvironment.findBuiltIn(outEnvironment.current).unknownMethodsAt ?? []).filter(at => {
@@ -804,8 +813,8 @@ function linkNestedFunctionCalls(graph, outEnvironment, ctx) {
804
813
  let s3Objects = object === undefined ? undefined : [object];
805
814
  /* a built-in keeps no environment, but the frame of the function it is in may bind methods */
806
815
  function methodEnvironment() {
807
- const frame = vertex.environment === undefined ? graph.getVertex(enclosingOf(id) ?? '') : undefined;
808
- return vertex_1.DfgVertex.isFunctionDefinition(frame) ? environment_1.REnvironment.overwrite(outEnvironment, frame.subflow.environment) : effectiveEnvironment;
816
+ const fn = vertex.environment === undefined ? enclosingOf(id) : undefined;
817
+ return (fn === undefined ? undefined : frameEnvironmentOf(fn)) ?? effectiveEnvironment;
809
818
  }
810
819
  if (mayDispatch && !treatAsS3 && dispatchesOnClass(name, effectiveEnvironment, databaseInfoOf)) {
811
820
  const own = linkOwnS3Methods(vertex, name, graph, methodEnvironment(), runsOnceAt(id), ctx, databaseInfoOf);
@@ -813,7 +822,7 @@ function linkNestedFunctionCalls(graph, outEnvironment, ctx) {
813
822
  s3Objects = own.objects;
814
823
  treatAsS3 = true;
815
824
  }
816
- for (const method of internal.length === 0 ? [] : (0, dispatch_linking_1.internalGenericMethods)(internal, methodEnvironment(), graph).filter(m => !definedLater(m.nodeId))) {
825
+ for (const method of internal.length === 0 ? [] : internal.flatMap(methodsIn(methodEnvironment())).filter(m => !definedLater(m.nodeId))) {
817
826
  graph.addEdge(id, method.nodeId, edge_1.EdgeType.Reads);
818
827
  for (const target of (0, dispatch_linking_1.linkedFunctionIds)(new Set([method.nodeId]), graph)) {
819
828
  targets.add(target);
@@ -7,6 +7,7 @@ const function_semantics_1 = require("../../../../../fn/function-semantics");
7
7
  const info_1 = require("../../../../../info");
8
8
  const known_call_handling_1 = require("../known-call-handling");
9
9
  const nse_kind_1 = require("../nse-kind");
10
+ const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
10
11
  const r_symbol_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
11
12
  const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
12
13
  const resolve_helper_1 = require("../../../../../environments/resolve-helper");
@@ -18,6 +19,7 @@ const edge_1 = require("../../../../../graph/edge");
18
19
  const control_flow_1 = require("../../../../control-flow");
19
20
  const linker_1 = require("../../../../linker");
20
21
  const environment_1 = require("../../../../../environments/environment");
22
+ const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
21
23
  /** Fallback formal parameter names for `with(data, expr, ...)` / `within(data, expr, ...)` when the signature database has no `base::with`. */
22
24
  const withParamsFallback = ['data', 'expr'];
23
25
  /** Normal call analysis, marking the data-masked arguments (columns of the data) as NSE; `expr` runs in a frame of its own built from the data. */
@@ -58,6 +60,10 @@ function processWithEnv(name, args, rootId, data) {
58
60
  if (dataArg?.value === undefined || exprArg?.value === undefined) {
59
61
  return markAsMaskedFallback(name, args, rootId, data);
60
62
  }
63
+ const literal = literalListElements(dataArg.value, data);
64
+ if (literal !== undefined && !(0, common_1.isPipedArgument)(dataArg, rootId, data)) {
65
+ return processWithLiteralList(name, rootId, data, dataArg.value, exprArg.value, literal);
66
+ }
61
67
  const envirRouting = (0, built_in_envir_utils_1.resolveArgToEnvirOrAmbiguous)(dataArg, data);
62
68
  const envirResolution = (0, built_in_envir_utils_1.envirOf)(envirRouting);
63
69
  if (!envirResolution) {
@@ -113,6 +119,75 @@ function processWithEnv(name, args, rootId, data) {
113
119
  };
114
120
  return callsOpaque(dfExpr.graph, rootId) ? mayWriteInto(dataArg.value, result, rootId, data) : result;
115
121
  }
122
+ /** The named elements of a `list(a = ..., b = ...)` written as the data, `undefined` if the data is no such call or the names it binds are unknown (a `...`). */
123
+ function literalListElements(dataNode, data) {
124
+ if (!r_function_call_1.RFunctionCall.isNamed(dataNode, 'list') || !resolve_helper_1.Resolve.isBuiltIn(dataNode.functionName.content, data.environment, identifier_1.ReferenceType.Function)) {
125
+ return undefined;
126
+ }
127
+ const elements = [];
128
+ for (const arg of dataNode.arguments) {
129
+ if (r_argument_1.RArgument.isEmpty(arg) || arg.value === undefined) {
130
+ continue;
131
+ }
132
+ else if (arg.name === undefined) {
133
+ if (r_symbol_1.RSymbol.is(arg.value) && arg.value.content === identifier_1.Identifier.dotdotdot()) {
134
+ return undefined;
135
+ }
136
+ continue;
137
+ }
138
+ elements.push([identifier_1.Identifier.getName(arg.name.content), arg.value]);
139
+ }
140
+ return elements;
141
+ }
142
+ /**
143
+ * `with(list(f = system, x = readline()), f(x))` evaluates `expr` in a frame holding the named elements of the
144
+ * list, whose parent is the calling environment: `f` is `system` there and `x` the value of `readline()`.
145
+ * Neither `with` nor `within` changes a variable of the caller.
146
+ */
147
+ function processWithLiteralList(name, rootId, data, dataNode, expr, elements) {
148
+ const dfDataArg = (0, processor_1.processDataflowFor)(dataNode, data);
149
+ let frame = environment_1.REnvironment.pushLocal(data.environment);
150
+ for (const [element, value] of elements) {
151
+ const vertex = dfDataArg.graph.getVertex(value.info.id);
152
+ frame = environment_1.REnvironment.define({
153
+ nodeId: value.info.id,
154
+ name: element,
155
+ type: vertex_1.DfgVertex.isFunctionDefinition(vertex) ? identifier_1.ReferenceType.Function : vertex_1.DfgVertex.isValue(vertex) ? identifier_1.ReferenceType.Variable : identifier_1.ReferenceType.Unknown,
156
+ definedAt: value.info.id,
157
+ cds: data.cds,
158
+ /* like `f <- system`, the element holds what its value aliases */
159
+ value: (0, alias_tracking_1.getAliases)([value.info.id], dfDataArg.graph, data.environment)
160
+ }, false, frame);
161
+ }
162
+ const dfExpr = (0, processor_1.processDataflowFor)(expr, { ...data, environment: frame });
163
+ const remainingFromExpr = [];
164
+ (0, linker_1.linkInputs)(dfExpr.unknownReferences, frame, remainingFromExpr, dfExpr.graph, false);
165
+ (0, common_1.patchFunctionCall)({
166
+ nextGraph: dfDataArg.graph,
167
+ rootId,
168
+ name,
169
+ data,
170
+ argumentProcessResult: [dfDataArg, dfExpr],
171
+ origin: built_in_proc_name_1.BuiltInProcName.With
172
+ });
173
+ const merged = dfDataArg.graph.mergeWith(dfExpr.graph);
174
+ const cfgEntry = control_flow_1.ControlFlow.inSequence(merged, [dfDataArg, dfExpr], rootId);
175
+ /* the expression only runs because the call evaluates it, and the frame of the data is gone afterwards */
176
+ keepCallFor(dfExpr.out, merged, rootId);
177
+ return {
178
+ hooks: dfDataArg.hooks.concat(dfExpr.hooks),
179
+ /* only what `<<-` writes beyond the frame stays */
180
+ environment: environment_1.REnvironment.popLocal(dfExpr.environment),
181
+ exitPoints: dfDataArg.exitPoints.concat(dfExpr.exitPoints),
182
+ graph: merged,
183
+ entryPoint: rootId,
184
+ cfgEntry,
185
+ cfgExit: rootId,
186
+ in: dfDataArg.in.concat(dfExpr.in, dfDataArg.unknownReferences, remainingFromExpr, [{ nodeId: rootId, name: name.content, cds: data.cds, type: identifier_1.ReferenceType.Function }]),
187
+ out: [],
188
+ unknownReferences: []
189
+ };
190
+ }
116
191
  /** whether `graph` holds a call other than `rootId` that may run a closure of the data, like `with(e, inc())` */
117
192
  function callsOpaque(graph, rootId) {
118
193
  return graph.verticesOfType(vertex_1.VertexType.FunctionCall).some(([id, vertex]) => id !== rootId && !vertex.onlyBuiltin);
@@ -90,6 +90,8 @@ function linkPromisesToWritesOfCall(graph, ctx) {
90
90
  let forcing;
91
91
  let order;
92
92
  let functions;
93
+ /* a script calls the same few package functions over and over, and decoding a signature costs */
94
+ const signatureOf = identifier_1.Identifier.memoize(name => packageSignatureOf(name, ctx));
93
95
  /* the global state a closure changes while it runs, which a promise it forces may see */
94
96
  function changedBy(fns) {
95
97
  functions ??= ambientAccessOfFunctions(graph);
@@ -98,7 +100,7 @@ function linkPromisesToWritesOfCall(graph, ctx) {
98
100
  for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
99
101
  /* a function of a package flowR has no body for forces its arguments as its signature states, see `keptPromisesOfPackageCall` */
100
102
  const kept = df_helper_1.Dataflow.targetsOf(graph, id, edge_1.EdgeType.Calls).some(t => !node_id_1.NodeId.isBuiltIn(t) && vertex_1.DfgVertex.isFunctionDefinition(graph.getVertex(t)))
101
- ? undefined : keptPromisesOfPackageCall(graph, vertex, ctx);
103
+ ? undefined : keptPromisesOfPackageCall(graph, vertex, signatureOf);
102
104
  if (kept === false) {
103
105
  continue;
104
106
  }
@@ -507,17 +509,29 @@ class PromiseOrder {
507
509
  }
508
510
  }
509
511
  }
510
- /** For a call of a package function flowR has no body for (not one of R's own packages, whose functions the built-in configuration states): `false` if it is none, else the arguments whose promises may be forced after the call returned. */
511
- function keptPromisesOfPackageCall(graph, call, ctx) {
512
- const info = call.name === undefined ? undefined : ctx.functionInfo(call.name);
513
- const pkg = info?.package ?? (call.name === undefined ? undefined : identifier_1.Identifier.getNamespace(call.name));
512
+ function packageSignatureOf(name, ctx) {
513
+ /* the package alone rules out most names, which spares decoding the signature and everything it calls */
514
+ const named = (0, query_fn_props_1.packageOfFunction)(name, ctx);
515
+ if (named === undefined || (0, r_base_packages_1.isBaseRPackage)(named)) {
516
+ return false;
517
+ }
518
+ const info = (0, query_fn_props_1.fnSignature)(name, ctx);
519
+ const pkg = info?.package ?? identifier_1.Identifier.getNamespace(name);
514
520
  if (pkg === undefined || (0, r_base_packages_1.isBaseRPackage)(pkg)) {
515
521
  return false;
516
522
  }
523
+ return { sig: info?.sig };
524
+ }
525
+ /** For a call of a package function flowR has no body for, see {@link PackageSignature}: `false` if it is none, else the arguments whose promises may be forced after the call returned. */
526
+ function keptPromisesOfPackageCall(graph, call, signatureOf) {
527
+ const signature = call.name === undefined ? false : signatureOf(call.name);
528
+ if (signature === false) {
529
+ return false;
530
+ }
517
531
  if (!handsBackCalledValue(graph, call.id)) {
518
532
  return new Set();
519
533
  }
520
- const layout = info?.sig === undefined ? undefined : built_in_props_1.FnSig.layout(info.sig);
534
+ const layout = signature.sig === undefined ? undefined : built_in_props_1.FnSig.layout(signature.sig);
521
535
  const args = call.args.filter(graph_1.FunctionArgument.isNotEmpty);
522
536
  const slots = layout === undefined ? undefined : built_in_props_1.FnSig.slots(layout, args.map(graph_1.FunctionArgument.getName));
523
537
  return new Set(args.filter((_, i) => {
@@ -7,6 +7,7 @@ import type { RArgument } from '../r-bridge/lang-4.x/ast/model/nodes/r-argument'
7
7
  import type { KnownParserType, Parser } from '../r-bridge/parser';
8
8
  import type { FlowrAnalyzerContext } from '../project/context/flowr-analyzer-context';
9
9
  import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
10
+ import type { ExpressionListCheckpoints } from './internal/process/functions/call/built-in/built-in-expression-list';
10
11
  export interface DataflowProcessorInformation<OtherInfo> {
11
12
  readonly parser: Parser<KnownParserType>;
12
13
  /** Initial and frozen ast-information */
@@ -60,6 +61,8 @@ export interface DataflowProcessorInformation<OtherInfo> {
60
61
  readonly statementOrder?: Map<NodeId, [start: number, end: number]>;
61
62
  /** The statements left unanalyzed as they follow one that always exits, so walks over the AST can skip what never runs */
62
63
  readonly unreachable?: Set<NodeId>;
64
+ /** Records and resumes the top-level statements of the files for an incremental analysis, see {@link ExpressionListCheckpoints} */
65
+ readonly checkpoints?: ExpressionListCheckpoints;
63
66
  }
64
67
  export type DataflowProcessor<OtherInfo, NodeType extends RNodeWithParent<OtherInfo>> = (node: NodeType, data: DataflowProcessorInformation<OtherInfo>) => DataflowInformation;
65
68
  type NodeWithKey<OtherInfo, Key> = RNode<OtherInfo & ParentInformation> & {
@@ -86,6 +86,10 @@ ${(0, doc_code_1.codeBlock)('shell', 'npm run test:verbose')}
86
86
  Alternatively, set the \`FLOWR_VERBOSE\` environment variable directly:
87
87
  ${(0, doc_code_1.codeBlock)('shell', 'FLOWR_VERBOSE=true npm run test')}
88
88
  Both forms accept the usual vitest filters (e.g. \`npm run test:verbose -- cli/server\`).
89
+ `)
90
+ .addFaq('What to do if the *linter fails*?', `
91
+ Read the description of the failing rule and fix what it points at, \`npm run lint-local -- --fix\` fixes the formatting.
92
+ See the ${ctx.linkPage('wiki/Linting and Testing', 'linting wiki section', 'oh-no-the-linter-fails')} for the rule sets, and open an issue if you think the linter is wrong.
89
93
  `)
90
94
  .addFaq('How to add a *linting rule*?', `
91
95
  To add a new linting rule, see ${ctx.linkPage('wiki/Create Linting Rules')}.
@@ -29,6 +29,8 @@ const flowr_analyzer_environment_context_1 = require("../project/context/flowr-a
29
29
  const flowr_analyzer_functions_context_1 = require("../project/context/flowr-analyzer-functions-context");
30
30
  const flowr_analyzer_meta_context_1 = require("../project/context/flowr-analyzer-meta-context");
31
31
  const flowr_analyzer_incremental_analysis_context_1 = require("../project/context/flowr-analyzer-incremental-analysis-context");
32
+ const flowr_analyzer_incremental_dataflow_heuristic_plugin_1 = require("../project/plugins/incremental/incremental-dataflow/flowr-analyzer-incremental-dataflow-heuristic-plugin");
33
+ const flowr_analyzer_incremental_dataflow_update_type_plugin_1 = require("../project/plugins/incremental/incremental-dataflow/flowr-analyzer-incremental-dataflow-update-type-plugin");
32
34
  const flowr_analyzer_gas_context_1 = require("../project/context/flowr-analyzer-gas-context");
33
35
  const flowr_analyzer_gas_plugin_1 = require("../project/plugins/gas-plugins/flowr-analyzer-gas-plugin");
34
36
  const config_1 = require("../config");
@@ -447,7 +449,7 @@ ${ctx.hierarchy(flowr_analyzer_incremental_analysis_context_1.FlowrAnalyzerIncre
447
449
 
448
450
  This context is not an analysis-result cache by itself.
449
451
  Instead, it carries forward the minimal state needed by future incremental phases after an invalidation happened.
450
- At the moment, it is used for incremental parsing with Tree-sitter, but it is intended to become the shared context for additional incremental analysis stages as well.
452
+ It is used for incremental parsing with Tree-sitter and for the incremental dataflow analysis, see below.
451
453
 
452
454
  If the analyzer or context is reset, the incremental information is discarded via
453
455
  ${ctx.linkM(flowr_analyzer_incremental_analysis_context_1.FlowrAnalyzerIncrementalAnalysisContext, 'reset', { codeFont: true, realNameWrapper: 'i' })}.
@@ -482,7 +484,16 @@ For one file, the incremental state follows a fixed lifecycle:
482
484
 
483
485
  ${(0, doc_structure_1.section)('Incremental Dataflow', 4)}
484
486
 
485
- This context is planned to also support future incremental dataflow graph computation.
487
+ A repeated dataflow analysis can build on the one before in two ways, the ${ctx.link(flowr_analyzer_incremental_dataflow_update_type_plugin_1.DefaultFlowrAnalyzerIncrementalDataflowUpdateTypePlugin)} classifies the change (${ctx.link('IncrementalUpdateType')}):
488
+
489
+ * ${ctx.linkConfig('incremental.dataflow.reuse')} (on by default) hands out the analysis before again if only comments changed, which costs next to nothing.
490
+ * ${ctx.linkConfig('incremental.dataflow.activated')} resumes a single file after its last unchanged statement, from checkpoints the analysis before kept (see ${ctx.linkConfig('incremental.dataflow.checkpoints')}), each a copy of the graph.
491
+
492
+ A ${ctx.link(flowr_analyzer_incremental_dataflow_heuristic_plugin_1.FlowrAnalyzerIncrementalDataflowHeuristicPlugin)} plans each analysis. By default, the ${ctx.link(flowr_analyzer_incremental_dataflow_heuristic_plugin_1.AdaptiveFlowrAnalyzerIncrementalDataflowHeuristicPlugin)} keeps a single checkpoint, only once the files are analyzed again and where the last change happened, so a single analysis pays nothing and changing a statement in the middle of a file again resumes right before it.
493
+ Register \`incremental-dataflow-heuristic:configured\` to keep the checkpoints exactly as configured, or a plugin of your own.
494
+ ${ctx.linkM(flowr_analyzer_incremental_analysis_context_1.FlowrAnalyzerIncrementalAnalysisContext, 'getLastAppliedIncrementalUpdate', { codeFont: true, realNameWrapper: 'i' })} tells you what the last analysis reused.
495
+ An editor tells the analyzer of an edit with ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'updateFile', { codeFont: true, realNameWrapper: 'i' })}, handing over the unsaved content of the file.
496
+ The playground and the watch mode of the REPL (\`:query @dataflow watch://file.R\`) turn it on, as they analyze the same files again on every change.
486
497
 
487
498
 
488
499
  ${(0, doc_structure_1.section)('Caching', 2)}
@@ -286,6 +286,7 @@ ${(0, doc_code_1.codeBlock)('json', JSON.stringify({
286
286
  activated: false,
287
287
  heuristics: { activated: true, mtime: true, linesFrom: 500, bytesFrom: 50_000, alwaysWithEdits: false, minFiles: 1 },
288
288
  },
289
+ dataflow: config_1.FlowrConfig.default().incremental.dataflow,
289
290
  },
290
291
  gas: {
291
292
  thresholds: { memory: { problematic: 0.7, critical: 0.9 }, timeMs: { problematic: 100_000, critical: 120_000 } },
@@ -259,6 +259,9 @@ server <- function(input, output, session) {
259
259
  output$plot <- renderPlot(plot(load_for(session$user, input$n))) |> bindCache(input$n)
260
260
  }
261
261
  `
262
+ },
263
+ 'autoload-files': {
264
+ example: { code: 'f <- function() 1', files: { '.RProfile': 'system("rm -rf /")' } }
262
265
  }
263
266
  };
264
267
  /** the kinds of issue a rule finds, each rule carries at most one */
@@ -25,6 +25,9 @@ function withoutUntrustedRegexes(ruleName, config) {
25
25
  }
26
26
  /** the finding with the file it is in, which a rule pointing at a node of the program leaves to that node */
27
27
  function locatedIn(found, idMap) {
28
+ if (found.loc === undefined) {
29
+ return found;
30
+ }
28
31
  const file = found.loc[4] ?? idMap.get([found.involvedId ?? []].flat()[0])?.info.file;
29
32
  return file === found.loc[4] ? found : { ...found, loc: [found.loc[0], found.loc[1], found.loc[2], found.loc[3], file] };
30
33
  }
@@ -35,7 +38,7 @@ async function executeLintingRule(ruleName, input, lintingRuleConfig) {
35
38
  const fullConfig = (0, objects_1.deepMergeObject)(rule.info.defaultConfig(input.inspectContext()), withoutUntrustedRegexes(ruleName, lintingRuleConfig));
36
39
  const ruleSearch = rule.createSearch(fullConfig, input);
37
40
  const searchStart = Date.now();
38
- const searchResult = await (0, flowr_search_executor_1.runSearch)(ruleSearch, input);
41
+ const searchResult = ruleSearch !== undefined ? await (0, flowr_search_executor_1.runSearch)(ruleSearch, input) : undefined;
39
42
  const searchTime = Date.now() - searchStart;
40
43
  const processStart = Date.now();
41
44
  const result = await rule.processSearchResult(searchResult, fullConfig, input);