@eagleoutice/flowr 2.13.14 → 2.13.16

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 (166) hide show
  1. package/README.md +25 -31
  2. package/abstract-interpretation/data-frame/resolve-args.js +11 -12
  3. package/abstract-interpretation/unsupported-functions.d.ts +1 -0
  4. package/abstract-interpretation/unsupported-functions.js +1 -0
  5. package/benchmark/summarizer/second-phase/graph.d.ts +23 -0
  6. package/benchmark/summarizer/second-phase/graph.js +47 -14
  7. package/cli/repl/commands/repl-cfg.js +2 -42
  8. package/cli/repl/commands/repl-clipboard.d.ts +7 -0
  9. package/cli/repl/commands/repl-clipboard.js +53 -0
  10. package/cli/repl/commands/repl-dataflow.js +5 -70
  11. package/cli/repl/commands/repl-normalize.js +3 -51
  12. package/cli/repl/commands/repl-query.js +37 -2
  13. package/cli/repl/core.js +5 -2
  14. package/control-flow/cfg-dead-code.js +5 -29
  15. package/control-flow/control-flow-graph.d.ts +2 -0
  16. package/control-flow/control-flow-graph.js +2 -0
  17. package/control-flow/diff-cfg.js +2 -56
  18. package/control-flow/semantic-cfg-guided-visitor.d.ts +7 -0
  19. package/control-flow/semantic-cfg-guided-visitor.js +14 -0
  20. package/control-flow/useless-loop.js +4 -26
  21. package/core/steps/all/core/10-normalize.d.ts +8 -0
  22. package/core/steps/all/core/10-normalize.js +10 -8
  23. package/core/steps/all/core/11-normalize-tree-sitter.d.ts +5 -7
  24. package/core/steps/all/core/11-normalize-tree-sitter.js +2 -9
  25. package/data/r-base-packages.generated.d.ts +1 -0
  26. package/data/r-base-packages.generated.js +5 -3
  27. package/dataflow/environments/built-in-config.d.ts +9 -1
  28. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  29. package/dataflow/environments/built-in-proc-name.js +2 -0
  30. package/dataflow/environments/built-in-props.d.ts +4 -0
  31. package/dataflow/environments/built-in-props.js +3 -3
  32. package/dataflow/environments/built-in.d.ts +4 -2
  33. package/dataflow/environments/built-in.js +53 -3
  34. package/dataflow/environments/data-masking-functions.d.ts +3 -4
  35. package/dataflow/environments/data-masking-functions.js +7 -8
  36. package/dataflow/environments/default-builtin-config.d.ts +92 -12
  37. package/dataflow/environments/default-builtin-config.js +86 -43
  38. package/dataflow/environments/environment.d.ts +5 -0
  39. package/dataflow/environments/environment.js +17 -12
  40. package/dataflow/environments/identifier.d.ts +3 -0
  41. package/dataflow/eval/resolve/alias-tracking.js +4 -7
  42. package/dataflow/eval/resolve/node-value.d.ts +51 -0
  43. package/dataflow/eval/resolve/node-value.js +71 -0
  44. package/dataflow/eval/resolve/resolve-argument.js +10 -7
  45. package/dataflow/eval/resolve/resolve-operators.js +1 -2
  46. package/dataflow/eval/values/general.d.ts +4 -0
  47. package/dataflow/eval/values/general.js +14 -0
  48. package/dataflow/eval/values/r-value.d.ts +15 -0
  49. package/dataflow/eval/values/r-value.js +27 -1
  50. package/dataflow/extractor.js +2 -0
  51. package/dataflow/fn/higher-order-function.d.ts +1 -1
  52. package/dataflow/fn/higher-order-function.js +22 -4
  53. package/dataflow/graph/call-graph.d.ts +1 -1
  54. package/dataflow/graph/call-graph.js +1 -1
  55. package/dataflow/graph/df-helper.d.ts +2 -2
  56. package/dataflow/graph/df-helper.js +1 -1
  57. package/dataflow/graph/diff-dataflow-graph.js +3 -55
  58. package/dataflow/graph/graph-helper.d.ts +1 -0
  59. package/dataflow/graph/graph-helper.js +1 -0
  60. package/dataflow/graph/graph.d.ts +5 -0
  61. package/dataflow/graph/graph.js +27 -0
  62. package/dataflow/graph/vertex.d.ts +5 -0
  63. package/dataflow/graph/vertex.js +5 -0
  64. package/dataflow/internal/linker.d.ts +23 -0
  65. package/dataflow/internal/linker.js +70 -1
  66. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +4 -1
  67. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +2 -0
  68. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +8 -29
  69. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +39 -6
  70. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +10 -22
  71. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +29 -53
  72. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -5
  73. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -7
  74. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -3
  75. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +19 -12
  76. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +2 -1
  77. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +3 -0
  78. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +69 -52
  79. package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
  80. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +2 -8
  81. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -8
  82. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +2 -2
  83. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -2
  84. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +6 -1
  85. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +31 -5
  86. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +5 -4
  87. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +7 -10
  88. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +6 -1
  89. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +20 -3
  90. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +6 -8
  91. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.d.ts +25 -0
  92. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +105 -0
  93. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +1 -27
  94. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
  95. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +1 -1
  96. package/dataflow/internal/process/functions/call/deferred.d.ts +48 -0
  97. package/dataflow/internal/process/functions/call/deferred.js +149 -0
  98. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +13 -12
  99. package/dataflow/internal/process/functions/call/known-call-handling.js +35 -35
  100. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
  101. package/dataflow/internal/process/functions/call/named-call-handling.js +8 -4
  102. package/dataflow/internal/process/functions/call/nse.d.ts +29 -0
  103. package/dataflow/internal/process/functions/call/nse.js +88 -0
  104. package/dataflow/internal/process/functions/call/quoted.d.ts +30 -0
  105. package/dataflow/internal/process/functions/call/quoted.js +191 -0
  106. package/documentation/doc-util/doc-types.js +15 -9
  107. package/documentation/wiki-dataflow-graph.js +8 -0
  108. package/linter/linter-format.d.ts +1 -0
  109. package/linter/linter-format.js +1 -0
  110. package/linter/rules/deprecated-functions.js +9 -3
  111. package/linter/rules/seeded-randomness.js +2 -3
  112. package/linter/rules/undefined-symbol.js +10 -1
  113. package/package.json +1 -1
  114. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +6 -0
  115. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +17 -1
  116. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +2 -11
  117. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +3 -15
  118. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.d.ts +16 -0
  119. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.js +26 -0
  120. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -11
  121. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +3 -15
  122. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +4 -10
  123. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +2 -9
  124. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +2 -9
  125. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +1 -1
  126. package/project/sigdb/reader.d.ts +9 -0
  127. package/project/sigdb/reader.js +30 -0
  128. package/queries/catalog/absint-query/absint-query-format.js +1 -1
  129. package/queries/catalog/does-call-query/does-call-query-format.js +2 -1
  130. package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -2
  131. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +0 -12
  132. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -37
  133. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -1
  134. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +2 -23
  135. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -1
  136. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +2 -2
  137. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +1 -1
  138. package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
  139. package/queries/catalog/origin-query/origin-query-format.js +1 -1
  140. package/queries/catalog/provenance-query/provenance-query-format.js +1 -1
  141. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
  142. package/queries/query-function-filter.d.ts +21 -0
  143. package/queries/query-function-filter.js +48 -0
  144. package/r-bridge/data/data.d.ts +13 -3
  145. package/r-bridge/data/data.js +15 -3
  146. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
  147. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
  148. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +2 -0
  149. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +4 -0
  150. package/search/flowr-search-filters.d.ts +5 -1
  151. package/search/flowr-search-filters.js +31 -21
  152. package/search/search-executor/search-enrichers.d.ts +24 -4
  153. package/search/search-executor/search-enrichers.js +22 -9
  154. package/search/search-executor/search-transformer.js +1 -1
  155. package/slicing/criterion/parse.d.ts +1 -0
  156. package/slicing/criterion/parse.js +1 -0
  157. package/util/diff-graph.d.ts +13 -0
  158. package/util/diff-graph.js +64 -1
  159. package/util/files.js +9 -8
  160. package/util/r-base-packages.d.ts +2 -0
  161. package/util/r-base-packages.js +3 -1
  162. package/util/r-version.d.ts +2 -0
  163. package/util/r-version.js +2 -0
  164. package/util/record.d.ts +1 -0
  165. package/util/record.js +1 -0
  166. package/util/version.js +1 -1
@@ -1,6 +1,6 @@
1
1
  import { ExitPointType } from '../info';
2
2
  import type { DataflowGraph } from '../graph/graph';
3
- import type { DataflowGraphVertexFunctionCall } from '../graph/vertex';
3
+ import type { DataflowGraphVertexInfo } from '../graph/vertex';
4
4
  import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
5
5
  import { CascadeAction } from '../../queries/catalog/call-context-query/cascade-action';
6
6
  import { KnownHooks } from '../hooks';
@@ -8,6 +8,7 @@ import { Identifier } from './identifier';
8
8
  import { BuiltInProcName } from './built-in-proc-name';
9
9
  import { BuiltInEvalName } from './built-in-eval-name';
10
10
  import { NseArguments } from '../internal/process/functions/call/known-call-handling';
11
+ import { Unquote } from '../internal/process/functions/call/nse';
11
12
  import { ArgProp, CallProp, type FnSig } from './built-in-props';
12
13
  /** Which stack environment an env-returning/-transforming builtin denotes (see {@link StackEnvBuiltins}). */
13
14
  export declare enum StackEnvKind {
@@ -29,6 +30,7 @@ export declare const StackEnvBuiltins: {
29
30
  readonly 'parent.env': StackEnvKind.Parent;
30
31
  readonly 'parent.frame': StackEnvKind.CallerFrame;
31
32
  readonly 'as.environment': StackEnvKind.Named;
33
+ readonly '.env': StackEnvKind.Current;
32
34
  readonly '.GlobalEnv': StackEnvKind.Global;
33
35
  readonly '.BaseEnv': StackEnvKind.Base;
34
36
  readonly '.BaseNamespaceEnv': StackEnvKind.Base;
@@ -900,7 +902,7 @@ export declare const WrittenBuiltinDefinitions: [{
900
902
  readonly forceArgs: "all";
901
903
  readonly hasUnknownSideEffects: {
902
904
  readonly type: "link-to-last-call";
903
- readonly ignoreIf: (source: DataflowGraphVertexFunctionCall, graph: DataflowGraph) => boolean;
905
+ readonly ignoreIf: (source: NodeId, graph: DataflowGraph) => boolean;
904
906
  readonly callName: RegExp;
905
907
  };
906
908
  readonly props: CallProp.Graphics;
@@ -919,7 +921,7 @@ export declare const WrittenBuiltinDefinitions: [{
919
921
  readonly type: "link-to-last-call";
920
922
  readonly callName: RegExp;
921
923
  readonly ignoreIf: (source: NodeId, graph: DataflowGraph) => boolean;
922
- readonly cascadeIf: (target: DataflowGraphVertexFunctionCall, _: NodeId, graph: DataflowGraph) => CascadeAction.Stop | CascadeAction.Continue;
924
+ readonly cascadeIf: (targetVertex: DataflowGraphVertexInfo, _: NodeId, graph: DataflowGraph) => CascadeAction.Stop | CascadeAction.Continue;
923
925
  };
924
926
  readonly props: CallProp.Graphics;
925
927
  };
@@ -1062,7 +1064,7 @@ export declare const WrittenBuiltinDefinitions: [{
1062
1064
  readonly config: {
1063
1065
  readonly hasUnknownSideEffects: true;
1064
1066
  readonly forceArgs: readonly [true];
1065
- readonly markArgsAsNSE: NseArguments.First;
1067
+ readonly markArgsAsMasked: NseArguments.First;
1066
1068
  readonly treatAsFnCall: {
1067
1069
  readonly '.Call': readonly [".NAME"];
1068
1070
  readonly '.External': readonly [".NAME"];
@@ -1079,6 +1081,7 @@ export declare const WrittenBuiltinDefinitions: [{
1079
1081
  readonly config: {
1080
1082
  readonly includeFunctionCall: true;
1081
1083
  readonly supportFunctionCall: false;
1084
+ readonly keepEnvironment: true;
1082
1085
  };
1083
1086
  readonly assumePrimitive: true;
1084
1087
  }, {
@@ -1088,6 +1091,7 @@ export declare const WrittenBuiltinDefinitions: [{
1088
1091
  readonly config: {
1089
1092
  readonly includeFunctionCall: true;
1090
1093
  readonly supportFunctionCall: true;
1094
+ readonly keepEnvironment: true;
1091
1095
  };
1092
1096
  readonly assumePrimitive: true;
1093
1097
  }, {
@@ -1133,7 +1137,7 @@ export declare const WrittenBuiltinDefinitions: [{
1133
1137
  readonly config: {
1134
1138
  readonly useAsProcessor: BuiltInProcName.Stop;
1135
1139
  readonly cfg: ExitPointType.Error;
1136
- readonly forceArgs: readonly ["all"];
1140
+ readonly forceArgs: "all";
1137
1141
  readonly props: CallProp.Throws;
1138
1142
  };
1139
1143
  readonly assumePrimitive: false;
@@ -1438,7 +1442,7 @@ export declare const WrittenBuiltinDefinitions: [{
1438
1442
  readonly assumePrimitive: false;
1439
1443
  }, {
1440
1444
  readonly type: "function";
1441
- readonly names: Identifier[];
1445
+ readonly names: [Identifier];
1442
1446
  readonly processor: BuiltInProcName.SpecialBinOp;
1443
1447
  readonly config: {
1444
1448
  readonly lazy: true;
@@ -1449,7 +1453,7 @@ export declare const WrittenBuiltinDefinitions: [{
1449
1453
  readonly evalHandler: BuiltInEvalName.Logical;
1450
1454
  }, {
1451
1455
  readonly type: "function";
1452
- readonly names: Identifier[];
1456
+ readonly names: [Identifier];
1453
1457
  readonly processor: BuiltInProcName.SpecialBinOp;
1454
1458
  readonly config: {
1455
1459
  readonly lazy: true;
@@ -1458,12 +1462,24 @@ export declare const WrittenBuiltinDefinitions: [{
1458
1462
  };
1459
1463
  readonly assumePrimitive: true;
1460
1464
  readonly evalHandler: BuiltInEvalName.Logical;
1465
+ }, {
1466
+ readonly type: "function";
1467
+ readonly names: Identifier[];
1468
+ readonly processor: BuiltInProcName.SpecialBinOp;
1469
+ readonly config: {
1470
+ readonly lazy: false;
1471
+ readonly props: CallProp.Pure;
1472
+ };
1473
+ readonly assumePrimitive: true;
1474
+ readonly evalHandler: BuiltInEvalName.Logical;
1461
1475
  }, {
1462
1476
  readonly type: "function";
1463
1477
  readonly names: ["|>"];
1464
1478
  readonly processor: BuiltInProcName.Pipe;
1465
1479
  readonly config: {
1466
1480
  readonly pipePlaceholderName: "_";
1481
+ readonly assignLhs: false;
1482
+ readonly returnLhs: false;
1467
1483
  };
1468
1484
  readonly assumePrimitive: true;
1469
1485
  }, {
@@ -1472,6 +1488,8 @@ export declare const WrittenBuiltinDefinitions: [{
1472
1488
  readonly processor: BuiltInProcName.Pipe;
1473
1489
  readonly config: {
1474
1490
  readonly pipePlaceholderName: ".";
1491
+ readonly assignLhs: false;
1492
+ readonly returnLhs: false;
1475
1493
  readonly rhsMightBeSymbol: true;
1476
1494
  };
1477
1495
  readonly assumePrimitive: true;
@@ -1482,6 +1500,7 @@ export declare const WrittenBuiltinDefinitions: [{
1482
1500
  readonly config: {
1483
1501
  readonly pipePlaceholderName: ".";
1484
1502
  readonly assignLhs: true;
1503
+ readonly returnLhs: false;
1485
1504
  readonly rhsMightBeSymbol: true;
1486
1505
  };
1487
1506
  readonly assumePrimitive: true;
@@ -1491,6 +1510,7 @@ export declare const WrittenBuiltinDefinitions: [{
1491
1510
  readonly processor: BuiltInProcName.Pipe;
1492
1511
  readonly config: {
1493
1512
  readonly pipePlaceholderName: ".";
1513
+ readonly assignLhs: false;
1494
1514
  readonly returnLhs: true;
1495
1515
  readonly rhsMightBeSymbol: true;
1496
1516
  };
@@ -1845,10 +1865,23 @@ export declare const WrittenBuiltinDefinitions: [{
1845
1865
  readonly assumePrimitive: true;
1846
1866
  }, {
1847
1867
  readonly type: "function";
1848
- readonly names: Identifier[];
1868
+ readonly names: [Identifier];
1849
1869
  readonly processor: BuiltInProcName.Quote;
1850
1870
  readonly config: {
1851
1871
  readonly quoteArgumentsWithIndex: 0;
1872
+ readonly keepEnvironment: true;
1873
+ readonly props: CallProp.Lang;
1874
+ readonly sig: [["expr", ArgProp.Nse]];
1875
+ };
1876
+ readonly assumePrimitive: true;
1877
+ }, {
1878
+ readonly type: "function";
1879
+ readonly names: [Identifier];
1880
+ readonly processor: BuiltInProcName.Quote;
1881
+ readonly config: {
1882
+ readonly quoteArgumentsWithIndex: 0;
1883
+ readonly unquote: Unquote.Bquote;
1884
+ readonly keepEnvironment: true;
1852
1885
  readonly props: CallProp.Lang;
1853
1886
  readonly sig: [["expr", ArgProp.Nse]];
1854
1887
  };
@@ -1860,6 +1893,7 @@ export declare const WrittenBuiltinDefinitions: [{
1860
1893
  readonly config: {
1861
1894
  readonly quoteArgumentsWithIndex: 0;
1862
1895
  readonly envArgIndex: 1;
1896
+ readonly keepEnvironment: true;
1863
1897
  readonly props: CallProp.Lang;
1864
1898
  readonly sig: [["expr", ArgProp.Nse], ["env", ArgProp.Value]];
1865
1899
  };
@@ -1870,18 +1904,64 @@ export declare const WrittenBuiltinDefinitions: [{
1870
1904
  readonly processor: BuiltInProcName.Quote;
1871
1905
  readonly config: {
1872
1906
  readonly quoteArgumentsWithIndex: 0;
1907
+ readonly unquote: Unquote.Rlang;
1908
+ readonly keepEnvironment: true;
1873
1909
  readonly libFn: true;
1874
1910
  readonly props: CallProp.Lang;
1875
1911
  };
1876
1912
  readonly assumePrimitive: true;
1877
1913
  }, {
1878
1914
  readonly type: "function";
1879
- readonly names: Identifier[];
1880
- readonly processor: BuiltInProcName.Default;
1915
+ readonly names: [Identifier];
1916
+ readonly processor: BuiltInProcName.Apply;
1881
1917
  readonly config: {
1882
- readonly libFn: true;
1918
+ readonly indexOfFunction: 0;
1919
+ readonly nameOfFunctionArgument: ".fn";
1920
+ readonly unquoteFunction: true;
1883
1921
  readonly hasUnknownSideEffects: true;
1922
+ readonly libFn: true;
1923
+ readonly props: CallProp.MayPure;
1924
+ readonly sig: [[".fn", ArgProp.Callee], ["...", ArgProp.Value]];
1925
+ };
1926
+ readonly assumePrimitive: false;
1927
+ }, {
1928
+ readonly type: "function";
1929
+ readonly names: Identifier[];
1930
+ readonly processor: BuiltInProcName.Apply;
1931
+ readonly config: {
1932
+ readonly indexOfFunction: 0;
1933
+ readonly nameOfFunctionArgument: ".f";
1884
1934
  readonly unquoteFunction: true;
1935
+ readonly hasUnknownSideEffects: true;
1936
+ readonly libFn: true;
1937
+ readonly props: CallProp.MayPure;
1938
+ readonly sig: [[".f", ArgProp.Callee], ["...", ArgProp.Value]];
1939
+ };
1940
+ readonly assumePrimitive: false;
1941
+ }, {
1942
+ readonly type: "function";
1943
+ readonly names: [...Identifier[], Identifier];
1944
+ readonly processor: BuiltInProcName.StringTemplate;
1945
+ readonly config: {
1946
+ readonly props: CallProp.MayPure;
1947
+ };
1948
+ readonly assumePrimitive: false;
1949
+ }, {
1950
+ readonly type: "function";
1951
+ readonly names: Identifier[];
1952
+ readonly processor: BuiltInProcName.StringTemplate;
1953
+ readonly config: {
1954
+ readonly markup: true;
1955
+ readonly props: CallProp.MayPure;
1956
+ };
1957
+ readonly assumePrimitive: false;
1958
+ }, {
1959
+ readonly type: "function";
1960
+ readonly names: [Identifier];
1961
+ readonly processor: BuiltInProcName.StringTemplate;
1962
+ readonly config: {
1963
+ readonly open: "${";
1964
+ readonly props: CallProp.MayPure;
1885
1965
  };
1886
1966
  readonly assumePrimitive: false;
1887
1967
  }, {
@@ -2488,7 +2568,7 @@ export declare const WrittenBuiltinDefinitions: [{
2488
2568
  /**
2489
2569
  * Contains the built-in definitions recognized by flowR
2490
2570
  */
2491
- export declare const DefaultBuiltinConfig: import("./built-in-config").BuiltInDefinition<BuiltInProcName.Access | BuiltInProcName.Apply | BuiltInProcName.Assignment | BuiltInProcName.AssignmentLike | BuiltInProcName.DefineArgument | BuiltInProcName.Default | BuiltInProcName.DefaultReadAllArgs | BuiltInProcName.Eval | BuiltInProcName.ExpressionList | BuiltInProcName.ForLoop | BuiltInProcName.FunctionDefinition | BuiltInProcName.Get | BuiltInProcName.IfThenElse | BuiltInProcName.Library | BuiltInProcName.List | BuiltInProcName.Load | BuiltInProcName.Local | BuiltInProcName.NamespaceAccess | BuiltInProcName.Pipe | BuiltInProcName.PurrrFormula | BuiltInProcName.Quote | BuiltInProcName.Recall | BuiltInProcName.RegisterHook | BuiltInProcName.RepeatLoop | BuiltInProcName.Replacement | BuiltInProcName.Rm | BuiltInProcName.S3Dispatch | BuiltInProcName.S7NewGeneric | BuiltInProcName.S7Dispatch | BuiltInProcName.S7MakeConstructor | BuiltInProcName.Source | BuiltInProcName.SpecialBinOp | BuiltInProcName.StackEnv | BuiltInProcName.StopIfNot | BuiltInProcName.Try | BuiltInProcName.Attach | BuiltInProcName.NewEnv | BuiltInProcName.ClassGenerator | BuiltInProcName.Vector | BuiltInProcName.WhileLoop | BuiltInProcName.With>[];
2571
+ export declare const DefaultBuiltinConfig: import("./built-in-config").BuiltInDefinition<BuiltInProcName.Access | BuiltInProcName.Apply | BuiltInProcName.Assignment | BuiltInProcName.AssignmentLike | BuiltInProcName.DefineArgument | BuiltInProcName.Default | BuiltInProcName.DefaultReadAllArgs | BuiltInProcName.Eval | BuiltInProcName.StringTemplate | BuiltInProcName.ExpressionList | BuiltInProcName.ForLoop | BuiltInProcName.FunctionDefinition | BuiltInProcName.Get | BuiltInProcName.IfThenElse | BuiltInProcName.Library | BuiltInProcName.List | BuiltInProcName.Load | BuiltInProcName.Local | BuiltInProcName.NamespaceAccess | BuiltInProcName.Pipe | BuiltInProcName.PurrrFormula | BuiltInProcName.Quote | BuiltInProcName.Recall | BuiltInProcName.RegisterHook | BuiltInProcName.RepeatLoop | BuiltInProcName.Replacement | BuiltInProcName.Rm | BuiltInProcName.S3Dispatch | BuiltInProcName.S7NewGeneric | BuiltInProcName.S7Dispatch | BuiltInProcName.S7MakeConstructor | BuiltInProcName.Source | BuiltInProcName.SpecialBinOp | BuiltInProcName.StackEnv | BuiltInProcName.StopIfNot | BuiltInProcName.Try | BuiltInProcName.Attach | BuiltInProcName.NewEnv | BuiltInProcName.ClassGenerator | BuiltInProcName.Vector | BuiltInProcName.WhileLoop | BuiltInProcName.With>[];
2492
2572
  /**
2493
2573
  * Expensive and naive lookup of the default processor for a built-in function name
2494
2574
  */
@@ -12,9 +12,11 @@ const identifier_1 = require("./identifier");
12
12
  const built_in_proc_name_1 = require("./built-in-proc-name");
13
13
  const built_in_eval_name_1 = require("./built-in-eval-name");
14
14
  const known_call_handling_1 = require("../internal/process/functions/call/known-call-handling");
15
+ const nse_1 = require("../internal/process/functions/call/nse");
15
16
  const data_masking_functions_1 = require("./data-masking-functions");
16
17
  const built_in_props_1 = require("./built-in-props");
17
18
  const r_base_packages_1 = require("../../util/r-base-packages");
19
+ const r_base_packages_generated_1 = require("../../data/r-base-packages.generated");
18
20
  /** Which stack environment an env-returning/-transforming builtin denotes (see {@link StackEnvBuiltins}). */
19
21
  var StackEnvKind;
20
22
  (function (StackEnvKind) {
@@ -36,6 +38,8 @@ exports.StackEnvBuiltins = {
36
38
  'parent.env': StackEnvKind.Parent,
37
39
  'parent.frame': StackEnvKind.CallerFrame,
38
40
  'as.environment': StackEnvKind.Named,
41
+ /* `.env$x` reaches past the data mask */
42
+ '.env': StackEnvKind.Current,
39
43
  '.GlobalEnv': StackEnvKind.Global,
40
44
  '.BaseEnv': StackEnvKind.Base,
41
45
  '.BaseNamespaceEnv': StackEnvKind.Base
@@ -200,35 +204,49 @@ exports.RGroupGenerics = {
200
204
  * The `<-` forms are left out, one replacement definition covers many names.
201
205
  * `npm run check:generic-labels` (part of `checkup`) compares this against a synced database.
202
206
  */
203
- const RGenerics = new Set([
204
- ...Object.values(exports.RGroupGenerics).flat(), '%*%',
205
- 'c', 'length', 'dim', 'dimnames', 'names', 'rep', 'seq.int', '[', '[[', '$', '@',
206
- 'as.call', 'as.character', 'as.complex', 'as.double', 'as.environment', 'as.integer', 'as.logical',
207
- 'as.numeric', 'as.raw', 'is.na', 'is.nan', 'is.finite', 'is.infinite', 'is.matrix', 'is.numeric',
208
- 'aperm', 'as.array', 'as.data.frame', 'as.expression', 'as.list', 'as.matrix', 'cbind', 'rbind', 'diff',
209
- 'duplicated', 'format', 'head', 'tail', 'mean', 'median', 'na.omit', 'print', 'quantile', 'rev', 'seq',
210
- 'simulate', 'solve', 'sort', 'subset', 't', 'transform', 'unique', 'with', 'within',
211
- 'plot', 'lines', 'points', 'text', 'image', 'contour', 'persp', 'hist', 'barplot', 'boxplot', 'density',
212
- 'pairs', 'qqnorm', 'mosaicplot', 'spineplot', 'stripchart', 'sunflowerplot'
213
- ]);
207
+ /**
208
+ * The internal generics: they dispatch in C rather than through `UseMethod`, so no signature can state it and
209
+ * the list has to be written down. Everything that dispatches from R is generated, see {@link RBasePackageStore}.
210
+ */
211
+ const InternalGenerics = [
212
+ '$', '[', '[[', '+', '-', '*', '/', '^', '%%', '%/%', '==', '!=', '<', '>', '<=', '>=', '&', '|', '!',
213
+ 'c', 'length', 'dim', 'dimnames', 'names', 'max', 'min', 'range', 'sum', 'prod', 'abs', 'sqrt', 'exp',
214
+ 'log', 'floor', 'ceiling', 'round', 'signif', 'trunc', 'cumsum', 'cumprod', 'cummax', 'cummin',
215
+ 'as.character', 'as.integer', 'as.double', 'as.logical', 'as.complex', 'as.numeric', 'as.raw',
216
+ 'is.na', 'is.nan', 'is.finite', 'is.infinite', 'is.matrix', 'is.numeric', 'cbind', 'rbind'
217
+ ];
218
+ /** Every name R dispatches on: the generated closure generics plus the {@link InternalGenerics}. */
219
+ const RGenerics = new Set([...r_base_packages_generated_1.RBasePackageStore.generics, ...InternalGenerics]);
214
220
  /** Label every {@link RGenerics} {@link CallProp.Generic}, splitting an entry that mixes them with names that do not dispatch (`&` does, `&&` does not). */
215
221
  function markGenerics(definitions) {
216
- return definitions.flatMap((def) => {
222
+ const out = [];
223
+ for (const def of definitions) {
217
224
  if (def.type !== 'function') {
218
- return [def];
225
+ out.push(def);
226
+ continue;
219
227
  }
220
228
  /* the attached base packages are the ones whose namespace layer a registered built-in hides, so their
221
229
  * label is the only thing left stating the dispatch */
222
- const dispatches = (name) => RGenerics.has(identifier_1.Identifier.getName(name))
223
- && r_base_packages_1.AttachedBasePackages.includes(identifier_1.Identifier.getNamespace(name) ?? "base" /* PkgName.Base */);
224
- const generics = def.names.filter(dispatches);
225
- if (generics.length === 0) {
226
- return [def];
230
+ let generics = undefined;
231
+ let rest = undefined;
232
+ for (const name of def.names) {
233
+ if (RGenerics.has(identifier_1.Identifier.getName(name)) && r_base_packages_1.AttachedBasePackageSet.has(identifier_1.Identifier.getNamespace(name) ?? "base" /* PkgName.Base */)) {
234
+ (generics ??= []).push(name);
235
+ }
236
+ else {
237
+ (rest ??= []).push(name);
238
+ }
227
239
  }
228
- const rest = def.names.filter(n => !dispatches(n));
229
- const labeled = { ...def, names: generics, config: { ...def.config, props: (def.config?.props ?? 0) | built_in_props_1.CallProp.Generic } };
230
- return rest.length === 0 ? [labeled] : [labeled, { ...def, names: rest }];
231
- });
240
+ if (generics === undefined) {
241
+ out.push(def);
242
+ continue;
243
+ }
244
+ out.push({ ...def, names: generics, config: { ...def.config, props: (def.config?.props ?? 0) | built_in_props_1.CallProp.Generic } });
245
+ if (rest !== undefined) {
246
+ out.push({ ...def, names: rest });
247
+ }
248
+ }
249
+ return out;
232
250
  }
233
251
  /**
234
252
  * Contains the built-in definitions recognized by flowR, as they are written down: {@link DefaultBuiltinConfig}
@@ -287,7 +305,8 @@ exports.WrittenBuiltinDefinitions = [
287
305
  /* data-masking without a data argument, e.g. `aes(x, y)` */
288
306
  {
289
307
  type: 'function',
290
- names: identifier_1.Identifier.fromAll("ggplot2" /* PkgName.GgPlot2 */, ['aes', 'aes_string', 'vars']),
308
+ names: [...identifier_1.Identifier.fromAll("ggplot2" /* PkgName.GgPlot2 */, ['aes', 'vars']), identifier_1.Identifier.from(['join_by', "dplyr" /* PkgName.Dplyr */]),
309
+ ...identifier_1.Identifier.fromAll("tibble" /* PkgName.Tibble */, ['tibble', 'tribble'])],
291
310
  processor: built_in_proc_name_1.BuiltInProcName.DefaultReadAllArgs,
292
311
  config: { markArgsAsMasked: known_call_handling_1.NseArguments.All },
293
312
  assumePrimitive: false
@@ -536,8 +555,9 @@ exports.WrittenBuiltinDefinitions = [
536
555
  hasUnknownSideEffects: {
537
556
  type: 'link-to-last-call',
538
557
  ignoreIf: (source, graph) => {
558
+ const sourceVertex = graph.getVertex(source);
539
559
  /* map with add = true appends to an existing plot */
540
- return (exports.PlotFunctionsWithAddParam.has(identifier_1.Identifier.getName(source.name)) && (0, identify_link_to_last_call_relation_1.getValueOfArgument)(graph, source, {
560
+ return (exports.PlotFunctionsWithAddParam.has(identifier_1.Identifier.getName(sourceVertex.name)) && (0, identify_link_to_last_call_relation_1.getValueOfArgument)(graph, sourceVertex, {
541
561
  index: -1,
542
562
  name: 'add'
543
563
  }, [type_1.RType.Logical])?.content === true);
@@ -564,7 +584,8 @@ exports.WrittenBuiltinDefinitions = [
564
584
  name: 'add'
565
585
  }, [type_1.RType.Logical])?.content !== true);
566
586
  },
567
- cascadeIf: (target, _, graph) => {
587
+ cascadeIf: (targetVertex, _, graph) => {
588
+ const target = targetVertex;
568
589
  /* map with add = true appends to an existing plot */
569
590
  return identifier_1.Identifier.getName(target.name) ? ((0, identify_link_to_last_call_relation_1.getValueOfArgument)(graph, target, {
570
591
  index: 11,
@@ -641,8 +662,8 @@ exports.WrittenBuiltinDefinitions = [
641
662
  config: {
642
663
  hasUnknownSideEffects: true,
643
664
  forceArgs: [true],
644
- /* first arg names a native routine (useDynLib), not a variable */
645
- markArgsAsNSE: known_call_handling_1.NseArguments.First,
665
+ /* the routine usually comes from useDynLib, but it may be a variable holding a symbol */
666
+ markArgsAsMasked: known_call_handling_1.NseArguments.First,
646
667
  treatAsFnCall: {
647
668
  '.Call': ['.NAME'],
648
669
  '.External': ['.NAME'],
@@ -654,9 +675,9 @@ exports.WrittenBuiltinDefinitions = [
654
675
  assumePrimitive: true
655
676
  },
656
677
  { type: 'function', names: [identifier_1.Identifier.from(['eval', "base" /* PkgName.Base */])],
657
- processor: built_in_proc_name_1.BuiltInProcName.Eval, config: { includeFunctionCall: true, supportFunctionCall: false }, assumePrimitive: true },
678
+ processor: built_in_proc_name_1.BuiltInProcName.Eval, config: { includeFunctionCall: true, supportFunctionCall: false, keepEnvironment: true }, assumePrimitive: true },
658
679
  { type: 'function', names: [identifier_1.Identifier.from(['evalText', "SoDA" /* PkgName.Soda */])],
659
- processor: built_in_proc_name_1.BuiltInProcName.Eval, config: { includeFunctionCall: true, supportFunctionCall: true }, assumePrimitive: true },
680
+ processor: built_in_proc_name_1.BuiltInProcName.Eval, config: { includeFunctionCall: true, supportFunctionCall: true, keepEnvironment: true }, assumePrimitive: true },
660
681
  { type: 'function', names: [identifier_1.Identifier.from(['cat', "base" /* PkgName.Base */])],
661
682
  processor: built_in_proc_name_1.BuiltInProcName.Default, config: { forceArgs: 'all', hasUnknownSideEffects: { type: 'link-to-last-call', callName: /^sink$/ }, props: built_in_props_1.CallProp.Invisible | built_in_props_1.CallProp.File | built_in_props_1.CallProp.Writes | built_in_props_1.CallProp.Prints, sig: [['...', built_in_props_1.ArgProp.Value | built_in_props_1.ArgProp.Forced], ['file', built_in_props_1.ArgProp.Resource]] }, assumePrimitive: false },
662
683
  { type: 'function', names: [identifier_1.Identifier.from(['switch', "base" /* PkgName.Base */])],
@@ -672,7 +693,7 @@ exports.WrittenBuiltinDefinitions = [
672
693
  ...identifier_1.Identifier.fromAll("purrr" /* PkgName.Purrr */, ['stop_bad_type', 'stop_bad_element_type', 'stop_bad_element_length'])
673
694
  ],
674
695
  processor: built_in_proc_name_1.BuiltInProcName.Default,
675
- config: { useAsProcessor: built_in_proc_name_1.BuiltInProcName.Stop, cfg: 4 /* ExitPointType.Error */, forceArgs: ['all'], props: built_in_props_1.CallProp.Throws },
696
+ config: { useAsProcessor: built_in_proc_name_1.BuiltInProcName.Stop, cfg: 4 /* ExitPointType.Error */, forceArgs: 'all', props: built_in_props_1.CallProp.Throws },
676
697
  assumePrimitive: false
677
698
  },
678
699
  { type: 'function', names: [identifier_1.Identifier.from(['try', "base" /* PkgName.Base */])],
@@ -739,15 +760,18 @@ exports.WrittenBuiltinDefinitions = [
739
760
  processor: built_in_proc_name_1.BuiltInProcName.Assignment, config: { superAssignment: true, swapSourceAndTarget: true, canBeReplacement: true, props: built_in_props_1.CallProp.Scope | built_in_props_1.CallProp.Invisible }, assumePrimitive: true },
740
761
  { type: 'function', names: [identifier_1.Identifier.from(['data', "utils" /* PkgName.Utils */]), identifier_1.Identifier.from(['getHdata', "Hmisc" /* PkgName.Hmisc */])],
741
762
  processor: built_in_proc_name_1.BuiltInProcName.DefineArgument, config: { superAssignment: true }, assumePrimitive: false },
742
- { type: 'function', names: identifier_1.Identifier.fromAll("base" /* PkgName.Base */, ['&&', '&']),
763
+ /* only `&&`/`||` short-circuit */
764
+ { type: 'function', names: [identifier_1.Identifier.from(['&&', "base" /* PkgName.Base */])],
743
765
  processor: built_in_proc_name_1.BuiltInProcName.SpecialBinOp, config: { lazy: true, evalRhsWhen: true, props: built_in_props_1.CallProp.Pure }, assumePrimitive: true, evalHandler: built_in_eval_name_1.BuiltInEvalName.Logical },
744
- { type: 'function', names: identifier_1.Identifier.fromAll("base" /* PkgName.Base */, ['||', '|']),
766
+ { type: 'function', names: [identifier_1.Identifier.from(['||', "base" /* PkgName.Base */])],
745
767
  processor: built_in_proc_name_1.BuiltInProcName.SpecialBinOp, config: { lazy: true, evalRhsWhen: false, props: built_in_props_1.CallProp.Pure }, assumePrimitive: true, evalHandler: built_in_eval_name_1.BuiltInEvalName.Logical },
768
+ { type: 'function', names: identifier_1.Identifier.fromAll("base" /* PkgName.Base */, ['&', '|']),
769
+ processor: built_in_proc_name_1.BuiltInProcName.SpecialBinOp, config: { lazy: false, props: built_in_props_1.CallProp.Pure }, assumePrimitive: true, evalHandler: built_in_eval_name_1.BuiltInEvalName.Logical },
746
770
  { type: 'function', names: ['|>'],
747
- processor: built_in_proc_name_1.BuiltInProcName.Pipe, config: { pipePlaceholderName: '_' }, assumePrimitive: true },
748
- { type: 'function', names: [identifier_1.Identifier.from(['%>%', "magrittr" /* PkgName.Magrittr */]), '%!>%'], processor: built_in_proc_name_1.BuiltInProcName.Pipe, config: { pipePlaceholderName: '.', rhsMightBeSymbol: true }, assumePrimitive: true },
749
- { type: 'function', names: [identifier_1.Identifier.from(['%<>%', "magrittr" /* PkgName.Magrittr */])], processor: built_in_proc_name_1.BuiltInProcName.Pipe, config: { pipePlaceholderName: '.', assignLhs: true, rhsMightBeSymbol: true }, assumePrimitive: true },
750
- { type: 'function', names: [identifier_1.Identifier.from(['%T>%', "magrittr" /* PkgName.Magrittr */])], processor: built_in_proc_name_1.BuiltInProcName.Pipe, config: { pipePlaceholderName: '.', returnLhs: true, rhsMightBeSymbol: true }, assumePrimitive: true },
771
+ processor: built_in_proc_name_1.BuiltInProcName.Pipe, config: { pipePlaceholderName: '_', assignLhs: false, returnLhs: false }, assumePrimitive: true },
772
+ { type: 'function', names: [identifier_1.Identifier.from(['%>%', "magrittr" /* PkgName.Magrittr */]), '%!>%'], processor: built_in_proc_name_1.BuiltInProcName.Pipe, config: { pipePlaceholderName: '.', assignLhs: false, returnLhs: false, rhsMightBeSymbol: true }, assumePrimitive: true },
773
+ { type: 'function', names: [identifier_1.Identifier.from(['%<>%', "magrittr" /* PkgName.Magrittr */])], processor: built_in_proc_name_1.BuiltInProcName.Pipe, config: { pipePlaceholderName: '.', assignLhs: true, returnLhs: false, rhsMightBeSymbol: true }, assumePrimitive: true },
774
+ { type: 'function', names: [identifier_1.Identifier.from(['%T>%', "magrittr" /* PkgName.Magrittr */])], processor: built_in_proc_name_1.BuiltInProcName.Pipe, config: { pipePlaceholderName: '.', assignLhs: false, returnLhs: true, rhsMightBeSymbol: true }, assumePrimitive: true },
751
775
  { type: 'function', names: identifier_1.Identifier.fromAll("purrr" /* PkgName.Purrr */, ['map', 'map_lgl', 'map_int', 'map_dbl', 'map_chr']), processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
752
776
  args: {
753
777
  '.x': { index: 0, name: '.x' }
@@ -888,12 +912,29 @@ exports.WrittenBuiltinDefinitions = [
888
912
  } },
889
913
  { type: 'function', names: ['function', '\\'],
890
914
  processor: built_in_proc_name_1.BuiltInProcName.FunctionDefinition, config: {}, assumePrimitive: true },
891
- { type: 'function', names: identifier_1.Identifier.fromAll("base" /* PkgName.Base */, ['quote', 'bquote']),
892
- processor: built_in_proc_name_1.BuiltInProcName.Quote, config: { quoteArgumentsWithIndex: 0, props: built_in_props_1.CallProp.Lang, sig: [['expr', built_in_props_1.ArgProp.Nse]] }, assumePrimitive: true },
915
+ { type: 'function', names: [identifier_1.Identifier.from(['quote', "base" /* PkgName.Base */])],
916
+ processor: built_in_proc_name_1.BuiltInProcName.Quote, config: { quoteArgumentsWithIndex: 0, keepEnvironment: true, props: built_in_props_1.CallProp.Lang, sig: [['expr', built_in_props_1.ArgProp.Nse]] }, assumePrimitive: true },
917
+ /* `bquote` evaluates the operand of `.()` */
918
+ { type: 'function', names: [identifier_1.Identifier.from(['bquote', "base" /* PkgName.Base */])],
919
+ processor: built_in_proc_name_1.BuiltInProcName.Quote, config: { quoteArgumentsWithIndex: 0, unquote: nse_1.Unquote.Bquote, keepEnvironment: true, props: built_in_props_1.CallProp.Lang, sig: [['expr', built_in_props_1.ArgProp.Nse]] }, assumePrimitive: true },
893
920
  { type: 'function', names: [identifier_1.Identifier.from(['substitute', "base" /* PkgName.Base */])],
894
- processor: built_in_proc_name_1.BuiltInProcName.Quote, config: { quoteArgumentsWithIndex: 0, envArgIndex: 1, props: built_in_props_1.CallProp.Lang, sig: [['expr', built_in_props_1.ArgProp.Nse], ['env', built_in_props_1.ArgProp.Value]] }, assumePrimitive: true },
895
- { type: 'function', names: identifier_1.Identifier.fromAll("rlang" /* PkgName.Rlang */, ['enquo', 'enquos', 'quo', 'quos', 'sym', 'syms', 'ensym', 'ensyms', 'expr', 'exprs', 'quo_name', 'as_name', 'as_label', 'as_string']), processor: built_in_proc_name_1.BuiltInProcName.Quote, config: { quoteArgumentsWithIndex: 0, libFn: true, props: built_in_props_1.CallProp.Lang }, assumePrimitive: true },
896
- { type: 'function', names: [...identifier_1.Identifier.fromAll("rlang" /* PkgName.Rlang */, ['call2', 'exec']), ...identifier_1.Identifier.fromAll("purrr" /* PkgName.Purrr */, ['invoke', 'invoke_map'])], processor: built_in_proc_name_1.BuiltInProcName.Default, config: { libFn: true, hasUnknownSideEffects: true, unquoteFunction: true }, assumePrimitive: false },
921
+ processor: built_in_proc_name_1.BuiltInProcName.Quote, config: { quoteArgumentsWithIndex: 0, envArgIndex: 1, keepEnvironment: true, props: built_in_props_1.CallProp.Lang, sig: [['expr', built_in_props_1.ArgProp.Nse], ['env', built_in_props_1.ArgProp.Value]] }, assumePrimitive: true },
922
+ /* the rlang functions that capture unevaluated, the rest take a value */
923
+ { type: 'function', names: identifier_1.Identifier.fromAll("rlang" /* PkgName.Rlang */, ['quo', 'quos', 'expr', 'exprs']), processor: built_in_proc_name_1.BuiltInProcName.Quote, config: { quoteArgumentsWithIndex: 0, unquote: nse_1.Unquote.Rlang, keepEnvironment: true, libFn: true, props: built_in_props_1.CallProp.Lang }, assumePrimitive: true },
924
+ { type: 'function', names: [identifier_1.Identifier.from(['exec', "rlang" /* PkgName.Rlang */])],
925
+ processor: built_in_proc_name_1.BuiltInProcName.Apply, config: { indexOfFunction: 0, nameOfFunctionArgument: '.fn', unquoteFunction: true, hasUnknownSideEffects: true, libFn: true, props: built_in_props_1.CallProp.MayPure, sig: [['.fn', built_in_props_1.ArgProp.Callee], ['...', built_in_props_1.ArgProp.Value]] }, assumePrimitive: false },
926
+ { type: 'function', names: identifier_1.Identifier.fromAll("purrr" /* PkgName.Purrr */, ['invoke', 'invoke_map']),
927
+ processor: built_in_proc_name_1.BuiltInProcName.Apply, config: { indexOfFunction: 0, nameOfFunctionArgument: '.f', unquoteFunction: true, hasUnknownSideEffects: true, libFn: true, props: built_in_props_1.CallProp.MayPure, sig: [['.f', built_in_props_1.ArgProp.Callee], ['...', built_in_props_1.ArgProp.Value]] }, assumePrimitive: false },
928
+ /* the `{...}` of a template holds R code, evaluated where the call is; `cli_abort` stays with the other
929
+ * error exits, as terminating a branch matters more than interpolating its message */
930
+ { type: 'function', names: [...identifier_1.Identifier.fromAll("glue" /* PkgName.Glue */, ['glue', 'glue_safe', 'glue_collapse']), identifier_1.Identifier.from(['str_glue', "stringr" /* PkgName.Stringr */])],
931
+ processor: built_in_proc_name_1.BuiltInProcName.StringTemplate, config: { props: built_in_props_1.CallProp.MayPure }, assumePrimitive: false },
932
+ { type: 'function', names: identifier_1.Identifier.fromAll("cli" /* PkgName.Cli */, ['cli_text', 'cli_alert', 'cli_alert_info', 'cli_alert_success',
933
+ 'cli_alert_warning', 'cli_alert_danger', 'cli_h1', 'cli_h2', 'cli_h3', 'cli_li', 'cli_bullets', 'cli_inform', 'cli_warn',
934
+ 'format_inline', 'cli_verbatim']),
935
+ processor: built_in_proc_name_1.BuiltInProcName.StringTemplate, config: { markup: true, props: built_in_props_1.CallProp.MayPure }, assumePrimitive: false },
936
+ { type: 'function', names: [identifier_1.Identifier.from(['str_interp', "stringr" /* PkgName.Stringr */])],
937
+ processor: built_in_proc_name_1.BuiltInProcName.StringTemplate, config: { open: '${', props: built_in_props_1.CallProp.MayPure }, assumePrimitive: false },
897
938
  { type: 'function', names: [identifier_1.Identifier.from(['local', "base" /* PkgName.Base */])],
898
939
  processor: built_in_proc_name_1.BuiltInProcName.Local, config: { args: { env: 'envir', expr: 'expr' } }, assumePrimitive: false },
899
940
  { type: 'function', names: identifier_1.Identifier.fromAll("base" /* PkgName.Base */, ['with', 'within']),
@@ -1071,8 +1112,10 @@ exports.WrittenBuiltinDefinitions = [
1071
1112
  processor: built_in_proc_name_1.BuiltInProcName.Default, config: { props: built_in_props_1.CallProp.Lang, sig: [['expr', built_in_props_1.ArgProp.Nse], ['envir', built_in_props_1.ArgProp.Value]] }, assumePrimitive: false },
1072
1113
  {
1073
1114
  type: 'function',
1074
- names: identifier_1.Identifier.fromAll("rlang" /* PkgName.Rlang */, ['enexpr', 'enexprs', 'inject', 'enquo0', 'enquos0', 'new_formula',
1075
- 'f_rhs', 'f_lhs', 'fn_body', 'fn_fmls', 'fn_fmls_names']),
1115
+ names: identifier_1.Identifier.fromAll("rlang" /* PkgName.Rlang */, ['enexpr', 'enexprs', 'inject', 'enquo', 'enquos', 'enquo0', 'enquos0',
1116
+ 'ensym', 'ensyms', 'new_formula',
1117
+ 'f_rhs', 'f_lhs', 'fn_body', 'fn_fmls', 'fn_fmls_names', 'call2', 'sym', 'syms', 'quo_name', 'as_name',
1118
+ 'as_label', 'as_string']),
1076
1119
  processor: built_in_proc_name_1.BuiltInProcName.Default,
1077
1120
  config: { forceArgs: 'all', libFn: true, props: built_in_props_1.CallProp.Lang },
1078
1121
  assumePrimitive: false
@@ -102,6 +102,11 @@ export declare class Environment implements IEnvironment {
102
102
  * Adds all writes of `other` to this environment (`other`'s operations *might* happen). Always recurses parents.
103
103
  */
104
104
  append(other: Environment | undefined): Environment;
105
+ /**
106
+ * The environment a merge with `other` settles on without touching either memory, `undefined` if the
107
+ * memories have to be merged. Package blocks are always unioned, never overwritten or appended to.
108
+ */
109
+ private mergeShortcut;
105
110
  /**
106
111
  * Unions two attached-package blocks, keeping every package once (memory merged for a package in both).
107
112
  */
@@ -237,12 +237,9 @@ class Environment {
237
237
  if (!other || this === other) {
238
238
  return this;
239
239
  }
240
- // package blocks are unioned, never overwritten (see mergePackageBlocks)
241
- if (this.t !== undefined || other.t !== undefined) {
242
- return this.mergePackageBlocks(other);
243
- }
244
- if (this.builtInEnv || this.n !== other.n) {
245
- return this;
240
+ const shortcut = this.mergeShortcut(other);
241
+ if (shortcut !== undefined) {
242
+ return shortcut;
246
243
  }
247
244
  const map = new Map(this.memory);
248
245
  for (const [key, values] of other.memory) {
@@ -291,12 +288,9 @@ class Environment {
291
288
  if (!other || this === other) {
292
289
  return this;
293
290
  }
294
- // package blocks may diverge between branches; union them before the built-in guard
295
- if (this.t !== undefined || other.t !== undefined) {
296
- return this.mergePackageBlocks(other);
297
- }
298
- if (this.builtInEnv || this.n !== other.n) {
299
- return this;
291
+ const shortcut = this.mergeShortcut(other);
292
+ if (shortcut !== undefined) {
293
+ return shortcut;
300
294
  }
301
295
  const map = new Map(this.memory);
302
296
  for (const [key, value] of other.memory) {
@@ -309,12 +303,23 @@ class Environment {
309
303
  }
310
304
  }
311
305
  const out = new Environment(this.parent.append(other.parent));
306
+ out.c = this.c;
312
307
  out.n = this.n;
313
308
  out.t = this.t;
314
309
  out.globalEnv = this.globalEnv;
315
310
  out.memory = map;
316
311
  return out;
317
312
  }
313
+ /**
314
+ * The environment a merge with `other` settles on without touching either memory, `undefined` if the
315
+ * memories have to be merged. Package blocks are always unioned, never overwritten or appended to.
316
+ */
317
+ mergeShortcut(other) {
318
+ if (this.t !== undefined || other.t !== undefined) {
319
+ return this.mergePackageBlocks(other);
320
+ }
321
+ return this.builtInEnv || this.n !== other.n ? this : undefined;
322
+ }
318
323
  /**
319
324
  * Unions two attached-package blocks, keeping every package once (memory merged for a package in both).
320
325
  */
@@ -192,6 +192,9 @@ export declare const enum PkgName {
192
192
  Tcltk = "tcltk",
193
193
  Testthat = "testthat",
194
194
  TidyR = "tidyr",
195
+ Tibble = "tibble",
196
+ Glue = "glue",
197
+ Stringr = "stringr",
195
198
  TinyPlot = "tinyplot",
196
199
  TryCatchLog = "tryCatchLog",
197
200
  Withr = "withr"
@@ -137,10 +137,8 @@ function resolveIdToValue(id, { environment, graph, idMap, full = true, ctx, res
137
137
  blocked.add(node.info.id);
138
138
  switch (node.type) {
139
139
  case type_1.RType.Argument:
140
- if (node.value) {
141
- return resolveIdToValue(node.value.info.id, { environment, graph, idMap, full, resolve, ctx, blocked });
142
- }
143
- // eslint-disable-next-line no-fallthrough
140
+ /* a missing argument (`f(x=)`) carries no value, and it is no symbol to resolve either */
141
+ return node.value ? resolveIdToValue(node.value.info.id, { environment, graph, idMap, full, resolve, ctx, blocked }) : r_value_1.Top;
144
142
  case type_1.RType.Symbol:
145
143
  if (full) {
146
144
  if (environment) {
@@ -170,9 +168,8 @@ function resolveIdToValue(id, { environment, graph, idMap, full = true, ctx, res
170
168
  }
171
169
  /** Resolves an id to a single constant string value, or `undefined` if it is not a unique string constant. */
172
170
  function resolveIdToSingleString(id, info) {
173
- const resolved = (0, general_1.valueSetGuard)(resolveIdToValue(id, info));
174
- const element = resolved?.elements.length === 1 ? resolved.elements[0] : undefined;
175
- return element?.type === 'string' && (0, r_value_1.isValue)(element.value) ? element.value.str : undefined;
171
+ const element = (0, general_1.soleValue)((0, general_1.valueSetGuard)(resolveIdToValue(id, info)), 'string');
172
+ return element !== undefined && (0, r_value_1.isValue)(element.value) ? element.value.str : undefined;
176
173
  }
177
174
  /** the values one element of a sequence may take: a vector contributes its elements, a set what its members do */
178
175
  function iteratedElements(value) {