@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
@@ -1,7 +1,165 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReferenceTypeReverseMapping = exports.ReferenceType = void 0;
3
+ exports.ReferenceTypeReverseMapping = exports.ReferenceType = exports.Identifier = void 0;
4
4
  exports.isReferenceType = isReferenceType;
5
+ const strings_1 = require("../../util/text/strings");
6
+ const dotDotDotAccess = /^\.\.\d+$/;
7
+ /**
8
+ * Helper functions to work with {@link Identifier|identifiers}.
9
+ * Use {@link Identifier.matches} to check if two identifiers match according to R's scoping rules!
10
+ * @example
11
+ * ```ts
12
+ * const id1 = Identifier.make('a', 'pkg');
13
+ * const id2 = Identifier.parse('pkg::a');
14
+ * const id3 = Identifier.parse('a');
15
+ * Identifier.matches(id1, id2); // true
16
+ * Identifier.matches(id3, id2); // true, as id3 has no namespace
17
+ * ```
18
+ */
19
+ exports.Identifier = {
20
+ /**
21
+ * Create an identifier from its name and optional namespace.
22
+ * Please note that for `internal` to count, a namespace must be provided!
23
+ */
24
+ make(name, namespace, internal = false) {
25
+ if ((0, strings_1.startAndEndsWith)(name, '`')) {
26
+ name = name.substring(1, name.length - 1);
27
+ }
28
+ if (namespace) {
29
+ return [name, namespace, internal];
30
+ }
31
+ else {
32
+ return name;
33
+ }
34
+ },
35
+ /**
36
+ * Parse an identifier from its string representation,
37
+ * Please note, that in R if one writes `"pkg::a"` this refers to a symbol named `pkg::a` and NOT to the namespaced identifier `a` in package `pkg`.
38
+ * In this scenario, see {@link Identifier.make} instead.
39
+ */
40
+ parse(str) {
41
+ const internal = str.includes(':::');
42
+ const parts = str.split(internal ? ':::' : '::');
43
+ if (parts.length === 2) {
44
+ return [parts[1], parts[0], internal];
45
+ }
46
+ return parts[0];
47
+ },
48
+ /**
49
+ * Get the name part of the identifier
50
+ */
51
+ getName(id) {
52
+ return Array.isArray(id) ? id[0] : id;
53
+ },
54
+ /**
55
+ * Get the namespace part of the identifier, undefined if there is none
56
+ */
57
+ getNamespace(id) {
58
+ return Array.isArray(id) ? id[1] : undefined;
59
+ },
60
+ /**
61
+ * Check if the identifier accesses internal objects (`:::`)
62
+ */
63
+ accessesInternal(id) {
64
+ return Array.isArray(id) ? id[2] : undefined;
65
+ },
66
+ /**
67
+ * Convert the identifier to a **valid R** string representation,
68
+ * this will properly quote namespaces that contain `::` to avoid confusion.
69
+ * @example
70
+ * ```ts
71
+ * Identifier.toString('a') // 'a'
72
+ * Identifier.toString(['a', 'pkg']) // 'pkg::a'
73
+ * Identifier.toString(['a', 'pkg:::internal', true]) // '"pkg:::internal":::a'
74
+ * ```
75
+ */
76
+ toString(id) {
77
+ if (Array.isArray(id)) {
78
+ if (id[1].includes('::')) {
79
+ return `${JSON.stringify(id[1])}${id[2] ? ':::' : '::'}${id[0]}`;
80
+ }
81
+ return `${id[1]}${id[2] ? ':::' : '::'}${id[0]}`;
82
+ }
83
+ else {
84
+ if (id.includes('::')) {
85
+ return JSON.stringify(id);
86
+ }
87
+ return id;
88
+ }
89
+ },
90
+ /**
91
+ * Check if two identifiers match.
92
+ * This differs from eq!
93
+ * If the first identifier is not namespaced, it will match any namespace!
94
+ * If we search for S3 methods (s3=true), the target may have an additional suffix after a dot.
95
+ * If the first identifier is internal, it will match any target (internal or not).
96
+ */
97
+ matches(id, target, s3 = false) {
98
+ const idName = exports.Identifier.getName(id);
99
+ const targetName = exports.Identifier.getName(target);
100
+ if (idName !== targetName) {
101
+ return s3 ? targetName.startsWith(idName + '.') : false;
102
+ }
103
+ const idNs = exports.Identifier.getNamespace(id);
104
+ if (idNs === undefined) {
105
+ return true;
106
+ }
107
+ const targetNs = exports.Identifier.getNamespace(target);
108
+ if (idNs !== targetNs) {
109
+ return false;
110
+ }
111
+ const idInternal = exports.Identifier.accessesInternal(id);
112
+ if (idInternal === true) {
113
+ return true;
114
+ }
115
+ const targetInternal = exports.Identifier.accessesInternal(target);
116
+ return idInternal === targetInternal;
117
+ },
118
+ /** Special identifier for the `...` argument */
119
+ dotdotdot() {
120
+ return '...';
121
+ },
122
+ /**
123
+ * Check if the identifier is the special `...` argument / or one of its accesses like `..1`, `..2`, etc.
124
+ * This always returns false for namespaced identifiers.
125
+ */
126
+ isDotDotDotAccess(id) {
127
+ return !Array.isArray(id) && (dotDotDotAccess.test(id) || id === '...');
128
+ },
129
+ /**
130
+ * Functor over the name of the identifier
131
+ */
132
+ mapName(id, fn) {
133
+ if (Array.isArray(id)) {
134
+ return [fn(id[0]), id[1], id[2]];
135
+ }
136
+ else {
137
+ return fn(id);
138
+ }
139
+ },
140
+ /**
141
+ * Functor over the namespace of the identifier
142
+ */
143
+ mapNamespace(id, fn) {
144
+ if (Array.isArray(id)) {
145
+ return [id[0], fn(id[1]), id[2]];
146
+ }
147
+ else {
148
+ return id;
149
+ }
150
+ },
151
+ /**
152
+ * Convert the identifier to its array representation
153
+ */
154
+ toArray(id) {
155
+ if (Array.isArray(id)) {
156
+ return [id[0], id[1], id[2]];
157
+ }
158
+ else {
159
+ return [id, undefined, undefined];
160
+ }
161
+ }
162
+ };
5
163
  /**
6
164
  * Each reference has exactly one reference type, stored as the respective number.
7
165
  * However, when checking, we may want to allow for one of several types,
@@ -34,6 +192,8 @@ var ReferenceType;
34
192
  ReferenceType[ReferenceType["BuiltInFunction"] = 128] = "BuiltInFunction";
35
193
  /** Prefix to identify S3 methods, use this, to for example dispatch a call to `f` which will then link to `f.*` */
36
194
  ReferenceType[ReferenceType["S3MethodPrefix"] = 256] = "S3MethodPrefix";
195
+ /** Prefix to identify S7 methods, use this, to for example dispatch a call to `f` which will then link to `f<7>*` */
196
+ ReferenceType[ReferenceType["S7MethodPrefix"] = 512] = "S7MethodPrefix";
37
197
  })(ReferenceType || (exports.ReferenceType = ReferenceType = {}));
38
198
  /** Reverse mapping of the reference types so you can get the name from the bitmask (useful for debugging) */
39
199
  exports.ReferenceTypeReverseMapping = new Map(Object.entries(ReferenceType).map(([k, v]) => [v, k]));
@@ -1,20 +1,20 @@
1
1
  import type { REnvironmentInformation } from './environment';
2
2
  import { Ternary } from '../../util/logic';
3
- import { type Identifier, type IdentifierDefinition, ReferenceType } from './identifier';
3
+ import { Identifier, type IdentifierDefinition, ReferenceType } from './identifier';
4
4
  /**
5
5
  * Resolves a given identifier name to a list of its possible definition location using R scoping and resolving rules.
6
6
  * If the type you want to reference is unknown, please use {@link resolveByNameAnyType} instead.
7
- * @param name - The name of the identifier to resolve
7
+ * @param id - The identifier to resolve (optionally namespaced)
8
8
  * @param environment - The current environment used for name resolution
9
9
  * @param target - The target (meta) type of the identifier to resolve
10
10
  * @returns A list of possible identifier definitions (one if the definition location is exactly and always known), or `undefined`
11
11
  * if the identifier is undefined in the current scope/with the current environment information.
12
12
  */
13
- export declare function resolveByName(name: Identifier, environment: REnvironmentInformation, target: ReferenceType): readonly IdentifierDefinition[] | undefined;
13
+ export declare function resolveByName(id: Identifier, environment: REnvironmentInformation, target: ReferenceType): readonly IdentifierDefinition[] | undefined;
14
14
  /**
15
15
  * The more performant version of {@link resolveByName} when the target type is unknown.
16
16
  */
17
- export declare function resolveByNameAnyType(name: Identifier, environment: REnvironmentInformation): IdentifierDefinition[] | undefined;
17
+ export declare function resolveByNameAnyType(id: Identifier, environment: REnvironmentInformation): IdentifierDefinition[] | undefined;
18
18
  /**
19
19
  * Checks whether the given identifier name resolves to a built-in constant with the given value.
20
20
  * @param name - The name of the identifier to resolve
@@ -6,6 +6,7 @@ exports.resolvesToBuiltInConstant = resolvesToBuiltInConstant;
6
6
  const logic_1 = require("../../util/logic");
7
7
  const identifier_1 = require("./identifier");
8
8
  const info_1 = require("../info");
9
+ const built_in_s_seven_dispatch_1 = require("../internal/process/functions/call/built-in/built-in-s-seven-dispatch");
9
10
  const FunctionTargetTypes = identifier_1.ReferenceType.Function | identifier_1.ReferenceType.BuiltInFunction | identifier_1.ReferenceType.Unknown | identifier_1.ReferenceType.Argument | identifier_1.ReferenceType.Parameter;
10
11
  const VariableTargetTypes = identifier_1.ReferenceType.Variable | identifier_1.ReferenceType.Parameter | identifier_1.ReferenceType.Argument | identifier_1.ReferenceType.Unknown;
11
12
  const ConstantTargetTypes = identifier_1.ReferenceType.Constant | identifier_1.ReferenceType.BuiltInConstant | identifier_1.ReferenceType.Unknown;
@@ -21,34 +22,44 @@ const TargetTypePredicate = {
21
22
  [identifier_1.ReferenceType.BuiltInConstant]: ({ type }) => (0, identifier_1.isReferenceType)(type, BuiltInConstantTargetTypes),
22
23
  [identifier_1.ReferenceType.BuiltInFunction]: ({ type }) => (0, identifier_1.isReferenceType)(type, BuiltInFunctionTargetTypes),
23
24
  [identifier_1.ReferenceType.S3MethodPrefix]: ({ type }) => (0, identifier_1.isReferenceType)(type, FunctionTargetTypes),
25
+ [identifier_1.ReferenceType.S7MethodPrefix]: ({ type }) => (0, identifier_1.isReferenceType)(type, FunctionTargetTypes),
24
26
  };
25
27
  /**
26
28
  * Resolves a given identifier name to a list of its possible definition location using R scoping and resolving rules.
27
29
  * If the type you want to reference is unknown, please use {@link resolveByNameAnyType} instead.
28
- * @param name - The name of the identifier to resolve
30
+ * @param id - The identifier to resolve (optionally namespaced)
29
31
  * @param environment - The current environment used for name resolution
30
32
  * @param target - The target (meta) type of the identifier to resolve
31
33
  * @returns A list of possible identifier definitions (one if the definition location is exactly and always known), or `undefined`
32
34
  * if the identifier is undefined in the current scope/with the current environment information.
33
35
  */
34
- function resolveByName(name, environment, target) {
36
+ function resolveByName(id, environment, target) {
35
37
  if (target === identifier_1.ReferenceType.Unknown) {
36
- return resolveByNameAnyType(name, environment);
38
+ return resolveByNameAnyType(id, environment);
37
39
  }
40
+ const [name, ns, internal] = identifier_1.Identifier.toArray(id);
38
41
  let current = environment.current;
39
42
  let definitions = undefined;
40
43
  const wantedType = TargetTypePredicate[target];
41
44
  do {
45
+ if (ns && current.n !== ns) {
46
+ current = current.parent;
47
+ continue;
48
+ }
42
49
  let definition;
43
- if (target === identifier_1.ReferenceType.S3MethodPrefix) {
44
- // S3 method prefixes only resolve to functions
50
+ if (target === identifier_1.ReferenceType.S3MethodPrefix || target === identifier_1.ReferenceType.S7MethodPrefix) {
51
+ // S3 method prefixes only resolve to functions, S3s must not match the exported criteria!
52
+ const infix = target === identifier_1.ReferenceType.S3MethodPrefix ? '.' : built_in_s_seven_dispatch_1.S7DispatchSeparator;
45
53
  definition = current.memory.entries()
46
- .filter(([defName]) => defName.startsWith(name + '.'))
54
+ .filter(([defName]) => defName.startsWith(name + infix))
47
55
  .flatMap(([, defs]) => defs)
48
56
  .toArray();
49
57
  }
50
58
  else {
51
59
  definition = current.memory.get(name);
60
+ if (internal === false) {
61
+ definition = definition?.filter(({ name }) => name === undefined || !identifier_1.Identifier.accessesInternal(name));
62
+ }
52
63
  }
53
64
  if (definition !== undefined && definition.length > 0) {
54
65
  const filtered = definition.filter(wantedType);
@@ -77,16 +88,24 @@ function resolveByName(name, environment, target) {
77
88
  /**
78
89
  * The more performant version of {@link resolveByName} when the target type is unknown.
79
90
  */
80
- function resolveByNameAnyType(name, environment) {
91
+ function resolveByNameAnyType(id, environment) {
81
92
  let current = environment.current;
82
- const g = current.cache?.get(name);
93
+ const g = current.cache?.get(id);
83
94
  if (g !== undefined) {
84
95
  return g;
85
96
  }
97
+ const [name, ns, internal] = identifier_1.Identifier.toArray(id);
86
98
  let definitions = undefined;
87
99
  do {
88
- const definition = current.memory.get(name);
100
+ if (ns && current.n !== ns) {
101
+ current = current.parent;
102
+ continue;
103
+ }
104
+ let definition = current.memory.get(name);
89
105
  if (definition) {
106
+ if (internal === false) {
107
+ definition = definition.filter(({ name }) => name === undefined || !identifier_1.Identifier.accessesInternal(name));
108
+ }
90
109
  if (definition.every(d => (0, info_1.happensInEveryBranch)(d.cds))) {
91
110
  environment.current.cache ??= new Map();
92
111
  environment.current.cache?.set(name, definition);
@@ -113,7 +132,7 @@ function resolveByNameAnyType(name, environment) {
113
132
  }
114
133
  if (ret) {
115
134
  environment.current.cache ??= new Map();
116
- environment.current.cache?.set(name, ret);
135
+ environment.current.cache?.set(id, ret);
117
136
  }
118
137
  return ret;
119
138
  }
@@ -87,6 +87,10 @@ function getAliases(sourceIds, dataflow, environment) {
87
87
  if (info === undefined) {
88
88
  return undefined;
89
89
  }
90
+ else if (info.tag === vertex_1.VertexType.FunctionDefinition) {
91
+ definitions.add(sourceId);
92
+ continue;
93
+ }
90
94
  const defs = AliasHandler[info.tag](sourceId, dataflow, environment);
91
95
  for (const def of defs ?? []) {
92
96
  definitions.add(def);
@@ -351,7 +355,10 @@ function resolveToConstants(name, environment) {
351
355
  return r_value_1.Top;
352
356
  }
353
357
  const values = new Set();
354
- definitions.forEach(def => values.add((0, general_1.valueFromTsValue)(def.value ?? r_value_1.Top)));
358
+ definitions.forEach(def => {
359
+ const d = def.value;
360
+ values.add(d === undefined ? r_value_1.Top : (0, general_1.valueFromTsValue)(d));
361
+ });
355
362
  return (0, set_constants_1.setFrom)(...values);
356
363
  }
357
364
  //# sourceMappingURL=alias-tracking.js.map
@@ -12,6 +12,7 @@ import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flow
12
12
  * aliases and vectors (in case of a vector).
13
13
  * @param a - Ast node to resolve
14
14
  * @param resolve - Variable resolve mode
15
+ * @param ctx - Analyzer context
15
16
  * @param env - Environment to use
16
17
  * @param graph - Dataflow Graph to use
17
18
  * @param map - Idmap of Dataflow Graph
@@ -41,9 +42,10 @@ export declare function resolveAsVector(resolve: VariableResolve, node: RNodeWit
41
42
  * by recursively resolving the values of the arguments by calling {@link resolveIdToValue}
42
43
  * @param resolve - Variable resolve mode
43
44
  * @param operator - Node of the sequence operator to resolve
44
- * @param env - Environment to use
45
45
  * @param graph - Dataflow graph
46
- * @param map - Id map of the dataflow graph
46
+ * @param ctx - Analyzer context
47
+ * @param idMap - Id map of the dataflow graph
48
+ * @param environment - Environment to use
47
49
  * @returns ValueVector of ValueNumbers or Top
48
50
  */
49
51
  export declare function resolveAsSeq(resolve: VariableResolve, operator: RNodeWithParent, ctx: ReadOnlyFlowrAnalyzerContext, environment?: REnvironmentInformation, graph?: DataflowGraph, idMap?: AstIdMap): ValueVector<Lift<ValueNumber[]>> | typeof Top;
@@ -55,9 +57,10 @@ export declare function resolveAsSeq(resolve: VariableResolve, operator: RNodeWi
55
57
  * by recursively resolving the values of the arguments by calling {@link resolveIdToValue}
56
58
  * @param resolve - Variable resolve mode
57
59
  * @param operator - Node of the plus operator to resolve
58
- * @param env - Environment to use
59
60
  * @param graph - Dataflow graph
60
- * @param map - Id map of the dataflow graph
61
+ * @param ctx - Analyzer context
62
+ * @param idMap - Id map of the dataflow graph
63
+ * @param environment - Environment to use
61
64
  * @returns ValueNumber, ValueVector of ValueNumbers, or Top
62
65
  */
63
66
  export declare function resolveAsPlus(resolve: VariableResolve, operator: RNodeWithParent, ctx: ReadOnlyFlowrAnalyzerContext, environment?: REnvironmentInformation, graph?: DataflowGraph, idMap?: AstIdMap): ValueNumber | ValueVector<Lift<ValueNumber[]>> | typeof Top;
@@ -69,9 +72,10 @@ export declare function resolveAsPlus(resolve: VariableResolve, operator: RNodeW
69
72
  * by recursively resolving the values of the arguments by calling {@link resolveIdToValue}
70
73
  * @param resolve - Variable resolve mode
71
74
  * @param operator - Node of the minus operator to resolve
72
- * @param env - Environment to use
73
75
  * @param graph - Dataflow graph
74
- * @param map - Id map of the dataflow graph
76
+ * @param ctx - Analyzer context
77
+ * @param idMap - Id map of the dataflow graph
78
+ * @param environment - Environment to use
75
79
  * @returns ValueNumber, ValueVector of ValueNumbers, or Top
76
80
  */
77
81
  export declare function resolveAsMinus(resolve: VariableResolve, operator: RNodeWithParent, ctx: ReadOnlyFlowrAnalyzerContext, environment?: REnvironmentInformation, graph?: DataflowGraph, idMap?: AstIdMap): ValueNumber | ValueVector<Lift<ValueNumber[]>> | typeof Top;
@@ -17,6 +17,7 @@ const string_constants_1 = require("../values/string/string-constants");
17
17
  const vector_constants_1 = require("../values/vectors/vector-constants");
18
18
  const alias_tracking_1 = require("./alias-tracking");
19
19
  const scalar_constants_1 = require("../values/scalar/scalar-constants");
20
+ const identifier_1 = require("../../environments/identifier");
20
21
  /**
21
22
  * Helper function used by {@link resolveIdToValue}, please use that instead, if
22
23
  * you want to resolve the value of an identifier / node
@@ -25,6 +26,7 @@ const scalar_constants_1 = require("../values/scalar/scalar-constants");
25
26
  * aliases and vectors (in case of a vector).
26
27
  * @param a - Ast node to resolve
27
28
  * @param resolve - Variable resolve mode
29
+ * @param ctx - Analyzer context
28
30
  * @param env - Environment to use
29
31
  * @param graph - Dataflow Graph to use
30
32
  * @param map - Idmap of Dataflow Graph
@@ -53,7 +55,7 @@ function resolveNode(resolve, a, ctx, env, graph, map) {
53
55
  builtInName = origin.proc;
54
56
  }
55
57
  else if (a.type === type_1.RType.FunctionCall && a.named) {
56
- builtInName = (0, built_in_1.builtInId)(a.functionName.content);
58
+ builtInName = (0, built_in_1.builtInId)(identifier_1.Identifier.getName(a.functionName.content));
57
59
  }
58
60
  else if (a.type === type_1.RType.BinaryOp || a.type === type_1.RType.UnaryOp) {
59
61
  builtInName = (0, built_in_1.builtInId)(a.operator);
@@ -98,9 +100,10 @@ function resolveAsVector(resolve, node, ctx, environment, graph, idMap) {
98
100
  * by recursively resolving the values of the arguments by calling {@link resolveIdToValue}
99
101
  * @param resolve - Variable resolve mode
100
102
  * @param operator - Node of the sequence operator to resolve
101
- * @param env - Environment to use
102
103
  * @param graph - Dataflow graph
103
- * @param map - Id map of the dataflow graph
104
+ * @param ctx - Analyzer context
105
+ * @param idMap - Id map of the dataflow graph
106
+ * @param environment - Environment to use
104
107
  * @returns ValueVector of ValueNumbers or Top
105
108
  */
106
109
  function resolveAsSeq(resolve, operator, ctx, environment, graph, idMap) {
@@ -125,9 +128,10 @@ function resolveAsSeq(resolve, operator, ctx, environment, graph, idMap) {
125
128
  * by recursively resolving the values of the arguments by calling {@link resolveIdToValue}
126
129
  * @param resolve - Variable resolve mode
127
130
  * @param operator - Node of the plus operator to resolve
128
- * @param env - Environment to use
129
131
  * @param graph - Dataflow graph
130
- * @param map - Id map of the dataflow graph
132
+ * @param ctx - Analyzer context
133
+ * @param idMap - Id map of the dataflow graph
134
+ * @param environment - Environment to use
131
135
  * @returns ValueNumber, ValueVector of ValueNumbers, or Top
132
136
  */
133
137
  function resolveAsPlus(resolve, operator, ctx, environment, graph, idMap) {
@@ -153,9 +157,10 @@ function resolveAsPlus(resolve, operator, ctx, environment, graph, idMap) {
153
157
  * by recursively resolving the values of the arguments by calling {@link resolveIdToValue}
154
158
  * @param resolve - Variable resolve mode
155
159
  * @param operator - Node of the minus operator to resolve
156
- * @param env - Environment to use
157
160
  * @param graph - Dataflow graph
158
- * @param map - Id map of the dataflow graph
161
+ * @param ctx - Analyzer context
162
+ * @param idMap - Id map of the dataflow graph
163
+ * @param environment - Environment to use
159
164
  * @returns ValueNumber, ValueVector of ValueNumbers, or Top
160
165
  */
161
166
  function resolveAsMinus(resolve, operator, ctx, environment, graph, idMap) {
@@ -39,7 +39,7 @@ function valueFromTsValue(a) {
39
39
  return r_value_1.Bottom;
40
40
  }
41
41
  else if (a === null) {
42
- return r_value_1.Top;
42
+ return { type: 'null' };
43
43
  }
44
44
  else if (typeof a === 'string') {
45
45
  return (0, string_constants_1.stringFrom)(a);
@@ -37,6 +37,9 @@ export interface ValueString<Str extends Lift<RStringValue> = Lift<RStringValue>
37
37
  type: 'string';
38
38
  value: Str;
39
39
  }
40
+ export interface ValueNull {
41
+ type: 'null';
42
+ }
40
43
  export interface ValueFunctionDefinition {
41
44
  type: 'function-definition';
42
45
  }
@@ -48,7 +51,7 @@ export interface ValueLogical {
48
51
  type: 'logical';
49
52
  value: Lift<TernaryLogical>;
50
53
  }
51
- export type Value = Lift<ValueInterval | ValueVector | ValueSet | ValueNumber | ValueString | ValueLogical | ValueMissing | ValueFunctionDefinition>;
54
+ export type Value = Lift<ValueInterval | ValueVector | ValueSet | ValueNumber | ValueString | ValueLogical | ValueMissing | ValueFunctionDefinition | ValueNull>;
52
55
  export type ValueType<V> = V extends {
53
56
  type: infer T;
54
57
  } ? T : never;
@@ -76,6 +76,8 @@ function stringifyValue(value) {
76
76
  return tryStringifyBoTop(value, v => {
77
77
  const t = v.type;
78
78
  switch (t) {
79
+ case 'null':
80
+ return 'NULL';
79
81
  case 'interval':
80
82
  return `${v.startInclusive ? '[' : '('}${stringifyValue(v.start)}, ${stringifyValue(v.end)}${v.endInclusive ? ']' : ')'}`;
81
83
  case 'vector':
@@ -20,6 +20,7 @@ const edge_1 = require("./graph/edge");
20
20
  const identify_link_to_last_call_relation_1 = require("../queries/catalog/call-context-query/identify-link-to-last-call-relation");
21
21
  const built_in_function_definition_1 = require("./internal/process/functions/call/built-in/built-in-function-definition");
22
22
  const flowr_file_1 = require("../project/context/flowr-file");
23
+ const identifier_1 = require("./environments/identifier");
23
24
  /**
24
25
  * The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
25
26
  * Maps every {@link RType} in the normalized AST to a processor.
@@ -53,7 +54,7 @@ exports.processors = {
53
54
  content: groupStart?.content ?? '{',
54
55
  lexeme: groupStart?.lexeme ?? '{',
55
56
  location: location ?? (0, range_1.invalidRange)(),
56
- namespace: groupStart?.content ? undefined : 'base'
57
+ ns: groupStart?.content ? undefined : 'base'
57
58
  }, (0, make_argument_1.wrapArgumentsUnnamed)(children, d.completeAst.idMap), info.id, d);
58
59
  }
59
60
  };
@@ -71,7 +72,7 @@ function resolveLinkToSideEffects(ast, graph) {
71
72
  cf = (0, extract_cfg_1.extractCfgQuick)(ast);
72
73
  if (graph.unknownSideEffects.size > 20) {
73
74
  knownCalls = (0, extract_cfg_1.getCallsInCfg)(cf, graph);
74
- allCallNames = Array.from(new Set(knownCalls.values().map(c => c.name)));
75
+ allCallNames = Array.from(new Set(knownCalls.values().map(c => identifier_1.Identifier.toString(c.name))));
75
76
  }
76
77
  }
77
78
  else if (handled.has(s.id)) {
@@ -109,10 +110,12 @@ function produceDataFlowGraph(parser, completeAst, ctx) {
109
110
  // we freeze the files here to avoid endless modifications during processing
110
111
  const files = completeAst.ast.files.slice();
111
112
  ctx.files.addConsideredFile(files[0].filePath ? files[0].filePath : flowr_file_1.FlowrFile.INLINE_PATH);
113
+ const env = ctx.env.makeCleanEnv();
114
+ env.current.n = ctx.meta.getNamespace();
112
115
  const dfData = {
113
116
  parser,
114
117
  completeAst,
115
- environment: ctx.env.makeCleanEnv(),
118
+ environment: env,
116
119
  processors: ctx.config.solver.instrument.dataflowExtractors?.(exports.processors, ctx) ?? exports.processors,
117
120
  cds: undefined,
118
121
  referenceChain: [files[0].filePath],
@@ -21,8 +21,8 @@ function isAnyReturnAFunction(def, graph) {
21
21
  return true;
22
22
  }
23
23
  const next = graph.outgoingEdges(current.id) ?? [];
24
- for (const [t, { types }] of next) {
25
- if ((0, edge_1.edgeIncludesType)(types, edge_1.EdgeType.Returns)) {
24
+ for (const [t, e] of next) {
25
+ if (edge_1.DfEdge.includesType(e, edge_1.EdgeType.Returns)) {
26
26
  const v = graph.getVertex(t);
27
27
  if (v) {
28
28
  workingQueue.push(v);
@@ -34,8 +34,8 @@ function isAnyReturnAFunction(def, graph) {
34
34
  }
35
35
  function inspectCallSitesArgumentsFns(def, graph, ctx) {
36
36
  const callSites = graph.ingoingEdges(def.id);
37
- for (const [callerId, { types }] of callSites ?? []) {
38
- if (!(0, edge_1.edgeIncludesType)(types, edge_1.EdgeType.Calls)) {
37
+ for (const [callerId, e] of callSites ?? []) {
38
+ if (!edge_1.DfEdge.includesType(e, edge_1.EdgeType.Calls)) {
39
39
  continue;
40
40
  }
41
41
  const caller = graph.getVertex(callerId);
@@ -14,7 +14,7 @@ export type CallGraph = DataflowGraph<Required<DataflowGraphVertexFunctionCall |
14
14
  */
15
15
  export declare function getSubCallGraph(graph: CallGraph, entryPoints: Set<NodeId>): CallGraph;
16
16
  /**
17
- *
17
+ * Determines whether there is a path from `from` to `to` in the given graph (via any edge type, only respecting direction)
18
18
  */
19
19
  export declare function reaches(from: NodeId, to: NodeId, graph: DataflowGraph, knownReachability?: DefaultMap<NodeId, Set<NodeId>>): boolean;
20
20
  /**
@@ -28,8 +28,8 @@ function getSubCallGraph(graph, entryPoints) {
28
28
  continue;
29
29
  }
30
30
  result.addVertex(currentVtx, undefined, true);
31
- for (const [tar, { types }] of graph.outgoingEdges(currentId) ?? []) {
32
- if ((0, edge_1.edgeIncludesType)(types, edge_1.EdgeType.Calls)) {
31
+ for (const [tar, e] of graph.outgoingEdges(currentId) ?? []) {
32
+ if (edge_1.DfEdge.includesType(e, edge_1.EdgeType.Calls)) {
33
33
  result.addEdge(currentId, tar, edge_1.EdgeType.Calls);
34
34
  toVisit.push(tar);
35
35
  }
@@ -38,7 +38,7 @@ function getSubCallGraph(graph, entryPoints) {
38
38
  return result;
39
39
  }
40
40
  /**
41
- *
41
+ * Determines whether there is a path from `from` to `to` in the given graph (via any edge type, only respecting direction)
42
42
  */
43
43
  function reaches(from, to, graph, knownReachability = new defaultmap_1.DefaultMap(() => new Set())) {
44
44
  const visited = new Set();
@@ -147,8 +147,8 @@ function fallbackUntargetedCall(vtx, graph) {
147
147
  continue;
148
148
  }
149
149
  let addedNew = false;
150
- for (const [tar, { types }] of graph.outgoingEdges(currentId) ?? []) {
151
- if ((0, edge_1.edgeIncludesType)(types, UntargetedCallFollow) && (0, edge_1.edgeDoesNotIncludeType)(types, UntargetedCallAvoid)) {
150
+ for (const [tar, e] of graph.outgoingEdges(currentId) ?? []) {
151
+ if (edge_1.DfEdge.includesType(e, UntargetedCallFollow) && edge_1.DfEdge.doesNotIncludeType(e, UntargetedCallAvoid)) {
152
152
  addedNew = true;
153
153
  toVisit.push(tar);
154
154
  }
@@ -174,10 +174,12 @@ function processCall(vtx, from, graph, result, state) {
174
174
  // for each call, resolve the targets
175
175
  const tars = (0, linker_1.getAllFunctionCallTargets)(vid, graph, vtx.environment);
176
176
  let addedTarget = false;
177
+ let addedBiTarget = false;
177
178
  for (const tar of tars) {
178
179
  if ((0, built_in_1.isBuiltIn)(tar)) {
179
180
  result.addEdge(vid, tar, edge_1.EdgeType.Calls);
180
181
  addedTarget = true;
182
+ addedBiTarget = true;
181
183
  continue;
182
184
  }
183
185
  const targetVtx = graph.getVertex(tar);
@@ -187,7 +189,7 @@ function processCall(vtx, from, graph, result, state) {
187
189
  addedTarget = true;
188
190
  processFunctionDefinition(targetVtx, vid, graph, result, state);
189
191
  }
190
- if (vtx.origin !== 'unnamed') {
192
+ if (!addedBiTarget && vtx.origin !== 'unnamed') {
191
193
  for (const origs of vtx.origin) {
192
194
  if (origs.startsWith('builtin:')) {
193
195
  addedTarget = true;
@@ -217,8 +219,8 @@ function processCall(vtx, from, graph, result, state) {
217
219
  }
218
220
  }
219
221
  // handle arguments, traversing the 'reads' and the 'returns' edges
220
- for (const [tar, { types }] of graph.outgoingEdges(vtx.id) ?? []) {
221
- if ((0, edge_1.edgeDoesNotIncludeType)(types, edge_1.EdgeType.Reads | edge_1.EdgeType.Returns | edge_1.EdgeType.Argument)) {
222
+ for (const [tar, e] of graph.outgoingEdges(vtx.id) ?? []) {
223
+ if (edge_1.DfEdge.doesNotIncludeType(e, edge_1.EdgeType.Reads | edge_1.EdgeType.Returns | edge_1.EdgeType.Argument)) {
222
224
  continue;
223
225
  }
224
226
  const tVtx = graph.getVertex(tar);
@@ -12,6 +12,7 @@ const arrays_1 = require("../../util/collections/arrays");
12
12
  const vertex_1 = require("./vertex");
13
13
  const edge_1 = require("./edge");
14
14
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
15
+ const identifier_1 = require("../environments/identifier");
15
16
  const diff_2 = require("../environments/diff");
16
17
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
17
18
  const info_1 = require("../info");
@@ -293,9 +294,10 @@ function diffReferenceLists(fn, a, b, ctx) {
293
294
  const aSorted = [...a].sort((x, y) => x.nodeId.toString().localeCompare(y.nodeId.toString()));
294
295
  const bSorted = [...b].sort((x, y) => x.nodeId.toString().localeCompare(y.nodeId.toString()));
295
296
  for (let i = 0; i < aSorted.length; ++i) {
297
+ const inam = aSorted[i].name;
296
298
  (0, diff_2.diffIdentifierReferences)(aSorted[i], bSorted[i], {
297
299
  ...ctx,
298
- position: `${ctx.position}In reference #${i} ("${aSorted[i].name ?? '?'}", id: ${aSorted[i].nodeId ?? '?'}) `,
300
+ position: `${ctx.position}In reference #${i} ("${inam ? identifier_1.Identifier.toString(inam) : '?'}", id: ${aSorted[i].nodeId ?? '?'}) `,
299
301
  });
300
302
  }
301
303
  }
@@ -325,13 +327,13 @@ function diffHooks(left, right, ctx, id) {
325
327
  }
326
328
  }
327
329
  function diffEdge(edge, otherEdge, ctx, id, target) {
328
- const edgeTypes = (0, edge_1.splitEdgeTypes)(edge.types);
329
- const otherEdgeTypes = (0, edge_1.splitEdgeTypes)(otherEdge.types);
330
+ const edgeTypes = edge_1.DfEdge.splitTypes(edge);
331
+ const otherEdgeTypes = edge_1.DfEdge.splitTypes(otherEdge);
330
332
  if ((edgeTypes.length < otherEdgeTypes.length && !ctx.config.leftIsSubgraph) || (edgeTypes.length > otherEdgeTypes.length && !ctx.config.rightIsSubgraph)) {
331
333
  ctx.report.addComment(`Target of ${id}->${target} in ${ctx.leftname} differs in number of edge types: ${JSON.stringify([...edgeTypes])} vs ${JSON.stringify([...otherEdgeTypes])}`, { tag: 'edge', from: id, to: target });
332
334
  }
333
335
  if (edge.types !== otherEdge.types) {
334
- ctx.report.addComment(`Target of ${id}->${target} in ${ctx.leftname} differs in edge types: ${JSON.stringify([...(0, edge_1.edgeTypesToNames)(edge.types)])} vs ${JSON.stringify([...(0, edge_1.edgeTypesToNames)(otherEdge.types)])}`, { tag: 'edge', from: id, to: target });
336
+ ctx.report.addComment(`Target of ${id}->${target} in ${ctx.leftname} differs in edge types: ${JSON.stringify([...edge_1.DfEdge.typesToNames(edge)])} vs ${JSON.stringify([...edge_1.DfEdge.typesToNames(otherEdge)])}`, { tag: 'edge', from: id, to: target });
335
337
  }
336
338
  }
337
339
  /**