@eagleoutice/flowr 2.11.1 → 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 (255) hide show
  1. package/README.md +193 -263
  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/repl/commands/repl-commands.d.ts +1 -0
  12. package/cli/repl/commands/repl-commands.js +66 -15
  13. package/cli/repl/commands/repl-dataflow.js +48 -4
  14. package/cli/repl/commands/repl-main.d.ts +2 -0
  15. package/cli/repl/commands/repl-main.js +5 -0
  16. package/cli/repl/commands/repl-query.d.ts +4 -1
  17. package/cli/repl/commands/repl-query.js +72 -22
  18. package/cli/repl/commands/repl-signature.d.ts +7 -0
  19. package/cli/repl/commands/repl-signature.js +119 -0
  20. package/cli/repl/core.d.ts +8 -1
  21. package/cli/repl/core.js +46 -6
  22. package/cli/repl/ghost-hint.d.ts +37 -0
  23. package/cli/repl/ghost-hint.js +72 -0
  24. package/cli/repl/parser/slice-query-parser.d.ts +11 -1
  25. package/cli/repl/parser/slice-query-parser.js +45 -16
  26. package/cli/repl/print-version.d.ts +2 -4
  27. package/cli/repl/print-version.js +41 -23
  28. package/cli/repl/server/connection.js +19 -17
  29. package/cli/slicer-app.d.ts +2 -0
  30. package/cli/slicer-app.js +3 -3
  31. package/cli/wiki.d.ts +2 -2
  32. package/cli/wiki.js +2 -2
  33. package/config.d.ts +63 -2
  34. package/config.js +64 -8
  35. package/control-flow/cfg-dead-code.js +0 -1
  36. package/control-flow/control-flow-graph.js +6 -6
  37. package/control-flow/diff-cfg.js +2 -2
  38. package/control-flow/semantic-cfg-guided-visitor.js +2 -0
  39. package/core/print/slice-diff-ansi.js +8 -8
  40. package/core/steps/all/core/20-dataflow.d.ts +2 -2
  41. package/core/steps/all/static-slicing/00-slice.d.ts +5 -0
  42. package/core/steps/all/static-slicing/00-slice.js +1 -1
  43. package/core/steps/all/static-slicing/10-reconstruct.d.ts +7 -0
  44. package/core/steps/all/static-slicing/10-reconstruct.js +6 -2
  45. package/core/steps/pipeline/default-pipelines.d.ts +20 -16
  46. package/data/r-base-packages.generated.d.ts +44 -0
  47. package/data/r-base-packages.generated.js +32 -0
  48. package/data/r-base-primitives.generated.d.ts +1 -0
  49. package/data/r-base-primitives.generated.js +15 -0
  50. package/data/sigdb/sigdb.remote.json +112 -0
  51. package/dataflow/environments/built-in-proc-name.d.ts +4 -0
  52. package/dataflow/environments/built-in-proc-name.js +4 -0
  53. package/dataflow/environments/built-in.d.ts +14 -4
  54. package/dataflow/environments/built-in.js +13 -2
  55. package/dataflow/environments/data-masking-functions.d.ts +12 -0
  56. package/dataflow/environments/data-masking-functions.js +46 -0
  57. package/dataflow/environments/default-builtin-config.d.ts +72 -19
  58. package/dataflow/environments/default-builtin-config.js +48 -14
  59. package/dataflow/environments/diff.js +1 -1
  60. package/dataflow/environments/environment.js +1 -2
  61. package/dataflow/environments/identifier.d.ts +11 -4
  62. package/dataflow/environments/identifier.js +28 -10
  63. package/dataflow/environments/resolve-by-name.js +16 -2
  64. package/dataflow/extractor.js +6 -3
  65. package/dataflow/graph/call-graph.d.ts +2 -2
  66. package/dataflow/graph/df-helper.d.ts +4 -4
  67. package/dataflow/graph/diff-dataflow-graph.js +2 -2
  68. package/dataflow/graph/edge.d.ts +3 -3
  69. package/dataflow/graph/edge.js +3 -3
  70. package/dataflow/graph/graph-helper.d.ts +2 -2
  71. package/dataflow/internal/linker.js +1 -1
  72. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +7 -0
  73. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +20 -0
  74. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +1 -0
  75. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -49
  76. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +6 -1
  77. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +7 -1
  78. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +19 -0
  79. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +111 -6
  80. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +13 -0
  81. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -3
  82. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +9 -0
  83. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +19 -0
  84. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +12 -4
  85. package/dataflow/internal/process/functions/call/common.js +8 -1
  86. package/dataflow/internal/process/functions/call/default-call-handling.js +6 -0
  87. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +17 -0
  88. package/dataflow/internal/process/functions/call/known-call-handling.js +32 -0
  89. package/dataflow/internal/process/functions/call/named-call-handling.js +29 -7
  90. package/dataflow/internal/process/functions/process-argument.js +12 -1
  91. package/dataflow/internal/process/process-named-call.d.ts +18 -1
  92. package/dataflow/internal/process/process-named-call.js +94 -0
  93. package/dataflow/processor.d.ts +18 -0
  94. package/documentation/data/faq/faqs.js +5 -1
  95. package/documentation/doc-capabilities.js +1 -1
  96. package/documentation/doc-util/doc-cli-option.d.ts +10 -0
  97. package/documentation/doc-util/doc-cli-option.js +23 -0
  98. package/documentation/doc-util/doc-dfg.js +2 -1
  99. package/documentation/doc-util/doc-query.d.ts +9 -3
  100. package/documentation/doc-util/doc-query.js +9 -4
  101. package/documentation/wiki-dataflow-graph.js +8 -5
  102. package/documentation/wiki-interface.js +3 -1
  103. package/documentation/wiki-linter.js +1 -1
  104. package/documentation/wiki-linting-and-testing.js +4 -1
  105. package/documentation/wiki-mk/doc-context.d.ts +14 -0
  106. package/documentation/wiki-mk/doc-context.js +3 -0
  107. package/documentation/wiki-mk/doc-maker.js +3 -1
  108. package/documentation/wiki-query.js +19 -1
  109. package/documentation/wiki-setup.js +10 -7
  110. package/documentation/wiki-signature-database.d.ts +16 -0
  111. package/documentation/wiki-signature-database.js +293 -0
  112. package/linter/linter-format.d.ts +7 -0
  113. package/linter/linter-rules.d.ts +10 -9
  114. package/linter/rules/naming-convention.d.ts +1 -0
  115. package/linter/rules/naming-convention.js +2 -0
  116. package/linter/rules/no-leaked-credentials.js +1 -2
  117. package/linter/rules/roxygen-arguments.js +18 -5
  118. package/linter/rules/stop-with-call-arg.js +2 -2
  119. package/linter/rules/undefined-symbol-util.d.ts +36 -0
  120. package/linter/rules/undefined-symbol-util.js +149 -0
  121. package/linter/rules/undefined-symbol.d.ts +58 -17
  122. package/linter/rules/undefined-symbol.js +143 -33
  123. package/linter/rules/unused-definition.d.ts +8 -1
  124. package/linter/rules/unused-definition.js +126 -1
  125. package/package.json +22 -10
  126. package/project/context/abstract-flowr-analyzer-context.js +7 -1
  127. package/project/context/flowr-analyzer-context.d.ts +8 -0
  128. package/project/context/flowr-analyzer-context.js +10 -0
  129. package/project/context/flowr-analyzer-dependencies-context.d.ts +28 -4
  130. package/project/context/flowr-analyzer-dependencies-context.js +51 -2
  131. package/project/context/flowr-analyzer-files-context.d.ts +1 -0
  132. package/project/context/flowr-analyzer-files-context.js +2 -1
  133. package/project/context/flowr-analyzer-functions-context.js +1 -1
  134. package/project/context/flowr-file.d.ts +5 -0
  135. package/project/context/flowr-file.js +5 -0
  136. package/project/flowr-analyzer-builder.js +12 -2
  137. package/project/plugins/file-plugins/files/flowr-description-file.js +6 -3
  138. package/project/plugins/file-plugins/files/flowr-namespace-file.js +9 -3
  139. package/project/plugins/file-plugins/files/flowr-news-file.js +1 -3
  140. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +26 -0
  141. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +39 -0
  142. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
  143. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -2
  144. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -0
  145. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +18 -2
  146. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +19 -0
  147. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +120 -0
  148. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +518 -0
  149. package/project/plugins/package-version-plugins/package.d.ts +5 -3
  150. package/project/plugins/package-version-plugins/package.js +27 -25
  151. package/project/plugins/plugin-registry.d.ts +3 -2
  152. package/project/plugins/plugin-registry.js +4 -2
  153. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +7 -2
  154. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +3 -1
  155. package/project/sigdb/build.d.ts +131 -0
  156. package/project/sigdb/build.js +628 -0
  157. package/project/sigdb/codec.d.ts +51 -0
  158. package/project/sigdb/codec.js +122 -0
  159. package/project/sigdb/decode.d.ts +58 -0
  160. package/project/sigdb/decode.js +129 -0
  161. package/project/sigdb/decompress.d.ts +44 -0
  162. package/project/sigdb/decompress.js +176 -0
  163. package/project/sigdb/hash.d.ts +9 -0
  164. package/project/sigdb/hash.js +54 -0
  165. package/project/sigdb/index-format.d.ts +40 -0
  166. package/project/sigdb/index-format.js +28 -0
  167. package/project/sigdb/manifest.d.ts +68 -0
  168. package/project/sigdb/manifest.js +146 -0
  169. package/project/sigdb/reader.d.ts +250 -0
  170. package/project/sigdb/reader.js +692 -0
  171. package/project/sigdb/schema.d.ts +196 -0
  172. package/project/sigdb/schema.js +33 -0
  173. package/project/sigdb/sigdb-download.d.ts +65 -0
  174. package/project/sigdb/sigdb-download.js +237 -0
  175. package/project/sigdb/signature-match.d.ts +26 -0
  176. package/project/sigdb/signature-match.js +40 -0
  177. package/project/sigdb/version.d.ts +20 -0
  178. package/project/sigdb/version.js +55 -0
  179. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -3
  180. package/queries/catalog/config-query/config-query-format.d.ts +3 -1
  181. package/queries/catalog/config-query/config-query-format.js +68 -9
  182. package/queries/catalog/dataflow-query/dataflow-query-format.js +11 -1
  183. package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
  184. package/queries/catalog/linter-query/linter-query-executor.d.ts +2 -0
  185. package/queries/catalog/linter-query/linter-query-executor.js +6 -1
  186. package/queries/catalog/linter-query/linter-query-format.d.ts +2 -1
  187. package/queries/catalog/linter-query/linter-query-format.js +40 -8
  188. package/queries/catalog/project-query/project-query-executor.d.ts +15 -0
  189. package/queries/catalog/project-query/project-query-executor.js +96 -4
  190. package/queries/catalog/project-query/project-query-format.d.ts +44 -0
  191. package/queries/catalog/project-query/project-query-format.js +33 -2
  192. package/queries/catalog/signature-query/signature-query-executor.d.ts +29 -0
  193. package/queries/catalog/signature-query/signature-query-executor.js +461 -0
  194. package/queries/catalog/signature-query/signature-query-format.d.ts +138 -0
  195. package/queries/catalog/signature-query/signature-query-format.js +76 -0
  196. package/queries/catalog/signature-query/signature-query-render.d.ts +15 -0
  197. package/queries/catalog/signature-query/signature-query-render.js +155 -0
  198. package/queries/catalog/static-slice-query/static-slice-query-executor.js +9 -3
  199. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +10 -0
  200. package/queries/catalog/static-slice-query/static-slice-query-format.js +19 -1
  201. package/queries/query-print.js +5 -0
  202. package/queries/query.d.ts +10 -1
  203. package/queries/query.js +5 -2
  204. package/r-bridge/init.js +5 -1
  205. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +10 -0
  206. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +55 -0
  207. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +16 -0
  208. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +27 -0
  209. package/r-bridge/lang-4.x/ast/parser/json/format.js +89 -2
  210. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -4
  211. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +2 -1
  212. package/r-bridge/parser.d.ts +2 -0
  213. package/r-bridge/retriever.js +4 -1
  214. package/r-bridge/roxygen2/documentation-provider.js +2 -1
  215. package/r-bridge/shell.d.ts +5 -0
  216. package/r-bridge/shell.js +17 -1
  217. package/reconstruct/inline/source-inline-map.d.ts +48 -0
  218. package/reconstruct/inline/source-inline-map.js +94 -0
  219. package/reconstruct/reconstruct.d.ts +19 -2
  220. package/reconstruct/reconstruct.js +79 -16
  221. package/search/search-executor/search-generators.js +5 -22
  222. package/search/search-executor/search-transformer.js +10 -6
  223. package/slicing/criterion/parse.d.ts +22 -4
  224. package/slicing/criterion/parse.js +125 -18
  225. package/slicing/static/slice-call.d.ts +24 -1
  226. package/slicing/static/slice-call.js +90 -0
  227. package/slicing/static/static-slicer.d.ts +7 -0
  228. package/slicing/static/static-slicer.js +38 -3
  229. package/util/collections/arrays.d.ts +4 -5
  230. package/util/collections/arrays.js +7 -18
  231. package/util/hash.d.ts +14 -0
  232. package/util/hash.js +31 -0
  233. package/util/mermaid/dfg.d.ts +7 -2
  234. package/util/mermaid/dfg.js +53 -13
  235. package/util/r-base-packages.d.ts +19 -0
  236. package/util/r-base-packages.js +72 -0
  237. package/util/r-license.js +2 -10
  238. package/util/r-version.d.ts +45 -15
  239. package/util/r-version.js +97 -36
  240. package/util/range.d.ts +15 -0
  241. package/util/range.js +39 -0
  242. package/util/schema.d.ts +10 -0
  243. package/util/schema.js +22 -0
  244. package/util/text/ansi.d.ts +3 -0
  245. package/util/text/ansi.js +10 -0
  246. package/util/text/args.js +1 -2
  247. package/util/version.js +28 -8
  248. package/data/pkgdb/pkgdb-latest.json.br +0 -0
  249. package/data/pkgdb/pkgdb-tiny.json.br +0 -0
  250. package/documentation/wiki-package-database.d.ts +0 -9
  251. package/documentation/wiki-package-database.js +0 -63
  252. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +0 -63
  253. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +0 -176
  254. package/project/plugins/package-version-plugins/pkgdb.d.ts +0 -133
  255. package/project/plugins/package-version-plugins/pkgdb.js +0 -370
package/cli/slicer-app.js CHANGED
@@ -22,6 +22,7 @@ const options = (0, script_1.processCommandLineArgs)('slicer', ['input', 'criter
22
22
  // why double escaped :C
23
23
  '{bold -c} {italic "3@a"} {bold -r} {italic "a <- 3\\\\nb <- 4\\\\nprint(a)"} {bold --diff}',
24
24
  '{bold -i} {italic example.R} {bold --stats} {bold --criterion} {italic "8:3;3:1;12@product"}',
25
+ '{bold -c} {italic "5@result"} {bold --inline} {italic main.R}',
25
26
  '{bold --help}'
26
27
  ]
27
28
  });
@@ -32,7 +33,7 @@ async function getSlice() {
32
33
  const config = config_1.FlowrConfig.fromFile();
33
34
  await slicer.init(options['input-is-text']
34
35
  ? { request: 'text', content: options.input.replaceAll('\\n', '\n') }
35
- : { request: 'file', content: options.input }, config, options['no-magic-comments'] ? auto_select_defaults_1.doNotAutoSelect : (0, magic_comments_1.makeMagicCommentHandler)(auto_select_defaults_1.doNotAutoSelect));
36
+ : { request: 'file', content: options.input }, config, options['no-magic-comments'] ? auto_select_defaults_1.doNotAutoSelect : (0, magic_comments_1.makeMagicCommentHandler)(auto_select_defaults_1.doNotAutoSelect), undefined, options.inline, options['include-callees']);
36
37
  let mappedSlices = [];
37
38
  let reconstruct = undefined;
38
39
  const doSlicing = options.criterion.trim() !== '';
@@ -76,8 +77,7 @@ async function getSlice() {
76
77
  if (doSlicing && options.diff) {
77
78
  let originalCode = options.input;
78
79
  if (!options['input-is-text']) {
79
- const request = { request: 'file', content: options.input };
80
- originalCode = request.request === 'text' ? request.content : fs_1.default.readFileSync(request.content).toString();
80
+ originalCode = fs_1.default.readFileSync(options.input).toString();
81
81
  }
82
82
  console.log((0, slice_diff_ansi_1.sliceDiffAnsi)(slice.result, normalize, new Set(mappedSlices.map(({ id }) => id)), originalCode));
83
83
  }
package/cli/wiki.d.ts CHANGED
@@ -10,8 +10,8 @@ import { WikiSetup } from '../documentation/wiki-setup';
10
10
  import { WikiOverview } from '../documentation/wiki-overview';
11
11
  import { WikiAbsint } from '../documentation/wiki-absint';
12
12
  import { WikiCreateLintingRules } from '../documentation/wiki-create-linting-rules';
13
- import { WikiPackageDatabase } from '../documentation/wiki-package-database';
14
- export declare const AllWikiDocuments: [WikiFaq, WikiSearch, WikiCfg, WikiQuery, WikiOnboarding, WikiAnalyzer, WikiEngine, WikiNormalizedAst, WikiCore, WikiSetup, WikiOverview, WikiInterface, WikiDataflowGraph, WikiLintingAndTesting, WikiLinter, WikiAbsint, WikiCreateLintingRules, WikiPackageDatabase, IssueLintingRule, DocReadme, DocCapabilities];
13
+ import { WikiSignatureDatabase } from '../documentation/wiki-signature-database';
14
+ export declare const AllWikiDocuments: [WikiFaq, WikiSearch, WikiCfg, WikiQuery, WikiOnboarding, WikiAnalyzer, WikiEngine, WikiNormalizedAst, WikiCore, WikiSetup, WikiOverview, WikiInterface, WikiDataflowGraph, WikiLintingAndTesting, WikiLinter, WikiAbsint, WikiCreateLintingRules, WikiSignatureDatabase, IssueLintingRule, DocReadme, DocCapabilities];
15
15
  export type ValidWikiDocumentTargets = ReturnType<typeof AllWikiDocuments[number]['getTarget']>;
16
16
  export type ValidWikiDocumentTargetsNoSuffix = ValidWikiDocumentTargets extends `${infer Name}.${string}` ? Name : never;
17
17
  /**
package/cli/wiki.js CHANGED
@@ -28,7 +28,7 @@ const wiki_setup_1 = require("../documentation/wiki-setup");
28
28
  const wiki_overview_1 = require("../documentation/wiki-overview");
29
29
  const wiki_absint_1 = require("../documentation/wiki-absint");
30
30
  const wiki_create_linting_rules_1 = require("../documentation/wiki-create-linting-rules");
31
- const wiki_package_database_1 = require("../documentation/wiki-package-database");
31
+ const wiki_signature_database_1 = require("../documentation/wiki-signature-database");
32
32
  exports.AllWikiDocuments = [
33
33
  new wiki_faq_1.WikiFaq(),
34
34
  new documentation_1.WikiSearch(),
@@ -47,7 +47,7 @@ exports.AllWikiDocuments = [
47
47
  new wiki_linter_1.WikiLinter(),
48
48
  new wiki_absint_1.WikiAbsint(),
49
49
  new wiki_create_linting_rules_1.WikiCreateLintingRules(),
50
- new wiki_package_database_1.WikiPackageDatabase(),
50
+ new wiki_signature_database_1.WikiSignatureDatabase(),
51
51
  new issue_linting_rule_1.IssueLintingRule(),
52
52
  new doc_readme_1.DocReadme(),
53
53
  new documentation_1.DocCapabilities()
package/config.d.ts CHANGED
@@ -16,6 +16,18 @@ export declare enum VariableResolve {
16
16
  /** Only resolve directly assigned builtin constants */
17
17
  Builtin = "builtin"
18
18
  }
19
+ /**
20
+ * How a constrained dependency (e.g. `Imports: quantmod (>= 0.4-9)`) is resolved to a concrete version
21
+ * against the signature database (see `solver.sigdb.versionSelection`).
22
+ */
23
+ export declare enum VersionSelection {
24
+ /** Resolve to the newest version satisfying the constraint (default; preserves the historic behavior). */
25
+ Newest = "newest",
26
+ /** Resolve to the oldest version satisfying the constraint. */
27
+ Oldest = "oldest",
28
+ /** Resolve to the version installed on the analyzing system (needs R; falls back to `newest` when unavailable). */
29
+ System = "system"
30
+ }
19
31
  /**
20
32
  * How to infer the working directory from a script
21
33
  */
@@ -117,12 +129,19 @@ export interface FlowrConfig extends MergeableRecord {
117
129
  quickStats: boolean;
118
130
  /** This instruments the dataflow processors to count how often each processor is called */
119
131
  dfProcessorHeat: boolean;
132
+ /** Whether to show dim inline hints (e.g. `:help`) on the empty prompt; automatically disabled on non-interactive terminals */
133
+ hints: boolean;
120
134
  /** Plugins to load in REPL mode */
121
135
  plugins: (ConfigPlugin<string> | 'flowr:default')[];
122
136
  };
123
137
  readonly project: {
124
138
  /** Whether to resolve unknown paths loaded by the r project disk when trying to source/analyze files */
125
139
  resolveUnknownPathsOnDisk: boolean;
140
+ /**
141
+ * The packages considered part of R itself, used e.g. by the project query to classify dependencies. If
142
+ * unset, flowR derives them (for the assumed R version) from the signature database via `baseRPackages`.
143
+ */
144
+ basePackages?: string[];
126
145
  };
127
146
  /**
128
147
  * The engines to use for interacting with R code. Currently, supports {@link TreeSitterEngineConfig} and {@link RShellEngineConfig}.
@@ -149,14 +168,42 @@ export interface FlowrConfig extends MergeableRecord {
149
168
  * When disabled all envir-style calls fall through to the conservative global treatment.
150
169
  */
151
170
  readonly trackEnvironments: boolean;
152
- /** Resolving `library()`/`use()` exports from a package database (e.g. the bundled `flowr-pkgdb`). */
153
- readonly pkgdb: {
171
+ /** Resolving `library()`/`use()` exports from a signature database (e.g. the bundled `flowr-sigdb`). */
172
+ readonly sigdb: {
154
173
  /** Resolve library exports from a package database (default `true`); when `false` no database is consulted. */
155
174
  readonly enabled: boolean;
175
+ /** Load the project's declared dependencies from its metadata files (`DESCRIPTION` Imports/Depends, `renv.lock`, `rv.lock`) into the dependency context (default `true`); when `false` these files are not read, so neither the undefined-symbol linter nor {@link linkDescriptionDependencies} sees any project-declared dependency. */
176
+ readonly loadProjectDependencies: boolean;
156
177
  /** Parse the database up front rather than on the first package load (default `false`, ignored if disabled). */
157
178
  readonly eagerlyLoad: boolean;
158
179
  /** Add a vertex for every export on load rather than on demand (default `false`); keeps the graph small. */
159
180
  readonly eagerlyLoadExports: boolean;
181
+ /**
182
+ * The R version analysis assumes when resolving versioned (base-R) package exports: a pin like `"4.5"`,
183
+ * or `"auto"` to detect the locally installed R (falling back to {@link DefaultAssumedRVersion} when the
184
+ * engine reports none, e.g. the tree-sitter engine). Resolve it with {@link resolveAssumedRVersion}.
185
+ */
186
+ readonly assumedRVersion?: string;
187
+ /** Eagerly attach base-R namespaces (from a signature database) so bare base calls resolve without `library()` (default `false`; changes every analysis; needs a base-R signature database). */
188
+ readonly linkBaseR: boolean;
189
+ /** Eagerly attach the namespaces of the project's declared `DESCRIPTION` dependencies (Imports/Depends) so their exports resolve without an explicit `library()` (default `false`; changes every analysis; needs a signature database resolving the declared packages). */
190
+ readonly linkDescriptionDependencies: boolean;
191
+ /** Add a lightweight `Reads` edge from a bare base-R call to its signature-database function vertex (`built-in:pkg:fn`); base-R qualification stays edge-free unless this is on (default `false`; adds edges to every base call). */
192
+ readonly linkBaseRCalls?: boolean;
193
+ /** Add a lightweight `Reads` edge from a resolved package call (`pkg::fn`/attached export) to its signature-database function vertex (default `false`). */
194
+ readonly linkPackageCalls?: boolean;
195
+ /** Decompress the hot shards (base + most-downloaded) in a background task on startup, so the first `library()` lookup is warm (default `false`; useful for long-running servers/REPLs, not one-shot runs). */
196
+ readonly warmInBackground?: boolean;
197
+ /** Extra directories (or bundle/manifest files) searched for signature databases, alongside the shipped default and `$FLOWR_SIGDB_DIR`. A downloaded full-history bundle placed here is mounted automatically. */
198
+ readonly additionalPaths?: string[];
199
+ /** GitHub `owner/repo` the full-history bundle is downloaded from (`:signature download`); default `flowr-analysis/flowr`, release tag `sigdb-v<flowR-version>`. */
200
+ readonly downloadRepo?: string;
201
+ /** On startup, compare the cache against the committed `sigdb.remote.json` link file and re-download changed shards in the background (default `false`; needs network, so opt-in — a `git pull` that updates the pointer then re-syncs automatically). */
202
+ readonly autoSync?: boolean;
203
+ /** When a project constrains a dependency, resolve to the `newest` (default) or `oldest` version satisfying the constraint, or the `system`-installed version (needs R; falls back to `newest` when unavailable). Base-R packages always resolve against the assumed R version. */
204
+ readonly versionSelection?: VersionSelection;
205
+ /** Force an exact version for specific packages (mapping a package name to a version), overriding both the project constraint and the {@link versionSelection} policy; a version missing from the database falls back with a warning (default `{}`). */
206
+ readonly versionOverrides?: Record<string, string>;
160
207
  };
161
208
  /** These keys are only intended for use within code, allowing to instrument the dataflow analyzer! */
162
209
  readonly instrument: {
@@ -230,6 +277,20 @@ export interface FlowrConfig extends MergeableRecord {
230
277
  export type ValidFlowrConfigPaths = Paths<FlowrConfig, {
231
278
  depth: 9;
232
279
  }>;
280
+ /** Whether library exports should be resolved from a signature database (`solver.sigdb.enabled`). */
281
+ export declare function isSigDbEnabled(config: FlowrConfig | undefined): boolean;
282
+ /**
283
+ * R version assumed for analysis when `solver.sigdb.assumedRVersion` is `"auto"` and none could be detected.
284
+ * Kept in step with the newest base-R release in the bundled sigdb (see `newestRVersion` in the generated
285
+ * base-package cache) so the default hits the precomputed base-package fast path.
286
+ */
287
+ export declare const DefaultAssumedRVersion = "4.5.3";
288
+ /**
289
+ * The R version analysis should assume when resolving versioned (base-R) exports (see `solver.sigdb.assumedRVersion`):
290
+ * an explicit pin wins, otherwise a real `detected` version (from the engine's `rVersion()`, ignoring `none`/`unknown`),
291
+ * otherwise {@link DefaultAssumedRVersion}. Pure and synchronous, so a resolver can call it per lookup.
292
+ */
293
+ export declare function resolveAssumedRVersion(config: FlowrConfig | undefined, detected?: string): string;
233
294
  export interface TreeSitterEngineConfig extends MergeableRecord {
234
295
  readonly type: 'tree-sitter';
235
296
  /**
package/config.js CHANGED
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FlowrConfig = exports.FlowrDefaultPlugins = exports.DropPathsOption = exports.InferWorkingDirectory = exports.VariableResolve = void 0;
6
+ exports.FlowrConfig = exports.FlowrDefaultPlugins = exports.DefaultAssumedRVersion = exports.DropPathsOption = exports.InferWorkingDirectory = exports.VersionSelection = exports.VariableResolve = void 0;
7
+ exports.isSigDbEnabled = isSigDbEnabled;
8
+ exports.resolveAssumedRVersion = resolveAssumedRVersion;
7
9
  const objects_1 = require("./util/objects");
8
10
  const path_1 = __importDefault(require("path"));
9
11
  const fs_1 = __importDefault(require("fs"));
@@ -21,6 +23,19 @@ var VariableResolve;
21
23
  /** Only resolve directly assigned builtin constants */
22
24
  VariableResolve["Builtin"] = "builtin";
23
25
  })(VariableResolve || (exports.VariableResolve = VariableResolve = {}));
26
+ /**
27
+ * How a constrained dependency (e.g. `Imports: quantmod (>= 0.4-9)`) is resolved to a concrete version
28
+ * against the signature database (see `solver.sigdb.versionSelection`).
29
+ */
30
+ var VersionSelection;
31
+ (function (VersionSelection) {
32
+ /** Resolve to the newest version satisfying the constraint (default; preserves the historic behavior). */
33
+ VersionSelection["Newest"] = "newest";
34
+ /** Resolve to the oldest version satisfying the constraint. */
35
+ VersionSelection["Oldest"] = "oldest";
36
+ /** Resolve to the version installed on the analyzing system (needs R; falls back to `newest` when unavailable). */
37
+ VersionSelection["System"] = "system";
38
+ })(VersionSelection || (exports.VersionSelection = VersionSelection = {}));
24
39
  /**
25
40
  * How to infer the working directory from a script
26
41
  */
@@ -47,6 +62,31 @@ var DropPathsOption;
47
62
  /** try to drop every folder of the path */
48
63
  DropPathsOption["All"] = "all";
49
64
  })(DropPathsOption || (exports.DropPathsOption = DropPathsOption = {}));
65
+ /** Whether library exports should be resolved from a signature database (`solver.sigdb.enabled`). */
66
+ function isSigDbEnabled(config) {
67
+ return config?.solver.sigdb.enabled === true;
68
+ }
69
+ /**
70
+ * R version assumed for analysis when `solver.sigdb.assumedRVersion` is `"auto"` and none could be detected.
71
+ * Kept in step with the newest base-R release in the bundled sigdb (see `newestRVersion` in the generated
72
+ * base-package cache) so the default hits the precomputed base-package fast path.
73
+ */
74
+ exports.DefaultAssumedRVersion = '4.5.3';
75
+ /**
76
+ * The R version analysis should assume when resolving versioned (base-R) exports (see `solver.sigdb.assumedRVersion`):
77
+ * an explicit pin wins, otherwise a real `detected` version (from the engine's `rVersion()`, ignoring `none`/`unknown`),
78
+ * otherwise {@link DefaultAssumedRVersion}. Pure and synchronous, so a resolver can call it per lookup.
79
+ */
80
+ function resolveAssumedRVersion(config, detected) {
81
+ const assumed = config?.solver.sigdb.assumedRVersion;
82
+ if (assumed && assumed !== 'auto') {
83
+ return assumed;
84
+ }
85
+ if (detected && detected !== 'none' && detected !== 'unknown') {
86
+ return detected;
87
+ }
88
+ return exports.DefaultAssumedRVersion;
89
+ }
50
90
  const defaultEngineConfigs = {
51
91
  'tree-sitter': { type: 'tree-sitter' },
52
92
  'r-shell': { type: 'r-shell' }
@@ -54,13 +94,14 @@ const defaultEngineConfigs = {
54
94
  exports.FlowrDefaultPlugins = [
55
95
  'file:description',
56
96
  'versions:description',
57
- 'versions:pkgdb',
97
+ 'versions:sigdb',
58
98
  'versions:renv',
59
99
  'versions:rv',
60
100
  'loading-order:description',
61
101
  'meta:description',
62
102
  'files:vignette',
63
103
  'files:test',
104
+ 'files:inst',
64
105
  'file:rmd',
65
106
  'file:qmd',
66
107
  'file:rnw',
@@ -94,6 +135,7 @@ exports.FlowrConfig = {
94
135
  repl: {
95
136
  quickStats: false,
96
137
  dfProcessorHeat: false,
138
+ hints: true,
97
139
  plugins: ['flowr:default'],
98
140
  },
99
141
  project: {
@@ -105,7 +147,7 @@ exports.FlowrConfig = {
105
147
  variables: VariableResolve.Alias,
106
148
  evalStrings: true,
107
149
  trackEnvironments: true,
108
- pkgdb: { enabled: true, eagerlyLoad: false, eagerlyLoadExports: false },
150
+ sigdb: { enabled: true, loadProjectDependencies: true, eagerlyLoad: false, eagerlyLoadExports: false, assumedRVersion: 'auto', linkBaseR: false, linkDescriptionDependencies: false, linkBaseRCalls: false, linkPackageCalls: false, warmInBackground: false, additionalPaths: [], autoSync: false, versionSelection: VersionSelection.Newest, versionOverrides: {} },
109
151
  resolveSource: {
110
152
  dropPaths: DropPathsOption.No,
111
153
  ignoreCapitalization: true,
@@ -157,10 +199,12 @@ exports.FlowrConfig = {
157
199
  repl: joi_1.default.object({
158
200
  quickStats: joi_1.default.boolean().optional().description('Whether to show quick stats in the REPL after each evaluation.'),
159
201
  dfProcessorHeat: joi_1.default.boolean().optional().description('This instruments the dataflow processors to count how often each processor is called.'),
202
+ hints: joi_1.default.boolean().optional().description('Whether to show dim inline hints on the empty prompt (automatically disabled on non-interactive terminals).'),
160
203
  plugins: joi_1.default.array().items(joi_1.default.alternatives().try(joi_1.default.string(), joi_1.default.array().ordered(joi_1.default.string(), joi_1.default.array().items(joi_1.default.any())).length(2))).optional().description('The plugins to load in REPL mode')
161
204
  }).description('Configuration options for the REPL.'),
162
205
  project: joi_1.default.object({
163
- resolveUnknownPathsOnDisk: joi_1.default.boolean().optional().description('Whether to resolve unknown paths loaded by the r project disk when trying to source/analyze files.')
206
+ resolveUnknownPathsOnDisk: joi_1.default.boolean().optional().description('Whether to resolve unknown paths loaded by the r project disk when trying to source/analyze files.'),
207
+ basePackages: joi_1.default.array().items(joi_1.default.string()).optional().description('The packages considered part of R itself (base and recommended); if unset, flowR uses its built-in list.')
164
208
  }).description('Project specific configuration options.'),
165
209
  engines: joi_1.default.array().items(joi_1.default.alternatives(joi_1.default.object({
166
210
  type: joi_1.default.string().required().valid('tree-sitter').description('Use the tree sitter engine.'),
@@ -176,11 +220,23 @@ exports.FlowrConfig = {
176
220
  variables: joi_1.default.string().valid(...Object.values(VariableResolve)).description('How to resolve variables and their values.'),
177
221
  evalStrings: joi_1.default.boolean().description('Should we include eval(parse(text="...")) calls in the dataflow graph?'),
178
222
  trackEnvironments: joi_1.default.boolean().optional().description('Track user-created environments (new.env, assign/get/local with envir=, dollar-assign, attach). When false, all envir-style calls fall through conservatively.'),
179
- pkgdb: joi_1.default.object({
180
- enabled: joi_1.default.boolean().optional().description('Resolve library()/use() exports from a package database (default true); when false no database is consulted.'),
223
+ sigdb: joi_1.default.object({
224
+ enabled: joi_1.default.boolean().optional().description('Resolve library()/use() exports from a signature database (default true); when false no database is consulted.'),
225
+ loadProjectDependencies: joi_1.default.boolean().optional().description('Load the project\'s declared dependencies from its metadata files (DESCRIPTION Imports/Depends, renv.lock, rv.lock) (default true); when false these files are not read for dependencies.'),
181
226
  eagerlyLoad: joi_1.default.boolean().optional().description('Parse the database up front rather than on the first package load (default false, ignored if disabled).'),
182
- eagerlyLoadExports: joi_1.default.boolean().optional().description('Add a vertex for every export on load rather than on demand (default false); keeps the dataflow graph small.')
183
- }).description('Resolving library exports from a package database.'),
227
+ eagerlyLoadExports: joi_1.default.boolean().optional().description('Add a vertex for every export on load rather than on demand (default false); keeps the dataflow graph small.'),
228
+ assumedRVersion: joi_1.default.string().optional().description('R version assumed when resolving versioned (base-R) exports: a pin like "4.5" or "auto" to detect the installed R (default "auto").'),
229
+ linkBaseR: joi_1.default.boolean().optional().description('Eagerly attach base-R namespaces so bare base calls resolve without library() (default false).'),
230
+ linkBaseRCalls: joi_1.default.boolean().optional().description('Add a lightweight Reads edge from a bare base-R call to its signature-database function vertex (default false; base-R qualification is edge-free otherwise).'),
231
+ linkPackageCalls: joi_1.default.boolean().optional().description('Add a lightweight Reads edge from a resolved package call to its signature-database function vertex (default false).'),
232
+ linkDescriptionDependencies: joi_1.default.boolean().optional().description('Eagerly attach the namespaces of the project\'s declared DESCRIPTION dependencies (Imports/Depends) so their exports resolve without an explicit library() (default false).'),
233
+ warmInBackground: joi_1.default.boolean().optional().description('Decompress the hot shards (base + most-downloaded) in a background task on startup so the first library() lookup is warm (default false; for long-running servers/REPLs).'),
234
+ additionalPaths: joi_1.default.array().items(joi_1.default.string()).optional().description('Extra directories or bundle/manifest files searched for signature databases (alongside the shipped default and $FLOWR_SIGDB_DIR); a downloaded full-history bundle placed here is mounted automatically.'),
235
+ downloadRepo: joi_1.default.string().optional().description('GitHub owner/repo the full-history bundle is downloaded from via ":signature download" (default "flowr-analysis/flowr", release tag "sigdb-v<flowR-version>").'),
236
+ autoSync: joi_1.default.boolean().optional().description('On startup, re-download shards whose committed sigdb.remote.json hash no longer matches the cache, in the background (default false; opt-in network sync after a git pull).'),
237
+ versionSelection: joi_1.default.string().valid(...Object.values(VersionSelection)).optional().description('When a project constrains a dependency, resolve to the newest (default), oldest, or system-installed version satisfying it; system needs R and falls back to newest. Base-R packages always resolve against the assumed R version.'),
238
+ versionOverrides: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.string()).optional().description('Force an exact version for specific packages (name -> version), overriding both the project constraint and the versionSelection policy (default {}).')
239
+ }).description('Resolving library exports from a signature database.'),
184
240
  instrument: joi_1.default.object({
185
241
  dataflowExtractors: joi_1.default.any().optional().description('These keys are only intended for use within code, allowing to instrument the dataflow analyzer!')
186
242
  }),
@@ -15,7 +15,6 @@ class CfgConditionalDeadCodeRemoval extends semantic_cfg_guided_visitor_1.Semant
15
15
  cachedConditions = new Map();
16
16
  cachedStatements = new Map();
17
17
  inTry = new Set();
18
- invertedCfg;
19
18
  getValue(id) {
20
19
  const has = this.cachedConditions.get(id);
21
20
  if (has) {
@@ -689,6 +689,12 @@ class ControlFlowGraph {
689
689
  * @see {@link ControlFlowGraph#removeEdge|removeEdge()} - to remove a specific edge
690
690
  */
691
691
  removeVertex(id) {
692
+ for (const to of this.edgeInfos.get(id)?.keys() ?? []) {
693
+ this.revEdgeInfos.get(to)?.delete(id);
694
+ }
695
+ for (const from of this.revEdgeInfos.get(id)?.keys() ?? []) {
696
+ this.edgeInfos.get(from)?.delete(id);
697
+ }
692
698
  this.vtxInfos.delete(id);
693
699
  this.edgeInfos.delete(id);
694
700
  this.revEdgeInfos.delete(id);
@@ -699,12 +705,6 @@ class ControlFlowGraph {
699
705
  this.bbChildren.delete(a);
700
706
  }
701
707
  }
702
- for (const edges of this.edgeInfos.values()) {
703
- edges.delete(id);
704
- }
705
- for (const edges of this.revEdgeInfos.values()) {
706
- edges.delete(id);
707
- }
708
708
  this.roots.delete(id);
709
709
  return this;
710
710
  }
@@ -31,8 +31,8 @@ function diffRootVertices(ctx) {
31
31
  });
32
32
  }
33
33
  function diffVertices(ctx) {
34
- const lVert = ctx.left.vertices(false).entries().map(([id, info]) => [id, info]).toArray();
35
- const rVert = ctx.right.vertices(false).entries().map(([id, info]) => [id, info]).toArray();
34
+ const lVert = [...ctx.left.vertices(false).entries()];
35
+ const rVert = [...ctx.right.vertices(false).entries()];
36
36
  if (lVert.length < rVert.length && !ctx.config.leftIsSubgraph
37
37
  || lVert.length > rVert.length && !ctx.config.rightIsSubgraph) {
38
38
  ctx.report.addComment(`Detected different number of vertices! ${ctx.leftname} has ${lVert.length}, ${ctx.rightname} has ${rVert.length}`);
@@ -262,6 +262,8 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
262
262
  case built_in_proc_name_1.BuiltInProcName.DefaultReadAllArgs:
263
263
  case built_in_proc_name_1.BuiltInProcName.Function:
264
264
  case built_in_proc_name_1.BuiltInProcName.FunctionDefinition:
265
+ case built_in_proc_name_1.BuiltInProcName.S7MakeConstructor:
266
+ case built_in_proc_name_1.BuiltInProcName.DefineArgument:
265
267
  return this.onDefaultFunctionCall({ call });
266
268
  default:
267
269
  (0, assert_1.assertUnreachable)(origin);
@@ -9,17 +9,17 @@ function grayOut() {
9
9
  }
10
10
  function mergeJointRangesInSorted(loc) {
11
11
  return loc.reduce((acc, curr) => {
12
- if (range_1.SourceRange.overlap(acc[acc.length - 1].location, curr.location)) {
13
- return [
14
- ...acc.slice(0, -1), {
15
- selected: curr.selected || acc[acc.length - 1].selected,
16
- location: range_1.SourceRange.merge([acc[acc.length - 1].location, curr.location])
17
- }
18
- ];
12
+ const last = acc[acc.length - 1];
13
+ if (range_1.SourceRange.overlap(last.location, curr.location)) {
14
+ acc[acc.length - 1] = {
15
+ selected: curr.selected || last.selected,
16
+ location: range_1.SourceRange.merge([last.location, curr.location])
17
+ };
19
18
  }
20
19
  else {
21
- return [...acc, curr];
20
+ acc.push(curr);
22
21
  }
22
+ return acc;
23
23
  }, [loc[0]]);
24
24
  }
25
25
  function highlight(s, selected) {
@@ -23,8 +23,8 @@ export declare const STATIC_DATAFLOW: {
23
23
  readonly 0: typeof internalPrinter;
24
24
  readonly 2: typeof dataflowGraphToJson;
25
25
  readonly 5: typeof dataflowGraphToQuads;
26
- readonly 3: (this: void, graph: import("../../../../dataflow/graph/graph").DataflowGraph | import("../../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
27
- readonly 4: (this: void, graph: import("../../../../dataflow/graph/graph").DataflowGraph | import("../../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
26
+ readonly 3: (this: void, graph: import("../../../../dataflow/graph/graph").DataflowGraph | import("../../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
27
+ readonly 4: (this: void, graph: import("../../../../dataflow/graph/graph").DataflowGraph | import("../../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
28
28
  };
29
29
  readonly dependencies: readonly ["normalize"];
30
30
  };
@@ -14,6 +14,11 @@ export interface SliceRequiredInput {
14
14
  readonly direction?: SliceDirection;
15
15
  /** The context of the analysis */
16
16
  readonly context?: ReadOnlyFlowrAnalyzerContext;
17
+ /**
18
+ * If set (and slicing backward), continue the slice past a function-definition boundary, also including
19
+ * the definition's binding and call sites. Defaults to `false`.
20
+ */
21
+ readonly includeCallees?: boolean;
17
22
  }
18
23
  declare function processor(results: {
19
24
  dataflow?: DataflowInformation;
@@ -9,7 +9,7 @@ function processor(results, input) {
9
9
  const direction = input.direction ?? slice_direction_1.SliceDirection.Backward;
10
10
  const threshold = input.threshold ?? input.context?.config.solver.slicer?.threshold;
11
11
  const n = results.normalize;
12
- return (0, static_slicer_1.staticSlice)({ ctx: input.context, info: results.dataflow, ast: n, ids: parse_1.SlicingCriteria.convertAll(input.criterion, n.idMap), direction, threshold });
12
+ return (0, static_slicer_1.staticSlice)({ ctx: input.context, info: results.dataflow, ast: n, ids: parse_1.SlicingCriteria.convertAll(input.criterion, n.idMap), direction, threshold, includeCallees: input.includeCallees });
13
13
  }
14
14
  exports.STATIC_SLICE = {
15
15
  name: 'slice',
@@ -3,6 +3,7 @@ import { PipelineStepStage } from '../../pipeline-step';
3
3
  import type { SliceResult } from '../../../../slicing/static/slicer-types';
4
4
  import type { NormalizedAst } from '../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
5
5
  import type { AutoSelectPredicate } from '../../../../reconstruct/auto-select/auto-select-defaults';
6
+ import type { DataflowInformation } from '../../../../dataflow/info';
6
7
  export interface ReconstructRequiredInput {
7
8
  autoSelectIf?: AutoSelectPredicate;
8
9
  /**
@@ -13,10 +14,16 @@ export interface ReconstructRequiredInput {
13
14
  * Either you can set this to `'all'` to reconstruct all files or provide an array of file indices in the files context to reconstruct only those files.
14
15
  */
15
16
  reconstructFiles?: 'all' | number[];
17
+ /**
18
+ * Inline resolvable `source()` calls into the reconstruction so the result is a single self-contained R text.
19
+ * Cyclic and unresolvable `source()` calls are kept verbatim and reported via `reconstruct.inlineWarnings`.
20
+ */
21
+ inlineSources?: boolean;
16
22
  }
17
23
  declare function processor(results: {
18
24
  normalize?: NormalizedAst;
19
25
  slice?: SliceResult;
26
+ dataflow?: DataflowInformation;
20
27
  }, input: Partial<ReconstructRequiredInput>): import("../../../../reconstruct/reconstruct").ReconstructionResult;
21
28
  export declare const NAIVE_RECONSTRUCT: {
22
29
  readonly name: "reconstruct";
@@ -3,10 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NAIVE_RECONSTRUCT = void 0;
4
4
  const print_1 = require("../../../print/print");
5
5
  const reconstruct_1 = require("../../../../reconstruct/reconstruct");
6
+ const source_inline_map_1 = require("../../../../reconstruct/inline/source-inline-map");
6
7
  function processor(results, input) {
7
- return (0, reconstruct_1.reconstructToCode)(results.normalize, {
8
+ const normalize = results.normalize;
9
+ return (0, reconstruct_1.reconstructToCode)(normalize, {
8
10
  nodes: results.slice.result,
9
- reconstructFiles: input.reconstructFiles
11
+ reconstructFiles: input.reconstructFiles,
12
+ inlineSources: input.inlineSources,
13
+ sourceMap: input.inlineSources ? source_inline_map_1.SourceInlineMap.build(normalize, results.dataflow.graph) : undefined
10
14
  }, input.autoSelectIf);
11
15
  }
12
16
  exports.NAIVE_RECONSTRUCT = {
@@ -57,8 +57,8 @@ export declare const DEFAULT_SLICING_PIPELINE: import("./pipeline").Pipeline<{
57
57
  readonly 0: typeof import("../../print/print").internalPrinter;
58
58
  readonly 2: typeof import("../../print/dataflow-printer").dataflowGraphToJson;
59
59
  readonly 5: typeof import("../../print/dataflow-printer").dataflowGraphToQuads;
60
- readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
61
- readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
60
+ readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
61
+ readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
62
62
  };
63
63
  readonly dependencies: readonly ["normalize"];
64
64
  } | {
@@ -82,6 +82,7 @@ export declare const DEFAULT_SLICING_PIPELINE: import("./pipeline").Pipeline<{
82
82
  readonly processor: (results: {
83
83
  normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
84
84
  slice?: import("../../../slicing/static/slicer-types").SliceResult;
85
+ dataflow?: import("../../../dataflow/info").DataflowInformation;
85
86
  }, input: Partial<import("../all/static-slicing/10-reconstruct").ReconstructRequiredInput>) => import("../../../reconstruct/reconstruct").ReconstructionResult;
86
87
  readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
87
88
  readonly printer: {
@@ -141,8 +142,8 @@ export declare const DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipeline"
141
142
  readonly 0: typeof import("../../print/print").internalPrinter;
142
143
  readonly 2: typeof import("../../print/dataflow-printer").dataflowGraphToJson;
143
144
  readonly 5: typeof import("../../print/dataflow-printer").dataflowGraphToQuads;
144
- readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
145
- readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
145
+ readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
146
+ readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
146
147
  };
147
148
  readonly dependencies: readonly ["normalize"];
148
149
  } | {
@@ -166,6 +167,7 @@ export declare const DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipeline"
166
167
  readonly processor: (results: {
167
168
  normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
168
169
  slice?: import("../../../slicing/static/slicer-types").SliceResult;
170
+ dataflow?: import("../../../dataflow/info").DataflowInformation;
169
171
  }, input: Partial<import("../all/static-slicing/10-reconstruct").ReconstructRequiredInput>) => import("../../../reconstruct/reconstruct").ReconstructionResult;
170
172
  readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
171
173
  readonly printer: {
@@ -225,8 +227,8 @@ export declare const DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./pipel
225
227
  readonly 0: typeof import("../../print/print").internalPrinter;
226
228
  readonly 2: typeof import("../../print/dataflow-printer").dataflowGraphToJson;
227
229
  readonly 5: typeof import("../../print/dataflow-printer").dataflowGraphToQuads;
228
- readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
229
- readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
230
+ readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
231
+ readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
230
232
  };
231
233
  readonly dependencies: readonly ["normalize"];
232
234
  } | {
@@ -262,8 +264,8 @@ export declare const TREE_SITTER_SLICING_PIPELINE: import("./pipeline").Pipeline
262
264
  readonly 0: typeof import("../../print/print").internalPrinter;
263
265
  readonly 2: typeof import("../../print/dataflow-printer").dataflowGraphToJson;
264
266
  readonly 5: typeof import("../../print/dataflow-printer").dataflowGraphToQuads;
265
- readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
266
- readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
267
+ readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
268
+ readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
267
269
  };
268
270
  readonly dependencies: readonly ["normalize"];
269
271
  } | {
@@ -287,6 +289,7 @@ export declare const TREE_SITTER_SLICING_PIPELINE: import("./pipeline").Pipeline
287
289
  readonly processor: (results: {
288
290
  normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
289
291
  slice?: import("../../../slicing/static/slicer-types").SliceResult;
292
+ dataflow?: import("../../../dataflow/info").DataflowInformation;
290
293
  }, input: Partial<import("../all/static-slicing/10-reconstruct").ReconstructRequiredInput>) => import("../../../reconstruct/reconstruct").ReconstructionResult;
291
294
  readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
292
295
  readonly printer: {
@@ -345,8 +348,8 @@ export declare const TREE_SITTER_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipel
345
348
  readonly 0: typeof import("../../print/print").internalPrinter;
346
349
  readonly 2: typeof import("../../print/dataflow-printer").dataflowGraphToJson;
347
350
  readonly 5: typeof import("../../print/dataflow-printer").dataflowGraphToQuads;
348
- readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
349
- readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
351
+ readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
352
+ readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
350
353
  };
351
354
  readonly dependencies: readonly ["normalize"];
352
355
  } | {
@@ -370,6 +373,7 @@ export declare const TREE_SITTER_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipel
370
373
  readonly processor: (results: {
371
374
  normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
372
375
  slice?: import("../../../slicing/static/slicer-types").SliceResult;
376
+ dataflow?: import("../../../dataflow/info").DataflowInformation;
373
377
  }, input: Partial<import("../all/static-slicing/10-reconstruct").ReconstructRequiredInput>) => import("../../../reconstruct/reconstruct").ReconstructionResult;
374
378
  readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
375
379
  readonly printer: {
@@ -428,8 +432,8 @@ export declare const TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./p
428
432
  readonly 0: typeof import("../../print/print").internalPrinter;
429
433
  readonly 2: typeof import("../../print/dataflow-printer").dataflowGraphToJson;
430
434
  readonly 5: typeof import("../../print/dataflow-printer").dataflowGraphToQuads;
431
- readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
432
- readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
435
+ readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
436
+ readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
433
437
  };
434
438
  readonly dependencies: readonly ["normalize"];
435
439
  } | {
@@ -535,8 +539,8 @@ export declare const DEFAULT_DATAFLOW_PIPELINE: import("./pipeline").Pipeline<{
535
539
  readonly 0: typeof import("../../print/print").internalPrinter;
536
540
  readonly 2: typeof import("../../print/dataflow-printer").dataflowGraphToJson;
537
541
  readonly 5: typeof import("../../print/dataflow-printer").dataflowGraphToQuads;
538
- readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
539
- readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
542
+ readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
543
+ readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
540
544
  };
541
545
  readonly dependencies: readonly ["normalize"];
542
546
  }>;
@@ -558,8 +562,8 @@ export declare const TREE_SITTER_DATAFLOW_PIPELINE: import("./pipeline").Pipelin
558
562
  readonly 0: typeof import("../../print/print").internalPrinter;
559
563
  readonly 2: typeof import("../../print/dataflow-printer").dataflowGraphToJson;
560
564
  readonly 5: typeof import("../../print/dataflow-printer").dataflowGraphToQuads;
561
- readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
562
- readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean) => string;
565
+ readonly 3: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
566
+ readonly 4: (this: void, graph: import("../../../dataflow/graph/graph").DataflowGraph | import("../../../dataflow/info").DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<import("../../../r-bridge/lang-4.x/ast/model/processing/node-id").NodeId>, simplified?: boolean, qualifyBaseR?: boolean) => string;
563
567
  };
564
568
  readonly dependencies: readonly ["normalize"];
565
569
  } | {