@eagleoutice/flowr 2.10.6 → 2.10.7

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 (51) hide show
  1. package/README.md +8 -8
  2. package/control-flow/semantic-cfg-guided-visitor.js +1 -0
  3. package/dataflow/environments/built-in-proc-name.d.ts +22 -20
  4. package/dataflow/environments/built-in-proc-name.js +22 -20
  5. package/dataflow/environments/built-in.d.ts +19 -19
  6. package/dataflow/environments/identifier.d.ts +5 -0
  7. package/dataflow/environments/reference-to-maybe.js +32 -6
  8. package/dataflow/eval/resolve/alias-tracking.js +5 -0
  9. package/dataflow/graph/graph.js +51 -30
  10. package/dataflow/graph/vertex.d.ts +12 -11
  11. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +49 -12
  12. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +4 -2
  13. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +12 -6
  14. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +22 -8
  15. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +57 -1
  16. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.d.ts +1 -1
  17. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +7 -7
  18. package/linter/linter-format.d.ts +4 -0
  19. package/linter/linter-rules.d.ts +5 -5
  20. package/linter/rules/absolute-path.d.ts +0 -2
  21. package/linter/rules/dataframe-access-validation.d.ts +4 -7
  22. package/linter/rules/dataframe-access-validation.js +3 -3
  23. package/linter/rules/dead-code.d.ts +4 -7
  24. package/linter/rules/file-path-validity.d.ts +0 -2
  25. package/linter/rules/function-finder-util.d.ts +1 -3
  26. package/linter/rules/function-finder-util.js +2 -2
  27. package/linter/rules/naming-convention.d.ts +0 -2
  28. package/linter/rules/network-functions.js +4 -1
  29. package/linter/rules/problematic-inputs.d.ts +0 -2
  30. package/linter/rules/roxygen-arguments.d.ts +0 -2
  31. package/linter/rules/seeded-randomness.d.ts +0 -2
  32. package/linter/rules/stop-with-call-arg.d.ts +3 -6
  33. package/linter/rules/unused-definition.d.ts +0 -2
  34. package/linter/rules/useless-loop.d.ts +0 -2
  35. package/package.json +4 -4
  36. package/queries/catalog/dependencies-query/dependencies-query-executor.js +6 -2
  37. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +2 -0
  38. package/queries/catalog/dependencies-query/function-info/source-functions.js +1 -1
  39. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +1 -1
  40. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +16 -16
  41. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +6 -0
  42. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +8 -0
  43. package/search/flowr-search-builder.d.ts +16 -2
  44. package/search/flowr-search-builder.js +10 -1
  45. package/search/flowr-search.d.ts +9 -0
  46. package/search/search-executor/search-generators.d.ts +1 -1
  47. package/search/search-executor/search-generators.js +28 -2
  48. package/slicing/static/static-slicer.js +2 -2
  49. package/util/range.d.ts +13 -1
  50. package/util/range.js +32 -2
  51. 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.6, R grammar v14 (tree-sitter engine)
28
28
  R> :query @linter "read.csv(\"/root/x.txt\")"
29
29
  ```
30
30
 
@@ -117,11 +117,11 @@ It offers a wide variety of features, for example:
117
117
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ _Metadata_: <code>consideredNodes: 0, searchTimeMs: 0, processTimeMs: 0</code>\
118
118
  &nbsp;&nbsp;&nbsp;╰ **Roxygen Arguments** (roxygen-arguments):\
119
119
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ _Metadata_: <code>searchTimeMs: 0, processTimeMs: 0</code>\
120
- _All queries together required ≈2 ms (1ms accuracy, total 2 ms)_
120
+ _All queries together required ≈2 ms (1ms accuracy, total 3 ms)_
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.6 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.6, 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!">104.7 ms</span></i> (as of May 29, 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.6, 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 _2.0 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
 
@@ -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 */)) {
@@ -303,20 +303,19 @@ class DataflowGraph {
303
303
  */
304
304
  addVertex(vertex, fallbackEnv, asRoot = true, overwrite = false) {
305
305
  const vid = vertex.id;
306
- const oldVertex = this.vertexInformation.get(vid);
307
- if (oldVertex !== undefined && !overwrite) {
306
+ if (this.vertexInformation.has(vid) && !overwrite) {
308
307
  return this;
309
308
  }
310
309
  const vtag = vertex.tag;
311
310
  // keep a clone of the original environment
312
311
  vertex.environment = vertex.environment ? (0, clone_1.cloneEnvironmentInformation)(vertex.environment) : (vtag === vertex_1.VertexType.FunctionDefinition || (vtag === vertex_1.VertexType.FunctionCall && !vertex.onlyBuiltin) ? fallbackEnv : undefined);
313
312
  this.vertexInformation.set(vid, vertex);
314
- const has = this.types.get(vertex.tag);
315
- if (has) {
316
- has.push(vid);
313
+ const typeIds = this.types.get(vtag);
314
+ if (typeIds) {
315
+ typeIds.push(vid);
317
316
  }
318
317
  else {
319
- this.types.set(vertex.tag, [vid]);
318
+ this.types.set(vtag, [vid]);
320
319
  }
321
320
  if (asRoot) {
322
321
  this.rootVertices.add(vid);
@@ -327,21 +326,20 @@ class DataflowGraph {
327
326
  if (fromId === toId) {
328
327
  return this;
329
328
  }
330
- const existingFrom = this.edgeInformation.get(fromId);
331
- const edgeInFrom = existingFrom?.get(toId);
332
- if (edgeInFrom === undefined) {
333
- const edge = { types: type };
334
- if (existingFrom === undefined) {
335
- this.edgeInformation.set(fromId, new Map([[toId, edge]]));
329
+ let fromEdges = this.edgeInformation.get(fromId);
330
+ if (fromEdges === undefined) {
331
+ fromEdges = new Map([[toId, { types: type }]]);
332
+ this.edgeInformation.set(fromId, fromEdges);
333
+ }
334
+ else {
335
+ const existing = fromEdges.get(toId);
336
+ if (existing === undefined) {
337
+ fromEdges.set(toId, { types: type });
336
338
  }
337
339
  else {
338
- existingFrom.set(toId, edge);
340
+ existing.types |= type;
339
341
  }
340
342
  }
341
- else {
342
- // adding the type
343
- edgeInFrom.types |= type;
344
- }
345
343
  return this;
346
344
  }
347
345
  /**
@@ -357,7 +355,12 @@ class DataflowGraph {
357
355
  this.mergeVertices(otherGraph, mergeRootVertices);
358
356
  for (const [type, ids] of otherGraph.types) {
359
357
  const existing = this.types.get(type);
360
- this.types.set(type, existing ? existing.concat(ids) : ids.slice());
358
+ if (existing) {
359
+ existing.push(...ids);
360
+ }
361
+ else {
362
+ this.types.set(type, ids.slice());
363
+ }
361
364
  }
362
365
  this.mergeEdges(otherGraph);
363
366
  return this;
@@ -379,12 +382,13 @@ class DataflowGraph {
379
382
  }
380
383
  mergeEdges(otherGraph) {
381
384
  for (const [id, edges] of otherGraph.edgeInformation.entries()) {
382
- for (const [target, edge] of edges) {
383
- const existing = this.edgeInformation.get(id);
384
- if (existing === undefined) {
385
- this.edgeInformation.set(id, new Map([[target, edge]]));
386
- }
387
- else {
385
+ let existing = this.edgeInformation.get(id);
386
+ if (existing === undefined) {
387
+ existing = new Map(edges);
388
+ this.edgeInformation.set(id, existing);
389
+ }
390
+ else {
391
+ for (const [target, edge] of edges) {
388
392
  const get = existing.get(target);
389
393
  if (get === undefined) {
390
394
  existing.set(target, edge);
@@ -409,12 +413,24 @@ class DataflowGraph {
409
413
  }
410
414
  else {
411
415
  const oldTag = vertex.tag;
416
+ const vid = reference.nodeId;
412
417
  vertex.tag = vertex_1.VertexType.VariableDefinition;
413
418
  if (sourceIds) {
414
419
  vertex.source = sourceIds;
415
420
  }
416
- this.types.set(oldTag, (this.types.get(oldTag) ?? []).filter(id => id !== reference.nodeId));
417
- this.types.set(vertex_1.VertexType.VariableDefinition, (this.types.get(vertex_1.VertexType.VariableDefinition) ?? []).concat([reference.nodeId]));
421
+ const oldIds = this.types.get(oldTag);
422
+ if (oldIds) {
423
+ for (let idx = oldIds.lastIndexOf(vid); idx >= 0; idx = oldIds.lastIndexOf(vid)) {
424
+ oldIds.splice(idx, 1);
425
+ }
426
+ }
427
+ const newIds = this.types.get(vertex_1.VertexType.VariableDefinition);
428
+ if (newIds) {
429
+ newIds.push(vid);
430
+ }
431
+ else {
432
+ this.types.set(vertex_1.VertexType.VariableDefinition, [vid]);
433
+ }
418
434
  }
419
435
  }
420
436
  /**
@@ -427,10 +443,15 @@ class DataflowGraph {
427
443
  (0, assert_1.guard)(vertex !== undefined && (vertex.tag === vertex_1.VertexType.Use || vertex.tag === vertex_1.VertexType.Value), () => `node must be a use or value node for ${JSON.stringify(info.id)} to update it to a function call but is ${vertex?.tag}`);
428
444
  const previousTag = vertex.tag;
429
445
  this.vertexInformation.set(infoId, { ...vertex, ...info, tag: vertex_1.VertexType.FunctionCall });
430
- this.types.set(previousTag, (this.types.get(previousTag) ?? []).filter(id => id !== infoId));
431
- const g = this.types.get(vertex_1.VertexType.FunctionCall);
432
- if (g) {
433
- g.push(infoId);
446
+ const prevIds = this.types.get(previousTag);
447
+ if (prevIds) {
448
+ for (let idx = prevIds.lastIndexOf(infoId); idx >= 0; idx = prevIds.lastIndexOf(infoId)) {
449
+ prevIds.splice(idx, 1);
450
+ }
451
+ }
452
+ const callIds = this.types.get(vertex_1.VertexType.FunctionCall);
453
+ if (callIds) {
454
+ callIds.push(infoId);
434
455
  }
435
456
  else {
436
457
  this.types.set(vertex_1.VertexType.FunctionCall, [infoId]);
@@ -5,6 +5,7 @@ import type { REnvironmentInformation } from '../environments/environment';
5
5
  import type { ControlDependency, ExitPoint } from '../info';
6
6
  import type { Identifier } from '../environments/identifier';
7
7
  import type { BuiltInProcName } from '../environments/built-in-proc-name';
8
+ import type { Value } from '../eval/values/r-value';
8
9
  export declare enum VertexType {
9
10
  Value = "value",
10
11
  Use = "use",
@@ -52,27 +53,22 @@ export interface DataflowGraphVertexAstLink {
52
53
  }
53
54
  /**
54
55
  * Marker vertex for a value in the dataflow of the program.
55
- * This does not contain the _value_ of the referenced constant
56
- * as this is available with the {@link DataflowGraphVertexBase#id|id} in the {@link NormalizedAst|normalized AST}
57
- * (or more specifically the {@link AstIdMap}).
58
- *
59
- * If you have a {@link DataflowGraph|dataflow graph} named `graph`
60
- * with an {@link AstIdMap} and a value vertex object with name `value` the following Code should work:
56
+ * For user-code constants (numbers, strings, logicals) the value is recovered by looking up the
57
+ * {@link DataflowGraphVertexBase#id|id} in the {@link NormalizedAst|normalized AST}:
61
58
  * @example
62
59
  * ```ts
63
60
  * const node = graph.idMap.get(value.id)
64
61
  * ```
65
62
  *
66
- * This then returns the corresponding node in the {@link NormalizedAst|normalized AST}, for example,
67
- * an {@link RNumber} or {@link RString}.
68
- *
69
- * This works similarly for {@link IdentifierReference|identifier references}
70
- * for which you can use the {@link IdentifierReference#nodeId|`nodeId`}.
63
+ * For built-in constants whose id is not in the {@link AstIdMap} (e.g. `T` resolving to `built-in:T`),
64
+ * the abstract {@link Value} is stored directly in the {@link DataflowGraphVertexValue#value|value} field.
71
65
  * @see {@link isValueVertex} - to check if a vertex is a value vertex
72
66
  */
73
67
  export interface DataflowGraphVertexValue extends DataflowGraphVertexBase {
74
68
  readonly tag: VertexType.Value;
75
69
  readonly environment?: undefined;
70
+ /** Pre-computed abstract value; set for built-in constants (e.g. `T`, `F`) whose id is not in the AST id map */
71
+ readonly value?: Value;
76
72
  }
77
73
  /**
78
74
  * Arguments required to construct a vertex which represents the usage of a variable in the {@link DataflowGraph|dataflow graph}.
@@ -159,6 +155,11 @@ export interface DataflowGraphVertexFunctionDefinition extends DataflowGraphVert
159
155
  * This is more of a convenience flag for later processing.
160
156
  */
161
157
  mode?: ('s3' | 's4' | 's7')[];
158
+ /**
159
+ * If this function statically returns a tracked environment, stores the envState it returns.
160
+ * Set by `processFunctionDefinition` when exit points include NewEnv calls or symbols resolving to tracked envs.
161
+ */
162
+ returnEnvState?: REnvironmentInformation;
162
163
  }
163
164
  /**
164
165
  * What is to be passed to construct a vertex in the {@link DataflowGraph|dataflow graph}