@eagleoutice/flowr 2.2.14 → 2.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/README.md +210 -6
  2. package/benchmark/slicer.d.ts +3 -1
  3. package/benchmark/slicer.js +8 -5
  4. package/benchmark/summarizer/first-phase/process.d.ts +2 -1
  5. package/benchmark/summarizer/first-phase/process.js +2 -2
  6. package/cli/benchmark-app.d.ts +1 -0
  7. package/cli/benchmark-app.js +4 -1
  8. package/cli/benchmark-helper-app.d.ts +1 -0
  9. package/cli/benchmark-helper-app.js +7 -8
  10. package/cli/common/options.js +2 -0
  11. package/cli/export-quads-app.js +2 -1
  12. package/cli/flowr.js +58 -57
  13. package/cli/repl/commands/repl-cfg.js +13 -13
  14. package/cli/repl/commands/repl-commands.js +3 -3
  15. package/cli/repl/commands/repl-dataflow.js +10 -10
  16. package/cli/repl/commands/repl-execute.d.ts +2 -3
  17. package/cli/repl/commands/repl-execute.js +5 -4
  18. package/cli/repl/commands/repl-lineage.js +4 -4
  19. package/cli/repl/commands/repl-main.d.ts +12 -1
  20. package/cli/repl/commands/repl-normalize.js +6 -6
  21. package/cli/repl/commands/repl-parse.js +2 -2
  22. package/cli/repl/commands/repl-query.js +9 -9
  23. package/cli/repl/commands/repl-version.js +1 -1
  24. package/cli/repl/core.d.ts +5 -2
  25. package/cli/repl/core.js +10 -8
  26. package/cli/repl/server/connection.d.ts +3 -1
  27. package/cli/repl/server/connection.js +7 -5
  28. package/cli/repl/server/server.d.ts +3 -2
  29. package/cli/repl/server/server.js +4 -2
  30. package/cli/script-core/statistics-core.d.ts +2 -1
  31. package/cli/script-core/statistics-core.js +2 -2
  32. package/cli/script-core/statistics-helper-core.d.ts +2 -1
  33. package/cli/script-core/statistics-helper-core.js +5 -4
  34. package/cli/slicer-app.js +4 -2
  35. package/cli/statistics-app.js +2 -1
  36. package/cli/statistics-helper-app.js +2 -1
  37. package/config.d.ts +12 -10
  38. package/config.js +27 -43
  39. package/control-flow/basic-cfg-guided-visitor.d.ts +3 -3
  40. package/control-flow/cfg-dead-code.d.ts +4 -0
  41. package/control-flow/cfg-dead-code.js +124 -0
  42. package/control-flow/cfg-simplification.d.ts +19 -6
  43. package/control-flow/cfg-simplification.js +23 -19
  44. package/control-flow/control-flow-graph.d.ts +3 -1
  45. package/control-flow/control-flow-graph.js +5 -0
  46. package/control-flow/dfg-cfg-guided-visitor.d.ts +9 -7
  47. package/control-flow/dfg-cfg-guided-visitor.js +16 -5
  48. package/control-flow/extract-cfg.d.ts +4 -2
  49. package/control-flow/extract-cfg.js +63 -59
  50. package/control-flow/semantic-cfg-guided-visitor.d.ts +36 -9
  51. package/control-flow/semantic-cfg-guided-visitor.js +73 -20
  52. package/control-flow/simple-visitor.d.ts +4 -0
  53. package/control-flow/simple-visitor.js +14 -0
  54. package/control-flow/syntax-cfg-guided-visitor.d.ts +2 -2
  55. package/core/pipeline-executor.d.ts +4 -1
  56. package/core/pipeline-executor.js +6 -5
  57. package/core/steps/all/core/10-normalize.d.ts +2 -0
  58. package/core/steps/all/core/10-normalize.js +1 -1
  59. package/core/steps/all/core/11-normalize-tree-sitter.d.ts +2 -1
  60. package/core/steps/all/core/11-normalize-tree-sitter.js +2 -2
  61. package/core/steps/all/core/20-dataflow.d.ts +2 -1
  62. package/core/steps/all/core/20-dataflow.js +2 -2
  63. package/core/steps/all/static-slicing/00-slice.d.ts +2 -1
  64. package/core/steps/all/static-slicing/00-slice.js +2 -2
  65. package/core/steps/pipeline/default-pipelines.d.ts +32 -31
  66. package/core/steps/pipeline/default-pipelines.js +8 -8
  67. package/core/steps/pipeline-step.d.ts +2 -1
  68. package/dataflow/environments/built-in-config.d.ts +4 -3
  69. package/dataflow/environments/built-in.d.ts +16 -1
  70. package/dataflow/environments/built-in.js +11 -5
  71. package/dataflow/environments/default-builtin-config.js +5 -3
  72. package/dataflow/environments/define.d.ts +2 -1
  73. package/dataflow/environments/define.js +4 -5
  74. package/dataflow/environments/remove.d.ts +6 -0
  75. package/dataflow/environments/remove.js +29 -0
  76. package/dataflow/environments/resolve-by-name.d.ts +0 -36
  77. package/dataflow/environments/resolve-by-name.js +0 -240
  78. package/dataflow/eval/resolve/alias-tracking.d.ts +92 -0
  79. package/dataflow/eval/resolve/alias-tracking.js +352 -0
  80. package/dataflow/eval/resolve/resolve-argument.d.ts +8 -0
  81. package/dataflow/eval/resolve/resolve-argument.js +118 -0
  82. package/dataflow/eval/resolve/resolve.d.ts +37 -0
  83. package/dataflow/eval/resolve/resolve.js +95 -0
  84. package/dataflow/eval/values/general.d.ts +27 -0
  85. package/dataflow/eval/values/general.js +73 -0
  86. package/dataflow/eval/values/intervals/interval-constants.d.ts +4 -0
  87. package/dataflow/eval/values/intervals/interval-constants.js +27 -0
  88. package/dataflow/eval/values/logical/logical-constants.d.ts +7 -0
  89. package/dataflow/eval/values/logical/logical-constants.js +31 -0
  90. package/dataflow/eval/values/r-value.d.ts +58 -0
  91. package/dataflow/eval/values/r-value.js +90 -0
  92. package/dataflow/eval/values/scalar/scalar-consatnts.d.ts +15 -0
  93. package/dataflow/eval/values/scalar/scalar-consatnts.js +35 -0
  94. package/dataflow/eval/values/sets/set-constants.d.ts +7 -0
  95. package/dataflow/eval/values/sets/set-constants.js +34 -0
  96. package/dataflow/eval/values/string/string-constants.d.ts +8 -0
  97. package/dataflow/eval/values/string/string-constants.js +45 -0
  98. package/dataflow/eval/values/vectors/vector-constants.d.ts +14 -0
  99. package/dataflow/eval/values/vectors/vector-constants.js +35 -0
  100. package/dataflow/extractor.d.ts +2 -1
  101. package/dataflow/extractor.js +2 -1
  102. package/dataflow/graph/unknown-replacement.d.ts +11 -0
  103. package/dataflow/graph/unknown-replacement.js +12 -0
  104. package/dataflow/graph/unknown-side-effect.d.ts +7 -0
  105. package/dataflow/graph/unknown-side-effect.js +13 -0
  106. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +5 -6
  107. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +8 -5
  108. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +4 -2
  109. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +15 -13
  110. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +20 -18
  111. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -2
  112. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -3
  113. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +5 -4
  114. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
  115. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +11 -5
  116. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +5 -3
  117. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +26 -29
  118. package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
  119. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +23 -0
  120. package/dataflow/internal/process/functions/call/common.js +1 -1
  121. package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
  122. package/dataflow/internal/process/functions/process-parameter.js +1 -1
  123. package/dataflow/origin/dfg-get-symbol-refs.d.ts +21 -0
  124. package/dataflow/origin/dfg-get-symbol-refs.js +50 -0
  125. package/dataflow/processor.d.ts +5 -0
  126. package/documentation/doc-util/doc-cfg.js +4 -3
  127. package/documentation/doc-util/doc-code.d.ts +1 -1
  128. package/documentation/doc-util/doc-dfg.js +3 -2
  129. package/documentation/doc-util/doc-functions.d.ts +24 -0
  130. package/documentation/doc-util/doc-functions.js +65 -0
  131. package/documentation/doc-util/doc-normalized-ast.js +3 -2
  132. package/documentation/doc-util/doc-print.d.ts +5 -0
  133. package/documentation/doc-util/doc-print.js +36 -0
  134. package/documentation/doc-util/doc-query.d.ts +6 -3
  135. package/documentation/doc-util/doc-query.js +6 -3
  136. package/documentation/doc-util/doc-repl.js +2 -1
  137. package/documentation/doc-util/doc-search.js +3 -2
  138. package/documentation/doc-util/doc-types.d.ts +28 -6
  139. package/documentation/doc-util/doc-types.js +89 -45
  140. package/documentation/print-cfg-wiki.js +10 -11
  141. package/documentation/print-core-wiki.js +5 -5
  142. package/documentation/print-dataflow-graph-wiki.js +14 -13
  143. package/documentation/print-engines-wiki.js +2 -3
  144. package/documentation/print-faq-wiki.js +8 -2
  145. package/documentation/print-interface-wiki.js +1 -2
  146. package/documentation/print-linter-issue.d.ts +1 -0
  147. package/documentation/print-linter-issue.js +71 -0
  148. package/documentation/print-linter-wiki.js +219 -34
  149. package/documentation/print-linting-and-testing-wiki.js +2 -4
  150. package/documentation/print-normalized-ast-wiki.js +3 -3
  151. package/documentation/print-query-wiki.js +81 -2
  152. package/documentation/print-readme.js +24 -1
  153. package/documentation/print-search-wiki.js +1 -2
  154. package/linter/linter-executor.d.ts +3 -1
  155. package/linter/linter-executor.js +3 -2
  156. package/linter/linter-format.d.ts +67 -7
  157. package/linter/linter-format.js +12 -1
  158. package/linter/linter-rules.d.ts +155 -16
  159. package/linter/linter-rules.js +12 -4
  160. package/linter/linter-tags.d.ts +80 -0
  161. package/linter/linter-tags.js +85 -0
  162. package/linter/rules/absolute-path.d.ts +71 -0
  163. package/linter/rules/absolute-path.js +177 -0
  164. package/linter/rules/deprecated-functions.d.ts +43 -0
  165. package/linter/rules/deprecated-functions.js +58 -0
  166. package/linter/rules/{2-file-path-validity.d.ts → file-path-validity.d.ts} +16 -6
  167. package/linter/rules/{2-file-path-validity.js → file-path-validity.js} +21 -13
  168. package/linter/rules/naming-convention.d.ts +71 -0
  169. package/linter/rules/naming-convention.js +164 -0
  170. package/linter/rules/seeded-randomness.d.ts +65 -0
  171. package/linter/rules/seeded-randomness.js +122 -0
  172. package/linter/rules/unused-definition.d.ts +41 -0
  173. package/linter/rules/unused-definition.js +105 -0
  174. package/package.json +4 -1
  175. package/queries/base-query-format.d.ts +2 -0
  176. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
  177. package/queries/catalog/call-context-query/call-context-query-executor.js +2 -2
  178. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
  179. package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
  180. package/queries/catalog/config-query/config-query-executor.js +2 -3
  181. package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +3 -0
  182. package/queries/catalog/control-flow-query/control-flow-query-executor.js +20 -0
  183. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +81 -0
  184. package/queries/catalog/control-flow-query/control-flow-query-format.js +34 -0
  185. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
  186. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
  187. package/queries/catalog/dependencies-query/dependencies-query-executor.js +4 -115
  188. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
  189. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
  190. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
  191. package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -1
  192. package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
  193. package/queries/catalog/linter-query/linter-query-executor.js +2 -2
  194. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
  195. package/queries/catalog/linter-query/linter-query-format.js +17 -12
  196. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
  197. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
  198. package/queries/catalog/project-query/project-query-format.d.ts +1 -1
  199. package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
  200. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -4
  201. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +3 -2
  202. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -22
  203. package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
  204. package/queries/catalog/search-query/search-query-executor.js +2 -2
  205. package/queries/catalog/search-query/search-query-format.d.ts +1 -1
  206. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
  207. package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -2
  208. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
  209. package/queries/query.d.ts +75 -15
  210. package/queries/query.js +2 -0
  211. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +2 -1
  212. package/r-bridge/lang-4.x/ast/parser/json/parser.js +4 -2
  213. package/r-bridge/lang-4.x/convert-values.js +2 -1
  214. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +3 -1
  215. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +4 -4
  216. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +1 -1
  217. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +18 -9
  218. package/r-bridge/shell.d.ts +3 -2
  219. package/r-bridge/shell.js +4 -5
  220. package/search/flowr-search-builder.d.ts +6 -2
  221. package/search/flowr-search-builder.js +7 -0
  222. package/search/flowr-search-filters.d.ts +32 -8
  223. package/search/flowr-search-filters.js +42 -15
  224. package/search/flowr-search.d.ts +4 -0
  225. package/search/search-executor/search-enrichers.d.ts +7 -3
  226. package/search/search-executor/search-enrichers.js +32 -20
  227. package/search/search-executor/search-generators.js +1 -1
  228. package/search/search-executor/search-transformer.d.ts +2 -0
  229. package/search/search-executor/search-transformer.js +10 -1
  230. package/slicing/criterion/parse.d.ts +8 -0
  231. package/slicing/criterion/parse.js +20 -0
  232. package/slicing/static/static-slicer.d.ts +1 -1
  233. package/slicing/static/static-slicer.js +2 -3
  234. package/statistics/statistics.d.ts +3 -1
  235. package/statistics/statistics.js +5 -4
  236. package/util/containers.d.ts +12 -9
  237. package/util/containers.js +12 -9
  238. package/util/objects.d.ts +5 -4
  239. package/util/range.d.ts +5 -1
  240. package/util/range.js +11 -3
  241. package/util/text/strings.d.ts +6 -0
  242. package/util/text/strings.js +35 -0
  243. package/util/version.js +1 -1
  244. package/linter/rules/1-deprecated-functions.d.ts +0 -34
  245. package/linter/rules/1-deprecated-functions.js +0 -54
@@ -4,20 +4,17 @@ exports.executeDependenciesQuery = executeDependenciesQuery;
4
4
  const query_1 = require("../../query");
5
5
  const dependencies_query_format_1 = require("./dependencies-query-format");
6
6
  const vertex_1 = require("../../../dataflow/graph/vertex");
7
- const graph_1 = require("../../../dataflow/graph/graph");
8
7
  const log_1 = require("../../../util/log");
9
8
  const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
10
- const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
11
9
  const visitor_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/visitor");
12
- const assert_1 = require("../../../util/assert");
13
10
  const objects_1 = require("../../../util/objects");
14
- const resolve_by_name_1 = require("../../../dataflow/environments/resolve-by-name");
15
11
  const library_functions_1 = require("./function-info/library-functions");
16
12
  const source_functions_1 = require("./function-info/source-functions");
17
13
  const read_functions_1 = require("./function-info/read-functions");
18
14
  const write_functions_1 = require("./function-info/write-functions");
19
15
  const function_info_1 = require("./function-info/function-info");
20
16
  const identify_link_to_last_call_relation_1 = require("../call-context-query/identify-link-to-last-call-relation");
17
+ const resolve_argument_1 = require("../../../dataflow/eval/resolve/resolve-argument");
21
18
  function collectNamespaceAccesses(data, libraries) {
22
19
  /* for libraries, we have to additionally track all uses of `::` and `:::`, for this we currently simply traverse all uses */
23
20
  (0, visitor_1.visitAst)(data.ast.ast, n => {
@@ -26,7 +23,7 @@ function collectNamespaceAccesses(data, libraries) {
26
23
  libraries.push({
27
24
  nodeId: n.info.id,
28
25
  functionName: (n.info.fullLexeme ?? n.lexeme).includes(':::') ? ':::' : '::',
29
- libraryName: n.namespace
26
+ libraryName: n.namespace,
30
27
  });
31
28
  }
32
29
  });
@@ -116,7 +113,7 @@ function getResults(data, results, kind, functions, makeInfo) {
116
113
  return kindEntries.flatMap(([name, results]) => results.flatMap(({ id, linkedIds }) => {
117
114
  const vertex = data.dataflow.graph.getVertex(id);
118
115
  const info = functions.find(f => f.name === name);
119
- const args = getArgumentValue(data, vertex, info.argIdx, info.argName, info.resolveValue);
116
+ const args = (0, resolve_argument_1.getArgumentStringValue)(data.config.solver.variables, data.dataflow.graph, vertex, info.argIdx, info.argName, info.resolveValue);
120
117
  const linkedArgs = collectValuesFromLinks(args, data, linkedIds);
121
118
  const foundValues = linkedArgs ?? args;
122
119
  if (!foundValues) {
@@ -158,7 +155,7 @@ function collectValuesFromLinks(args, data, linkedIds) {
158
155
  if (vertex === undefined || vertex.tag !== vertex_1.VertexType.FunctionCall) {
159
156
  continue;
160
157
  }
161
- const args = getArgumentValue(data, vertex, info.argIdx, info.argName, info.resolveValue);
158
+ const args = (0, resolve_argument_1.getArgumentStringValue)(data.config.solver.variables, data.dataflow.graph, vertex, info.argIdx, info.argName, info.resolveValue);
162
159
  if (args === undefined) {
163
160
  continue;
164
161
  }
@@ -172,114 +169,6 @@ function collectValuesFromLinks(args, data, linkedIds) {
172
169
  }
173
170
  return map.size ? map : undefined;
174
171
  }
175
- function hasCharacterOnly(data, vertex, idMap) {
176
- if (!vertex.args || vertex.args.length === 0 || !idMap) {
177
- return false;
178
- }
179
- const treatAsChar = getArgumentValue(data, vertex, 5, 'character.only', true);
180
- if (!treatAsChar) {
181
- return false;
182
- }
183
- const hasTrue = [...treatAsChar.values()].some(set => set?.has('TRUE'));
184
- const hasFalse = hasTrue ? [...treatAsChar.values()].some(set => set === undefined || set.has('FALSE')) : false;
185
- if (hasTrue && hasFalse) {
186
- return 'maybe';
187
- }
188
- else {
189
- return hasTrue;
190
- }
191
- }
192
- function resolveBasedOnConfig(data, vertex, argument, environment, idMap, resolveValue) {
193
- let full = true;
194
- if (!resolveValue) {
195
- full = false;
196
- }
197
- if (resolveValue === 'library') {
198
- const hasChar = hasCharacterOnly(data, vertex, idMap);
199
- if (hasChar === false) {
200
- if (argument.type === type_1.RType.Symbol) {
201
- return [argument.lexeme];
202
- }
203
- full = false;
204
- }
205
- }
206
- return (0, resolve_by_name_1.resolveIdToValue)(argument, { environment, graph: data.dataflow.graph, full });
207
- }
208
- function unwrapRValue(value) {
209
- if (value === undefined) {
210
- return undefined;
211
- }
212
- switch (typeof value) {
213
- case 'string':
214
- return value;
215
- case 'number':
216
- return value.toString();
217
- case 'boolean':
218
- return value ? 'TRUE' : 'FALSE';
219
- }
220
- if (typeof value !== 'object' || value === null) {
221
- return JSON.stringify(value);
222
- }
223
- if ('str' in value) {
224
- return value.str;
225
- }
226
- else if ('num' in value) {
227
- return value.num.toString();
228
- }
229
- else {
230
- return JSON.stringify(value);
231
- }
232
- }
233
- /**
234
- * Get the values of all arguments matching the criteria.
235
- */
236
- function getArgumentValue(data, vertex, argumentIndex, argumentName, resolveValue) {
237
- const graph = data.dataflow.graph;
238
- if (argumentName) {
239
- const arg = vertex?.args.findIndex(arg => arg !== r_function_call_1.EmptyArgument && arg.name === argumentName);
240
- if (arg >= 0) {
241
- argumentIndex = arg;
242
- }
243
- }
244
- if (!vertex || argumentIndex === undefined) {
245
- return undefined;
246
- }
247
- if (argumentIndex === 'unnamed') {
248
- // return all unnamed arguments
249
- const references = vertex.args.filter(arg => arg !== r_function_call_1.EmptyArgument && !arg.name).map(graph_1.getReferenceOfArgument).filter(assert_1.isNotUndefined);
250
- const map = new Map();
251
- for (const ref of references) {
252
- let valueNode = graph.idMap?.get(ref);
253
- if (valueNode?.type === type_1.RType.Argument) {
254
- valueNode = valueNode.value;
255
- }
256
- if (valueNode) {
257
- // TDODO: extend vector support etc.
258
- // this should be evaluated in the callee-context
259
- const values = resolveBasedOnConfig(data, vertex, valueNode, vertex.environment, graph.idMap, resolveValue)
260
- ?.map(unwrapRValue) ?? [dependencies_query_format_1.Unknown];
261
- map.set(ref, new Set(values));
262
- }
263
- }
264
- return map;
265
- }
266
- if (vertex.args.length > argumentIndex) {
267
- const arg = (0, graph_1.getReferenceOfArgument)(vertex.args[argumentIndex]);
268
- if (!arg) {
269
- return undefined;
270
- }
271
- let valueNode = graph.idMap?.get(arg);
272
- if (valueNode?.type === type_1.RType.Argument) {
273
- valueNode = valueNode.value;
274
- }
275
- if (valueNode) {
276
- const values = resolveBasedOnConfig(data, vertex, valueNode, vertex.environment, graph.idMap, resolveValue)
277
- ?.map(unwrapRValue) ?? [dependencies_query_format_1.Unknown];
278
- return new Map([[arg, new Set(values)]]);
279
- }
280
- }
281
- return undefined;
282
- }
283
172
  function getFunctionsToCheck(customFunctions, ignoreDefaultFunctions, defaultFunctions) {
284
173
  let functions = ignoreDefaultFunctions ? [] : [...defaultFunctions];
285
174
  if (customFunctions) {
@@ -79,7 +79,7 @@ export declare const DependenciesQueryDefinition: {
79
79
  }, input: {
80
80
  request?: import("../../../r-bridge/retriever").RParseRequests;
81
81
  parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
82
- }) => import("../../../dataflow/info").DataflowInformation;
82
+ }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
83
83
  readonly requiredInput: {};
84
84
  readonly name: "dataflow";
85
85
  readonly description: "Construct the dataflow graph";
@@ -53,7 +53,7 @@ export declare const HappensBeforeQueryDefinition: {
53
53
  }, input: {
54
54
  request?: import("../../../r-bridge/retriever").RParseRequests;
55
55
  parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
56
- }) => import("../../../dataflow/info").DataflowInformation;
56
+ }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
57
57
  readonly requiredInput: {};
58
58
  readonly name: "dataflow";
59
59
  readonly description: "Construct the dataflow graph";
@@ -50,7 +50,7 @@ export declare const IdMapQueryDefinition: {
50
50
  }, input: {
51
51
  request?: import("../../../r-bridge/retriever").RParseRequests;
52
52
  parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
53
- }) => import("../../../dataflow/info").DataflowInformation;
53
+ }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
54
54
  readonly requiredInput: {};
55
55
  readonly name: "dataflow";
56
56
  readonly description: "Construct the dataflow graph";
@@ -56,7 +56,7 @@ export declare const LineageQueryDefinition: {
56
56
  }, input: {
57
57
  request?: import("../../../r-bridge/retriever").RParseRequests;
58
58
  parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
59
- }) => import("../../../dataflow/info").DataflowInformation;
59
+ }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
60
60
  readonly requiredInput: {};
61
61
  readonly name: "dataflow";
62
62
  readonly description: "Construct the dataflow graph";
@@ -1,3 +1,3 @@
1
1
  import type { BasicQueryData } from '../../base-query-format';
2
2
  import type { LinterQuery, LinterQueryResult } from './linter-query-format';
3
- export declare function executeLinterQuery({ ast, dataflow }: BasicQueryData, queries: readonly LinterQuery[]): LinterQueryResult;
3
+ export declare function executeLinterQuery({ ast, dataflow, config }: BasicQueryData, queries: readonly LinterQuery[]): LinterQueryResult;
@@ -4,7 +4,7 @@ exports.executeLinterQuery = executeLinterQuery;
4
4
  const linter_rules_1 = require("../../../linter/linter-rules");
5
5
  const log_1 = require("../../../util/log");
6
6
  const linter_executor_1 = require("../../../linter/linter-executor");
7
- function executeLinterQuery({ ast, dataflow }, queries) {
7
+ function executeLinterQuery({ ast, dataflow, config }, queries) {
8
8
  const flattened = queries.flatMap(q => q.rules ?? Object.keys(linter_rules_1.LintingRules));
9
9
  const distinct = new Set(flattened);
10
10
  if (distinct.size !== flattened.length) {
@@ -13,7 +13,7 @@ function executeLinterQuery({ ast, dataflow }, queries) {
13
13
  }
14
14
  const results = { results: {} };
15
15
  const start = Date.now();
16
- const input = { normalize: ast, dataflow };
16
+ const input = { normalize: ast, dataflow, config };
17
17
  for (const entry of distinct) {
18
18
  const ruleName = typeof entry === 'string' ? entry : entry.name;
19
19
  results.results[ruleName] = (0, linter_executor_1.executeLintingRule)(ruleName, input, entry?.config);
@@ -61,7 +61,7 @@ export declare const LinterQueryDefinition: {
61
61
  }, input: {
62
62
  request?: import("../../../r-bridge/retriever").RParseRequests;
63
63
  parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
64
- }) => import("../../../dataflow/info").DataflowInformation;
64
+ }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
65
65
  readonly requiredInput: {};
66
66
  readonly name: "dataflow";
67
67
  readonly description: "Construct the dataflow graph";
@@ -10,24 +10,14 @@ const linter_rules_1 = require("../../../linter/linter-rules");
10
10
  const linter_format_1 = require("../../../linter/linter-format");
11
11
  const ansi_1 = require("../../../util/text/ansi");
12
12
  const time_1 = require("../../../util/text/time");
13
+ const doc_code_1 = require("../../../documentation/doc-util/doc-code");
13
14
  exports.LinterQueryDefinition = {
14
15
  executor: linter_query_executor_1.executeLinterQuery,
15
16
  asciiSummarizer: (formatter, _processed, queryResults, result) => {
16
17
  const out = queryResults;
17
18
  result.push(`Query: ${(0, ansi_1.bold)('linter', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
18
19
  for (const [ruleName, results] of Object.entries(out.results)) {
19
- const rule = linter_rules_1.LintingRules[ruleName];
20
- result.push(` ╰ ${ruleName}:`);
21
- for (const certainty of [linter_format_1.LintingCertainty.Definitely, linter_format_1.LintingCertainty.Maybe]) {
22
- const certaintyResults = results.results.filter(r => r.certainty === certainty);
23
- if (certaintyResults.length) {
24
- result.push(` ╰ ${certainty}:`);
25
- for (const res of certaintyResults) {
26
- result.push(` ╰ ${rule.prettyPrint(res)}`);
27
- }
28
- }
29
- }
30
- result.push(` ╰ Metadata: ${JSON.stringify(results['.meta'])}`);
20
+ addLintingRuleResult(ruleName, results, result);
31
21
  }
32
22
  return true;
33
23
  },
@@ -40,4 +30,19 @@ exports.LinterQueryDefinition = {
40
30
  }).description('The linter query lints for the given set of rules and returns the result.'),
41
31
  flattenInvolvedNodes: () => []
42
32
  };
33
+ function addLintingRuleResult(ruleName, results, result) {
34
+ const rule = linter_rules_1.LintingRules[ruleName];
35
+ result.push(` ╰ **${rule.info.name}** (${ruleName}):`);
36
+ for (const certainty of [linter_format_1.LintingCertainty.Definitely, linter_format_1.LintingCertainty.Maybe]) {
37
+ const certaintyResults = results.results.filter(r => r.certainty === certainty);
38
+ if (certaintyResults.length) {
39
+ result.push(` ╰ ${certainty}:`);
40
+ for (const res of certaintyResults) {
41
+ const pretty = rule.prettyPrint[linter_format_1.LintingPrettyPrintContext.Query](res, results['.meta']);
42
+ result.push(` ╰ ${pretty}${res.quickFix ? ` (${res.quickFix.length} quick fix(es) available)` : ''}`);
43
+ }
44
+ }
45
+ }
46
+ result.push(` ╰ _Metadata_: ${(0, doc_code_1.codeInline)(JSON.stringify(results['.meta']))}`);
47
+ }
43
48
  //# sourceMappingURL=linter-query-format.js.map
@@ -53,7 +53,7 @@ export declare const NormalizedAstQueryDefinition: {
53
53
  }, input: {
54
54
  request?: import("../../../r-bridge/retriever").RParseRequests;
55
55
  parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
56
- }) => import("../../../dataflow/info").DataflowInformation;
56
+ }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
57
57
  readonly requiredInput: {};
58
58
  readonly name: "dataflow";
59
59
  readonly description: "Construct the dataflow graph";
@@ -54,7 +54,7 @@ export declare const OriginQueryDefinition: {
54
54
  }, input: {
55
55
  request?: import("../../../r-bridge/retriever").RParseRequests;
56
56
  parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
57
- }) => import("../../../dataflow/info").DataflowInformation;
57
+ }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
58
58
  readonly requiredInput: {};
59
59
  readonly name: "dataflow";
60
60
  readonly description: "Construct the dataflow graph";
@@ -49,7 +49,7 @@ export declare const ProjectQueryDefinition: {
49
49
  }, input: {
50
50
  request?: import("../../../r-bridge/retriever").RParseRequests;
51
51
  parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
52
- }) => import("../../../dataflow/info").DataflowInformation;
52
+ }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
53
53
  readonly requiredInput: {};
54
54
  readonly name: "dataflow";
55
55
  readonly description: "Construct the dataflow graph";
@@ -1,4 +1,4 @@
1
1
  import type { ResolveValueQuery, ResolveValueQueryResult } from './resolve-value-query-format';
2
2
  import type { BasicQueryData } from '../../base-query-format';
3
3
  export declare function fingerPrintOfQuery(query: ResolveValueQuery): string;
4
- export declare function executeResolveValueQuery({ dataflow: { graph }, ast }: BasicQueryData, queries: readonly ResolveValueQuery[]): ResolveValueQueryResult;
4
+ export declare function executeResolveValueQuery({ dataflow: { graph }, ast, config }: BasicQueryData, queries: readonly ResolveValueQuery[]): ResolveValueQueryResult;
@@ -4,11 +4,11 @@ exports.fingerPrintOfQuery = fingerPrintOfQuery;
4
4
  exports.executeResolveValueQuery = executeResolveValueQuery;
5
5
  const log_1 = require("../../../util/log");
6
6
  const parse_1 = require("../../../slicing/criterion/parse");
7
- const resolve_by_name_1 = require("../../../dataflow/environments/resolve-by-name");
7
+ const alias_tracking_1 = require("../../../dataflow/eval/resolve/alias-tracking");
8
8
  function fingerPrintOfQuery(query) {
9
9
  return JSON.stringify(query);
10
10
  }
11
- function executeResolveValueQuery({ dataflow: { graph }, ast }, queries) {
11
+ function executeResolveValueQuery({ dataflow: { graph }, ast, config }, queries) {
12
12
  const start = Date.now();
13
13
  const results = {};
14
14
  for (const query of queries) {
@@ -18,9 +18,9 @@ function executeResolveValueQuery({ dataflow: { graph }, ast }, queries) {
18
18
  }
19
19
  const values = query.criteria
20
20
  .map(criteria => (0, parse_1.slicingCriterionToId)(criteria, ast.idMap))
21
- .flatMap(ident => (0, resolve_by_name_1.resolveIdToValue)(ident, { graph, full: true, idMap: ast.idMap }) ?? []);
21
+ .flatMap(ident => (0, alias_tracking_1.resolveIdToValue)(ident, { graph, full: true, idMap: ast.idMap, resolve: config.solver.variables }));
22
22
  results[key] = {
23
- values: values ? [...new Set(values)] : []
23
+ values: values
24
24
  };
25
25
  }
26
26
  return {
@@ -2,6 +2,7 @@ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
2
2
  import type { SlicingCriteria } from '../../../slicing/criterion/parse';
3
3
  import Joi from 'joi';
4
4
  import { executeResolveValueQuery } from './resolve-value-query-executor';
5
+ import type { ResolveResult } from '../../../dataflow/eval/resolve/alias-tracking';
5
6
  export interface ResolveValueQuery extends BaseQueryFormat {
6
7
  readonly type: 'resolve-value';
7
8
  /** The slicing criteria to use */
@@ -9,7 +10,7 @@ export interface ResolveValueQuery extends BaseQueryFormat {
9
10
  }
10
11
  export interface ResolveValueQueryResult extends BaseQueryResult {
11
12
  results: Record<string, {
12
- values: unknown[];
13
+ values: ResolveResult[];
13
14
  }>;
14
15
  }
15
16
  export declare const ResolveValueQueryDefinition: {
@@ -54,7 +55,7 @@ export declare const ResolveValueQueryDefinition: {
54
55
  }, input: {
55
56
  request?: import("../../../r-bridge/retriever").RParseRequests;
56
57
  parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
57
- }) => import("../../../dataflow/info").DataflowInformation;
58
+ }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
58
59
  readonly requiredInput: {};
59
60
  readonly name: "dataflow";
60
61
  readonly description: "Construct the dataflow graph";
@@ -8,27 +8,7 @@ const ansi_1 = require("../../../util/text/ansi");
8
8
  const time_1 = require("../../../util/text/time");
9
9
  const joi_1 = __importDefault(require("joi"));
10
10
  const resolve_value_query_executor_1 = require("./resolve-value-query-executor");
11
- function rValueToAscii(value) {
12
- if (value === null || value === undefined) {
13
- return 'undefined';
14
- }
15
- else if (typeof value === 'string') {
16
- return value;
17
- }
18
- else if (typeof value === 'object') {
19
- if ('num' in value) {
20
- return value.num.toString();
21
- }
22
- else if ('str' in value) {
23
- return `${value.quotes}${value.str}${value.quotes}`;
24
- }
25
- else {
26
- console.warn('omega lul');
27
- return JSON.stringify(value);
28
- }
29
- }
30
- return value;
31
- }
11
+ const r_value_1 = require("../../../dataflow/eval/values/r-value");
32
12
  exports.ResolveValueQueryDefinition = {
33
13
  executor: resolve_value_query_executor_1.executeResolveValueQuery,
34
14
  asciiSummarizer: (formatter, _processed, queryResults, result) => {
@@ -37,7 +17,7 @@ exports.ResolveValueQueryDefinition = {
37
17
  for (const [fingerprint, obj] of Object.entries(out.results)) {
38
18
  const { criteria } = JSON.parse(fingerprint);
39
19
  result.push(` ╰ Values for {${criteria.join(', ')}}`);
40
- result.push(` ╰ ${obj.values.map(v => rValueToAscii(v)).join(', ')}`);
20
+ result.push(` ╰ ${obj.values.map(v => (0, r_value_1.stringifyValue)(v)).join(', ')}`);
41
21
  }
42
22
  return true;
43
23
  },
@@ -1,3 +1,3 @@
1
1
  import type { BasicQueryData } from '../../base-query-format';
2
2
  import type { SearchQuery, SearchQueryResult } from './search-query-format';
3
- export declare function executeSearch({ ast, dataflow }: BasicQueryData, queries: readonly SearchQuery[]): SearchQueryResult;
3
+ export declare function executeSearch({ ast, dataflow, config }: BasicQueryData, queries: readonly SearchQuery[]): SearchQueryResult;
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeSearch = executeSearch;
4
4
  const flowr_search_executor_1 = require("../../../search/flowr-search-executor");
5
- function executeSearch({ ast, dataflow }, queries) {
5
+ function executeSearch({ ast, dataflow, config }, queries) {
6
6
  const start = Date.now();
7
7
  const results = [];
8
8
  for (const query of queries) {
9
9
  const { search } = query;
10
10
  results.push({
11
- ids: (0, flowr_search_executor_1.runSearch)(search, { normalize: ast, dataflow })
11
+ ids: (0, flowr_search_executor_1.runSearch)(search, { normalize: ast, dataflow, config })
12
12
  .map(({ node }) => node.info.id),
13
13
  search
14
14
  });
@@ -55,7 +55,7 @@ export declare const SearchQueryDefinition: {
55
55
  }, input: {
56
56
  request?: import("../../../r-bridge/retriever").RParseRequests;
57
57
  parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
58
- }) => import("../../../dataflow/info").DataflowInformation;
58
+ }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
59
59
  readonly requiredInput: {};
60
60
  readonly name: "dataflow";
61
61
  readonly description: "Construct the dataflow graph";
@@ -1,4 +1,4 @@
1
1
  import type { StaticSliceQuery, StaticSliceQueryResult } from './static-slice-query-format';
2
2
  import type { BasicQueryData } from '../../base-query-format';
3
3
  export declare function fingerPrintOfQuery(query: StaticSliceQuery): string;
4
- export declare function executeStaticSliceQuery({ dataflow: { graph }, ast }: BasicQueryData, queries: readonly StaticSliceQuery[]): StaticSliceQueryResult;
4
+ export declare function executeStaticSliceQuery({ dataflow: { graph }, ast, config }: BasicQueryData, queries: readonly StaticSliceQuery[]): StaticSliceQueryResult;
@@ -10,7 +10,7 @@ const log_1 = require("../../../util/log");
10
10
  function fingerPrintOfQuery(query) {
11
11
  return JSON.stringify(query);
12
12
  }
13
- function executeStaticSliceQuery({ dataflow: { graph }, ast }, queries) {
13
+ function executeStaticSliceQuery({ dataflow: { graph }, ast, config }, queries) {
14
14
  const start = Date.now();
15
15
  const results = {};
16
16
  for (const query of queries) {
@@ -20,7 +20,7 @@ function executeStaticSliceQuery({ dataflow: { graph }, ast }, queries) {
20
20
  }
21
21
  const { criteria, noReconstruction, noMagicComments } = query;
22
22
  const sliceStart = Date.now();
23
- const slice = (0, static_slicer_1.staticSlicing)(graph, ast, criteria);
23
+ const slice = (0, static_slicer_1.staticSlicing)(graph, ast, criteria, config.solver.slicer?.threshold);
24
24
  const sliceEnd = Date.now();
25
25
  if (noReconstruction) {
26
26
  results[key] = { slice: { ...slice, '.meta': { timing: sliceEnd - sliceStart } } };
@@ -67,7 +67,7 @@ export declare const StaticSliceQueryDefinition: {
67
67
  }, input: {
68
68
  request?: import("../../../r-bridge/retriever").RParseRequests;
69
69
  parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
70
- }) => import("../../../dataflow/info").DataflowInformation;
70
+ }, config: import("../../../config").FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
71
71
  readonly requiredInput: {};
72
72
  readonly name: "dataflow";
73
73
  readonly description: "Construct the dataflow graph";