@eagleoutice/flowr 2.11.0 → 2.12.0

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 (256) hide show
  1. package/README.md +190 -260
  2. package/abstract-interpretation/data-frame/mappers/arguments.js +7 -1
  3. package/abstract-interpretation/domains/set-range-domain.js +1 -1
  4. package/abstract-interpretation/domains/set-upper-bound-domain.js +6 -2
  5. package/benchmark/slicer.d.ts +1 -1
  6. package/benchmark/slicer.js +3 -1
  7. package/benchmark/summarizer/second-phase/graph.js +5 -0
  8. package/cli/common/options.d.ts +8 -0
  9. package/cli/common/options.js +2 -0
  10. package/cli/common/scripts-info.d.ts +8 -0
  11. package/cli/flowr.js +1 -1
  12. package/cli/repl/commands/repl-commands.d.ts +1 -0
  13. package/cli/repl/commands/repl-commands.js +69 -17
  14. package/cli/repl/commands/repl-dataflow.js +48 -4
  15. package/cli/repl/commands/repl-main.d.ts +2 -0
  16. package/cli/repl/commands/repl-main.js +5 -0
  17. package/cli/repl/commands/repl-query.d.ts +4 -1
  18. package/cli/repl/commands/repl-query.js +72 -22
  19. package/cli/repl/commands/repl-signature.d.ts +7 -0
  20. package/cli/repl/commands/repl-signature.js +119 -0
  21. package/cli/repl/core.d.ts +8 -1
  22. package/cli/repl/core.js +46 -6
  23. package/cli/repl/ghost-hint.d.ts +37 -0
  24. package/cli/repl/ghost-hint.js +72 -0
  25. package/cli/repl/parser/slice-query-parser.d.ts +11 -1
  26. package/cli/repl/parser/slice-query-parser.js +45 -16
  27. package/cli/repl/print-version.d.ts +2 -4
  28. package/cli/repl/print-version.js +41 -23
  29. package/cli/repl/server/connection.js +19 -17
  30. package/cli/slicer-app.d.ts +2 -0
  31. package/cli/slicer-app.js +3 -3
  32. package/cli/wiki.d.ts +2 -2
  33. package/cli/wiki.js +2 -2
  34. package/config.d.ts +70 -13
  35. package/config.js +65 -7
  36. package/control-flow/cfg-dead-code.js +0 -1
  37. package/control-flow/control-flow-graph.js +6 -6
  38. package/control-flow/diff-cfg.js +2 -2
  39. package/control-flow/semantic-cfg-guided-visitor.js +2 -0
  40. package/core/print/slice-diff-ansi.js +8 -8
  41. package/core/steps/all/core/20-dataflow.d.ts +2 -2
  42. package/core/steps/all/static-slicing/00-slice.d.ts +5 -0
  43. package/core/steps/all/static-slicing/00-slice.js +1 -1
  44. package/core/steps/all/static-slicing/10-reconstruct.d.ts +7 -0
  45. package/core/steps/all/static-slicing/10-reconstruct.js +6 -2
  46. package/core/steps/pipeline/default-pipelines.d.ts +20 -16
  47. package/data/r-base-packages.generated.d.ts +44 -0
  48. package/data/r-base-packages.generated.js +32 -0
  49. package/data/r-base-primitives.generated.d.ts +1 -0
  50. package/data/r-base-primitives.generated.js +15 -0
  51. package/data/sigdb/sigdb.remote.json +112 -0
  52. package/dataflow/environments/built-in-proc-name.d.ts +4 -0
  53. package/dataflow/environments/built-in-proc-name.js +4 -0
  54. package/dataflow/environments/built-in.d.ts +14 -4
  55. package/dataflow/environments/built-in.js +13 -2
  56. package/dataflow/environments/data-masking-functions.d.ts +12 -0
  57. package/dataflow/environments/data-masking-functions.js +46 -0
  58. package/dataflow/environments/default-builtin-config.d.ts +72 -19
  59. package/dataflow/environments/default-builtin-config.js +48 -14
  60. package/dataflow/environments/diff.js +1 -1
  61. package/dataflow/environments/environment.js +1 -2
  62. package/dataflow/environments/identifier.d.ts +11 -4
  63. package/dataflow/environments/identifier.js +28 -10
  64. package/dataflow/environments/resolve-by-name.js +16 -2
  65. package/dataflow/extractor.js +6 -3
  66. package/dataflow/graph/call-graph.d.ts +2 -2
  67. package/dataflow/graph/df-helper.d.ts +4 -4
  68. package/dataflow/graph/diff-dataflow-graph.js +2 -2
  69. package/dataflow/graph/edge.d.ts +3 -3
  70. package/dataflow/graph/edge.js +3 -3
  71. package/dataflow/graph/graph-helper.d.ts +2 -2
  72. package/dataflow/internal/linker.js +1 -1
  73. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +7 -0
  74. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +20 -0
  75. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +1 -0
  76. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -49
  77. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +6 -1
  78. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +7 -1
  79. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +19 -0
  80. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +111 -6
  81. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +13 -0
  82. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -3
  83. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +9 -0
  84. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +19 -0
  85. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +12 -4
  86. package/dataflow/internal/process/functions/call/common.js +8 -1
  87. package/dataflow/internal/process/functions/call/default-call-handling.js +6 -0
  88. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +17 -0
  89. package/dataflow/internal/process/functions/call/known-call-handling.js +32 -0
  90. package/dataflow/internal/process/functions/call/named-call-handling.js +29 -7
  91. package/dataflow/internal/process/functions/process-argument.js +12 -1
  92. package/dataflow/internal/process/process-named-call.d.ts +18 -1
  93. package/dataflow/internal/process/process-named-call.js +94 -0
  94. package/dataflow/processor.d.ts +18 -0
  95. package/documentation/data/faq/faqs.js +5 -1
  96. package/documentation/doc-capabilities.js +1 -1
  97. package/documentation/doc-util/doc-cli-option.d.ts +10 -0
  98. package/documentation/doc-util/doc-cli-option.js +23 -0
  99. package/documentation/doc-util/doc-dfg.js +2 -1
  100. package/documentation/doc-util/doc-query.d.ts +9 -3
  101. package/documentation/doc-util/doc-query.js +9 -4
  102. package/documentation/wiki-dataflow-graph.js +8 -5
  103. package/documentation/wiki-interface.js +3 -2
  104. package/documentation/wiki-linter.js +1 -1
  105. package/documentation/wiki-linting-and-testing.js +4 -1
  106. package/documentation/wiki-mk/doc-context.d.ts +14 -0
  107. package/documentation/wiki-mk/doc-context.js +3 -0
  108. package/documentation/wiki-mk/doc-maker.js +3 -1
  109. package/documentation/wiki-query.js +19 -1
  110. package/documentation/wiki-setup.js +10 -7
  111. package/documentation/wiki-signature-database.d.ts +16 -0
  112. package/documentation/wiki-signature-database.js +293 -0
  113. package/linter/linter-format.d.ts +7 -0
  114. package/linter/linter-rules.d.ts +10 -9
  115. package/linter/rules/naming-convention.d.ts +1 -0
  116. package/linter/rules/naming-convention.js +2 -0
  117. package/linter/rules/no-leaked-credentials.js +1 -2
  118. package/linter/rules/roxygen-arguments.js +18 -5
  119. package/linter/rules/stop-with-call-arg.js +2 -2
  120. package/linter/rules/undefined-symbol-util.d.ts +36 -0
  121. package/linter/rules/undefined-symbol-util.js +149 -0
  122. package/linter/rules/undefined-symbol.d.ts +58 -17
  123. package/linter/rules/undefined-symbol.js +143 -33
  124. package/linter/rules/unused-definition.d.ts +8 -1
  125. package/linter/rules/unused-definition.js +126 -1
  126. package/package.json +23 -10
  127. package/project/context/abstract-flowr-analyzer-context.js +7 -1
  128. package/project/context/flowr-analyzer-context.d.ts +8 -0
  129. package/project/context/flowr-analyzer-context.js +10 -0
  130. package/project/context/flowr-analyzer-dependencies-context.d.ts +28 -4
  131. package/project/context/flowr-analyzer-dependencies-context.js +53 -1
  132. package/project/context/flowr-analyzer-files-context.d.ts +1 -0
  133. package/project/context/flowr-analyzer-files-context.js +2 -1
  134. package/project/context/flowr-analyzer-functions-context.js +1 -1
  135. package/project/context/flowr-file.d.ts +5 -0
  136. package/project/context/flowr-file.js +5 -0
  137. package/project/flowr-analyzer-builder.js +12 -2
  138. package/project/plugins/file-plugins/files/flowr-description-file.js +6 -3
  139. package/project/plugins/file-plugins/files/flowr-namespace-file.js +9 -3
  140. package/project/plugins/file-plugins/files/flowr-news-file.js +1 -3
  141. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +26 -0
  142. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +39 -0
  143. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
  144. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -2
  145. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -0
  146. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +18 -2
  147. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +19 -0
  148. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +120 -0
  149. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +518 -0
  150. package/project/plugins/package-version-plugins/package.d.ts +5 -3
  151. package/project/plugins/package-version-plugins/package.js +27 -25
  152. package/project/plugins/plugin-registry.d.ts +3 -2
  153. package/project/plugins/plugin-registry.js +4 -2
  154. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +7 -2
  155. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +3 -1
  156. package/project/sigdb/build.d.ts +131 -0
  157. package/project/sigdb/build.js +628 -0
  158. package/project/sigdb/codec.d.ts +51 -0
  159. package/project/sigdb/codec.js +122 -0
  160. package/project/sigdb/decode.d.ts +58 -0
  161. package/project/sigdb/decode.js +129 -0
  162. package/project/sigdb/decompress.d.ts +44 -0
  163. package/project/sigdb/decompress.js +176 -0
  164. package/project/sigdb/hash.d.ts +9 -0
  165. package/project/sigdb/hash.js +54 -0
  166. package/project/sigdb/index-format.d.ts +40 -0
  167. package/project/sigdb/index-format.js +28 -0
  168. package/project/sigdb/manifest.d.ts +68 -0
  169. package/project/sigdb/manifest.js +146 -0
  170. package/project/sigdb/reader.d.ts +250 -0
  171. package/project/sigdb/reader.js +692 -0
  172. package/project/sigdb/schema.d.ts +196 -0
  173. package/project/sigdb/schema.js +33 -0
  174. package/project/sigdb/sigdb-download.d.ts +65 -0
  175. package/project/sigdb/sigdb-download.js +237 -0
  176. package/project/sigdb/signature-match.d.ts +26 -0
  177. package/project/sigdb/signature-match.js +40 -0
  178. package/project/sigdb/version.d.ts +20 -0
  179. package/project/sigdb/version.js +55 -0
  180. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -3
  181. package/queries/catalog/config-query/config-query-format.d.ts +3 -1
  182. package/queries/catalog/config-query/config-query-format.js +68 -9
  183. package/queries/catalog/dataflow-query/dataflow-query-format.js +11 -1
  184. package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
  185. package/queries/catalog/linter-query/linter-query-executor.d.ts +2 -0
  186. package/queries/catalog/linter-query/linter-query-executor.js +6 -1
  187. package/queries/catalog/linter-query/linter-query-format.d.ts +2 -1
  188. package/queries/catalog/linter-query/linter-query-format.js +40 -8
  189. package/queries/catalog/project-query/project-query-executor.d.ts +15 -0
  190. package/queries/catalog/project-query/project-query-executor.js +96 -4
  191. package/queries/catalog/project-query/project-query-format.d.ts +44 -0
  192. package/queries/catalog/project-query/project-query-format.js +33 -2
  193. package/queries/catalog/signature-query/signature-query-executor.d.ts +29 -0
  194. package/queries/catalog/signature-query/signature-query-executor.js +461 -0
  195. package/queries/catalog/signature-query/signature-query-format.d.ts +138 -0
  196. package/queries/catalog/signature-query/signature-query-format.js +76 -0
  197. package/queries/catalog/signature-query/signature-query-render.d.ts +15 -0
  198. package/queries/catalog/signature-query/signature-query-render.js +155 -0
  199. package/queries/catalog/static-slice-query/static-slice-query-executor.js +9 -3
  200. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +10 -0
  201. package/queries/catalog/static-slice-query/static-slice-query-format.js +19 -1
  202. package/queries/query-print.js +5 -0
  203. package/queries/query.d.ts +10 -1
  204. package/queries/query.js +5 -2
  205. package/r-bridge/init.js +5 -1
  206. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +10 -0
  207. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +55 -0
  208. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +16 -0
  209. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +27 -0
  210. package/r-bridge/lang-4.x/ast/parser/json/format.js +89 -2
  211. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -4
  212. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +2 -1
  213. package/r-bridge/parser.d.ts +2 -0
  214. package/r-bridge/retriever.js +4 -1
  215. package/r-bridge/roxygen2/documentation-provider.js +2 -1
  216. package/r-bridge/shell.d.ts +5 -0
  217. package/r-bridge/shell.js +17 -1
  218. package/reconstruct/inline/source-inline-map.d.ts +48 -0
  219. package/reconstruct/inline/source-inline-map.js +94 -0
  220. package/reconstruct/reconstruct.d.ts +19 -2
  221. package/reconstruct/reconstruct.js +79 -16
  222. package/search/search-executor/search-generators.js +5 -22
  223. package/search/search-executor/search-transformer.js +10 -6
  224. package/slicing/criterion/parse.d.ts +22 -4
  225. package/slicing/criterion/parse.js +125 -18
  226. package/slicing/static/slice-call.d.ts +24 -1
  227. package/slicing/static/slice-call.js +90 -0
  228. package/slicing/static/static-slicer.d.ts +7 -0
  229. package/slicing/static/static-slicer.js +38 -3
  230. package/util/collections/arrays.d.ts +4 -5
  231. package/util/collections/arrays.js +7 -18
  232. package/util/hash.d.ts +14 -0
  233. package/util/hash.js +31 -0
  234. package/util/mermaid/dfg.d.ts +7 -2
  235. package/util/mermaid/dfg.js +53 -13
  236. package/util/r-base-packages.d.ts +19 -0
  237. package/util/r-base-packages.js +72 -0
  238. package/util/r-license.js +2 -10
  239. package/util/r-version.d.ts +45 -15
  240. package/util/r-version.js +97 -36
  241. package/util/range.d.ts +15 -0
  242. package/util/range.js +39 -0
  243. package/util/schema.d.ts +10 -0
  244. package/util/schema.js +22 -0
  245. package/util/text/ansi.d.ts +13 -1
  246. package/util/text/ansi.js +27 -4
  247. package/util/text/args.js +1 -2
  248. package/util/version.js +28 -8
  249. package/data/pkgdb/pkgdb-latest.json.br +0 -0
  250. package/data/pkgdb/pkgdb-tiny.json.br +0 -0
  251. package/documentation/wiki-package-database.d.ts +0 -9
  252. package/documentation/wiki-package-database.js +0 -63
  253. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +0 -63
  254. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +0 -174
  255. package/project/plugins/package-version-plugins/pkgdb.d.ts +0 -133
  256. package/project/plugins/package-version-plugins/pkgdb.js +0 -370
@@ -0,0 +1,12 @@
1
+ import { Identifier, PkgName } from './identifier';
2
+ /**
3
+ * Functions that data-mask their non-first argument: the symbols passed there name columns of the first
4
+ * (data) argument, not variables in scope. The {@link DefaultBuiltinConfig} marks those arguments
5
+ * {@link EdgeType.NonStandardEvaluation|NSE}; the pipe processor ({@link processPipe}) re-applies the same
6
+ * treatment when the data is supplied through `%>%`/`|>` (then every explicit argument is a column).
7
+ */
8
+ export declare const DataMaskingFunctions: readonly (readonly [string, PkgName])[];
9
+ /** The {@link DataMaskingFunctions} as {@link Identifier}s, for the built-in configuration. */
10
+ export declare const DataMaskingFunctionIdentifiers: Identifier[];
11
+ /** Names to treat as data-masking in the pipe: the {@link DataMaskingFunctions} plus `with`/`within` (own processor). */
12
+ export declare const DataMaskingFunctionNames: ReadonlySet<string>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataMaskingFunctionNames = exports.DataMaskingFunctionIdentifiers = exports.DataMaskingFunctions = void 0;
4
+ const identifier_1 = require("./identifier");
5
+ /**
6
+ * Functions that data-mask their non-first argument: the symbols passed there name columns of the first
7
+ * (data) argument, not variables in scope. The {@link DefaultBuiltinConfig} marks those arguments
8
+ * {@link EdgeType.NonStandardEvaluation|NSE}; the pipe processor ({@link processPipe}) re-applies the same
9
+ * treatment when the data is supplied through `%>%`/`|>` (then every explicit argument is a column).
10
+ */
11
+ exports.DataMaskingFunctions = [
12
+ ['subset', "base" /* PkgName.Base */], ['transform', "base" /* PkgName.Base */],
13
+ ['filter', "dplyr" /* PkgName.Dplyr */], ['filter_out', "janitor" /* PkgName.Janitor */],
14
+ ['mutate', "dplyr" /* PkgName.Dplyr */], ['transmute', "dplyr" /* PkgName.Dplyr */],
15
+ ['summarise', "dplyr" /* PkgName.Dplyr */], ['summarize', "dplyr" /* PkgName.Dplyr */],
16
+ ['arrange', "dplyr" /* PkgName.Dplyr */], ['group_by', "dplyr" /* PkgName.Dplyr */],
17
+ ['distinct', "dplyr" /* PkgName.Dplyr */], ['count', "dplyr" /* PkgName.Dplyr */],
18
+ ['tally', "dplyr" /* PkgName.Dplyr */], ['reframe', "dplyr" /* PkgName.Dplyr */],
19
+ ['slice', "dplyr" /* PkgName.Dplyr */], ['slice_head', "dplyr" /* PkgName.Dplyr */],
20
+ ['slice_tail', "dplyr" /* PkgName.Dplyr */], ['slice_min', "dplyr" /* PkgName.Dplyr */],
21
+ ['slice_max', "dplyr" /* PkgName.Dplyr */], ['slice_sample', "dplyr" /* PkgName.Dplyr */],
22
+ ['pull', "dplyr" /* PkgName.Dplyr */], ['rename', "dplyr" /* PkgName.Dplyr */],
23
+ ['relocate', "dplyr" /* PkgName.Dplyr */], ['select', "dplyr" /* PkgName.Dplyr */],
24
+ ['group_split', "dplyr" /* PkgName.Dplyr */], ['add_count', "dplyr" /* PkgName.Dplyr */],
25
+ ['add_tally', "dplyr" /* PkgName.Dplyr */], ['nest_by', "dplyr" /* PkgName.Dplyr */],
26
+ ['pivot_longer', "tidyr" /* PkgName.TidyR */], ['pivot_wider', "tidyr" /* PkgName.TidyR */],
27
+ ['gather', "tidyr" /* PkgName.TidyR */], ['spread', "tidyr" /* PkgName.TidyR */],
28
+ ['separate', "tidyr" /* PkgName.TidyR */], ['separate_rows', "tidyr" /* PkgName.TidyR */],
29
+ ['separate_wider_delim', "tidyr" /* PkgName.TidyR */], ['separate_wider_regex', "tidyr" /* PkgName.TidyR */],
30
+ ['separate_wider_position', "tidyr" /* PkgName.TidyR */], ['unite', "tidyr" /* PkgName.TidyR */],
31
+ ['extract', "tidyr" /* PkgName.TidyR */], ['nest', "tidyr" /* PkgName.TidyR */],
32
+ ['unnest', "tidyr" /* PkgName.TidyR */], ['unnest_longer', "tidyr" /* PkgName.TidyR */],
33
+ ['unnest_wider', "tidyr" /* PkgName.TidyR */], ['hoist', "tidyr" /* PkgName.TidyR */],
34
+ ['chop', "tidyr" /* PkgName.TidyR */], ['unchop', "tidyr" /* PkgName.TidyR */],
35
+ ['pack', "tidyr" /* PkgName.TidyR */], ['unpack', "tidyr" /* PkgName.TidyR */],
36
+ ['drop_na', "tidyr" /* PkgName.TidyR */], ['fill', "tidyr" /* PkgName.TidyR */],
37
+ ['replace_na', "tidyr" /* PkgName.TidyR */], ['complete', "tidyr" /* PkgName.TidyR */],
38
+ ['expand', "tidyr" /* PkgName.TidyR */], ['crossing', "tidyr" /* PkgName.TidyR */],
39
+ ['nesting', "tidyr" /* PkgName.TidyR */], ['expand_grid', "tidyr" /* PkgName.TidyR */],
40
+ ['uncount', "tidyr" /* PkgName.TidyR */]
41
+ ];
42
+ /** The {@link DataMaskingFunctions} as {@link Identifier}s, for the built-in configuration. */
43
+ exports.DataMaskingFunctionIdentifiers = exports.DataMaskingFunctions.map(([name, pkg]) => identifier_1.Identifier.from([name, pkg]));
44
+ /** Names to treat as data-masking in the pipe: the {@link DataMaskingFunctions} plus `with`/`within` (own processor). */
45
+ exports.DataMaskingFunctionNames = new Set([...exports.DataMaskingFunctions.map(([name]) => name), 'with', 'within']);
46
+ //# sourceMappingURL=data-masking-functions.js.map
@@ -6,6 +6,7 @@ import { CascadeAction } from '../../queries/catalog/call-context-query/cascade-
6
6
  import { KnownHooks } from '../hooks';
7
7
  import { Identifier } from './identifier';
8
8
  import { BuiltInProcName } from './built-in-proc-name';
9
+ import { NseArguments } from '../internal/process/functions/call/known-call-handling';
9
10
  /** Which stack environment an env-returning/-transforming builtin denotes (see {@link StackEnvBuiltins}). */
10
11
  export declare enum StackEnvKind {
11
12
  Global = 0,
@@ -101,7 +102,31 @@ export declare const DefaultBuiltinConfig: [{
101
102
  readonly assumePrimitive: true;
102
103
  }, {
103
104
  readonly type: "function";
104
- readonly names: [Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier];
105
+ readonly names: [Identifier];
106
+ readonly processor: BuiltInProcName.DefaultReadAllArgs;
107
+ readonly config: {
108
+ readonly markArgsAsNSE: NseArguments.All;
109
+ };
110
+ readonly assumePrimitive: false;
111
+ }, {
112
+ readonly type: "function";
113
+ readonly names: Identifier[];
114
+ readonly processor: BuiltInProcName.Default;
115
+ readonly config: {
116
+ readonly markArgsAsNSE: NseArguments.AllButFirst;
117
+ };
118
+ readonly assumePrimitive: false;
119
+ }, {
120
+ readonly type: "function";
121
+ readonly names: [Identifier, Identifier, Identifier];
122
+ readonly processor: BuiltInProcName.DefaultReadAllArgs;
123
+ readonly config: {
124
+ readonly markArgsAsNSE: NseArguments.All;
125
+ };
126
+ readonly assumePrimitive: false;
127
+ }, {
128
+ readonly type: "function";
129
+ readonly names: [Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier];
105
130
  readonly processor: BuiltInProcName.DefaultReadAllArgs;
106
131
  readonly config: {};
107
132
  readonly assumePrimitive: true;
@@ -169,6 +194,7 @@ export declare const DefaultBuiltinConfig: [{
169
194
  readonly config: {
170
195
  readonly returnsNthArgument: 0;
171
196
  readonly forceArgs: "all";
197
+ readonly keepArgumentOut: true;
172
198
  readonly hasUnknownSideEffects: {
173
199
  readonly type: "link-to-last-call";
174
200
  readonly callName: RegExp;
@@ -182,8 +208,19 @@ export declare const DefaultBuiltinConfig: [{
182
208
  readonly config: {
183
209
  readonly returnsNthArgument: 0;
184
210
  readonly forceArgs: "all";
211
+ readonly keepArgumentOut: true;
185
212
  };
186
213
  readonly assumePrimitive: true;
214
+ }, {
215
+ readonly type: "function";
216
+ readonly names: [Identifier, Identifier];
217
+ readonly processor: BuiltInProcName.Default;
218
+ readonly config: {
219
+ readonly returnsNthArgument: 0;
220
+ readonly forceArgs: "all";
221
+ readonly keepArgumentOut: true;
222
+ };
223
+ readonly assumePrimitive: false;
187
224
  }, {
188
225
  readonly type: "function";
189
226
  readonly names: string[];
@@ -259,6 +296,7 @@ export declare const DefaultBuiltinConfig: [{
259
296
  readonly processor: BuiltInProcName.Default;
260
297
  readonly config: {
261
298
  readonly returnsNthArgument: 0;
299
+ readonly keepArgumentOut: true;
262
300
  };
263
301
  readonly assumePrimitive: true;
264
302
  }, {
@@ -286,6 +324,7 @@ export declare const DefaultBuiltinConfig: [{
286
324
  readonly config: {
287
325
  readonly hasUnknownSideEffects: true;
288
326
  readonly forceArgs: readonly [true];
327
+ readonly markArgsAsNSE: NseArguments.First;
289
328
  readonly treatAsFnCall: {
290
329
  readonly '.Call': readonly [".NAME"];
291
330
  readonly '.External': readonly [".NAME"];
@@ -339,6 +378,7 @@ export declare const DefaultBuiltinConfig: [{
339
378
  readonly config: {
340
379
  readonly returnsNthArgument: 0;
341
380
  readonly cfg: ExitPointType.Return;
381
+ readonly keepArgumentOut: true;
342
382
  readonly useAsProcessor: BuiltInProcName.Return;
343
383
  };
344
384
  readonly assumePrimitive: true;
@@ -597,6 +637,14 @@ export declare const DefaultBuiltinConfig: [{
597
637
  readonly canBeReplacement: true;
598
638
  };
599
639
  readonly assumePrimitive: true;
640
+ }, {
641
+ readonly type: "function";
642
+ readonly names: [Identifier, Identifier];
643
+ readonly processor: BuiltInProcName.DefineArgument;
644
+ readonly config: {
645
+ readonly superAssignment: true;
646
+ };
647
+ readonly assumePrimitive: false;
600
648
  }, {
601
649
  readonly type: "function";
602
650
  readonly names: [Identifier, Identifier];
@@ -977,23 +1025,6 @@ export declare const DefaultBuiltinConfig: [{
977
1025
  };
978
1026
  readonly ignore: [".names", ".unpack"];
979
1027
  };
980
- }, {
981
- readonly type: "function";
982
- readonly names: [Identifier, Identifier];
983
- readonly processor: BuiltInProcName.PurrrFormula;
984
- readonly config: {
985
- readonly args: {
986
- readonly '.x': {
987
- readonly index: 0;
988
- readonly name: ".data";
989
- };
990
- };
991
- readonly '.f': {
992
- readonly index: 1;
993
- readonly name: "...";
994
- };
995
- readonly ignore: [".by", ".preserve"];
996
- };
997
1028
  }, {
998
1029
  readonly type: "function";
999
1030
  readonly names: [Identifier];
@@ -1184,6 +1215,28 @@ export declare const DefaultBuiltinConfig: [{
1184
1215
  readonly libFn: true;
1185
1216
  };
1186
1217
  readonly assumePrimitive: true;
1218
+ }, {
1219
+ readonly type: "function";
1220
+ readonly names: [Identifier, Identifier];
1221
+ readonly processor: BuiltInProcName.S7MakeConstructor;
1222
+ readonly config: {
1223
+ readonly mode: readonly ["s7"];
1224
+ };
1225
+ readonly assumePrimitive: true;
1226
+ }, {
1227
+ readonly type: "function";
1228
+ readonly names: [Identifier];
1229
+ readonly processor: BuiltInProcName.S7MakeConstructor;
1230
+ readonly config: {
1231
+ readonly mode: readonly ["s4"];
1232
+ };
1233
+ readonly assumePrimitive: true;
1234
+ }, {
1235
+ readonly type: "function";
1236
+ readonly names: [Identifier, Identifier, Identifier];
1237
+ readonly processor: BuiltInProcName.S7MakeConstructor;
1238
+ readonly config: {};
1239
+ readonly assumePrimitive: true;
1187
1240
  }, {
1188
1241
  readonly type: "function";
1189
1242
  readonly names: [Identifier, Identifier];
@@ -1271,7 +1324,7 @@ export declare const DefaultBuiltinConfig: [{
1271
1324
  };
1272
1325
  }, {
1273
1326
  readonly type: "function";
1274
- readonly names: [Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier];
1327
+ readonly names: [Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier];
1275
1328
  readonly processor: BuiltInProcName.Default;
1276
1329
  readonly config: {
1277
1330
  readonly hasUnknownSideEffects: true;
@@ -9,6 +9,8 @@ const unnamed_call_handling_1 = require("../internal/process/functions/call/unna
9
9
  const hooks_1 = require("../hooks");
10
10
  const identifier_1 = require("./identifier");
11
11
  const built_in_proc_name_1 = require("./built-in-proc-name");
12
+ const known_call_handling_1 = require("../internal/process/functions/call/known-call-handling");
13
+ const data_masking_functions_1 = require("./data-masking-functions");
12
14
  /** Which stack environment an env-returning/-transforming builtin denotes (see {@link StackEnvBuiltins}). */
13
15
  var StackEnvKind;
14
16
  (function (StackEnvKind) {
@@ -144,11 +146,34 @@ exports.DefaultBuiltinConfig = [
144
146
  value: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], assumePrimitive: true },
145
147
  { type: 'constant', names: [identifier_1.Identifier.from(['month.name', "base" /* PkgName.Base */])],
146
148
  value: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], assumePrimitive: true },
149
+ /* formula: operands are model terms/columns, not variables (NSE) */
150
+ {
151
+ type: 'function',
152
+ names: [identifier_1.Identifier.from(['~', "base" /* PkgName.Base */])],
153
+ processor: built_in_proc_name_1.BuiltInProcName.DefaultReadAllArgs,
154
+ config: { markArgsAsNSE: known_call_handling_1.NseArguments.All },
155
+ assumePrimitive: false
156
+ },
157
+ /* data-masking: the non-data arguments name columns of the (first) data object, not variables (NSE) */
158
+ {
159
+ type: 'function',
160
+ names: data_masking_functions_1.DataMaskingFunctionIdentifiers,
161
+ processor: built_in_proc_name_1.BuiltInProcName.Default,
162
+ config: { markArgsAsNSE: known_call_handling_1.NseArguments.AllButFirst },
163
+ assumePrimitive: false
164
+ },
165
+ /* data-masking without a data argument, e.g. `aes(x, y)` */
166
+ {
167
+ type: 'function',
168
+ names: [identifier_1.Identifier.from(['aes', "ggplot2" /* PkgName.GgPlot2 */]), identifier_1.Identifier.from(['aes_string', "ggplot2" /* PkgName.GgPlot2 */]), identifier_1.Identifier.from(['vars', "ggplot2" /* PkgName.GgPlot2 */])],
169
+ processor: built_in_proc_name_1.BuiltInProcName.DefaultReadAllArgs,
170
+ config: { markArgsAsNSE: known_call_handling_1.NseArguments.All },
171
+ assumePrimitive: false
172
+ },
147
173
  {
148
174
  type: 'function',
149
175
  names: [
150
176
  /* arithmetic & comparison operators (base) */
151
- identifier_1.Identifier.from(['~', "base" /* PkgName.Base */]),
152
177
  identifier_1.Identifier.from(['+', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['-', "base" /* PkgName.Base */]),
153
178
  identifier_1.Identifier.from(['*', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['/', "base" /* PkgName.Base */]),
154
179
  identifier_1.Identifier.from(['^', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['**', "base" /* PkgName.Base */]),
@@ -182,7 +207,7 @@ exports.DefaultBuiltinConfig = [
182
207
  identifier_1.Identifier.from(['as.data.frame', "base" /* PkgName.Base */]),
183
208
  /* collections & data (base) */
184
209
  identifier_1.Identifier.from(['unique', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['intersect', "base" /* PkgName.Base */]),
185
- identifier_1.Identifier.from(['subset', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['match', "base" /* PkgName.Base */]),
210
+ identifier_1.Identifier.from(['match', "base" /* PkgName.Base */]),
186
211
  identifier_1.Identifier.from(['which', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['any', "base" /* PkgName.Base */]),
187
212
  identifier_1.Identifier.from(['length', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['expression', "base" /* PkgName.Base */]),
188
213
  identifier_1.Identifier.from(['factor', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['missing', "base" /* PkgName.Base */]),
@@ -230,9 +255,11 @@ exports.DefaultBuiltinConfig = [
230
255
  { type: 'function', names: [identifier_1.Identifier.from(['apply', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['tapply', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['Tapply', "functools" /* PkgName.Functools */])],
231
256
  processor: built_in_proc_name_1.BuiltInProcName.Apply, config: { indexOfFunction: 2, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
232
257
  { type: 'function', names: [identifier_1.Identifier.from(['print', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['message', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['warning', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['warn', "rlang" /* PkgName.Rlang */]), identifier_1.Identifier.from(['warn', "R.utils" /* PkgName.Rutils */]), identifier_1.Identifier.from(['info', "msgr" /* PkgName.Msgr */])],
233
- processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, forceArgs: 'all', hasUnknownSideEffects: { type: 'link-to-last-call', callName: /^sink$/ } }, assumePrimitive: false },
258
+ processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, forceArgs: 'all', keepArgumentOut: true, hasUnknownSideEffects: { type: 'link-to-last-call', callName: /^sink$/ } }, assumePrimitive: false },
234
259
  { type: 'function', names: [identifier_1.Identifier.from(['invisible', "base" /* PkgName.Base */])],
235
- processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, forceArgs: 'all' }, assumePrimitive: true },
260
+ processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, forceArgs: 'all', keepArgumentOut: true }, assumePrimitive: true },
261
+ { type: 'function', names: [identifier_1.Identifier.from(['force', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['identity', "base" /* PkgName.Base */])],
262
+ processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, forceArgs: 'all', keepArgumentOut: true }, assumePrimitive: false },
236
263
  // graphics base
237
264
  { type: 'function', names: exports.PlotCreate,
238
265
  processor: built_in_proc_name_1.BuiltInProcName.Default,
@@ -321,7 +348,7 @@ exports.DefaultBuiltinConfig = [
321
348
  }, assumePrimitive: true
322
349
  },
323
350
  { type: 'function', names: ['('],
324
- processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0 }, assumePrimitive: true },
351
+ processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, keepArgumentOut: true }, assumePrimitive: true },
325
352
  { type: 'function', names: [identifier_1.Identifier.from(['load_all', "pkgload" /* PkgName.PkgLoad */]), identifier_1.Identifier.from(['load_all', "devtools" /* PkgName.Devtools */]), identifier_1.Identifier.from(['setwd', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['set.seed', "base" /* PkgName.Base */])],
326
353
  processor: built_in_proc_name_1.BuiltInProcName.Default, config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: false },
327
354
  { type: 'function', names: [identifier_1.Identifier.from(['body', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['formals', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['environment', "base" /* PkgName.Base */])],
@@ -333,6 +360,8 @@ exports.DefaultBuiltinConfig = [
333
360
  config: {
334
361
  hasUnknownSideEffects: true,
335
362
  forceArgs: [true],
363
+ /* first arg names a native routine (useDynLib), not a variable */
364
+ markArgsAsNSE: known_call_handling_1.NseArguments.First,
336
365
  treatAsFnCall: {
337
366
  '.Call': ['.NAME'],
338
367
  '.External': ['.NAME'],
@@ -351,7 +380,7 @@ exports.DefaultBuiltinConfig = [
351
380
  { type: 'function', names: [identifier_1.Identifier.from(['switch', "base" /* PkgName.Base */])],
352
381
  processor: built_in_proc_name_1.BuiltInProcName.Default, config: { forceArgs: [true] }, assumePrimitive: false },
353
382
  { type: 'function', names: ['return'],
354
- processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, cfg: 1 /* ExitPointType.Return */, useAsProcessor: built_in_proc_name_1.BuiltInProcName.Return }, assumePrimitive: true },
383
+ processor: built_in_proc_name_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, cfg: 1 /* ExitPointType.Return */, keepArgumentOut: true, useAsProcessor: built_in_proc_name_1.BuiltInProcName.Return }, assumePrimitive: true },
355
384
  {
356
385
  type: 'function',
357
386
  names: [
@@ -422,6 +451,8 @@ exports.DefaultBuiltinConfig = [
422
451
  processor: built_in_proc_name_1.BuiltInProcName.Assignment, config: { swapSourceAndTarget: true, canBeReplacement: true }, assumePrimitive: true },
423
452
  { type: 'function', names: ['->>'],
424
453
  processor: built_in_proc_name_1.BuiltInProcName.Assignment, config: { superAssignment: true, swapSourceAndTarget: true, canBeReplacement: true }, assumePrimitive: true },
454
+ { type: 'function', names: [identifier_1.Identifier.from(['data', "utils" /* PkgName.Utils */]), identifier_1.Identifier.from(['getHdata', "Hmisc" /* PkgName.Hmisc */])],
455
+ processor: built_in_proc_name_1.BuiltInProcName.DefineArgument, config: { superAssignment: true }, assumePrimitive: false },
425
456
  { type: 'function', names: [identifier_1.Identifier.from(['&&', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['&', "base" /* PkgName.Base */])],
426
457
  processor: built_in_proc_name_1.BuiltInProcName.SpecialBinOp, config: { lazy: true, evalRhsWhen: true }, assumePrimitive: true },
427
458
  { type: 'function', names: [identifier_1.Identifier.from(['||', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['|', "base" /* PkgName.Base */])],
@@ -562,13 +593,6 @@ exports.DefaultBuiltinConfig = [
562
593
  '.f': { index: 1, name: '.fns' },
563
594
  ignore: ['.names', '.unpack']
564
595
  } },
565
- { type: 'function', names: [identifier_1.Identifier.from(['filter', "dplyr" /* PkgName.Dplyr */]), identifier_1.Identifier.from(['filter_out', "janitor" /* PkgName.Janitor */])], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
566
- args: {
567
- '.x': { index: 0, name: '.data' },
568
- },
569
- '.f': { index: 1, name: '...' },
570
- ignore: ['.by', '.preserve']
571
- } },
572
596
  { type: 'function', names: [identifier_1.Identifier.from(['rename_with', "dplyr" /* PkgName.Dplyr */])], processor: built_in_proc_name_1.BuiltInProcName.PurrrFormula, config: {
573
597
  args: {
574
598
  '.x': { index: 0, name: '.data' },
@@ -622,6 +646,16 @@ exports.DefaultBuiltinConfig = [
622
646
  processor: built_in_proc_name_1.BuiltInProcName.S7NewGeneric, config: { args: { name: 'name', dispatchArg: undefined, fun: 'fun' } }, assumePrimitive: true },
623
647
  { type: 'function', names: [identifier_1.Identifier.from(['S7_dispatch', "S7" /* PkgName.S7 */])],
624
648
  processor: built_in_proc_name_1.BuiltInProcName.S7Dispatch, config: { libFn: true }, assumePrimitive: true },
649
+ { type: 'function', names: [
650
+ identifier_1.Identifier.from(['make_constructor', "ggplot2" /* PkgName.GgPlot2 */]),
651
+ identifier_1.Identifier.from(['new_class', "S7" /* PkgName.S7 */])
652
+ ], processor: built_in_proc_name_1.BuiltInProcName.S7MakeConstructor, config: { mode: ['s7'] }, assumePrimitive: true },
653
+ { type: 'function', names: [identifier_1.Identifier.from(['setClass', "methods" /* PkgName.Methods */])],
654
+ processor: built_in_proc_name_1.BuiltInProcName.S7MakeConstructor, config: { mode: ['s4'] }, assumePrimitive: true },
655
+ { type: 'function', names: [
656
+ identifier_1.Identifier.from(['Negate', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['Vectorize', "base" /* PkgName.Base */]),
657
+ identifier_1.Identifier.from(['partial', "purrr" /* PkgName.Purrr */])
658
+ ], processor: built_in_proc_name_1.BuiltInProcName.S7MakeConstructor, config: {}, assumePrimitive: true },
625
659
  { type: 'function', names: [identifier_1.Identifier.from(['.Primitive', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['.Internal', "base" /* PkgName.Base */])],
626
660
  processor: built_in_proc_name_1.BuiltInProcName.Apply, config: { indexOfFunction: 0, unquoteFunction: true, resolveInEnvironment: 'global' }, assumePrimitive: true },
627
661
  { type: 'function', names: [identifier_1.Identifier.from(['interference', "inferference" /* PkgName.Inferference */])],
@@ -662,7 +696,7 @@ exports.DefaultBuiltinConfig = [
662
696
  /* library/require/(require|load|attach)Namespace/use are handled above */
663
697
  identifier_1.Identifier.from(['asNamespace', "base" /* PkgName.Base */]),
664
698
  /* env attachment */
665
- identifier_1.Identifier.from(['unname', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['data', "utils" /* PkgName.Utils */]),
699
+ identifier_1.Identifier.from(['unname', "base" /* PkgName.Base */]),
666
700
  /* file creation/removal (base) */
667
701
  identifier_1.Identifier.from(['dir.create', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['dir_create', "fs" /* PkgName.Fs */]),
668
702
  identifier_1.Identifier.from(['Sys.chmod', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['unlink', "base" /* PkgName.Base */]),
@@ -76,7 +76,7 @@ function diffEnvironment(a, b, info, depth) {
76
76
  });
77
77
  }
78
78
  diffMemory(a, b, { ...info, position: `${info.position}[at level: ${depth}] ` });
79
- diffEnvironment(a.parent, b.parent, { ...info, position: `${info.position}Parents of ${a.id} & ${b.id}. ` }, depth--);
79
+ diffEnvironment(a.parent, b.parent, { ...info, position: `${info.position}Parents of ${a.id} & ${b.id}. ` }, depth - 1);
80
80
  }
81
81
  /**
82
82
  * Compares two REnvironmentInformation objects and reports differences.
@@ -213,8 +213,7 @@ class Environment {
213
213
  const updated = old?.slice() ?? [];
214
214
  for (const v of values) {
215
215
  const { nodeId, definedAt } = v;
216
- const index = updated.find(o => o.nodeId === nodeId && o.definedAt === definedAt);
217
- if (index) {
216
+ if (updated.some(o => o.nodeId === nodeId && o.definedAt === definedAt)) {
218
217
  continue;
219
218
  }
220
219
  if (applyCds === undefined) {
@@ -1,5 +1,5 @@
1
1
  import type { BuiltInIdentifierConstant, BuiltInIdentifierDefinition } from './built-in';
2
- import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
2
+ import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
3
3
  import type { ControlDependency } from '../info';
4
4
  import type { REnvironmentInformation } from './environment';
5
5
  import type { Origin } from '../origin/dfg-get-origin';
@@ -113,12 +113,17 @@ export declare const Identifier: {
113
113
  readonly toArray: (this: void, id: Identifier) => [BrandedIdentifier, BrandedNamespace | undefined, boolean | undefined];
114
114
  /**
115
115
  * The qualified identifier of a call from its dataflow {@link Origin}s (via `getOriginInDfg`), if it
116
- * resolves to an export of a loaded package (the `flowr-pkgdb` info attached by `library()`/`use()`);
116
+ * resolves to an export of a loaded package (the signature-database info attached by `library()`/`use()`);
117
117
  * `undefined` otherwise. With `purrr` loaded, `map()` yields `Identifier.make('map', 'purrr')`.
118
+ *
119
+ * Pass the call's `name` to additionally get *edge-free* base-R qualification: a bare base call is qualified
120
+ * from the base package that exports it (`sd` yields `stats::sd`, `plot` yields `base::plot`) via the
121
+ * precomputed {@link baseRExportOwner} store -- no loaded database, no graph edges. This is suppressed when
122
+ * the call resolves to a user definition or is already namespaced, so a local `sd()` is never `stats::sd`.
118
123
  */
119
- readonly toQualified: (this: void, origins: readonly Origin[] | undefined) => Identifier | undefined;
124
+ readonly toQualified: (this: void, origins: readonly Origin[] | undefined, name?: Identifier) => Identifier | undefined;
120
125
  /** The fully qualified `package::name` of a resolved call (see {@link Identifier.toQualified}). */
121
- readonly toQualifiedName: (this: void, origins: readonly Origin[] | undefined) => string | undefined;
126
+ readonly toQualifiedName: (this: void, origins: readonly Origin[] | undefined, name?: Identifier) => string | undefined;
122
127
  };
123
128
  /**
124
129
  * Well-known R package names used in {@link DefaultBuiltinConfig}.
@@ -141,6 +146,7 @@ export declare const enum PkgName {
141
146
  Fs = "fs",
142
147
  Functools = "functools",
143
148
  GgPlot2 = "ggplot2",
149
+ Hmisc = "Hmisc",
144
150
  Import = "import",
145
151
  Inferference = "inferference",
146
152
  Janitor = "janitor",
@@ -161,6 +167,7 @@ export declare const enum PkgName {
161
167
  S7 = "S7",
162
168
  Soda = "SoDA",
163
169
  Testthat = "testthat",
170
+ TidyR = "tidyr",
164
171
  TinyPlot = "tinyplot",
165
172
  TryCatchLog = "tryCatchLog"
166
173
  }
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReferenceTypeReverseMapping = exports.ReferenceType = exports.Identifier = void 0;
4
4
  exports.isReferenceType = isReferenceType;
5
+ const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
5
6
  const strings_1 = require("../../util/text/strings");
7
+ const r_base_packages_1 = require("../../util/r-base-packages");
6
8
  const dotDotDotAccess = /^\.\.\d+$/;
7
9
  /**
8
10
  * Helper functions to work with {@link Identifier|identifiers}.
@@ -191,25 +193,41 @@ exports.Identifier = {
191
193
  },
192
194
  /**
193
195
  * The qualified identifier of a call from its dataflow {@link Origin}s (via `getOriginInDfg`), if it
194
- * resolves to an export of a loaded package (the `flowr-pkgdb` info attached by `library()`/`use()`);
196
+ * resolves to an export of a loaded package (the signature-database info attached by `library()`/`use()`);
195
197
  * `undefined` otherwise. With `purrr` loaded, `map()` yields `Identifier.make('map', 'purrr')`.
198
+ *
199
+ * Pass the call's `name` to additionally get *edge-free* base-R qualification: a bare base call is qualified
200
+ * from the base package that exports it (`sd` yields `stats::sd`, `plot` yields `base::plot`) via the
201
+ * precomputed {@link baseRExportOwner} store -- no loaded database, no graph edges. This is suppressed when
202
+ * the call resolves to a user definition or is already namespaced, so a local `sd()` is never `stats::sd`.
196
203
  */
197
- toQualified(origins) {
204
+ toQualified(origins, name) {
205
+ let sawUserDefinition = false;
198
206
  for (const origin of origins ?? []) {
199
- // a package-export origin carries the target builtin id `built-in:pkg:func` in `proc`
200
- if ('proc' in origin && origin.proc.startsWith('built-in:')) {
201
- const rest = origin.proc.slice('built-in:'.length);
202
- const sep = rest.indexOf(':'); // base builtins (`built-in:print`) have no separator
203
- if (sep > 0) {
204
- return exports.Identifier.make(rest.slice(sep + 1), rest.slice(0, sep));
207
+ // an attached package export carries the target builtin id `built-in:pkg:func` in `proc`
208
+ if ('proc' in origin) {
209
+ const pkgFn = node_id_1.NodeId.toPkgFn(origin.proc); // [pkg, func], or undefined for a bare/processor-level builtin
210
+ if (pkgFn) {
211
+ return exports.Identifier.make(pkgFn[1], pkgFn[0]);
205
212
  }
206
213
  }
214
+ else {
215
+ sawUserDefinition = true; // a function-call/variable origin: resolves to a user definition
216
+ }
217
+ }
218
+ // only qualify a bare base call: never override a user definition, nor an explicitly namespaced call
219
+ if (name !== undefined && !sawUserDefinition && exports.Identifier.getNamespace(name) === undefined) {
220
+ const bare = exports.Identifier.getName(name);
221
+ const owner = (0, r_base_packages_1.baseRExportOwner)(bare);
222
+ if (owner !== undefined) {
223
+ return exports.Identifier.make(bare, owner);
224
+ }
207
225
  }
208
226
  return undefined;
209
227
  },
210
228
  /** The fully qualified `package::name` of a resolved call (see {@link Identifier.toQualified}). */
211
- toQualifiedName(origins) {
212
- const qualified = exports.Identifier.toQualified(origins);
229
+ toQualifiedName(origins, name) {
230
+ const qualified = exports.Identifier.toQualified(origins, name);
213
231
  return qualified === undefined ? undefined : exports.Identifier.toString(qualified);
214
232
  }
215
233
  };
@@ -47,6 +47,11 @@ function resolveByName(id, environment, target) {
47
47
  }
48
48
  const [name, ns, internal] = identifier_1.Identifier.toArray(id);
49
49
  let current = environment.current;
50
+ /* `current` can already be the built-in environment itself (e.g. `get(x, envir=baseenv())`);
51
+ * it has no parent to walk to, so resolve directly instead of entering the loop below. */
52
+ if (current.builtInEnv) {
53
+ return current.memory.get(name);
54
+ }
50
55
  let definitions = undefined;
51
56
  const wantedType = TargetTypePredicate[target];
52
57
  do {
@@ -57,9 +62,9 @@ function resolveByName(id, environment, target) {
57
62
  let definition;
58
63
  if (target === identifier_1.ReferenceType.S3MethodPrefix || target === identifier_1.ReferenceType.S7MethodPrefix) {
59
64
  // S3 method prefixes only resolve to functions, S3s must not match the exported criteria!
60
- const infix = target === identifier_1.ReferenceType.S3MethodPrefix ? '.' : built_in_s_seven_dispatch_1.S7DispatchSeparator;
65
+ const prefix = name + (target === identifier_1.ReferenceType.S3MethodPrefix ? '.' : built_in_s_seven_dispatch_1.S7DispatchSeparator);
61
66
  definition = current.memory.entries()
62
- .filter(([defName]) => defName.startsWith(name + infix))
67
+ .filter(([defName]) => defName.startsWith(prefix))
63
68
  .flatMap(([, defs]) => defs)
64
69
  .toArray();
65
70
  }
@@ -107,6 +112,15 @@ function resolveByNameAnyType(id, environment) {
107
112
  }
108
113
  }
109
114
  const [name, ns, internal] = identifier_1.Identifier.toArray(id);
115
+ /* `current` can already be the built-in environment itself */
116
+ if (current.builtInEnv) {
117
+ const ret = current.memory.get(name);
118
+ if (ret && cacheable) {
119
+ current.cache ??= new Map();
120
+ current.cache.set(id, ret);
121
+ }
122
+ return ret;
123
+ }
110
124
  let definitions = undefined;
111
125
  do {
112
126
  if (layerSkipped(current, ns)) {
@@ -14,6 +14,7 @@ const named_call_handling_1 = require("./internal/process/functions/call/named-c
14
14
  const make_argument_1 = require("./internal/process/functions/call/argument/make-argument");
15
15
  const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
16
16
  const built_in_source_1 = require("./internal/process/functions/call/built-in/built-in-source");
17
+ const built_in_library_1 = require("./internal/process/functions/call/built-in/built-in-library");
17
18
  const extract_cfg_1 = require("../control-flow/extract-cfg");
18
19
  const edge_1 = require("./graph/edge");
19
20
  const identify_link_to_last_call_relation_1 = require("../queries/catalog/call-context-query/identify-link-to-last-call-relation");
@@ -38,8 +39,8 @@ exports.processors = {
38
39
  [type_1.RType.LineDirective]: process_uninteresting_leaf_1.processUninterestingLeaf,
39
40
  [type_1.RType.Symbol]: process_symbol_1.processSymbol,
40
41
  [type_1.RType.Access]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.operator, [n.accessed, ...n.access]),
41
- [type_1.RType.BinaryOp]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.operator, [n.lhs, n.rhs]),
42
- [type_1.RType.Pipe]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.lexeme, [n.lhs, n.rhs]),
42
+ [type_1.RType.BinaryOp]: process_named_call_1.processChainedCall,
43
+ [type_1.RType.Pipe]: process_named_call_1.processChainedCall,
43
44
  [type_1.RType.UnaryOp]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.operator, [n.operand]),
44
45
  [type_1.RType.ForLoop]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.lexeme, [n.variable, n.vector, n.body]),
45
46
  [type_1.RType.WhileLoop]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.lexeme, [n.condition, n.body]),
@@ -125,10 +126,12 @@ function produceDataFlowGraph(parser, completeAst, ctx) {
125
126
  ctx.files.addConsideredFile(files[0].filePath ? files[0].filePath : flowr_file_1.FlowrFile.INLINE_PATH);
126
127
  const env = ctx.env.makeCleanEnv();
127
128
  env.current.n = ctx.meta.getNamespace();
129
+ // eagerly attach the always-available base-R namespaces, then the project's declared DESCRIPTION dependencies
130
+ const environment = (0, built_in_library_1.attachDeclaredDependencies)((0, built_in_library_1.attachBaseRNamespaces)(env, ctx), ctx);
128
131
  const dfData = {
129
132
  parser,
130
133
  completeAst,
131
- environment: env,
134
+ environment,
132
135
  processors: ctx.config.solver.instrument.dataflowExtractors?.(exports.processors, ctx) ?? exports.processors,
133
136
  cds: undefined,
134
137
  referenceChain: [files[0].filePath],
@@ -42,8 +42,8 @@ export declare const CallGraph: {
42
42
  string: string;
43
43
  mermaid: import("../../util/mermaid/dfg").MermaidGraph;
44
44
  };
45
- readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
46
- readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
45
+ readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
46
+ readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
47
47
  };
48
48
  readonly quads: {
49
49
  readonly convert: typeof import("./quads").df2quads;
@@ -52,8 +52,8 @@ export declare const Dataflow: {
52
52
  string: string;
53
53
  mermaid: import("../../util/mermaid/dfg").MermaidGraph;
54
54
  };
55
- readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
56
- readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
55
+ readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
56
+ readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
57
57
  };
58
58
  readonly quads: {
59
59
  readonly convert: typeof import("./quads").df2quads;
@@ -137,8 +137,8 @@ export declare const Dataflow: {
137
137
  string: string;
138
138
  mermaid: import("../../util/mermaid/dfg").MermaidGraph;
139
139
  };
140
- readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
141
- readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string;
140
+ readonly raw: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
141
+ readonly url: (this: void, graph: DataflowGraph | import("../info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
142
142
  };
143
143
  readonly quads: {
144
144
  readonly convert: typeof import("./quads").df2quads;
@@ -115,8 +115,8 @@ function diffFunctionArguments(fn, a, b, ctx) {
115
115
  */
116
116
  function diffVertices(ctx) {
117
117
  // collect vertices from both sides
118
- const lVert = ctx.left.vertices(true).map(([id, info]) => [id, info]).toArray();
119
- const rVert = ctx.right.vertices(true).map(([id, info]) => [id, info]).toArray();
118
+ const lVert = ctx.left.vertices(true).toArray();
119
+ const rVert = ctx.right.vertices(true).toArray();
120
120
  if (lVert.length < rVert.length && !ctx.config.leftIsSubgraph
121
121
  || lVert.length > rVert.length && !ctx.config.rightIsSubgraph) {
122
122
  ctx.report.addComment(`Detected different number of vertices! ${ctx.leftname} has ${lVert.length}, ${ctx.rightname} has ${rVert.length}`);