@eagleoutice/flowr 2.10.6 → 2.10.8

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 (78) hide show
  1. package/README.md +9 -9
  2. package/abstract-interpretation/domains/multi-value-state-domain.d.ts +4 -10
  3. package/abstract-interpretation/domains/multi-value-state-domain.js +1 -6
  4. package/abstract-interpretation/domains/partial-product-domain.d.ts +6 -2
  5. package/abstract-interpretation/domains/partial-product-domain.js +7 -3
  6. package/control-flow/semantic-cfg-guided-visitor.js +1 -0
  7. package/dataflow/environments/built-in-proc-name.d.ts +22 -20
  8. package/dataflow/environments/built-in-proc-name.js +22 -20
  9. package/dataflow/environments/built-in.d.ts +19 -19
  10. package/dataflow/environments/identifier.d.ts +5 -0
  11. package/dataflow/environments/reference-to-maybe.js +32 -6
  12. package/dataflow/eval/resolve/alias-tracking.js +5 -0
  13. package/dataflow/graph/graph.js +51 -30
  14. package/dataflow/graph/vertex.d.ts +12 -11
  15. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +49 -12
  16. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +4 -2
  17. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +12 -6
  18. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +22 -8
  19. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +57 -1
  20. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.d.ts +1 -1
  21. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +7 -7
  22. package/documentation/wiki-linting-and-testing.js +1 -1
  23. package/documentation/wiki-mk/doc-context.d.ts +21 -1
  24. package/documentation/wiki-mk/doc-context.js +9 -0
  25. package/documentation/wiki-search.js +13 -2
  26. package/linter/linter-format.d.ts +4 -0
  27. package/linter/linter-rules.d.ts +9 -7
  28. package/linter/rules/absolute-path.d.ts +3 -2
  29. package/linter/rules/absolute-path.js +37 -12
  30. package/linter/rules/dataframe-access-validation.d.ts +4 -7
  31. package/linter/rules/dataframe-access-validation.js +3 -3
  32. package/linter/rules/dead-code.d.ts +4 -7
  33. package/linter/rules/file-path-validity.d.ts +9 -4
  34. package/linter/rules/file-path-validity.js +83 -36
  35. package/linter/rules/function-finder-util.d.ts +1 -3
  36. package/linter/rules/function-finder-util.js +2 -2
  37. package/linter/rules/naming-convention.d.ts +0 -2
  38. package/linter/rules/network-functions.js +4 -1
  39. package/linter/rules/problematic-inputs.d.ts +0 -2
  40. package/linter/rules/problematic-inputs.js +4 -1
  41. package/linter/rules/roxygen-arguments.d.ts +0 -2
  42. package/linter/rules/seeded-randomness.d.ts +0 -2
  43. package/linter/rules/stop-with-call-arg.d.ts +3 -6
  44. package/linter/rules/unused-definition.d.ts +0 -2
  45. package/linter/rules/useless-loop.d.ts +0 -2
  46. package/package.json +7 -6
  47. package/queries/catalog/dependencies-query/dependencies-query-executor.js +6 -2
  48. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +2 -0
  49. package/queries/catalog/dependencies-query/function-info/read-functions.js +21 -1
  50. package/queries/catalog/dependencies-query/function-info/source-functions.js +1 -1
  51. package/queries/catalog/dependencies-query/function-info/write-functions.js +18 -1
  52. package/queries/catalog/input-sources-query/input-source-functions.d.ts +3 -1
  53. package/queries/catalog/input-sources-query/input-source-functions.js +322 -46
  54. package/queries/catalog/input-sources-query/input-sources-query-executor.js +14 -9
  55. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +4 -2
  56. package/queries/catalog/input-sources-query/input-sources-query-format.js +8 -4
  57. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +13 -6
  58. package/queries/catalog/input-sources-query/simple-input-classifier.js +33 -8
  59. package/queries/catalog/linter-query/linter-query-format.d.ts +2 -2
  60. package/queries/catalog/linter-query/linter-query-format.js +9 -3
  61. package/queries/query.d.ts +3 -2
  62. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +1 -1
  63. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +16 -16
  64. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +6 -0
  65. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +8 -0
  66. package/search/flowr-search-builder.d.ts +64 -16
  67. package/search/flowr-search-builder.js +41 -16
  68. package/search/flowr-search-filters.d.ts +10 -1
  69. package/search/flowr-search-filters.js +10 -0
  70. package/search/flowr-search.d.ts +17 -3
  71. package/search/search-executor/search-generators.d.ts +3 -1
  72. package/search/search-executor/search-generators.js +30 -4
  73. package/slicing/static/static-slicer.js +2 -2
  74. package/util/range.d.ts +13 -1
  75. package/util/range.js +32 -2
  76. package/util/text/strings.d.ts +7 -0
  77. package/util/text/strings.js +23 -0
  78. package/util/version.js +1 -1
package/README.md CHANGED
@@ -24,7 +24,7 @@ It offers a wide variety of features, for example:
24
24
 
25
25
  ```shell
26
26
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
27
- flowR repl using flowR v2.10.5, R grammar v14 (tree-sitter engine)
27
+ flowR repl using flowR v2.10.7, R grammar v14 (tree-sitter engine)
28
28
  R> :query @linter "read.csv(\"/root/x.txt\")"
29
29
  ```
30
30
 
@@ -51,9 +51,9 @@ It offers a wide variety of features, for example:
51
51
  ╰ Naming Convention (naming-convention):
52
52
  ╰ Metadata: numMatches: 0, numBreak: 0, searchTimeMs: 0, processTimeMs: 0
53
53
  ╰ Network Functions (network-functions):
54
- ╰ Metadata: totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs: 0, processTimeMs: 0
54
+ ╰ Metadata: totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs: 0, processTimeMs: 1
55
55
  ╰ Dataframe Access Validation (dataframe-access-validation):
56
- ╰ Metadata: numOperations: 0, numAccesses: 0, totalAccessed: 0, searchTimeMs: 0, processTimeMs: 1
56
+ ╰ Metadata: numOperations: 0, numAccesses: 0, totalAccessed: 0, searchTimeMs: 0, processTimeMs: 0
57
57
  ╰ Dead Code (dead-code):
58
58
  ╰ Metadata: consideredNodes: 5, searchTimeMs: 0, processTimeMs: 0
59
59
  ╰ Useless Loops (useless-loop):
@@ -121,7 +121,7 @@ It offers a wide variety of features, for example:
121
121
 
122
122
  <details> <summary style="color:gray">Show Detailed Results as Json</summary>
123
123
 
124
- The analysis required _2.2 ms_ (including parsing and normalization and the query) within the generation environment.
124
+ The analysis required _2.4 ms_ (including parsing and normalization and the query) within the generation environment.
125
125
 
126
126
  In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR.
127
127
  Please consult the [Interface](https://github.com/flowr-analysis/flowr/wiki/Interface) wiki page for more information on how to get those.
@@ -342,7 +342,7 @@ It offers a wide variety of features, for example:
342
342
 
343
343
  ```shell
344
344
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
345
- flowR repl using flowR v2.10.5, R grammar v14 (tree-sitter engine)
345
+ flowR repl using flowR v2.10.7, R grammar v14 (tree-sitter engine)
346
346
  R> :query @static-slice (11@sum) file://test/testfiles/example.R
347
347
  ```
348
348
 
@@ -356,7 +356,7 @@ It offers a wide variety of features, for example:
356
356
  N <- 10
357
357
  for(i in 1:(N-1)) sum <- sum + i + w
358
358
  sum
359
- All queries together required ≈2 ms (1ms accuracy, total 3 ms)
359
+ All queries together required ≈2 ms (1ms accuracy, total 2 ms)
360
360
  ```
361
361
 
362
362
 
@@ -390,7 +390,7 @@ It offers a wide variety of features, for example:
390
390
 
391
391
 
392
392
  * 🚀 **fast call-graph, data-, and control-flow graphs**\
393
- Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">97.4 ms</span></i> (as of May 9, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
393
+ Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">98.6 ms</span></i> (as of Jun 3, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
394
394
  _flowR_ can analyze the data- and control-flow of the average real-world R&nbsp;script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
395
395
  and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph) for more details on the [dataflow graphs](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph) as well as [call graphs](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph#perspectives-cg).
396
396
 
@@ -426,7 +426,7 @@ It offers a wide variety of features, for example:
426
426
 
427
427
  ```shell
428
428
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
429
- flowR repl using flowR v2.10.5, R grammar v14 (tree-sitter engine)
429
+ flowR repl using flowR v2.10.7, R grammar v14 (tree-sitter engine)
430
430
  R> :dataflow* test/testfiles/example.R
431
431
  ```
432
432
 
@@ -734,7 +734,7 @@ It offers a wide variety of features, for example:
734
734
  ```
735
735
 
736
736
 
737
- (The analysis required _1.4 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment.)
737
+ (The analysis required _1.9 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment.)
738
738
 
739
739
 
740
740
 
@@ -1,17 +1,13 @@
1
1
  import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
2
- import { type AbstractProduct, PartialProductDomain } from './partial-product-domain';
2
+ import { type AbstractProduct, type ProductReduction, PartialProductDomain } from './partial-product-domain';
3
3
  import { type StateDomainLift, StateAbstractDomain } from './state-abstract-domain';
4
- /**
5
- * A reduction function for abstract values of a product domain.
6
- */
7
- export type Reduction<Product extends AbstractProduct> = (value: Product) => Product;
8
4
  /**
9
5
  * A multi-value state abstract domain that maps AST node IDs to multiple abstract values from different abstract domains.
10
6
  * @template Product - Type of the abstract product of the multi-value domain combining multiple abstract values
11
7
  * @see {@link NodeId} for the node IDs of the AST nodes
12
8
  */
13
9
  export declare class MultiValueStateDomain<Product extends AbstractProduct, Value extends StateDomainLift<MultiValueDomain<Product>> = StateDomainLift<MultiValueDomain<Product>>> extends StateAbstractDomain<MultiValueDomain<Product>, Value> {
14
- constructor(value: Value, domain: Required<Product>, reductions?: readonly Reduction<Product>[]);
10
+ constructor(value: Value, domain: Required<Product>, reductions?: readonly ProductReduction<Product>[]);
15
11
  create(value: StateDomainLift<MultiValueDomain<Product>>): this;
16
12
  getValue<Key extends keyof Product>(node: NodeId, property: Key): Product[Key] | undefined;
17
13
  hasValue(node: NodeId, property: keyof Product): boolean;
@@ -24,9 +20,7 @@ export declare class MultiValueStateDomain<Product extends AbstractProduct, Valu
24
20
  * @see {@link MultiValueStateDomain} for a state abstract domain of a multi-value domain
25
21
  */
26
22
  export declare class MultiValueDomain<Product extends AbstractProduct> extends PartialProductDomain<Product> {
27
- readonly reductions: readonly Reduction<Product>[];
28
- constructor(value: Product, domain: Required<Product>, reductions?: readonly Reduction<Product>[]);
23
+ constructor(value: Product, domain: Required<Product>, reductions?: readonly ProductReduction<Product>[]);
29
24
  create(value: Product): this;
30
- static top<Product extends AbstractProduct>(domain: Required<Product>, reductions?: readonly Reduction<Product>[]): MultiValueDomain<Product>;
31
- protected reduce(value: Product): Product;
25
+ static top<Product extends AbstractProduct>(domain: Required<Product>, reductions?: readonly ProductReduction<Product>[]): MultiValueDomain<Product>;
32
26
  }
@@ -41,10 +41,8 @@ exports.MultiValueStateDomain = MultiValueStateDomain;
41
41
  * @see {@link MultiValueStateDomain} for a state abstract domain of a multi-value domain
42
42
  */
43
43
  class MultiValueDomain extends partial_product_domain_1.PartialProductDomain {
44
- reductions;
45
44
  constructor(value, domain, reductions = []) {
46
- super(value, domain);
47
- this.reductions = reductions;
45
+ super(value, domain, reductions);
48
46
  }
49
47
  create(value) {
50
48
  return new MultiValueDomain(value, this.domain, this.reductions);
@@ -52,9 +50,6 @@ class MultiValueDomain extends partial_product_domain_1.PartialProductDomain {
52
50
  static top(domain, reductions = []) {
53
51
  return new MultiValueDomain({}, domain, reductions);
54
52
  }
55
- reduce(value) {
56
- return this.reductions.reduce((current, reduction) => reduction(current), value);
57
- }
58
53
  }
59
54
  exports.MultiValueDomain = MultiValueDomain;
60
55
  //# sourceMappingURL=multi-value-state-domain.js.map
@@ -8,6 +8,8 @@ export type AbstractProduct<Domain extends AnyAbstractDomain = AnyAbstractDomain
8
8
  export type ConcreteProductOf<Product extends AbstractProduct> = {
9
9
  [Key in keyof Product]: Product[Key] extends AbstractDomain<infer Concrete, unknown, unknown, unknown> ? Concrete : never;
10
10
  };
11
+ /** A reduction function of a reduced product domain refining the abstract value based on the values of its sub abstract domains. */
12
+ export type ProductReduction<Product extends AbstractProduct> = (value: Product) => Product;
11
13
  /**
12
14
  * A partial product abstract domain as named Cartesian product of (optional) sub abstract domains.
13
15
  * The sub abstract domains are represented by a (partial) record mapping property names to abstract domains.
@@ -16,7 +18,8 @@ export type ConcreteProductOf<Product extends AbstractProduct> = {
16
18
  */
17
19
  export declare abstract class PartialProductDomain<Product extends AbstractProduct> extends AbstractDomain<ConcreteProductOf<Product>, Product, Product, Product> {
18
20
  readonly domain: Required<Product>;
19
- constructor(value: Product, domain: Required<Product>);
21
+ readonly reductions: readonly ProductReduction<Product>[];
22
+ constructor(value: Product, domain: Required<Product>, reductions?: readonly ProductReduction<Product>[]);
20
23
  abstract create(value: Product): this;
21
24
  bottom(): this;
22
25
  top(): this;
@@ -37,7 +40,8 @@ export declare abstract class PartialProductDomain<Product extends AbstractProdu
37
40
  isValue(): boolean;
38
41
  isValue(): this is this;
39
42
  /**
40
- * Optional reduction function for a reduced product domain.
43
+ * Applies the {@link reductions} of the (reduced) product domain to refine the abstract value based on its components.
44
+ * Subclasses may override this to implement a fixed reduction instead of (or in addition to) the configurable reductions.
41
45
  */
42
46
  protected reduce(value: Product): Product;
43
47
  }
@@ -12,8 +12,11 @@ const record_1 = require("../../util/record");
12
12
  */
13
13
  class PartialProductDomain extends abstract_domain_1.AbstractDomain {
14
14
  domain;
15
- constructor(value, domain) {
15
+ reductions;
16
+ constructor(value, domain, reductions = []) {
16
17
  super(record_1.Record.mapProperties(value, entry => entry?.create(entry.value)));
18
+ // must be assigned before reduce is called, as the (overridable) reduce may depend on the reductions
19
+ this.reductions = reductions;
17
20
  this._value = this.reduce(this.value);
18
21
  this.domain = domain;
19
22
  }
@@ -153,10 +156,11 @@ class PartialProductDomain extends abstract_domain_1.AbstractDomain {
153
156
  return true;
154
157
  }
155
158
  /**
156
- * Optional reduction function for a reduced product domain.
159
+ * Applies the {@link reductions} of the (reduced) product domain to refine the abstract value based on its components.
160
+ * Subclasses may override this to implement a fixed reduction instead of (or in addition to) the configurable reductions.
157
161
  */
158
162
  reduce(value) {
159
- return value;
163
+ return this.reductions.reduce((current, reduction) => reduction(current), value);
160
164
  }
161
165
  }
162
166
  exports.PartialProductDomain = PartialProductDomain;
@@ -199,6 +199,7 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
199
199
  case built_in_proc_name_1.BuiltInProcName.Vector:
200
200
  return this.onVectorCall({ call });
201
201
  case built_in_proc_name_1.BuiltInProcName.Assignment:
202
+ case built_in_proc_name_1.BuiltInProcName.SuperAssignment:
202
203
  case built_in_proc_name_1.BuiltInProcName.AssignmentLike:
203
204
  case built_in_proc_name_1.BuiltInProcName.TableAssignment:
204
205
  return this.onAssignmentCall({ call, ...this.getSourceAndTarget(call) });
@@ -3,35 +3,37 @@
3
3
  */
4
4
  export declare enum BuiltInProcName {
5
5
  /** for subsetting operations, see {@link processAccess} */
6
- Access = "builtin:access",
6
+ Access = "builtin:acc",
7
7
  /** for the `*apply` family, see {@link processApply} */
8
- Apply = "builtin:apply",
8
+ Apply = "builtin:app",
9
9
  /** for assignments like `<-` and `=`, see {@link processAssignment} */
10
- Assignment = "builtin:assignment",
10
+ Assignment = "builtin:assign",
11
11
  /** for assignment like functions that may do additional work, see {@link processAssignmentLike} */
12
- AssignmentLike = "builtin:assignment-like",
12
+ AssignmentLike = "builtin:assign-l",
13
+ /** for super-assignments like `<<-` and `->>`, see {@link processAssignment} */
14
+ SuperAssignment = "builtin:s-assign",
13
15
  /** for `break` calls */
14
16
  Break = "builtin:break",
15
17
  /** the default built-in processor, see {@link defaultBuiltInProcessor} */
16
- Default = "builtin:default",
18
+ Default = "builtin:d",
17
19
  /** Just a more performant variant of the default processor for built-ins that need to read all their arguments, see {@link defaultBuiltInProcessor}, this will still produce the origin `BuiltIn.Default` */
18
- DefaultReadAllArgs = "builtin:default-read-all-args",
20
+ DefaultReadAllArgs = "builtin:d-ra",
19
21
  /** for `eval` calls, see {@link processEvalCall} */
20
22
  Eval = "builtin:eval",
21
23
  /** for expression lists, see {@link processExpressionList} */
22
- ExpressionList = "builtin:expression-list",
24
+ ExpressionList = "builtin:el",
23
25
  /** for `for` loops, see {@link processForLoop} */
24
- ForLoop = "builtin:for-loop",
26
+ ForLoop = "builtin:fl",
25
27
  /** We resolved a function call, similar to {@link BuiltInProcName#Default} */
26
28
  Function = "function",
27
29
  /** for function definitions, see {@link processFunctionDefinition} */
28
- FunctionDefinition = "builtin:function-definition",
30
+ FunctionDefinition = "builtin:f-def",
29
31
  /** for `get` calls, see {@link processGet} */
30
32
  Get = "builtin:get",
31
33
  /** for `if-then-else` constructs, see {@link processIfThenElse} */
32
- IfThenElse = "builtin:if-then-else",
34
+ IfThenElse = "builtin:ite",
33
35
  /** for `library` and `require` calls, see {@link processLibrary} */
34
- Library = "builtin:library",
36
+ Library = "builtin:lib",
35
37
  /** for `list` calls, see {@link processList} */
36
38
  List = "builtin:list",
37
39
  /** for `local` calls, see {@link processLocal} */
@@ -43,7 +45,7 @@ export declare enum BuiltInProcName {
43
45
  * for example, supports `map(g, ~ .x + 2)`
44
46
  * @see {@link processPurrrFormula}
45
47
  */
46
- PurrrFormula = "builtin:purrr-formula",
48
+ PurrrFormula = "builtin:purrr-f",
47
49
  /** for `quote`, and other substituting calls, see {@link processQuote} */
48
50
  Quote = "builtin:quote",
49
51
  /**
@@ -51,19 +53,19 @@ export declare enum BuiltInProcName {
51
53
  */
52
54
  Recall = "builtin:recall",
53
55
  /** for `on.exìt` and other hooks, see {@link processRegisterHook} */
54
- RegisterHook = "builtin:register-hook",
56
+ RegisterHook = "builtin:r-hook",
55
57
  /** for `repeat` loops, see {@link processRepeatLoop} */
56
- RepeatLoop = "builtin:repeat-loop",
58
+ RepeatLoop = "builtin:rl",
57
59
  /** for replacement functions like `names<-`, see {@link processReplacementFunction} */
58
- Replacement = "builtin:replacement",
60
+ Replacement = "builtin:repl",
59
61
  /** for `return` calls */
60
62
  Return = "builtin:return",
61
63
  /** for `rm` calls, see {@link processRm} */
62
64
  Rm = "builtin:rm",
63
65
  /** for `UseMethod` calls, see {@link processS3Dispatch} */
64
- S3Dispatch = "builtin:s3-dispatch",
66
+ S3Dispatch = "builtin:s3-dp",
65
67
  /** for `NextMethod` calls, see {@link processS3Dispatch} */
66
- S3DispatchNext = "builtin:s3-dispatch-next",
68
+ S3DispatchNext = "builtin:s3-dp-next",
67
69
  /** for `new.generic` calls, see {@link processS7NewGeneric} */
68
70
  S7NewGeneric = "builtin:s7-new-generic",
69
71
  /** for `S7_dispatch` calls (and their implicit creations), see {@link processS7Dispatch} */
@@ -71,7 +73,7 @@ export declare enum BuiltInProcName {
71
73
  /** for `source` calls, see {@link processSourceCall} */
72
74
  Source = "builtin:source",
73
75
  /** for special binary operators like `%x%`, see {@link processSpecialBinOp} */
74
- SpecialBinOp = "builtin:special-bin-op",
76
+ SpecialBinOp = "builtin:s-bop",
75
77
  /** for `stop` calls */
76
78
  Stop = "builtin:stop",
77
79
  /** for `stopifnot` calls, see {@link processStopIfNot} */
@@ -83,13 +85,13 @@ export declare enum BuiltInProcName {
83
85
  /** for `attach` calls that inject environment contents into the search path, see {@link processAttach} */
84
86
  Attach = "builtin:attach",
85
87
  /** for `new.env` and related environment-creation calls, see {@link processNewEnv} */
86
- NewEnv = "builtin:new-env",
88
+ NewEnv = "builtin:nenv",
87
89
  /** for unnamed directly-linked function calls */
88
90
  Unnamed = "unnamed",
89
91
  /** for vector construction calls, see {@link processVector} */
90
92
  Vector = "builtin:vector",
91
93
  /** for `while` loops, see {@link processWhileLoop} */
92
- WhileLoop = "builtin:while-loop",
94
+ WhileLoop = "builtin:wl",
93
95
  /** for `with` calls that evaluate an expression inside a named environment, see {@link processWithEnv} */
94
96
  With = "builtin:with"
95
97
  }
@@ -7,35 +7,37 @@ exports.BuiltInProcName = void 0;
7
7
  var BuiltInProcName;
8
8
  (function (BuiltInProcName) {
9
9
  /** for subsetting operations, see {@link processAccess} */
10
- BuiltInProcName["Access"] = "builtin:access";
10
+ BuiltInProcName["Access"] = "builtin:acc";
11
11
  /** for the `*apply` family, see {@link processApply} */
12
- BuiltInProcName["Apply"] = "builtin:apply";
12
+ BuiltInProcName["Apply"] = "builtin:app";
13
13
  /** for assignments like `<-` and `=`, see {@link processAssignment} */
14
- BuiltInProcName["Assignment"] = "builtin:assignment";
14
+ BuiltInProcName["Assignment"] = "builtin:assign";
15
15
  /** for assignment like functions that may do additional work, see {@link processAssignmentLike} */
16
- BuiltInProcName["AssignmentLike"] = "builtin:assignment-like";
16
+ BuiltInProcName["AssignmentLike"] = "builtin:assign-l";
17
+ /** for super-assignments like `<<-` and `->>`, see {@link processAssignment} */
18
+ BuiltInProcName["SuperAssignment"] = "builtin:s-assign";
17
19
  /** for `break` calls */
18
20
  BuiltInProcName["Break"] = "builtin:break";
19
21
  /** the default built-in processor, see {@link defaultBuiltInProcessor} */
20
- BuiltInProcName["Default"] = "builtin:default";
22
+ BuiltInProcName["Default"] = "builtin:d";
21
23
  /** Just a more performant variant of the default processor for built-ins that need to read all their arguments, see {@link defaultBuiltInProcessor}, this will still produce the origin `BuiltIn.Default` */
22
- BuiltInProcName["DefaultReadAllArgs"] = "builtin:default-read-all-args";
24
+ BuiltInProcName["DefaultReadAllArgs"] = "builtin:d-ra";
23
25
  /** for `eval` calls, see {@link processEvalCall} */
24
26
  BuiltInProcName["Eval"] = "builtin:eval";
25
27
  /** for expression lists, see {@link processExpressionList} */
26
- BuiltInProcName["ExpressionList"] = "builtin:expression-list";
28
+ BuiltInProcName["ExpressionList"] = "builtin:el";
27
29
  /** for `for` loops, see {@link processForLoop} */
28
- BuiltInProcName["ForLoop"] = "builtin:for-loop";
30
+ BuiltInProcName["ForLoop"] = "builtin:fl";
29
31
  /** We resolved a function call, similar to {@link BuiltInProcName#Default} */
30
32
  BuiltInProcName["Function"] = "function";
31
33
  /** for function definitions, see {@link processFunctionDefinition} */
32
- BuiltInProcName["FunctionDefinition"] = "builtin:function-definition";
34
+ BuiltInProcName["FunctionDefinition"] = "builtin:f-def";
33
35
  /** for `get` calls, see {@link processGet} */
34
36
  BuiltInProcName["Get"] = "builtin:get";
35
37
  /** for `if-then-else` constructs, see {@link processIfThenElse} */
36
- BuiltInProcName["IfThenElse"] = "builtin:if-then-else";
38
+ BuiltInProcName["IfThenElse"] = "builtin:ite";
37
39
  /** for `library` and `require` calls, see {@link processLibrary} */
38
- BuiltInProcName["Library"] = "builtin:library";
40
+ BuiltInProcName["Library"] = "builtin:lib";
39
41
  /** for `list` calls, see {@link processList} */
40
42
  BuiltInProcName["List"] = "builtin:list";
41
43
  /** for `local` calls, see {@link processLocal} */
@@ -47,7 +49,7 @@ var BuiltInProcName;
47
49
  * for example, supports `map(g, ~ .x + 2)`
48
50
  * @see {@link processPurrrFormula}
49
51
  */
50
- BuiltInProcName["PurrrFormula"] = "builtin:purrr-formula";
52
+ BuiltInProcName["PurrrFormula"] = "builtin:purrr-f";
51
53
  /** for `quote`, and other substituting calls, see {@link processQuote} */
52
54
  BuiltInProcName["Quote"] = "builtin:quote";
53
55
  /**
@@ -55,19 +57,19 @@ var BuiltInProcName;
55
57
  */
56
58
  BuiltInProcName["Recall"] = "builtin:recall";
57
59
  /** for `on.exìt` and other hooks, see {@link processRegisterHook} */
58
- BuiltInProcName["RegisterHook"] = "builtin:register-hook";
60
+ BuiltInProcName["RegisterHook"] = "builtin:r-hook";
59
61
  /** for `repeat` loops, see {@link processRepeatLoop} */
60
- BuiltInProcName["RepeatLoop"] = "builtin:repeat-loop";
62
+ BuiltInProcName["RepeatLoop"] = "builtin:rl";
61
63
  /** for replacement functions like `names<-`, see {@link processReplacementFunction} */
62
- BuiltInProcName["Replacement"] = "builtin:replacement";
64
+ BuiltInProcName["Replacement"] = "builtin:repl";
63
65
  /** for `return` calls */
64
66
  BuiltInProcName["Return"] = "builtin:return";
65
67
  /** for `rm` calls, see {@link processRm} */
66
68
  BuiltInProcName["Rm"] = "builtin:rm";
67
69
  /** for `UseMethod` calls, see {@link processS3Dispatch} */
68
- BuiltInProcName["S3Dispatch"] = "builtin:s3-dispatch";
70
+ BuiltInProcName["S3Dispatch"] = "builtin:s3-dp";
69
71
  /** for `NextMethod` calls, see {@link processS3Dispatch} */
70
- BuiltInProcName["S3DispatchNext"] = "builtin:s3-dispatch-next";
72
+ BuiltInProcName["S3DispatchNext"] = "builtin:s3-dp-next";
71
73
  /** for `new.generic` calls, see {@link processS7NewGeneric} */
72
74
  BuiltInProcName["S7NewGeneric"] = "builtin:s7-new-generic";
73
75
  /** for `S7_dispatch` calls (and their implicit creations), see {@link processS7Dispatch} */
@@ -75,7 +77,7 @@ var BuiltInProcName;
75
77
  /** for `source` calls, see {@link processSourceCall} */
76
78
  BuiltInProcName["Source"] = "builtin:source";
77
79
  /** for special binary operators like `%x%`, see {@link processSpecialBinOp} */
78
- BuiltInProcName["SpecialBinOp"] = "builtin:special-bin-op";
80
+ BuiltInProcName["SpecialBinOp"] = "builtin:s-bop";
79
81
  /** for `stop` calls */
80
82
  BuiltInProcName["Stop"] = "builtin:stop";
81
83
  /** for `stopifnot` calls, see {@link processStopIfNot} */
@@ -87,13 +89,13 @@ var BuiltInProcName;
87
89
  /** for `attach` calls that inject environment contents into the search path, see {@link processAttach} */
88
90
  BuiltInProcName["Attach"] = "builtin:attach";
89
91
  /** for `new.env` and related environment-creation calls, see {@link processNewEnv} */
90
- BuiltInProcName["NewEnv"] = "builtin:new-env";
92
+ BuiltInProcName["NewEnv"] = "builtin:nenv";
91
93
  /** for unnamed directly-linked function calls */
92
94
  BuiltInProcName["Unnamed"] = "unnamed";
93
95
  /** for vector construction calls, see {@link processVector} */
94
96
  BuiltInProcName["Vector"] = "builtin:vector";
95
97
  /** for `while` loops, see {@link processWhileLoop} */
96
- BuiltInProcName["WhileLoop"] = "builtin:while-loop";
98
+ BuiltInProcName["WhileLoop"] = "builtin:wl";
97
99
  /** for `with` calls that evaluate an expression inside a named environment, see {@link processWithEnv} */
98
100
  BuiltInProcName["With"] = "builtin:with";
99
101
  })(BuiltInProcName || (exports.BuiltInProcName = BuiltInProcName = {}));
@@ -88,41 +88,41 @@ export type BuiltInEvalHandler = (args: BuiltInEvalHandlerArgs) => Value;
88
88
  declare function defaultBuiltInProcessor<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { returnsNthArgument, useAsProcessor, forceArgs, readAllArguments, cfg, hasUnknownSideEffects, treatAsFnCall }: DefaultBuiltInProcessorConfiguration): DataflowInformation;
89
89
  declare function defaultBuiltInProcessorReadallArgs<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, forceArgs }: Pick<DefaultBuiltInProcessorConfiguration, 'useAsProcessor' | 'forceArgs'>): DataflowInformation;
90
90
  export declare const BuiltInProcessorMapper: {
91
- readonly "builtin:access": typeof processAccess;
92
- readonly "builtin:apply": typeof processApply;
93
- readonly "builtin:assignment": typeof processAssignment;
94
- readonly "builtin:assignment-like": typeof processAssignmentLike;
95
- readonly "builtin:default": typeof defaultBuiltInProcessor;
96
- readonly "builtin:default-read-all-args": typeof defaultBuiltInProcessorReadallArgs;
91
+ readonly "builtin:acc": typeof processAccess;
92
+ readonly "builtin:app": typeof processApply;
93
+ readonly "builtin:assign": typeof processAssignment;
94
+ readonly "builtin:assign-l": typeof processAssignmentLike;
95
+ readonly "builtin:d": typeof defaultBuiltInProcessor;
96
+ readonly "builtin:d-ra": typeof defaultBuiltInProcessorReadallArgs;
97
97
  readonly "builtin:eval": typeof processEvalCall;
98
- readonly "builtin:expression-list": typeof processExpressionList;
99
- readonly "builtin:for-loop": typeof processForLoop;
100
- readonly "builtin:function-definition": typeof processFunctionDefinition;
98
+ readonly "builtin:el": typeof processExpressionList;
99
+ readonly "builtin:fl": typeof processForLoop;
100
+ readonly "builtin:f-def": typeof processFunctionDefinition;
101
101
  readonly "builtin:get": typeof processGet;
102
- readonly "builtin:if-then-else": typeof processIfThenElse;
103
- readonly "builtin:library": typeof processLibrary;
102
+ readonly "builtin:ite": typeof processIfThenElse;
103
+ readonly "builtin:lib": typeof processLibrary;
104
104
  readonly "builtin:list": typeof processList;
105
105
  readonly "builtin:local": typeof processLocal;
106
106
  readonly "builtin:pipe": typeof processPipe;
107
- readonly "builtin:purrr-formula": typeof processPurrrFormula;
107
+ readonly "builtin:purrr-f": typeof processPurrrFormula;
108
108
  readonly "builtin:quote": typeof processQuote;
109
109
  readonly "builtin:recall": typeof processRecall;
110
- readonly "builtin:register-hook": typeof processRegisterHook;
111
- readonly "builtin:repeat-loop": typeof processRepeatLoop;
112
- readonly "builtin:replacement": typeof processReplacementFunction;
110
+ readonly "builtin:r-hook": typeof processRegisterHook;
111
+ readonly "builtin:rl": typeof processRepeatLoop;
112
+ readonly "builtin:repl": typeof processReplacementFunction;
113
113
  readonly "builtin:rm": typeof processRm;
114
- readonly "builtin:s3-dispatch": typeof processS3Dispatch;
114
+ readonly "builtin:s3-dp": typeof processS3Dispatch;
115
115
  readonly "builtin:s7-new-generic": typeof processS7NewGeneric;
116
116
  readonly "builtin:s7-dispatch": typeof processS7Dispatch;
117
117
  readonly "builtin:source": typeof processSourceCall;
118
- readonly "builtin:special-bin-op": typeof processSpecialBinOp;
118
+ readonly "builtin:s-bop": typeof processSpecialBinOp;
119
119
  readonly "builtin:stopifnot": typeof processStopIfNot;
120
120
  readonly "builtin:try": typeof processTryCatch;
121
121
  readonly "builtin:attach": typeof processAttach;
122
- readonly "builtin:new-env": typeof processNewEnv;
122
+ readonly "builtin:nenv": typeof processNewEnv;
123
123
  readonly "builtin:with": typeof processWithEnv;
124
124
  readonly "builtin:vector": typeof processVector;
125
- readonly "builtin:while-loop": typeof processWhileLoop;
125
+ readonly "builtin:wl": typeof processWhileLoop;
126
126
  };
127
127
  export declare const BuiltInEvalHandlerMapper: {
128
128
  readonly 'built-in:c': typeof resolveAsVector;
@@ -205,6 +205,11 @@ export interface InGraphIdentifierDefinition extends IdentifierReference {
205
205
  * Use this to resolve variables assigned via `assign(name, val, envir=<this var>)`.
206
206
  */
207
207
  readonly envState?: REnvironmentInformation;
208
+ /**
209
+ * If this is a function that returns a tracked environment, stores the envState
210
+ * that the function returns (best-effort: only set when statically detectable).
211
+ */
212
+ readonly returnsEnvState?: REnvironmentInformation;
208
213
  }
209
214
  /**
210
215
  * A narrowed variant of {@link InGraphIdentifierDefinition} that is guaranteed to have a non-undefined `name`.
@@ -8,17 +8,40 @@ const identifier_1 = require("./identifier");
8
8
  const resolve_by_name_1 = require("./resolve-by-name");
9
9
  const vertex_1 = require("../graph/vertex");
10
10
  function appToCdsUnique(target, toAdd) {
11
- if (toAdd) {
12
- target.push(...toAdd.filter(c => !target.some(tc => tc.id === c.id && tc.when === c.when)));
11
+ if (!toAdd) {
12
+ return;
13
+ }
14
+ for (const c of toAdd) {
15
+ let found = false;
16
+ for (const tc of target) {
17
+ if (tc.id === c.id && tc.when === c.when) {
18
+ found = true;
19
+ break;
20
+ }
21
+ }
22
+ if (!found) {
23
+ target.push(c);
24
+ }
13
25
  }
14
26
  }
15
27
  function concatCdsUnique(target, toAdd) {
16
- if (toAdd) {
17
- return target.concat(toAdd.filter(c => !target.some(tc => tc.id === c.id && tc.when === c.when)));
18
- }
19
- else {
28
+ if (!toAdd) {
20
29
  return target;
21
30
  }
31
+ const result = Array.from(target);
32
+ for (const c of toAdd) {
33
+ let found = false;
34
+ for (const tc of target) {
35
+ if (tc.id === c.id && tc.when === c.when) {
36
+ found = true;
37
+ break;
38
+ }
39
+ }
40
+ if (!found) {
41
+ result.push(c);
42
+ }
43
+ }
44
+ return result;
22
45
  }
23
46
  /**
24
47
  * Marks the reference as maybe (i.e., as controlled by a set of {@link IdentifierReference#cds|control dependencies}).
@@ -94,6 +117,9 @@ function applyCdsToAllInGraphButConstants(graph, references, cds) {
94
117
  * apply the given cds to all given references, but not to the graph. This is useful if we want to mark the references as maybe without marking all other nodes in the graph as maybe.
95
118
  */
96
119
  function applyCdToReferences(references, cds) {
120
+ if (cds.length === 0) {
121
+ return;
122
+ }
97
123
  for (const ref of references) {
98
124
  if (ref.cds) {
99
125
  appToCdsUnique(ref.cds, cds);
@@ -324,6 +324,11 @@ function trackAliasesInGraph(id, graph, ctx, idMap) {
324
324
  }
325
325
  const values = new Set();
326
326
  for (const id of resultIds) {
327
+ const vertex = graph.getVertex(id);
328
+ if ((0, vertex_1.isValueVertex)(vertex) && vertex.value !== undefined) {
329
+ values.add(vertex.value);
330
+ continue;
331
+ }
327
332
  const node = idMap.get(id);
328
333
  if (node !== undefined) {
329
334
  if (node.info.role === "param-v" /* RoleInParent.ParameterDefaultValue */ || model_1.RNode.iterateParents(node, idMap).some(p => p.info.role === "param-v" /* RoleInParent.ParameterDefaultValue */)) {