@eagleoutice/flowr 2.8.15 → 2.9.1

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 (216) hide show
  1. package/README.md +20 -21
  2. package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +4 -3
  3. package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -3
  4. package/abstract-interpretation/data-frame/mappers/arguments.d.ts +2 -1
  5. package/abstract-interpretation/data-frame/mappers/arguments.js +2 -1
  6. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +4 -3
  7. package/abstract-interpretation/data-frame/mappers/function-mapper.js +13 -10
  8. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +7 -6
  9. package/abstract-interpretation/data-frame/resolve-args.js +2 -1
  10. package/benchmark/slicer.d.ts +0 -16
  11. package/benchmark/slicer.js +1 -48
  12. package/benchmark/stats/print.js +0 -6
  13. package/benchmark/stats/stats.d.ts +0 -3
  14. package/benchmark/summarizer/first-phase/process.js +1 -1
  15. package/benchmark/summarizer/second-phase/process.js +0 -6
  16. package/cli/benchmark-app.d.ts +0 -1
  17. package/cli/benchmark-app.js +0 -1
  18. package/cli/benchmark-helper-app.d.ts +0 -1
  19. package/cli/benchmark-helper-app.js +1 -5
  20. package/cli/common/options.d.ts +0 -10
  21. package/cli/common/options.js +0 -2
  22. package/cli/common/scripts-info.d.ts +0 -10
  23. package/cli/repl/server/connection.js +1 -1
  24. package/config.d.ts +0 -15
  25. package/config.js +0 -21
  26. package/control-flow/cfg-dead-code.js +0 -3
  27. package/control-flow/extract-cfg.js +4 -0
  28. package/control-flow/semantic-cfg-guided-visitor.d.ts +32 -0
  29. package/control-flow/semantic-cfg-guided-visitor.js +36 -4
  30. package/dataflow/cluster.js +2 -2
  31. package/dataflow/environments/built-in-config.d.ts +1 -0
  32. package/dataflow/environments/built-in.d.ts +19 -3
  33. package/dataflow/environments/built-in.js +25 -7
  34. package/dataflow/environments/default-builtin-config.d.ts +59 -8
  35. package/dataflow/environments/default-builtin-config.js +20 -6
  36. package/dataflow/environments/define.d.ts +4 -11
  37. package/dataflow/environments/define.js +16 -96
  38. package/dataflow/environments/diff.js +3 -2
  39. package/dataflow/environments/environment.d.ts +17 -6
  40. package/dataflow/environments/environment.js +69 -18
  41. package/dataflow/environments/identifier.d.ts +95 -7
  42. package/dataflow/environments/identifier.js +161 -1
  43. package/dataflow/environments/resolve-by-name.d.ts +4 -4
  44. package/dataflow/environments/resolve-by-name.js +29 -10
  45. package/dataflow/eval/resolve/alias-tracking.js +8 -1
  46. package/dataflow/eval/resolve/resolve.d.ts +10 -6
  47. package/dataflow/eval/resolve/resolve.js +12 -7
  48. package/dataflow/eval/values/general.js +1 -1
  49. package/dataflow/eval/values/r-value.d.ts +4 -1
  50. package/dataflow/eval/values/r-value.js +2 -0
  51. package/dataflow/extractor.js +6 -3
  52. package/dataflow/fn/higher-order-function.js +4 -4
  53. package/dataflow/graph/call-graph.d.ts +1 -1
  54. package/dataflow/graph/call-graph.js +10 -8
  55. package/dataflow/graph/diff-dataflow-graph.js +6 -4
  56. package/dataflow/graph/edge.d.ts +48 -31
  57. package/dataflow/graph/edge.js +66 -60
  58. package/dataflow/graph/graph.d.ts +7 -7
  59. package/dataflow/graph/quads.js +1 -1
  60. package/dataflow/graph/resolve-graph.js +1 -1
  61. package/dataflow/graph/unknown-replacement.d.ts +2 -1
  62. package/dataflow/graph/vertex.d.ts +2 -103
  63. package/dataflow/graph/vertex.js +0 -44
  64. package/dataflow/internal/linker.d.ts +2 -2
  65. package/dataflow/internal/linker.js +35 -19
  66. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +3 -65
  67. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +4 -6
  68. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +18 -51
  69. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -1
  70. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +4 -4
  71. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -2
  72. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +34 -9
  73. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +4 -4
  74. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +2 -2
  75. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +6 -2
  76. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +1 -69
  77. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +1 -1
  78. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +1 -1
  79. package/dataflow/internal/process/functions/call/built-in/built-in-recall.d.ts +11 -0
  80. package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +46 -0
  81. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +3 -2
  82. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -2
  83. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +30 -72
  84. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +12 -0
  85. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +27 -0
  86. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +19 -0
  87. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +204 -0
  88. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +2 -0
  89. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +25 -4
  90. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +2 -1
  91. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +4 -3
  92. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +3 -2
  93. package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +1 -60
  94. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +3 -3
  95. package/dataflow/internal/process/functions/call/common.d.ts +3 -1
  96. package/dataflow/internal/process/functions/call/common.js +4 -16
  97. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +6 -2
  98. package/dataflow/internal/process/functions/call/known-call-handling.js +2 -3
  99. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -0
  100. package/dataflow/internal/process/functions/call/named-call-handling.js +1 -0
  101. package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +2 -1
  102. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -1
  103. package/dataflow/internal/process/functions/process-parameter.js +1 -1
  104. package/dataflow/internal/process/process-named-call.d.ts +2 -1
  105. package/dataflow/internal/process/process-named-call.js +0 -1
  106. package/dataflow/internal/process/process-symbol.d.ts +3 -1
  107. package/dataflow/internal/process/process-symbol.js +8 -5
  108. package/dataflow/origin/dfg-get-origin.d.ts +2 -2
  109. package/dataflow/origin/dfg-get-origin.js +4 -4
  110. package/dataflow/origin/dfg-get-symbol-refs.js +2 -2
  111. package/documentation/data/interface/doc-writing-code.d.ts +6 -0
  112. package/documentation/data/interface/doc-writing-code.js +175 -0
  113. package/documentation/doc-util/doc-types.d.ts +3 -1
  114. package/documentation/doc-util/doc-types.js +4 -2
  115. package/documentation/wiki-absint.js +2 -1
  116. package/documentation/wiki-analyzer.js +17 -2
  117. package/documentation/wiki-cfg.js +2 -2
  118. package/documentation/wiki-dataflow-graph.js +9 -8
  119. package/documentation/wiki-interface.js +8 -164
  120. package/documentation/wiki-mk/doc-context.d.ts +12 -1
  121. package/documentation/wiki-mk/doc-context.js +21 -4
  122. package/documentation/wiki-normalized-ast.js +5 -0
  123. package/linter/linter-rules.d.ts +3 -3
  124. package/linter/rules/absolute-path.js +23 -23
  125. package/linter/rules/dataframe-access-validation.js +2 -1
  126. package/linter/rules/deprecated-functions.d.ts +1 -1
  127. package/linter/rules/deprecated-functions.js +1 -1
  128. package/linter/rules/function-finder-util.d.ts +2 -2
  129. package/linter/rules/naming-convention.d.ts +9 -2
  130. package/linter/rules/naming-convention.js +38 -36
  131. package/linter/rules/network-functions.d.ts +1 -1
  132. package/linter/rules/seeded-randomness.d.ts +2 -2
  133. package/linter/rules/seeded-randomness.js +5 -4
  134. package/linter/rules/unused-definition.js +4 -4
  135. package/package.json +6 -5
  136. package/project/context/flowr-analyzer-context.d.ts +17 -1
  137. package/project/context/flowr-analyzer-context.js +17 -1
  138. package/project/context/flowr-analyzer-meta-context.d.ts +51 -0
  139. package/project/context/flowr-analyzer-meta-context.js +47 -0
  140. package/project/flowr-analyzer.d.ts +17 -1
  141. package/project/flowr-analyzer.js +18 -0
  142. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +15 -0
  143. package/project/plugins/file-plugins/files/flowr-description-file.js +26 -0
  144. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +40 -3
  145. package/project/plugins/file-plugins/files/flowr-namespace-file.js +352 -9
  146. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +1 -1
  147. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +2 -2
  148. package/project/plugins/flowr-analyzer-plugin-defaults.js +2 -0
  149. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
  150. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.d.ts +12 -0
  151. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +42 -0
  152. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +1 -1
  153. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +2 -2
  154. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.d.ts +1 -1
  155. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +2 -2
  156. package/project/plugins/plugin-registry.d.ts +2 -1
  157. package/project/plugins/plugin-registry.js +2 -0
  158. package/queries/catalog/call-context-query/call-context-query-executor.js +6 -4
  159. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -1
  160. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +3 -3
  161. package/queries/catalog/dependencies-query/dependencies-query-format.js +5 -3
  162. package/queries/catalog/does-call-query/does-call-query-executor.js +2 -1
  163. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -2
  164. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -1
  165. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +1 -1
  166. package/r-bridge/data/data.d.ts +12 -7
  167. package/r-bridge/data/data.js +13 -7
  168. package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -12
  169. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +2 -1
  170. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -1
  171. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +7 -3
  172. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +2 -1
  173. package/r-bridge/lang-4.x/ast/model/type.d.ts +1 -1
  174. package/r-bridge/lang-4.x/ast/model/type.js +1 -1
  175. package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +1 -1
  176. package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +5 -5
  177. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -3
  178. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +4 -5
  179. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
  180. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +2 -2
  181. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-break.js +1 -1
  182. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-for.js +1 -1
  183. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-next.js +1 -1
  184. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +1 -1
  185. package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +1 -1
  186. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -2
  187. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +2 -3
  188. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +1 -1
  189. package/r-bridge/lang-4.x/ast/parser/main/internal/other/normalize-comment.js +1 -1
  190. package/r-bridge/lang-4.x/ast/parser/main/internal/other/normalize-line-directive.js +2 -2
  191. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +3 -3
  192. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +1 -1
  193. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -2
  194. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
  195. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.d.ts +1 -2
  196. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +13 -14
  197. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +24 -31
  198. package/r-bridge/roxygen2/roxygen-parse.js +1 -1
  199. package/reconstruct/auto-select/magic-comments.js +1 -1
  200. package/reconstruct/reconstruct.js +6 -5
  201. package/search/flowr-search-filters.js +2 -1
  202. package/search/search-executor/search-enrichers.d.ts +1 -2
  203. package/search/search-executor/search-enrichers.js +2 -1
  204. package/slicing/static/slice-call.d.ts +1 -1
  205. package/slicing/static/slice-call.js +8 -8
  206. package/slicing/static/static-slicer.js +2 -2
  207. package/statistics/features/common-syntax-probability.js +3 -2
  208. package/statistics/features/supported/defined-functions/defined-functions.js +3 -3
  209. package/statistics/features/supported/used-functions/used-functions.js +3 -2
  210. package/util/mermaid/dfg.js +3 -3
  211. package/util/r-value.d.ts +3 -2
  212. package/util/r-value.js +3 -0
  213. package/util/simple-df/dfg-ascii.js +5 -5
  214. package/util/version.js +1 -1
  215. package/util/containers.d.ts +0 -66
  216. package/util/containers.js +0 -143
@@ -9,17 +9,18 @@ const retriever_1 = require("../../../../../../r-bridge/retriever");
9
9
  const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
10
10
  const edge_1 = require("../../../../../graph/edge");
11
11
  const built_in_1 = require("../../../../../environments/built-in");
12
+ const identifier_1 = require("../../../../../environments/identifier");
12
13
  /**
13
14
  * Processes a built-in 'get' function call.
14
15
  */
15
16
  function processGet(name, args, rootId, data) {
16
17
  if (args.length !== 1) {
17
- logger_1.dataflowLogger.warn(`symbol access with ${name.content} has not 1 argument, skipping`);
18
+ logger_1.dataflowLogger.warn(`symbol access with ${identifier_1.Identifier.toString(name.content)} has not 1 argument, skipping`);
18
19
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
19
20
  }
20
21
  const retrieve = (0, unpack_argument_1.unpackNonameArg)(args[0]);
21
22
  if (retrieve === undefined || retrieve.type !== type_1.RType.String) {
22
- logger_1.dataflowLogger.warn(`symbol access with ${name.content} has not 1 argument, skipping`);
23
+ logger_1.dataflowLogger.warn(`symbol access with ${identifier_1.Identifier.toString(name.content)} has not 1 argument, skipping`);
23
24
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
24
25
  }
25
26
  const treatTargetAsSymbol = {
@@ -27,8 +28,7 @@ function processGet(name, args, rootId, data) {
27
28
  info: retrieve.info,
28
29
  content: (0, retriever_1.removeRQuotes)(retrieve.lexeme),
29
30
  lexeme: retrieve.lexeme,
30
- location: retrieve.location,
31
- namespace: undefined
31
+ location: retrieve.location
32
32
  };
33
33
  const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({
34
34
  name,
@@ -44,12 +44,12 @@ function getArguments(config, args) {
44
44
  */
45
45
  function processIfThenElse(name, args, rootId, data, config) {
46
46
  if (args.length !== 2 && args.length !== 3) {
47
- logger_1.dataflowLogger.warn(`If-then-else ${name.content} has something different from 2 or 3 arguments, skipping`);
47
+ logger_1.dataflowLogger.warn(`If-then-else ${identifier_1.Identifier.toString(name.content)} has something different from 2 or 3 arguments, skipping`);
48
48
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
49
49
  }
50
50
  const { condArg, thenArg, otherwiseArg } = getArguments(config, args);
51
51
  if (condArg === undefined || thenArg === undefined) {
52
- logger_1.dataflowLogger.warn(`If-then-else ${name.content} has empty condition or then case in ${JSON.stringify(args)}, skipping`);
52
+ logger_1.dataflowLogger.warn(`If-then-else ${identifier_1.Identifier.toString(name.content)} has empty condition or then case in ${JSON.stringify(args)}, skipping`);
53
53
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
54
54
  }
55
55
  const cond = (0, processor_1.processDataflowFor)(condArg, data);
@@ -7,13 +7,14 @@ const unpack_argument_1 = require("../argument/unpack-argument");
7
7
  const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
8
8
  const make_argument_1 = require("../argument/make-argument");
9
9
  const built_in_1 = require("../../../../../environments/built-in");
10
+ const identifier_1 = require("../../../../../environments/identifier");
10
11
  /**
11
12
  * Process a library call like `library` or `require`
12
13
  */
13
14
  function processLibrary(name, args, rootId, data) {
14
15
  /* we do not really know what loading the library does and what side effects it causes, hence we mark it as an unknown side effect */
15
16
  if (args.length !== 1) {
16
- logger_1.dataflowLogger.warn(`Currently only one-arg library-likes are allows (for ${name.content}), skipping`);
17
+ logger_1.dataflowLogger.warn(`Currently only one-arg library-likes are allows (for ${identifier_1.Identifier.toString(name.content)}), skipping`);
17
18
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, hasUnknownSideEffect: true, origin: 'default' }).information;
18
19
  }
19
20
  const nameToLoad = (0, unpack_argument_1.unpackNonameArg)(args[0]);
@@ -21,6 +22,9 @@ function processLibrary(name, args, rootId, data) {
21
22
  logger_1.dataflowLogger.warn('No library name provided, skipping');
22
23
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, hasUnknownSideEffect: true, origin: 'default' }).information;
23
24
  }
25
+ if (identifier_1.Identifier.getNamespace(nameToLoad.content) !== undefined) {
26
+ logger_1.dataflowLogger.warn('Namespaced library names are not supported, ignoring namespace');
27
+ }
24
28
  // treat as a function call but convert the first argument to a string
25
29
  const newArg = {
26
30
  type: type_1.RType.String,
@@ -29,7 +33,7 @@ function processLibrary(name, args, rootId, data) {
29
33
  location: nameToLoad.location,
30
34
  content: {
31
35
  quotes: 'none',
32
- str: nameToLoad.content
36
+ str: identifier_1.Identifier.getName(nameToLoad.content)
33
37
  }
34
38
  };
35
39
  return (0, known_call_handling_1.processKnownFunctionCall)({
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.processList = processList;
4
- const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
5
- const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
6
4
  const known_call_handling_1 = require("../known-call-handling");
7
- const config_1 = require("../../../../../../config");
8
- const containers_1 = require("../../../../../../util/containers");
9
5
  const built_in_1 = require("../../../../../environments/built-in");
10
6
  /**
11
7
  * Process a list call.
@@ -16,70 +12,6 @@ const built_in_1 = require("../../../../../environments/built-in");
16
12
  * ```
17
13
  */
18
14
  function processList(name, args, rootId, data) {
19
- const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_1.BuiltInProcName.List });
20
- if (!data.ctx.config.solver.pointerTracking) {
21
- return fnCall.information;
22
- }
23
- const listArgs = [];
24
- for (const arg of args) {
25
- // Skip non named arguments
26
- if (arg === r_function_call_1.EmptyArgument || arg.type !== type_1.RType.Argument || arg.value === undefined) {
27
- continue;
28
- }
29
- let newIndex;
30
- if (arg.name) {
31
- // Named argument
32
- newIndex = {
33
- identifier: {
34
- index: arg.info.index,
35
- lexeme: arg.name.content
36
- },
37
- nodeId: arg.info.id,
38
- };
39
- }
40
- else {
41
- // Unnamed argument
42
- newIndex = {
43
- identifier: {
44
- index: arg.info.index,
45
- },
46
- nodeId: arg.value.info.id,
47
- };
48
- }
49
- // Check whether argument value can be resolved
50
- if (arg.value.type === type_1.RType.Symbol) {
51
- const indicesCollection = (0, containers_1.resolveIndicesByName)(arg.value.lexeme, data.environment);
52
- if (indicesCollection) {
53
- newIndex = {
54
- ...newIndex,
55
- subIndices: indicesCollection,
56
- };
57
- }
58
- }
59
- else {
60
- // Check whether argument is nested container
61
- const indicesCollection = fnCall.information.graph.getVertex(arg.value.info.id)?.indicesCollection;
62
- if (indicesCollection) {
63
- newIndex = {
64
- ...newIndex,
65
- subIndices: indicesCollection,
66
- };
67
- }
68
- }
69
- listArgs.push(newIndex);
70
- }
71
- if ((0, config_1.isOverPointerAnalysisThreshold)(data.ctx.config, listArgs.length)) {
72
- return fnCall.information;
73
- }
74
- const indices = {
75
- indices: listArgs,
76
- isContainer: true,
77
- };
78
- // Add resolved indices to vertex
79
- const vertex = fnCall.information.graph.getVertex(rootId);
80
- if (vertex) {
81
- vertex.indicesCollection = [indices];
82
- }
83
- return fnCall.information;
15
+ return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_1.BuiltInProcName.List }).information;
84
16
  }
85
17
  //# sourceMappingURL=built-in-list.js.map
@@ -16,7 +16,7 @@ const built_in_1 = require("../../../../../environments/built-in");
16
16
  function processPipe(name, args, rootId, data) {
17
17
  const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_1.BuiltInProcName.Pipe });
18
18
  if (args.length !== 2) {
19
- logger_1.dataflowLogger.warn(`Pipe ${name.content} has something else than 2 arguments, skipping`);
19
+ logger_1.dataflowLogger.warn(`Pipe ${identifier_1.Identifier.toString(name.content)} has something else than 2 arguments, skipping`);
20
20
  return information;
21
21
  }
22
22
  const [lhs, rhs] = args.map(e => (0, unpack_argument_1.unpackNonameArg)(e));
@@ -23,7 +23,7 @@ function processQuote(name, args, rootId, data, config) {
23
23
  else if (processedArg) {
24
24
  information.graph.addEdge(rootId, processedArg.entryPoint, edge_1.EdgeType.NonStandardEvaluation);
25
25
  /* nse actually affects _everything_ within that argument! */
26
- for (const [vtx,] of processedArg.graph.vertices(true)) {
26
+ for (const [vtx] of processedArg.graph.vertices(true)) {
27
27
  information.graph.addEdge(rootId, vtx, edge_1.EdgeType.NonStandardEvaluation);
28
28
  }
29
29
  }
@@ -0,0 +1,11 @@
1
+ import type { DataflowProcessorInformation } from '../../../../../processor';
2
+ import type { DataflowInformation } from '../../../../../info';
3
+ import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
4
+ import type { RFunctionArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
5
+ import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
6
+ import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
+ /**
8
+ * Processes a built-in 'Recall' function call, linking
9
+ * the recall to the enveloping function closure.
10
+ */
11
+ export declare function processRecall<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processRecall = processRecall;
4
+ const known_call_handling_1 = require("../known-call-handling");
5
+ const built_in_1 = require("../../../../../environments/built-in");
6
+ const log_1 = require("../../../../../../util/log");
7
+ const edge_1 = require("../../../../../graph/edge");
8
+ const vertex_1 = require("../../../../../graph/vertex");
9
+ const unnamed_call_handling_1 = require("../unnamed-call-handling");
10
+ const identifier_1 = require("../../../../../environments/identifier");
11
+ /**
12
+ * Processes a built-in 'Recall' function call, linking
13
+ * the recall to the enveloping function closure.
14
+ */
15
+ function processRecall(name, args, rootId, data) {
16
+ const { information } = (0, known_call_handling_1.processKnownFunctionCall)({
17
+ name,
18
+ args,
19
+ rootId,
20
+ data,
21
+ origin: built_in_1.BuiltInProcName.Recall
22
+ });
23
+ let cur = data.environment.current;
24
+ let closure;
25
+ while (cur) {
26
+ if (cur.closure) {
27
+ closure = cur.closure;
28
+ break;
29
+ }
30
+ cur = cur.parent;
31
+ }
32
+ if (closure) {
33
+ information.graph.addEdge(rootId, closure, edge_1.EdgeType.Calls);
34
+ // also kill the name of the recall function
35
+ const r = information.graph.getVertex(rootId);
36
+ if ((0, vertex_1.isFunctionCallVertex)(r)) {
37
+ r.name = unnamed_call_handling_1.UnnamedFunctionCallPrefix + rootId + '-' + identifier_1.Identifier.toString(r.name);
38
+ r.environment = information.environment;
39
+ }
40
+ }
41
+ else {
42
+ log_1.log.warn('No enclosing function closure found for recall at node', rootId);
43
+ }
44
+ return information;
45
+ }
46
+ //# sourceMappingURL=built-in-recall.js.map
@@ -9,6 +9,7 @@ const unpack_argument_1 = require("../argument/unpack-argument");
9
9
  const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
10
10
  const logger_1 = require("../../../../../logger");
11
11
  const built_in_1 = require("../../../../../environments/built-in");
12
+ const identifier_1 = require("../../../../../environments/identifier");
12
13
  /**
13
14
  * Process a built-in repeat loop function call like `repeat { ... }`.
14
15
  * @param name - The name of the function being called.
@@ -19,7 +20,7 @@ const built_in_1 = require("../../../../../environments/built-in");
19
20
  */
20
21
  function processRepeatLoop(name, args, rootId, data) {
21
22
  if (args.length !== 1 || args[0] === r_function_call_1.EmptyArgument) {
22
- logger_1.dataflowLogger.warn(`Repeat-Loop ${name.content} does not have 1 argument, skipping`);
23
+ logger_1.dataflowLogger.warn(`Repeat-Loop ${identifier_1.Identifier.toString(name.content)} does not have 1 argument, skipping`);
23
24
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
24
25
  }
25
26
  const unpacked = (0, unpack_argument_1.unpackNonameArg)(args[0]);
@@ -39,7 +40,7 @@ function processRepeatLoop(name, args, rootId, data) {
39
40
  origin: built_in_1.BuiltInProcName.RepeatLoop
40
41
  });
41
42
  const body = processedArguments[0];
42
- (0, assert_1.guard)(body !== undefined, () => `Repeat-Loop ${name.content} has no body, impossible!`);
43
+ (0, assert_1.guard)(body !== undefined, () => `Repeat-Loop ${identifier_1.Identifier.toString(name.content)} has no body, impossible!`);
43
44
  (0, linker_1.linkCircularRedefinitionsWithinALoop)(information.graph, (0, linker_1.produceNameSharedIdMap)((0, linker_1.findNonLocalReads)(information.graph, [])), body.out);
44
45
  (0, linker_1.reapplyLoopExitPoints)(body.exitPoints, body.in.concat(body.out, body.unknownReferences));
45
46
  information.exitPoints = (0, info_1.filterOutLoopExitPoints)(information.exitPoints);
@@ -5,7 +5,6 @@ import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/
5
5
  import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
6
6
  import { type RFunctionArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
7
7
  import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
8
- import { type ContainerIndicesCollection } from '../../../../../graph/vertex';
9
8
  /**
10
9
  * Process a replacement function call like `<-`, `[[<-`, `$<-`, etc.
11
10
  * These are automatically created when doing assignments like `x[y] <- value` or in general `fun(x) <- value` will call `fun<- (x, value)`.
@@ -14,8 +13,8 @@ export declare function processReplacementFunction<OtherInfo>(name: RSymbol<Othe
14
13
  /** The last one has to be the value */
15
14
  args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: {
16
15
  makeMaybe?: boolean;
16
+ constructName?: 's7';
17
17
  assignmentOperator?: '<-' | '<<-';
18
18
  readIndices?: boolean;
19
- activeIndices?: ContainerIndicesCollection;
20
19
  assignRootId?: NodeId;
21
20
  } & ForceArguments): DataflowInformation;
@@ -10,13 +10,15 @@ const logger_1 = require("../../../../../logger");
10
10
  const vertex_1 = require("../../../../../graph/vertex");
11
11
  const graph_1 = require("../../../../../graph/graph");
12
12
  const edge_1 = require("../../../../../graph/edge");
13
- const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
14
- const containers_1 = require("../../../../../../util/containers");
15
13
  const unpack_argument_1 = require("../argument/unpack-argument");
16
14
  const built_in_access_1 = require("./built-in-access");
17
15
  const built_in_1 = require("../../../../../environments/built-in");
18
16
  const identifier_1 = require("../../../../../environments/identifier");
19
17
  const unknown_replacement_1 = require("../../../../../graph/unknown-replacement");
18
+ const built_in_s_seven_dispatch_1 = require("./built-in-s-seven-dispatch");
19
+ const make_argument_1 = require("../argument/make-argument");
20
+ const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
21
+ const range_1 = require("../../../../../../util/range");
20
22
  /**
21
23
  * Process a replacement function call like `<-`, `[[<-`, `$<-`, etc.
22
24
  * These are automatically created when doing assignments like `x[y] <- value` or in general `fun(x) <- value` will call `fun<- (x, value)`.
@@ -25,20 +27,30 @@ function processReplacementFunction(name,
25
27
  /** The last one has to be the value */
26
28
  args, rootId, data, config) {
27
29
  if (args.length < 2) {
28
- logger_1.dataflowLogger.warn(`Replacement ${name.content} has less than 2 arguments, skipping`);
30
+ logger_1.dataflowLogger.warn(`Replacement ${identifier_1.Identifier.getName(name.content)} has less than 2 arguments, skipping`);
29
31
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
30
32
  }
31
33
  /* we only get here if <-, <<-, ... or whatever is part of the replacement is not overwritten */
32
- (0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Replacement ${name.content} with ${JSON.stringify(args)}, processing`);
33
- let indices = config.activeIndices;
34
- if (data.ctx.config.solver.pointerTracking) {
35
- indices ??= constructAccessedIndices(name.content, args);
34
+ (0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Replacement ${identifier_1.Identifier.getName(name.content)} with ${JSON.stringify(args)}, processing`);
35
+ let targetArg = args[0];
36
+ if (config.constructName === 's7' && targetArg !== r_function_call_1.EmptyArgument) {
37
+ let tarName = targetArg.lexeme;
38
+ if (args.length > 2 && args[1] !== r_function_call_1.EmptyArgument) {
39
+ tarName += built_in_s_seven_dispatch_1.S7DispatchSeparator + args[1].lexeme;
40
+ }
41
+ const uArg = (0, unpack_argument_1.unpackArg)(targetArg) ?? targetArg;
42
+ targetArg = (0, make_argument_1.toUnnamedArgument)({
43
+ content: tarName,
44
+ type: type_1.RType.Symbol,
45
+ info: uArg.info,
46
+ lexeme: tarName,
47
+ location: uArg.location ?? (0, range_1.invalidRange)()
48
+ }, data.completeAst.idMap);
36
49
  }
37
50
  /* we assign the first argument by the last for now and maybe mark as maybe!, we can keep the symbol as we now know we have an assignment */
38
- let res = built_in_1.BuiltInProcessorMapper[built_in_1.BuiltInProcName.Assignment](name, [args[0], args.at(-1)], rootId, data, {
51
+ let res = built_in_1.BuiltInProcessorMapper[built_in_1.BuiltInProcName.Assignment](name, [targetArg, args.at(-1)], rootId, data, {
39
52
  superAssignment: config.assignmentOperator === '<<-',
40
- makeMaybe: indices === undefined ? config.makeMaybe : false,
41
- indicesCollection: indices,
53
+ makeMaybe: config.makeMaybe,
42
54
  canBeReplacement: true
43
55
  });
44
56
  const createdVert = res.graph.getVertex(rootId);
@@ -86,73 +98,19 @@ args, rootId, data, config) {
86
98
  }
87
99
  }
88
100
  const fa = (0, unpack_argument_1.unpackNonameArg)(args[0]);
89
- if (!data.ctx.config.solver.pointerTracking && fa) {
101
+ if (fa) {
90
102
  res = {
91
103
  ...res,
92
104
  in: [...res.in, { name: fa.lexeme, type: identifier_1.ReferenceType.Variable, nodeId: fa.info.id, cds: data.cds }]
93
105
  };
94
106
  }
95
- return res;
96
- }
97
- /**
98
- * Constructs accessed indices of replacement function recursively.
99
- *
100
- * Example:
101
- * ```r
102
- * a$b <- 1
103
- * # results in index with lexeme b as identifier
104
- *
105
- * a[[1]]$b
106
- * # results in index with index 1 as identifier with a sub-index with lexeme b as identifier
107
- * ```
108
- * @param operation - Operation of replacement function e.g. '$\<-', '[\<-', '[[\<-'
109
- * @param args - Arguments of the replacement function
110
- * @returns Accessed indices construct
111
- */
112
- function constructAccessedIndices(operation, args) {
113
- const { accessedArg, accessArg } = (0, containers_1.getAccessOperands)(args);
114
- if (accessedArg === undefined || accessArg?.value === undefined || !isSupportedOperation(operation, accessArg.value)) {
115
- return undefined;
116
- }
117
- const constructIdentifier = getIdentifierBuilder(operation);
118
- const leafIndex = {
119
- identifier: constructIdentifier(accessArg),
120
- nodeId: accessedArg.info.parent ?? ''
121
- };
122
- const accessIndices = {
123
- indices: [leafIndex],
124
- isContainer: false
125
- };
126
- // Check for nested access
127
- let indicesCollection = undefined;
128
- if (accessedArg.value?.type === type_1.RType.Access) {
129
- indicesCollection = (0, containers_1.constructNestedAccess)(accessedArg.value, accessIndices, constructIdentifier);
107
+ // dispatches actually as S3:
108
+ const fns = res.in.filter(i => i.nodeId === rootId);
109
+ for (const fn of fns) {
110
+ fn.type = identifier_1.ReferenceType.S3MethodPrefix;
130
111
  }
131
- else {
132
- // use access node as reference to get complete line in slice
133
- indicesCollection = [accessIndices];
134
- }
135
- return indicesCollection;
136
- }
137
- function isSupportedOperation(operation, value) {
138
- const isNameBasedAccess = (operation === '$<-' || operation === '@<-') && value.type === type_1.RType.Symbol;
139
- const isNumericalIndexBasedAccess = (operation === '[[<-' || operation === '[<-') && value.type === type_1.RType.Number;
140
- return isNameBasedAccess || isNumericalIndexBasedAccess;
141
- }
142
- function getIdentifierBuilder(operation) {
143
- if (operation === '$<-' || operation == '@<-') {
144
- return (arg) => {
145
- return {
146
- index: undefined,
147
- lexeme: arg.lexeme,
148
- };
149
- };
150
- }
151
- // [[<- and [<-
152
- return (arg) => {
153
- return {
154
- index: Number(arg.lexeme),
155
- };
156
- };
112
+ // link the built-in replacement op
113
+ res.graph.addEdge(rootId, (0, built_in_1.builtInId)(identifier_1.Identifier.getName(name.content)), edge_1.EdgeType.Calls | edge_1.EdgeType.Reads);
114
+ return res;
157
115
  }
158
116
  //# sourceMappingURL=built-in-replacement.js.map
@@ -0,0 +1,12 @@
1
+ import type { DataflowProcessorInformation } from '../../../../../processor';
2
+ import type { DataflowInformation } from '../../../../../info';
3
+ import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
4
+ import { type RFunctionArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
5
+ import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
6
+ import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
+ /** Used to separate S7 dispatch info in identifiers */
8
+ export declare const S7DispatchSeparator = "\uFE55s3\uFE55";
9
+ /**
10
+ * Process an S7 generic dispatch call like `S7_dispatch`.
11
+ */
12
+ export declare function processS7Dispatch<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): DataflowInformation;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.S7DispatchSeparator = void 0;
4
+ exports.processS7Dispatch = processS7Dispatch;
5
+ const known_call_handling_1 = require("../known-call-handling");
6
+ const built_in_1 = require("../../../../../environments/built-in");
7
+ const identifier_1 = require("../../../../../environments/identifier");
8
+ /** Used to separate S7 dispatch info in identifiers */
9
+ exports.S7DispatchSeparator = '﹕s3﹕';
10
+ /**
11
+ * Process an S7 generic dispatch call like `S7_dispatch`.
12
+ */
13
+ function processS7Dispatch(name, args, rootId, data) {
14
+ if (!('currentS7name' in data) || !Array.isArray(data.currentS7name)) {
15
+ return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_1.BuiltInProcName.S7Dispatch }).information;
16
+ }
17
+ const info = (0, known_call_handling_1.processKnownFunctionCall)({ name, forceArgs: 'all', args, rootId, data, origin: built_in_1.BuiltInProcName.S7Dispatch }).information;
18
+ for (const id of data.currentS7name) {
19
+ if (typeof id === 'string') {
20
+ const newIn = info.in.slice();
21
+ newIn.push({ nodeId: rootId, name: id, cds: data.cds, type: identifier_1.ReferenceType.S7MethodPrefix });
22
+ info.in = newIn;
23
+ }
24
+ }
25
+ return info;
26
+ }
27
+ //# sourceMappingURL=built-in-s-seven-dispatch.js.map
@@ -0,0 +1,19 @@
1
+ import type { DataflowProcessorInformation } from '../../../../../processor';
2
+ import type { DataflowInformation } from '../../../../../info';
3
+ import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
4
+ import { type RFunctionArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
5
+ import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
6
+ import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
+ /** e.g. new_generic(name, dispatch_args, fun=NULL) */
8
+ interface S7GenericDispatchConfig {
9
+ args: {
10
+ name: string;
11
+ dispatchArg: string | undefined;
12
+ fun: string;
13
+ };
14
+ }
15
+ /**
16
+ * Process an S7 new generic dispatch call like `new_generic` or `setGeneric`.
17
+ */
18
+ export declare function processS7NewGeneric<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: S7GenericDispatchConfig): DataflowInformation;
19
+ export {};