@eagleoutice/flowr 2.13.13 → 2.13.15

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 (186) hide show
  1. package/README.md +31 -28
  2. package/abstract-interpretation/data-frame/resolve-args.js +11 -12
  3. package/benchmark/calibration.d.ts +18 -0
  4. package/benchmark/calibration.js +63 -0
  5. package/benchmark/slicer.d.ts +19 -0
  6. package/benchmark/slicer.js +84 -1
  7. package/benchmark/stats/feature-counts.d.ts +6 -0
  8. package/benchmark/stats/feature-counts.js +61 -0
  9. package/benchmark/stats/print.js +20 -0
  10. package/benchmark/stats/sigdb-counts.d.ts +7 -0
  11. package/benchmark/stats/sigdb-counts.js +219 -0
  12. package/benchmark/stats/size-of.d.ts +6 -0
  13. package/benchmark/stats/size-of.js +8 -0
  14. package/benchmark/stats/stats.d.ts +79 -0
  15. package/benchmark/stats/stats.js +7 -1
  16. package/benchmark/stopwatch.d.ts +4 -0
  17. package/benchmark/stopwatch.js +12 -1
  18. package/benchmark/summarizer/data.d.ts +17 -1
  19. package/benchmark/summarizer/first-phase/input.js +5 -0
  20. package/benchmark/summarizer/first-phase/process.js +12 -2
  21. package/benchmark/summarizer/second-phase/graph.d.ts +24 -1
  22. package/benchmark/summarizer/second-phase/graph.js +249 -18
  23. package/benchmark/summarizer/second-phase/process.js +56 -0
  24. package/benchmark/summarizer/summarizer.js +1 -2
  25. package/cli/benchmark-app.d.ts +1 -0
  26. package/cli/benchmark-app.js +2 -1
  27. package/cli/benchmark-helper-app.d.ts +1 -0
  28. package/cli/benchmark-helper-app.js +12 -2
  29. package/cli/common/options.d.ts +10 -0
  30. package/cli/common/options.js +3 -1
  31. package/cli/common/scripts-info.d.ts +10 -0
  32. package/cli/repl/commands/repl-cfg.js +2 -42
  33. package/cli/repl/commands/repl-clipboard.d.ts +7 -0
  34. package/cli/repl/commands/repl-clipboard.js +53 -0
  35. package/cli/repl/commands/repl-dataflow.js +5 -70
  36. package/cli/repl/commands/repl-normalize.js +3 -51
  37. package/control-flow/cfg-builder.d.ts +30 -0
  38. package/control-flow/cfg-builder.js +79 -0
  39. package/control-flow/cfg-dead-code.js +5 -29
  40. package/control-flow/diff-cfg.js +2 -56
  41. package/control-flow/extract-cfg.js +17 -10
  42. package/control-flow/semantic-cfg-guided-visitor.d.ts +7 -0
  43. package/control-flow/semantic-cfg-guided-visitor.js +14 -0
  44. package/control-flow/useless-loop.js +4 -26
  45. package/core/steps/all/core/10-normalize.d.ts +8 -0
  46. package/core/steps/all/core/10-normalize.js +10 -8
  47. package/core/steps/all/core/11-normalize-tree-sitter.d.ts +5 -7
  48. package/core/steps/all/core/11-normalize-tree-sitter.js +2 -9
  49. package/data/r-base-packages.generated.d.ts +1 -0
  50. package/data/r-base-packages.generated.js +5 -3
  51. package/dataflow/environments/apply-kill.d.ts +3 -3
  52. package/dataflow/environments/apply-kill.js +60 -31
  53. package/dataflow/environments/built-in-config.d.ts +9 -1
  54. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  55. package/dataflow/environments/built-in-proc-name.js +2 -0
  56. package/dataflow/environments/built-in-props.d.ts +4 -0
  57. package/dataflow/environments/built-in-props.js +3 -3
  58. package/dataflow/environments/built-in.d.ts +4 -2
  59. package/dataflow/environments/built-in.js +53 -3
  60. package/dataflow/environments/data-masking-functions.d.ts +3 -4
  61. package/dataflow/environments/data-masking-functions.js +7 -8
  62. package/dataflow/environments/default-builtin-config.d.ts +92 -12
  63. package/dataflow/environments/default-builtin-config.js +86 -43
  64. package/dataflow/environments/environment.d.ts +5 -0
  65. package/dataflow/environments/environment.js +17 -12
  66. package/dataflow/environments/identifier.d.ts +3 -0
  67. package/dataflow/environments/reference-to-maybe.d.ts +5 -3
  68. package/dataflow/environments/reference-to-maybe.js +17 -52
  69. package/dataflow/environments/resolve-helper.d.ts +2 -1
  70. package/dataflow/environments/resolve-helper.js +2 -1
  71. package/dataflow/eval/resolve/alias-tracking.js +4 -7
  72. package/dataflow/eval/resolve/node-value.d.ts +51 -0
  73. package/dataflow/eval/resolve/node-value.js +71 -0
  74. package/dataflow/eval/resolve/resolve-argument.js +10 -7
  75. package/dataflow/eval/resolve/resolve-operators.js +1 -2
  76. package/dataflow/eval/values/general.d.ts +4 -0
  77. package/dataflow/eval/values/general.js +11 -0
  78. package/dataflow/eval/values/r-value.d.ts +15 -0
  79. package/dataflow/eval/values/r-value.js +27 -1
  80. package/dataflow/extractor.js +2 -0
  81. package/dataflow/fn/higher-order-function.js +2 -3
  82. package/dataflow/graph/df-helper.d.ts +2 -1
  83. package/dataflow/graph/diff-dataflow-graph.js +3 -55
  84. package/dataflow/graph/graph.d.ts +5 -0
  85. package/dataflow/graph/graph.js +27 -0
  86. package/dataflow/info.d.ts +7 -1
  87. package/dataflow/info.js +36 -7
  88. package/dataflow/internal/linker.d.ts +23 -0
  89. package/dataflow/internal/linker.js +70 -1
  90. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +4 -1
  91. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +2 -0
  92. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +8 -29
  93. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +39 -6
  94. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +10 -22
  95. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +29 -53
  96. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +33 -10
  97. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +4 -1
  98. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -5
  99. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -7
  100. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -3
  101. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +6 -2
  102. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +19 -12
  103. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +2 -1
  104. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +3 -0
  105. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +69 -52
  106. package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
  107. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +2 -8
  108. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -1
  109. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +7 -2
  110. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -8
  111. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +2 -2
  112. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -2
  113. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +5 -0
  114. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +23 -3
  115. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +5 -4
  116. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +7 -10
  117. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +6 -1
  118. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +20 -3
  119. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +6 -8
  120. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.d.ts +25 -0
  121. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +105 -0
  122. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +9 -28
  123. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
  124. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +1 -1
  125. package/dataflow/internal/process/functions/call/deferred.d.ts +41 -0
  126. package/dataflow/internal/process/functions/call/deferred.js +127 -0
  127. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +13 -12
  128. package/dataflow/internal/process/functions/call/known-call-handling.js +35 -35
  129. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
  130. package/dataflow/internal/process/functions/call/named-call-handling.js +8 -4
  131. package/dataflow/internal/process/functions/call/nse.d.ts +28 -0
  132. package/dataflow/internal/process/functions/call/nse.js +87 -0
  133. package/dataflow/internal/process/functions/call/quoted.d.ts +29 -0
  134. package/dataflow/internal/process/functions/call/quoted.js +188 -0
  135. package/documentation/doc-readme.js +5 -2
  136. package/documentation/doc-util/doc-issue.d.ts +2 -0
  137. package/documentation/doc-util/doc-issue.js +3 -1
  138. package/documentation/doc-util/doc-types.js +15 -9
  139. package/documentation/wiki-dataflow-graph.js +4 -0
  140. package/documentation/wiki-faq.js +6 -2
  141. package/documentation/wiki-onboarding.js +11 -1
  142. package/documentation/wiki-setup.js +2 -1
  143. package/linter/rules/deprecated-functions.js +9 -3
  144. package/linter/rules/seeded-randomness.js +2 -3
  145. package/linter/rules/undefined-symbol.js +10 -1
  146. package/package.json +9 -4
  147. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +6 -0
  148. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +17 -1
  149. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +2 -11
  150. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +3 -15
  151. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.d.ts +16 -0
  152. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.js +26 -0
  153. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -11
  154. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +3 -15
  155. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +4 -10
  156. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +2 -9
  157. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +2 -9
  158. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +1 -1
  159. package/project/sigdb/reader.d.ts +9 -0
  160. package/project/sigdb/reader.js +30 -0
  161. package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -1
  162. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +0 -12
  163. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -37
  164. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +2 -23
  165. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +2 -2
  166. package/queries/query-function-filter.d.ts +21 -0
  167. package/queries/query-function-filter.js +48 -0
  168. package/r-bridge/data/data.d.ts +13 -3
  169. package/r-bridge/data/data.js +15 -3
  170. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +2 -0
  171. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +4 -0
  172. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +11 -9
  173. package/search/flowr-search-filters.d.ts +5 -1
  174. package/search/flowr-search-filters.js +31 -21
  175. package/search/search-executor/search-enrichers.d.ts +24 -4
  176. package/search/search-executor/search-enrichers.js +22 -9
  177. package/search/search-executor/search-transformer.js +1 -1
  178. package/slicing/static/slice-call.js +4 -4
  179. package/util/diff-graph.d.ts +13 -0
  180. package/util/diff-graph.js +64 -1
  181. package/util/files.js +9 -8
  182. package/util/node-version.d.ts +4 -0
  183. package/util/node-version.js +29 -0
  184. package/util/r-base-packages.d.ts +2 -0
  185. package/util/r-base-packages.js +3 -1
  186. package/util/version.js +1 -1
@@ -15,6 +15,7 @@ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-
15
15
  const unpack_argument_1 = require("../argument/unpack-argument");
16
16
  const built_in_envir_utils_1 = require("./built-in-envir-utils");
17
17
  const built_in_stack_env_1 = require("./built-in-stack-env");
18
+ const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
18
19
  function tableAssignmentProcessor(name, args, rootId, data, outInfo) {
19
20
  outInfo.definitionRootNodes.push(rootId);
20
21
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.TableAssignment }).information;
@@ -69,7 +70,9 @@ function processAccess(name, args, rootId, data, config) {
69
70
  if (envState) {
70
71
  const fieldNode = (0, unpack_argument_1.unpackArg)(args[1]);
71
72
  const fieldName = fieldNode?.type === type_1.RType.String ? fieldNode.content.str : (config.treatIndicesAsString ? fieldNode?.lexeme : undefined);
72
- const fieldDefs = fieldName ? envState.current.memory.get(fieldName) : undefined;
73
+ const fieldDefs = fieldName
74
+ ? ((0, built_in_stack_env_1.stackEnvInheritsFields)(head.value) ? (0, resolve_by_name_1.resolveByName)(fieldName, envState, identifier_1.ReferenceType.Unknown) : envState.current.memory.get(fieldName))
75
+ : undefined;
73
76
  for (const fd of fieldDefs ?? []) {
74
77
  info.graph.addEdge(name.info.id, fd.nodeId, edge_1.EdgeType.Reads);
75
78
  if (stackEnvState === undefined && fd.type === identifier_1.ReferenceType.Function) {
@@ -30,6 +30,8 @@ export interface BuiltInApplyConfiguration extends MergeableRecord {
30
30
  readonly resolveInEnvironment?: 'global' | 'local';
31
31
  /** Should the value of the function be resolved? */
32
32
  readonly resolveValue?: boolean;
33
+ /** the call reaches beyond what we can see even when the callee resolves, like `rlang::exec` */
34
+ readonly hasUnknownSideEffects?: boolean;
33
35
  }
34
36
  /**
35
37
  * Process an apply call like `vapply` or `mapply`.
@@ -10,10 +10,9 @@ const vertex_1 = require("../../../../../graph/vertex");
10
10
  const edge_1 = require("../../../../../graph/edge");
11
11
  const unknown_side_effect_1 = require("../../../../../graph/unknown-side-effect");
12
12
  const identifier_1 = require("../../../../../environments/identifier");
13
- const resolve_by_name_1 = require("../../../../../environments/resolve-by-name");
14
13
  const unnamed_call_handling_1 = require("../unnamed-call-handling");
15
- const log_1 = require("../../../../../../util/log");
16
- const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
14
+ const linker_1 = require("../../../../linker");
15
+ const node_value_1 = require("../../../../../eval/resolve/node-value");
17
16
  const r_string_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
18
17
  const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
19
18
  /** Resolve the function an argument stands for: a string literal, a symbol, or an inline definition; `undefined` if none. */
@@ -28,7 +27,7 @@ function resolveFunctionArgument(val, data, opts) {
28
27
  return undefined;
29
28
  }
30
29
  const functionName = opts.resolveValue
31
- ? (0, alias_tracking_1.resolveIdToSingleString)(val.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables, ctx: data.ctx })
30
+ ? node_value_1.NodeValue.singleStringOf(val.info.id, data)
32
31
  : val.content;
33
32
  return functionName === undefined ? undefined : { functionId: val.info.id, functionName, anonymous: false, asString: false };
34
33
  }
@@ -36,7 +35,7 @@ function resolveFunctionArgument(val, data, opts) {
36
35
  * Process an apply call like `vapply` or `mapply`.
37
36
  */
38
37
  function processApply(name, args, rootId, data, config) {
39
- const { indexOfFunction = 1, nameOfFunctionArgument, unquoteFunction, resolveInEnvironment, resolveValue } = config;
38
+ const { indexOfFunction = 1, nameOfFunctionArgument, unquoteFunction, resolveInEnvironment, resolveValue, hasUnknownSideEffects } = config;
40
39
  /* as the length is one-based and the argument filter mapping is zero-based, we do not have to subtract 1 */
41
40
  const forceArgsMask = new Array(indexOfFunction).fill(false);
42
41
  forceArgsMask.push(true);
@@ -44,6 +43,9 @@ function processApply(name, args, rootId, data, config) {
44
43
  name, args, rootId, data, forceArgs: forceArgsMask, origin: built_in_proc_name_1.BuiltInProcName.Apply
45
44
  });
46
45
  let information = resFn.information;
46
+ if (hasUnknownSideEffects) {
47
+ (0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
48
+ }
47
49
  const processedArguments = resFn.processedArguments;
48
50
  let index = indexOfFunction;
49
51
  /* search, if one of the arguments actually contains the argument name if given in the config */
@@ -132,30 +134,7 @@ function processApply(name, args, rootId, data, config) {
132
134
  };
133
135
  const dfVert = information.graph.getVertex(rootId);
134
136
  if (dfVert && dfVert.tag === vertex_1.VertexType.FunctionDefinition) {
135
- // resolve all ingoings against the environment
136
- const ingoingRefs = dfVert.subflow.in;
137
- const remainingIn = [];
138
- for (const ingoing of ingoingRefs) {
139
- const resolved = ingoing.name ? (0, resolve_by_name_1.resolveByName)(ingoing.name, data.environment, ingoing.type) : undefined;
140
- if (resolved === undefined) {
141
- remainingIn.push(ingoing);
142
- continue;
143
- }
144
- (0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Found ${resolved.length} references to open ref ${ingoing.nodeId} in closure of function definition ${rootId}`);
145
- let allBuiltIn = true;
146
- const inId = ingoing.nodeId;
147
- for (const { nodeId, type } of resolved) {
148
- information.graph.addEdge(inId, nodeId, edge_1.EdgeType.Reads);
149
- information.graph.addEdge(rootId, nodeId, edge_1.EdgeType.Reads); // because the def. is the anonymous call
150
- if (!(0, identifier_1.isReferenceType)(type, identifier_1.ReferenceType.BuiltInConstant | identifier_1.ReferenceType.BuiltInFunction)) {
151
- allBuiltIn = false;
152
- }
153
- }
154
- if (allBuiltIn) {
155
- remainingIn.push(ingoing);
156
- }
157
- }
158
- dfVert.subflow.in = remainingIn;
137
+ linker_1.ClosureRefs.resolveOpenIngoing(information.graph, rootId, dfVert, data.environment);
159
138
  }
160
139
  }
161
140
  else {
@@ -5,6 +5,9 @@ exports.processAssignment = processAssignment;
5
5
  exports.processDefineArgument = processDefineArgument;
6
6
  exports.markAsAssignment = markAsAssignment;
7
7
  const known_call_handling_1 = require("../known-call-handling");
8
+ const nse_1 = require("../nse");
9
+ const data_masking_functions_1 = require("../../../../../environments/data-masking-functions");
10
+ const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
8
11
  const log_1 = require("../../../../../../util/log");
9
12
  const unpack_argument_1 = require("../argument/unpack-argument");
10
13
  const process_named_call_1 = require("../../../process-named-call");
@@ -95,6 +98,37 @@ args, rootId, data, config) {
95
98
  }
96
99
  return processAssignment(name, args, rootId, data, { ...config, mayHaveMoreArgs: true });
97
100
  }
101
+ /** Within a data-masking call `a := b` is rlang's name-value pair, not data.table's assignment. */
102
+ function isMaskedNamePair(name, rootId, data) {
103
+ if (identifier_1.Identifier.getName(name.content) !== ':=') {
104
+ return false;
105
+ }
106
+ const idMap = data.completeAst.idMap;
107
+ let parent = idMap.get(rootId)?.info.parent;
108
+ while (parent !== undefined) {
109
+ const node = idMap.get(parent);
110
+ if (node === undefined) {
111
+ return false;
112
+ }
113
+ else if (r_argument_1.RArgument.is(node)) {
114
+ parent = node.info.parent;
115
+ }
116
+ else {
117
+ return r_function_call_1.RFunctionCall.isNamed(node) && data_masking_functions_1.DataMaskingFunctionNames.has(identifier_1.Identifier.getName(node.functionName.content));
118
+ }
119
+ }
120
+ return false;
121
+ }
122
+ /** Analyzes `a := b` as the named argument it is. */
123
+ function processMaskedNamePair(name, args, rootId, data) {
124
+ const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' });
125
+ const target = args[0];
126
+ (0, known_call_handling_1.markArgumentsAsNonStandardEvaluation)(information.graph, rootId, processedArguments, known_call_handling_1.NseArguments.First, {
127
+ kind: known_call_handling_1.NseKind.DataMasked,
128
+ evaluated: nse_1.Nse.unquoted(target === r_function_call_1.EmptyArgument ? undefined : target?.value, nse_1.Unquote.Rlang)
129
+ });
130
+ return information;
131
+ }
98
132
  /**
99
133
  * Processes an assignment, i.e., `<target> <- <source>`.
100
134
  * Handling it as a function call \`&lt;-\` `(<target>, <source>)`.
@@ -103,6 +137,9 @@ args, rootId, data, config) {
103
137
  function processAssignment(name,
104
138
  /* we expect them to be ordered in the sense that we have (source, target): `<source> <- <target>` */
105
139
  args, rootId, data, config) {
140
+ if (isMaskedNamePair(name, rootId, data)) {
141
+ return processMaskedNamePair(name, args, rootId, data);
142
+ }
106
143
  if (!config.mayHaveMoreArgs && args.length !== 2) {
107
144
  logger_1.dataflowLogger.warn(`Assignment ${identifier_1.Identifier.toString(name.content)} has something else than 2 arguments, skipping`);
108
145
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: 'default' }).information;
@@ -416,12 +453,8 @@ function markAsAssignment(information, nodeToDefine, sourceIds, rootIdOfAssignme
416
453
  }
417
454
  information.graph.addEdge(nid, rootIdOfAssignment, edge_1.EdgeType.DefinedBy);
418
455
  // kinda dirty, but we have to remove existing read edges for the symbol, added by the child
419
- const out = information.graph.outgoingEdges(nodeToDefine.nodeId);
420
- for (const [id, edge] of (out ?? [])) {
421
- edge.types &= ~edge_1.EdgeType.Reads;
422
- if (edge.types === 0) {
423
- out?.delete(id);
424
- }
456
+ for (const [id] of [...information.graph.outgoingEdges(nodeToDefine.nodeId) ?? []]) {
457
+ information.graph.removeEdgeType(nodeToDefine.nodeId, id, edge_1.EdgeType.Reads);
425
458
  }
426
459
  }
427
460
  /**
@@ -8,6 +8,7 @@ exports.resolveEnvirArg = resolveEnvirArg;
8
8
  exports.resolveSymbolToEnvir = resolveSymbolToEnvir;
9
9
  exports.routeWrittenToCustomEnv = routeWrittenToCustomEnv;
10
10
  exports.resolveAttachPosition = resolveAttachPosition;
11
+ const r_value_1 = require("../../../../../eval/values/r-value");
11
12
  const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
12
13
  const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
13
14
  const unpack_argument_1 = require("../argument/unpack-argument");
@@ -19,8 +20,8 @@ const environment_1 = require("../../../../../environments/environment");
19
20
  const prefix_1 = require("../../../../../../util/prefix");
20
21
  const built_in_stack_env_1 = require("./built-in-stack-env");
21
22
  const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
23
+ const node_value_1 = require("../../../../../eval/resolve/node-value");
22
24
  const resolve_strings_1 = require("../../../../../eval/resolve/resolve-strings");
23
- const general_1 = require("../../../../../eval/values/general");
24
25
  const logger_1 = require("../../../../../logger");
25
26
  /** A tracked env is a real stack environment (not a private custom env) when its current layer is the global or the built-in/base env. */
26
27
  function isStackEnvState(envState) {
@@ -73,7 +74,7 @@ function signatureParamNames(data, id, fallback) {
73
74
  }
74
75
  /** The constant string a name-position node denotes at construction time (string literal, aliased variable, or a paste-like join of such); `undefined` if any part is dynamic or the paste builtin is user-shadowed. */
75
76
  function resolveConstantString(node, data) {
76
- const info = { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables, ctx: data.ctx, full: true };
77
+ const info = node_value_1.NodeValue.infoOf(data);
77
78
  const unshadowed = new Map();
78
79
  const fold = (n) => {
79
80
  if (!r_function_call_1.RFunctionCall.isNamed(n)) {
@@ -155,19 +156,6 @@ function routeWrittenToCustomEnv(result, envDef, newDefAt, definedAt) {
155
156
  function clampAttachPosition(pos) {
156
157
  return Number.isFinite(pos) ? Math.max(environment_1.DefaultAttachPosition, Math.trunc(pos)) : undefined;
157
158
  }
158
- /** The number a value denotes, directly or as the single point of an interval (how a numeric literal resolves). */
159
- function scalarNumber(value) {
160
- if (value.type === 'number') {
161
- return 'num' in value.value ? value.value.num : undefined;
162
- }
163
- if (value.type === 'interval' && value.startInclusive && value.endInclusive
164
- && value.start.type === 'number' && 'num' in value.start.value
165
- && value.end.type === 'number' && 'num' in value.end.value
166
- && value.start.value.num === value.end.value.num) {
167
- return value.start.value.num;
168
- }
169
- return undefined;
170
- }
171
159
  /**
172
160
  * The `search()` position the `pos` argument of a `library()` call requests, either given as a number or as the name of
173
161
  * an existing entry (`pos = "package:base"`). Returns `undefined` when there is no such argument, its value is unknown
@@ -178,19 +166,19 @@ function resolveAttachPosition(posId, data) {
178
166
  if (posId === undefined) {
179
167
  return undefined;
180
168
  }
181
- const values = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(posId, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables, ctx: data.ctx }));
182
- if (values?.type !== 'set' || values.elements.length !== 1) {
169
+ const element = node_value_1.NodeValue.soleOf(posId, data);
170
+ if (element === undefined) {
183
171
  return undefined;
184
172
  }
185
- const element = values.elements[0];
186
- const asNumber = scalarNumber(element);
173
+ const asNumber = r_value_1.RValue.numberOf(element);
187
174
  if (asNumber !== undefined) {
188
175
  return clampAttachPosition(asNumber);
189
176
  }
190
- if (element.type === 'string' && 'str' in element.value) {
191
- const found = environment_1.REnvironment.searchPosition(data.environment.current, element.value.str);
177
+ const asString = r_value_1.RValue.stringOf(element);
178
+ if (asString !== undefined) {
179
+ const found = environment_1.REnvironment.searchPosition(data.environment.current, asString);
192
180
  if (found === undefined) {
193
- logger_1.dataflowLogger.warn(`search-path entry '${element.value.str}' does not exist, attaching at the default position`);
181
+ logger_1.dataflowLogger.warn(`search-path entry '${asString}' does not exist, attaching at the default position`);
194
182
  return undefined;
195
183
  }
196
184
  return clampAttachPosition(found);
@@ -11,37 +11,46 @@ const log_1 = require("../../../../../../util/log");
11
11
  const built_in_source_1 = require("./built-in-source");
12
12
  const edge_1 = require("../../../../../graph/edge");
13
13
  const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
14
- const append_1 = require("../../../../../environments/append");
15
14
  const assert_1 = require("../../../../../../util/assert");
16
- const general_1 = require("../../../../../eval/values/general");
17
- const string_constants_1 = require("../../../../../eval/values/string/string-constants");
18
15
  const unknown_side_effect_1 = require("../../../../../graph/unknown-side-effect");
19
- const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
16
+ const node_value_1 = require("../../../../../eval/resolve/node-value");
20
17
  const arrays_1 = require("../../../../../../util/collections/arrays");
21
18
  const identifier_1 = require("../../../../../environments/identifier");
22
19
  const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
20
+ /** the formals of `eval(expr, envir, enclos)` */
21
+ const EvalParameterNames = ['expr', 'envir', 'enclos'];
23
22
  /**
24
23
  * Process a call to `eval()`, trying to resolve the code being evaluated if possible.
25
24
  */
26
25
  function processEvalCall(name, args, rootId, data, config) {
27
- if (args.length !== 1 || args[0] === r_function_call_1.EmptyArgument || !args[0].value) {
28
- logger_1.dataflowLogger.warn(`Expected exactly one argument for eval currently, but got ${args.length} instead, skipping`);
29
- return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
26
+ const bound = r_function_call_1.RFunctionCall.matchArgsToParams(args, EvalParameterNames);
27
+ /* `evalText` names its formal differently, so a lone argument is the expression whatever it is called */
28
+ const evalArgument = (bound.get('expr') ?? r_function_call_1.RFunctionCall.soleArgument(args))?.value;
29
+ const envirArg = bound.get('envir');
30
+ if (evalArgument === undefined) {
31
+ logger_1.dataflowLogger.warn(`Expected an expression argument for eval, but got ${args.length} argument(s), skipping`);
32
+ const bail = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' }).information;
33
+ (0, unknown_side_effect_1.handleUnknownSideEffect)(bail.graph, bail.environment, rootId);
34
+ return bail;
30
35
  }
31
36
  const information = config.includeFunctionCall ?
32
37
  (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: [true], origin: built_in_proc_name_1.BuiltInProcName.Eval }).information
33
38
  : info_1.DataflowInformation.initialize(rootId, data);
34
- const evalArgument = args[0];
35
39
  if (config.includeFunctionCall) {
36
- information.graph.addEdge(rootId, args[0].value.info.id, edge_1.EdgeType.Returns);
40
+ information.graph.addEdge(rootId, evalArgument.info.id, edge_1.EdgeType.Returns);
37
41
  }
38
42
  if (!data.ctx.config.solver.evalStrings) {
39
43
  (0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Skipping eval call ${JSON.stringify(evalArgument)} (disabled in config file)`);
40
44
  (0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
41
45
  return information;
42
46
  }
43
- const code = resolveEvalToCode(evalArgument.value, config, data);
47
+ const code = resolveEvalToCode(evalArgument, config, data);
44
48
  if (code) {
49
+ if (envirArg !== undefined) {
50
+ /* the code runs in another environment, so its definitions do not land in the current one and
51
+ * pretending they do would produce wrong edges */
52
+ (0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
53
+ }
45
54
  const idGenerator = (0, decorate_1.sourcedDeterministicCountingIdGenerator)(name.lexeme + '::' + rootId, name.location);
46
55
  data = {
47
56
  ...data,
@@ -58,37 +67,16 @@ function processEvalCall(name, args, rootId, data, config) {
58
67
  information.graph.addEdge(rootId, e.nodeId, edge_1.EdgeType.Returns);
59
68
  }
60
69
  }
61
- return {
62
- graph: result.reduce((acc, r) => acc.mergeWith(r.graph), information.graph),
63
- environment: result.reduce((acc, r) => (0, append_1.appendEnvironment)(acc, r.environment), information.environment),
64
- entryPoint: rootId,
65
- out: information.out.concat(result.flatMap(r => r.out)),
66
- in: information.in.concat(result.flatMap(r => r.in)),
67
- unknownReferences: information.unknownReferences.concat(result.flatMap(r => r.unknownReferences)),
68
- exitPoints: information.exitPoints.concat(result.flatMap(r => r.exitPoints)),
69
- hooks: information.hooks.concat(result.flatMap(r => r.hooks)),
70
- };
70
+ return (0, built_in_source_1.mergeSourced)({ ...information, entryPoint: rootId }, result);
71
71
  }
72
72
  (0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Non-constant argument ${JSON.stringify(args)} for eval is currently not supported, skipping`);
73
73
  (0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
74
74
  return information;
75
75
  }
76
76
  function resolveEvalToCode(evalArgument, config, data) {
77
- const ctx = data.ctx;
78
- const env = data.environment;
79
- const idMap = data.completeAst.idMap;
80
77
  const val = evalArgument;
81
78
  if (config.supportFunctionCall) {
82
- if (val.type === type_1.RType.String) {
83
- return [val.content.str];
84
- }
85
- else if (val.type === type_1.RType.Symbol) {
86
- const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(val.info.id, { environment: env, idMap: idMap, resolve: ctx.config.solver.variables, ctx }));
87
- if (resolved) {
88
- return (0, string_constants_1.collectStrings)(resolved.elements);
89
- }
90
- }
91
- return undefined;
79
+ return getAsString(val, data);
92
80
  }
93
81
  else {
94
82
  if (val.type === type_1.RType.FunctionCall && val.named && val.functionName.content === 'parse') {
@@ -97,19 +85,10 @@ function resolveEvalToCode(evalArgument, config, data) {
97
85
  if (nArg !== undefined || arg === undefined || arg === r_function_call_1.EmptyArgument) {
98
86
  return undefined;
99
87
  }
100
- if (arg.value?.type === type_1.RType.String) {
101
- return [arg.value.content.str];
102
- }
103
- else if (arg.value?.type === type_1.RType.Symbol) {
104
- const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(arg.value.info.id, { environment: env, idMap: idMap, resolve: ctx.config.solver.variables, ctx }));
105
- if (resolved) {
106
- return (0, string_constants_1.collectStrings)(resolved.elements);
107
- }
108
- }
109
- else if (arg.value?.type === type_1.RType.FunctionCall && arg.value.named && ['paste', 'paste0'].includes(identifier_1.Identifier.getName(arg.value.functionName.content))) {
110
- return handlePaste(ctx.config, arg.value.arguments, env, idMap, arg.value.functionName.content === 'paste' ? [' '] : [''], ctx);
88
+ if (arg.value?.type === type_1.RType.FunctionCall && arg.value.named && ['paste', 'paste0'].includes(identifier_1.Identifier.getName(arg.value.functionName.content))) {
89
+ return handlePaste(arg.value.arguments, data, arg.value.functionName.content === 'paste' ? [' '] : ['']);
111
90
  }
112
- return undefined;
91
+ return getAsString(arg.value, data);
113
92
  }
114
93
  else if (val.type === type_1.RType.Symbol) {
115
94
  // const resolved = resolveValueOfVariable(val.content, env);
@@ -121,7 +100,7 @@ function resolveEvalToCode(evalArgument, config, data) {
121
100
  }
122
101
  }
123
102
  }
124
- function getAsString(config, val, env, idMap, ctx) {
103
+ function getAsString(val, data) {
125
104
  if (!val) {
126
105
  return undefined;
127
106
  }
@@ -129,17 +108,14 @@ function getAsString(config, val, env, idMap, ctx) {
129
108
  return [val.content.str];
130
109
  }
131
110
  else if (val.type === type_1.RType.Symbol) {
132
- const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(val.info.id, { environment: env, idMap: idMap, resolve: config.solver.variables, ctx }));
133
- if (resolved) {
134
- return (0, string_constants_1.collectStrings)(resolved.elements);
135
- }
111
+ return node_value_1.NodeValue.stringsOf(val.info.id, data);
136
112
  }
137
113
  return undefined;
138
114
  }
139
- function handlePaste(config, args, env, idMap, sepDefault, ctx) {
115
+ function handlePaste(args, data, sepDefault) {
140
116
  const sepArg = args.find(v => v !== r_function_call_1.EmptyArgument && v.name?.content === 'sep');
141
117
  if (sepArg) {
142
- const res = sepArg !== r_function_call_1.EmptyArgument && sepArg.value ? getAsString(config, sepArg.value, env, idMap, ctx) : undefined;
118
+ const res = sepArg !== r_function_call_1.EmptyArgument && sepArg.value ? getAsString(sepArg.value, data) : undefined;
143
119
  if (!res) {
144
120
  // sep not resolvable clearly / unknown
145
121
  return undefined;
@@ -148,7 +124,7 @@ function handlePaste(config, args, env, idMap, sepDefault, ctx) {
148
124
  }
149
125
  const allArgs = args
150
126
  .filter(v => v !== r_function_call_1.EmptyArgument && v.name?.content !== 'sep' && v.value)
151
- .map(v => getAsString(config, v.value, env, idMap, ctx));
127
+ .map(v => getAsString(v.value, data));
152
128
  if (allArgs.some(assert_1.isUndefined)) {
153
129
  return undefined;
154
130
  }
@@ -21,11 +21,27 @@ const reference_to_maybe_1 = require("../../../../../environments/reference-to-m
21
21
  const apply_kill_1 = require("../../../../../environments/apply-kill");
22
22
  const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
23
23
  const general_1 = require("../../../../../eval/values/general");
24
+ /**
25
+ * Whether the definitions of this list among the `targets` of a read cover every branch, alone or together.
26
+ * Only then the read is resolved here and must not bubble up as an ingoing reference.
27
+ */
28
+ function coveredByListDefinitions(targets, listEnvironments) {
29
+ let cds;
30
+ for (const target of targets) {
31
+ if (!listEnvironments.has(target.nodeId)) {
32
+ continue;
33
+ }
34
+ else if (target.cds === undefined) {
35
+ return true;
36
+ }
37
+ (cds ??= []).push(...target.cds);
38
+ }
39
+ return cds !== undefined && (0, info_1.happensInEveryBranch)(cds);
40
+ }
24
41
  function linkReadNameToWriteIfPossible(read, environments, listEnvironments, remainingRead, nextGraph) {
25
42
  const readName = read.name && identifier_1.Identifier.isDotDotDotAccess(read.name) ? identifier_1.Identifier.dotdotdot() : read.name;
26
43
  const probableTarget = readName ? (0, resolve_by_name_1.resolveByName)(readName, environments, read.type) : undefined;
27
- // record if at least one has not been defined
28
- if (probableTarget === undefined || probableTarget.some(t => !listEnvironments.has(t.nodeId) || !(0, info_1.happensInEveryBranch)(t.cds))) {
44
+ if (probableTarget === undefined || !coveredByListDefinitions(probableTarget, listEnvironments)) {
29
45
  const readId = readName ? identifier_1.Identifier.getName(readName) : undefined;
30
46
  const has = remainingRead.get(readId);
31
47
  if (has) {
@@ -172,8 +188,7 @@ function updateSideEffectsForCalledFunctions(calledEnvs, inputEnvironment, nextG
172
188
  * Processes a list of expressions joining their dataflow graphs accordingly.
173
189
  */
174
190
  function processExpressionList(name, args, rootId, data) {
175
- const expressions = args.map(unpack_argument_1.unpackNonameArg);
176
- (0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `[expr list] with ${expressions.length} expressions`);
191
+ (0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `[expr list] with ${args.length} expressions`);
177
192
  let { environment } = data;
178
193
  // used to detect if a "write" happens within the same expression list
179
194
  const listEnvironments = new Set();
@@ -187,7 +202,9 @@ function processExpressionList(name, args, rootId, data) {
187
202
  const invertExitCds = [];
188
203
  const processedExpressions = [];
189
204
  let defaultReturnExpr = undefined;
190
- for (const expression of expressions) {
205
+ let hooks;
206
+ for (const arg of args) {
207
+ const expression = (0, unpack_argument_1.unpackNonameArg)(arg);
191
208
  if (expression === undefined) {
192
209
  processedExpressions.push(undefined);
193
210
  continue;
@@ -205,7 +222,9 @@ function processExpressionList(name, args, rootId, data) {
205
222
  processed.in = (0, reference_to_maybe_1.makeAllMaybe)(processed.in, nextGraph, processed.environment, false, invertExitCds);
206
223
  processed.unknownReferences = (0, reference_to_maybe_1.makeAllMaybe)(processed.unknownReferences, nextGraph, processed.environment, false);
207
224
  }
208
- out.push(...processed.out);
225
+ if (processed.hooks.length > 0) {
226
+ (hooks ??= []).push(...processed.hooks);
227
+ }
209
228
  // all inputs that have not been written until now are read!
210
229
  for (const read of processed.in) {
211
230
  linkReadNameToWriteIfPossible(read, environment, listEnvironments, remainingRead, nextGraph);
@@ -232,10 +251,14 @@ function processExpressionList(name, args, rootId, data) {
232
251
  if (processed.kill?.length) {
233
252
  // if we may have already exited (break/next), the removal only happens maybe
234
253
  const kills = exitPoints.length > 0 ? (0, apply_kill_1.makeKillsMaybe)(processed.kill, invertExitCds) : processed.kill;
235
- (killed ??= []).push(...kills);
254
+ killed ??= [];
255
+ for (const kill of kills) {
256
+ killed.push(kill);
257
+ }
236
258
  }
237
- for (const { nodeId } of processed.out) {
238
- listEnvironments.add(nodeId);
259
+ for (const ref of processed.out) {
260
+ out.push(ref);
261
+ listEnvironments.add(ref.nodeId);
239
262
  }
240
263
  /** if at least built-one of the exit points encountered happens unconditionally, we exit here (dead code)! */
241
264
  if ((0, info_1.alwaysExits)(processed)) {
@@ -291,7 +314,7 @@ function processExpressionList(name, args, rootId, data) {
291
314
  /* if we have no group, we take the last evaluated expr */
292
315
  entryPoint: meId,
293
316
  exitPoints: exitPoints,
294
- hooks: processedExpressions.flatMap(p => p?.hooks ?? []),
317
+ hooks: hooks ?? [],
295
318
  kill: killed,
296
319
  };
297
320
  }
@@ -67,6 +67,9 @@ function processForLoop(name, args, rootId, data) {
67
67
  (0, reference_to_maybe_1.applyCdToReferences)(body.out, cd);
68
68
  const outgoing = variable.out.concat(writtenVariable, body.out);
69
69
  (0, linker_1.linkCircularRedefinitionsWithinALoop)(nextGraph, nameIdShares, body.out, body.environment);
70
+ /* the loop variable is bound by the head whenever the body runs, so reads of it are not ingoing */
71
+ const loopVariables = new Set(writtenVariable.map(w => w.name));
72
+ const bodyReadsOfOthers = [...nameIdShares.entries()].filter(([n]) => !loopVariables.has(n)).flatMap(([, refs]) => refs);
70
73
  (0, linker_1.reapplyLoopExitPoints)(body.exitPoints, body.in.concat(body.out, body.unknownReferences), nextGraph);
71
74
  (0, common_1.patchFunctionCall)({
72
75
  nextGraph,
@@ -86,7 +89,7 @@ function processForLoop(name, args, rootId, data) {
86
89
  return {
87
90
  unknownReferences: [],
88
91
  // we only want those not bound by a local variable
89
- in: [{ nodeId: rootId, name: name.content, cds: originalDependency, type: identifier_1.ReferenceType.Function }, ...vector.unknownReferences, ...[...nameIdShares.values()].flat()],
92
+ in: [{ nodeId: rootId, name: name.content, cds: originalDependency, type: identifier_1.ReferenceType.Function }, ...vector.unknownReferences, ...bodyReadsOfOthers],
90
93
  out: outgoing,
91
94
  graph: nextGraph,
92
95
  entryPoint: name.info.id,
@@ -10,8 +10,7 @@ const logger_1 = require("../../../../../logger");
10
10
  const edge_1 = require("../../../../../graph/edge");
11
11
  const append_1 = require("../../../../../environments/append");
12
12
  const identifier_1 = require("../../../../../environments/identifier");
13
- const general_1 = require("../../../../../eval/values/general");
14
- const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
13
+ const node_value_1 = require("../../../../../eval/resolve/node-value");
15
14
  const reference_to_maybe_1 = require("../../../../../environments/reference-to-maybe");
16
15
  const apply_kill_1 = require("../../../../../environments/apply-kill");
17
16
  const linker_1 = require("../../../../linker");
@@ -64,9 +63,9 @@ function processIfThenElse(name, args, rootId, data, config) {
64
63
  let then;
65
64
  let makeThenMaybe = false;
66
65
  // we should defer this to the abstract interpretation
67
- const values = (0, alias_tracking_1.resolveIdToValue)(condArg?.info.id, { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables, ctx: data.ctx });
68
- const conditionIsAlwaysFalse = (0, general_1.valueSetGuard)(values)?.elements.every(d => d.type === 'logical' && d.value === false) ?? false;
69
- const conditionIsAlwaysTrue = (0, general_1.valueSetGuard)(values)?.elements.every(d => d.type === 'logical' && d.value === true) ?? false;
66
+ const values = node_value_1.NodeValue.setOf(condArg?.info.id, data);
67
+ const conditionIsAlwaysFalse = values?.elements.every(d => d.type === 'logical' && d.value === false) ?? false;
68
+ const conditionIsAlwaysTrue = values?.elements.every(d => d.type === 'logical' && d.value === true) ?? false;
70
69
  if (!conditionIsAlwaysFalse) {
71
70
  then = (0, processor_1.processDataflowFor)(thenArg, data);
72
71
  if (then.entryPoint) {
@@ -8,6 +8,7 @@ exports.attachBaseRNamespaces = attachBaseRNamespaces;
8
8
  exports.attachDeclaredDependencies = attachDeclaredDependencies;
9
9
  exports.attachProjectImports = attachProjectImports;
10
10
  exports.attachProject = attachProject;
11
+ const r_value_1 = require("../../../../../eval/values/r-value");
11
12
  const known_call_handling_1 = require("../known-call-handling");
12
13
  const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
13
14
  const r_access_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-access");
@@ -22,8 +23,7 @@ const environment_1 = require("../../../../../environments/environment");
22
23
  const edge_1 = require("../../../../../graph/edge");
23
24
  const assert_1 = require("../../../../../../util/assert");
24
25
  const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
25
- const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
26
- const general_1 = require("../../../../../eval/values/general");
26
+ const node_value_1 = require("../../../../../eval/resolve/node-value");
27
27
  const package_1 = require("../../../../../../project/plugins/package-version-plugins/package");
28
28
  const attached_packages_1 = require("../../../../../../project/attached-packages");
29
29
  const flowr_namespace_file_1 = require("../../../../../../project/plugins/file-plugins/files/flowr-namespace-file");
@@ -51,7 +51,6 @@ function processLibrary(name, args, rootId, data, config = {}) {
51
51
  /* last, so the positional fallback keeps its previous order */
52
52
  'pos': 'pos'
53
53
  };
54
- const resolveArgs = { environment: data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables, ctx: data.ctx };
55
54
  const argMaps = (0, linker_1.pMatch)((0, common_1.convertFnArguments)(args), params);
56
55
  const packageId = Array.from(new Set(argMaps.get('pkg')));
57
56
  const charId = Array.from(new Set(argMaps.get('char')));
@@ -71,7 +70,7 @@ function processLibrary(name, args, rootId, data, config = {}) {
71
70
  }
72
71
  let isCharacterOnly = config.characterOnly === true;
73
72
  if (!config.characterOnly && charId.length >= 1) {
74
- const values = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(charId[0], resolveArgs));
73
+ const values = node_value_1.NodeValue.setOf(charId[0], data);
75
74
  if (values?.type === 'set' && values?.elements.length > 0) {
76
75
  let hasTrue = 0;
77
76
  let hasFalse = 0;
@@ -109,11 +108,12 @@ function processLibrary(name, args, rootId, data, config = {}) {
109
108
  //case: true or maybe
110
109
  if (isCharacterOnly) {
111
110
  for (const nameToLoad of namesToLoad) {
112
- const values = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(nameToLoad.info.id, resolveArgs));
111
+ const values = node_value_1.NodeValue.setOf(nameToLoad.info.id, data);
113
112
  if (values?.type === 'set' && values.elements.length !== 0) {
114
113
  for (const elem of values.elements) {
115
- if (elem.type === 'string' && 'str' in elem.value) {
116
- packetName.push(elem.value.str);
114
+ const name = r_value_1.RValue.stringOf(elem);
115
+ if (name !== undefined) {
116
+ packetName.push(name);
117
117
  }
118
118
  }
119
119
  }
@@ -12,8 +12,7 @@ const logger_1 = require("../../../../../logger");
12
12
  const unknown_side_effect_1 = require("../../../../../graph/unknown-side-effect");
13
13
  const edge_1 = require("../../../../../graph/edge");
14
14
  const unpack_argument_1 = require("../argument/unpack-argument");
15
- const general_1 = require("../../../../../eval/values/general");
16
- const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
15
+ const node_value_1 = require("../../../../../eval/resolve/node-value");
17
16
  const r_value_1 = require("../../../../../eval/values/r-value");
18
17
  const assert_1 = require("../../../../../../util/assert");
19
18
  const range_1 = require("../../../../../../util/range");
@@ -47,7 +46,7 @@ function processLoadCall(name, args, rootId, data) {
47
46
  sourceFile = [(0, retriever_1.removeRQuotes)(fileArg.lexeme)];
48
47
  }
49
48
  else {
50
- const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(fileArg.info.id, { environment: envirResolution ? envirResolution.envirData.environment : data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables, ctx: data.ctx }));
49
+ const resolved = node_value_1.NodeValue.setOf(fileArg.info.id, data, { environment: envirResolution?.envirData.environment ?? data.environment });
51
50
  sourceFile = resolved?.elements.map(r => r.type === 'string' && (0, r_value_1.isValue)(r.value) ? r.value.str : undefined).filter(assert_1.isNotUndefined);
52
51
  }
53
52
  if (sourceFile) {