@eagleoutice/flowr 2.10.1 → 2.10.3

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 (128) hide show
  1. package/README.md +31 -20
  2. package/abstract-interpretation/absint-visitor.d.ts +13 -8
  3. package/abstract-interpretation/absint-visitor.js +35 -26
  4. package/abstract-interpretation/data-frame/dataframe-domain.d.ts +1 -2
  5. package/abstract-interpretation/data-frame/dataframe-domain.js +14 -15
  6. package/abstract-interpretation/data-frame/mappers/access-mapper.js +2 -15
  7. package/abstract-interpretation/data-frame/mappers/arguments.d.ts +11 -17
  8. package/abstract-interpretation/data-frame/mappers/arguments.js +18 -18
  9. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +41 -15
  10. package/abstract-interpretation/data-frame/mappers/function-mapper.js +74 -48
  11. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +2 -1
  12. package/abstract-interpretation/data-frame/semantics.d.ts +1 -1
  13. package/abstract-interpretation/data-frame/semantics.js +31 -35
  14. package/abstract-interpretation/data-frame/shape-inference.js +1 -1
  15. package/abstract-interpretation/domains/interval-domain.d.ts +1 -0
  16. package/abstract-interpretation/domains/interval-domain.js +3 -0
  17. package/abstract-interpretation/domains/product-domain.d.ts +9 -0
  18. package/abstract-interpretation/domains/product-domain.js +26 -6
  19. package/abstract-interpretation/domains/state-abstract-domain.d.ts +36 -22
  20. package/abstract-interpretation/domains/state-abstract-domain.js +169 -62
  21. package/abstract-interpretation/unsupported-functions.d.ts +10 -0
  22. package/abstract-interpretation/unsupported-functions.js +45 -0
  23. package/benchmark/slicer.js +10 -13
  24. package/cli/flowr.js +1 -1
  25. package/control-flow/control-flow-graph.js +13 -9
  26. package/control-flow/semantic-cfg-guided-visitor.d.ts +6 -0
  27. package/control-flow/semantic-cfg-guided-visitor.js +6 -0
  28. package/dataflow/environments/built-in-proc-name.d.ts +6 -0
  29. package/dataflow/environments/built-in-proc-name.js +6 -0
  30. package/dataflow/environments/built-in.d.ts +7 -5
  31. package/dataflow/environments/built-in.js +2 -0
  32. package/dataflow/environments/default-builtin-config.d.ts +442 -6
  33. package/dataflow/environments/default-builtin-config.js +158 -3
  34. package/dataflow/environments/overwrite.js +2 -5
  35. package/dataflow/graph/df-helper.d.ts +14 -4
  36. package/dataflow/graph/df-helper.js +36 -6
  37. package/dataflow/graph/graph.d.ts +10 -0
  38. package/dataflow/graph/graph.js +12 -0
  39. package/dataflow/instrument/instrument-dataflow-count.d.ts +10 -0
  40. package/dataflow/instrument/instrument-dataflow-count.js +10 -0
  41. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +4 -4
  42. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +3 -3
  43. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +2 -2
  44. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +3 -3
  45. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +2 -2
  46. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +2 -2
  47. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.d.ts +2 -2
  48. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
  49. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +6 -17
  50. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +2 -2
  51. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +2 -2
  52. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +2 -2
  53. package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +2 -2
  54. package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +2 -2
  55. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +23 -3
  56. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +80 -12
  57. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +41 -0
  58. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +179 -0
  59. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +7 -4
  60. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +62 -1
  61. package/dataflow/internal/process/functions/call/built-in/built-in-recall.d.ts +7 -2
  62. package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +15 -1
  63. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +2 -2
  64. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +2 -2
  65. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -2
  66. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -2
  67. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +2 -2
  68. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +2 -2
  69. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +2 -2
  70. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -2
  71. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +2 -2
  72. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.d.ts +2 -2
  73. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +2 -2
  74. package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +2 -2
  75. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +2 -2
  76. package/dataflow/internal/process/functions/call/common.d.ts +2 -2
  77. package/dataflow/internal/process/functions/call/common.js +4 -3
  78. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +2 -2
  79. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +2 -2
  80. package/documentation/wiki-absint.js +6 -5
  81. package/documentation/wiki-analyzer.js +0 -2
  82. package/documentation/wiki-cfg.js +3 -3
  83. package/documentation/wiki-linter.js +1 -0
  84. package/documentation/wiki-normalized-ast.js +7 -7
  85. package/documentation/wiki-query.js +29 -0
  86. package/linter/linter-rules.d.ts +24 -1
  87. package/linter/linter-rules.js +3 -1
  88. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  89. package/linter/rules/dataframe-access-validation.js +3 -4
  90. package/linter/rules/roxygen-arguments.d.ts +35 -0
  91. package/linter/rules/roxygen-arguments.js +100 -0
  92. package/package.json +4 -5
  93. package/project/context/flowr-analyzer-context.d.ts +1 -8
  94. package/project/context/flowr-analyzer-context.js +1 -7
  95. package/project/context/flowr-analyzer-environment-context.d.ts +5 -0
  96. package/project/context/flowr-analyzer-environment-context.js +6 -0
  97. package/project/context/flowr-analyzer-files-context.d.ts +6 -0
  98. package/project/context/flowr-analyzer-files-context.js +4 -2
  99. package/project/flowr-analyzer-builder.js +1 -4
  100. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
  101. package/queries/catalog/call-context-query/call-context-query-executor.js +10 -5
  102. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
  103. package/queries/catalog/dependencies-query/function-info/library-functions.js +2 -0
  104. package/queries/catalog/dependencies-query/function-info/write-functions.js +1 -1
  105. package/queries/catalog/df-shape-query/df-shape-query-format.js +7 -2
  106. package/queries/catalog/files-query/files-query-executor.js +0 -1
  107. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +2 -0
  108. package/queries/catalog/input-sources-query/simple-input-classifier.js +5 -3
  109. package/r-bridge/data/data.d.ts +2 -2
  110. package/r-bridge/data/data.js +2 -2
  111. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +13 -5
  112. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +14 -2
  113. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +3 -3
  114. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +9 -0
  115. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +13 -0
  116. package/r-bridge/lang-4.x/ast/model/versions.d.ts +2 -0
  117. package/r-bridge/lang-4.x/ast/model/versions.js +3 -1
  118. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +1 -1
  119. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
  120. package/r-bridge/roxygen2/documentation-provider.js +15 -6
  121. package/r-bridge/roxygen2/roxygen-ast.d.ts +3 -1
  122. package/search/flowr-search-builder.js +3 -2
  123. package/util/mermaid/ast.js +2 -1
  124. package/util/record.d.ts +23 -0
  125. package/util/record.js +33 -0
  126. package/util/version.js +1 -1
  127. package/abstract-interpretation/domains/mapped-abstract-domain.d.ts +0 -41
  128. package/abstract-interpretation/domains/mapped-abstract-domain.js +0 -213
@@ -9,15 +9,16 @@ exports.getFunctionArguments = getFunctionArguments;
9
9
  exports.getUnresolvedSymbolsInExpression = getUnresolvedSymbolsInExpression;
10
10
  exports.hasCriticalArgument = hasCriticalArgument;
11
11
  exports.isDataFrameArgument = isDataFrameArgument;
12
- exports.isNamedArgument = isNamedArgument;
13
12
  exports.isRNull = isRNull;
14
13
  exports.isValidColName = isValidColName;
15
14
  exports.parseRequestContent = parseRequestContent;
15
+ const graph_1 = require("../../../dataflow/graph/graph");
16
16
  const vertex_1 = require("../../../dataflow/graph/vertex");
17
17
  const make_argument_1 = require("../../../dataflow/internal/process/functions/call/argument/make-argument");
18
18
  const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
19
+ const r_argument_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
19
20
  const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
20
- const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
21
+ const r_symbol_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
21
22
  const convert_values_1 = require("../../../r-bridge/lang-4.x/convert-values");
22
23
  const assert_1 = require("../../../util/assert");
23
24
  const files_1 = require("../../../util/files");
@@ -84,7 +85,7 @@ function getArgumentValue(args, argument, info) {
84
85
  * @returns The filtered list of arguments
85
86
  */
86
87
  function getEffectiveArgs(args, excluded) {
87
- return args.filter(arg => arg === r_function_call_1.EmptyArgument || arg.name === undefined || !excluded.includes((0, resolve_args_1.unquoteArgument)(arg.name.content)));
88
+ return args.filter(arg => r_argument_1.RArgument.isEmpty(arg) || !r_argument_1.RArgument.isNamed(arg) || !excluded.includes((0, resolve_args_1.unquoteArgument)(arg.name.content)));
88
89
  }
89
90
  /**
90
91
  * Gets an argument specified as {@link FunctionParameterLocation} from a list of arguments.
@@ -114,11 +115,11 @@ function getFunctionArgument(args, argument, info) {
114
115
  */
115
116
  function getFunctionArguments(node, dfg) {
116
117
  const vertex = dfg.getVertex(node.info.id);
117
- if (vertex?.tag === vertex_1.VertexType.FunctionCall && dfg.idMap !== undefined) {
118
+ if ((0, vertex_1.isFunctionCallVertex)(vertex) && dfg.idMap !== undefined) {
118
119
  const idMap = dfg.idMap;
119
120
  return vertex.args
120
- .map(arg => arg === r_function_call_1.EmptyArgument ? arg : idMap.get(arg.nodeId))
121
- .map(arg => arg === r_function_call_1.EmptyArgument || arg?.type === type_1.RType.Argument ? arg : (0, make_argument_1.toUnnamedArgument)(arg, idMap));
121
+ .map(arg => graph_1.FunctionArgument.isEmpty(arg) ? arg : idMap.get(arg.nodeId))
122
+ .map(arg => r_argument_1.RArgument.isEmpty(arg) || r_argument_1.RArgument.is(arg) ? arg : (0, make_argument_1.toUnnamedArgument)(arg, idMap));
122
123
  }
123
124
  return node.arguments;
124
125
  }
@@ -134,10 +135,12 @@ function getUnresolvedSymbolsInExpression(expression, dfg) {
134
135
  }
135
136
  const unresolvedSymbols = [];
136
137
  model_1.RNode.visitAst(expression, node => {
137
- if (node.type === type_1.RType.Symbol) {
138
+ if (r_symbol_1.RSymbol.is(node)) {
138
139
  const vertex = dfg.get(node.info.id);
139
- if ((0, vertex_1.isUseVertex)(vertex?.[0]) && vertex[1].size === 0) {
140
- unresolvedSymbols.push(identifier_1.Identifier.mapName(node.content, resolve_args_1.unquoteArgument));
140
+ const symbolName = identifier_1.Identifier.mapName(node.content, resolve_args_1.unquoteArgument);
141
+ // ignore symbols named ".", as they are used as argument placeholder in magrittr pipe operations
142
+ if ((0, vertex_1.isUseVertex)(vertex?.[0]) && vertex[1].size === 0 && symbolName !== '.') {
143
+ unresolvedSymbols.push(symbolName);
141
144
  }
142
145
  }
143
146
  });
@@ -169,17 +172,14 @@ function hasCriticalArgument(args, critical, info) {
169
172
  function isDataFrameArgument(arg, inference) {
170
173
  return arg !== r_function_call_1.EmptyArgument && inference.getAbstractValue(arg) !== undefined;
171
174
  }
172
- /**
173
- * Checks whether a function argument is a names argument.
174
- */
175
- function isNamedArgument(arg) {
176
- return arg !== r_function_call_1.EmptyArgument && arg?.name !== undefined;
177
- }
178
175
  function isRNull(node) {
179
- if (node === r_function_call_1.EmptyArgument || node?.type === type_1.RType.Argument) {
180
- return node !== r_function_call_1.EmptyArgument && isRNull(node.value);
176
+ if (r_argument_1.RArgument.isEmpty(node)) {
177
+ return false;
178
+ }
179
+ else if (r_argument_1.RArgument.is(node)) {
180
+ return isRNull(node.value);
181
181
  }
182
- return node?.type === type_1.RType.Symbol && node.content === convert_values_1.RNull;
182
+ return r_symbol_1.RSymbol.is(node) && node.content === convert_values_1.RNull;
183
183
  }
184
184
  /**
185
185
  * Checks whether a string is a valid columns name according to the flag `check.names` in R.
@@ -2,7 +2,7 @@ import { type ResolveInfo } from '../../../dataflow/eval/resolve/alias-tracking'
2
2
  import type { DataflowGraph } from '../../../dataflow/graph/graph';
3
3
  import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flowr-analyzer-context';
4
4
  import type { RNode } from '../../../r-bridge/lang-4.x/ast/model/model';
5
- import { type RFunctionArgument } from '../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
5
+ import { type PotentiallyEmptyRArgument } from '../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
6
6
  import type { ParentInformation } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
7
7
  import type { DataFrameOperations, DataFrameShapeInferenceVisitor } from '../shape-inference';
8
8
  import { type FunctionParameterLocation } from './arguments';
@@ -23,61 +23,73 @@ declare const DataFrameFunctionMapper: {
23
23
  readonly mapper: typeof mapDataFrameCreate;
24
24
  readonly library: "base";
25
25
  readonly returnType: DataFrameType.DataFrame;
26
+ readonly alwaysDataFrame: true;
26
27
  };
27
28
  readonly 'as.data.frame': {
28
29
  readonly mapper: typeof mapDataFrameConvert;
29
30
  readonly library: "base";
30
31
  readonly returnType: DataFrameType.DataFrame;
32
+ readonly alwaysDataFrame: true;
31
33
  };
32
34
  readonly 'read.table': {
33
35
  readonly mapper: typeof mapDataFrameRead;
34
36
  readonly library: "utils";
35
37
  readonly returnType: DataFrameType.DataFrame;
38
+ readonly alwaysDataFrame: true;
36
39
  };
37
40
  readonly 'read.csv': {
38
41
  readonly mapper: typeof mapDataFrameRead;
39
42
  readonly library: "utils";
40
43
  readonly returnType: DataFrameType.DataFrame;
44
+ readonly alwaysDataFrame: true;
41
45
  };
42
46
  readonly 'read.csv2': {
43
47
  readonly mapper: typeof mapDataFrameRead;
44
48
  readonly library: "utils";
45
49
  readonly returnType: DataFrameType.DataFrame;
50
+ readonly alwaysDataFrame: true;
46
51
  };
47
52
  readonly 'read.delim': {
48
53
  readonly mapper: typeof mapDataFrameRead;
49
54
  readonly library: "utils";
50
55
  readonly returnType: DataFrameType.DataFrame;
56
+ readonly alwaysDataFrame: true;
51
57
  };
52
58
  readonly 'read.delim2': {
53
59
  readonly mapper: typeof mapDataFrameRead;
54
60
  readonly library: "utils";
55
61
  readonly returnType: DataFrameType.DataFrame;
62
+ readonly alwaysDataFrame: true;
56
63
  };
57
64
  readonly read_table: {
58
65
  readonly mapper: typeof mapDataFrameRead;
59
66
  readonly library: "readr";
60
67
  readonly returnType: DataFrameType.Tibble;
68
+ readonly alwaysDataFrame: true;
61
69
  };
62
70
  readonly read_csv: {
63
71
  readonly mapper: typeof mapDataFrameRead;
64
72
  readonly library: "readr";
65
73
  readonly returnType: DataFrameType.Tibble;
74
+ readonly alwaysDataFrame: true;
66
75
  };
67
76
  readonly read_csv2: {
68
77
  readonly mapper: typeof mapDataFrameRead;
69
78
  readonly library: "readr";
70
79
  readonly returnType: DataFrameType.Tibble;
80
+ readonly alwaysDataFrame: true;
71
81
  };
72
82
  readonly read_tsv: {
73
83
  readonly mapper: typeof mapDataFrameRead;
74
84
  readonly library: "readr";
75
85
  readonly returnType: DataFrameType.Tibble;
86
+ readonly alwaysDataFrame: true;
76
87
  };
77
88
  readonly read_delim: {
78
89
  readonly mapper: typeof mapDataFrameRead;
79
90
  readonly library: "readr";
80
91
  readonly returnType: DataFrameType.Tibble;
92
+ readonly alwaysDataFrame: true;
81
93
  };
82
94
  readonly cbind: {
83
95
  readonly mapper: typeof mapDataFrameColBind;
@@ -108,71 +120,85 @@ declare const DataFrameFunctionMapper: {
108
120
  readonly mapper: typeof mapDataFrameFilter;
109
121
  readonly library: "dplyr";
110
122
  readonly returnType: DataFrameType.DataFrame;
123
+ readonly alwaysDataFrame: true;
111
124
  };
112
125
  readonly select: {
113
126
  readonly mapper: typeof mapDataFrameSelect;
114
127
  readonly library: "dplyr";
115
128
  readonly returnType: DataFrameType.DataFrame;
129
+ readonly alwaysDataFrame: true;
116
130
  };
117
131
  readonly mutate: {
118
132
  readonly mapper: typeof mapDataFrameMutate;
119
133
  readonly library: "dplyr";
120
134
  readonly returnType: DataFrameType.DataFrame;
135
+ readonly alwaysDataFrame: true;
121
136
  };
122
137
  readonly transform: {
123
138
  readonly mapper: typeof mapDataFrameMutate;
124
139
  readonly library: "base";
125
140
  readonly returnType: DataFrameType.DataFrame;
141
+ readonly alwaysDataFrame: true;
126
142
  };
127
143
  readonly group_by: {
128
144
  readonly mapper: typeof mapDataFrameGroupBy;
129
145
  readonly library: "dplyr";
130
146
  readonly returnType: DataFrameType.Tibble;
147
+ readonly alwaysDataFrame: true;
131
148
  };
132
149
  readonly summarise: {
133
150
  readonly mapper: typeof mapDataFrameSummarize;
134
151
  readonly library: "dplyr";
135
152
  readonly returnType: DataFrameType.DataFrame;
153
+ readonly alwaysDataFrame: true;
136
154
  };
137
155
  readonly summarize: {
138
156
  readonly mapper: typeof mapDataFrameSummarize;
139
157
  readonly library: "dplyr";
140
158
  readonly returnType: DataFrameType.DataFrame;
159
+ readonly alwaysDataFrame: true;
141
160
  };
142
161
  readonly inner_join: {
143
162
  readonly mapper: typeof mapDataFrameJoin;
144
163
  readonly library: "dplyr";
145
164
  readonly returnType: DataFrameType.DataFrame;
165
+ readonly alwaysDataFrame: true;
146
166
  };
147
167
  readonly left_join: {
148
168
  readonly mapper: typeof mapDataFrameJoin;
149
169
  readonly library: "dplyr";
150
170
  readonly returnType: DataFrameType.DataFrame;
171
+ readonly alwaysDataFrame: true;
151
172
  };
152
173
  readonly right_join: {
153
174
  readonly mapper: typeof mapDataFrameJoin;
154
175
  readonly library: "dplyr";
155
176
  readonly returnType: DataFrameType.DataFrame;
177
+ readonly alwaysDataFrame: true;
156
178
  };
157
179
  readonly full_join: {
158
180
  readonly mapper: typeof mapDataFrameJoin;
159
181
  readonly library: "dplyr";
160
182
  readonly returnType: DataFrameType.DataFrame;
183
+ readonly alwaysDataFrame: true;
161
184
  };
162
185
  readonly merge: {
163
186
  readonly mapper: typeof mapDataFrameJoin;
164
187
  readonly library: "base";
165
188
  readonly returnType: DataFrameType.DataFrame;
189
+ readonly alwaysDataFrame: true;
166
190
  };
167
191
  readonly relocate: {
168
192
  readonly mapper: typeof mapDataFrameIdentity;
169
193
  readonly library: "dplyr";
170
194
  readonly returnType: DataFrameType.DataFrame;
195
+ readonly alwaysDataFrame: true;
171
196
  };
172
197
  readonly arrange: {
173
198
  readonly mapper: typeof mapDataFrameIdentity;
174
199
  readonly library: "dplyr";
175
200
  readonly returnType: DataFrameType.DataFrame;
201
+ readonly alwaysDataFrame: true;
176
202
  };
177
203
  };
178
204
  /** All currently supported data frame functions */
@@ -186,15 +212,15 @@ type DataFrameFunction = keyof typeof DataFrameFunctionMapper;
186
212
  * @returns The mapped abstract data frame operations for the function call, or `undefined` if the node does not represent a data frame function call
187
213
  */
188
214
  export declare function mapDataFrameFunctionCall<Name extends DataFrameFunction>(node: RNode<ParentInformation>, inference: DataFrameShapeInferenceVisitor, dfg: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext): DataFrameOperations;
189
- declare function mapDataFrameCreate(args: readonly RFunctionArgument<ParentInformation>[], params: {
215
+ declare function mapDataFrameCreate(args: readonly PotentiallyEmptyRArgument<ParentInformation>[], params: {
190
216
  checkNames: FunctionParameterLocation<boolean>;
191
217
  noDupNames: FunctionParameterLocation<boolean>;
192
218
  special: string[];
193
219
  }, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
194
- declare function mapDataFrameConvert(args: readonly RFunctionArgument<ParentInformation>[], params: {
220
+ declare function mapDataFrameConvert(args: readonly PotentiallyEmptyRArgument<ParentInformation>[], params: {
195
221
  dataFrame: FunctionParameterLocation;
196
222
  }, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
197
- declare function mapDataFrameRead(args: readonly RFunctionArgument<ParentInformation>[], params: {
223
+ declare function mapDataFrameRead(args: readonly PotentiallyEmptyRArgument<ParentInformation>[], params: {
198
224
  fileName: FunctionParameterLocation;
199
225
  text?: FunctionParameterLocation;
200
226
  header: FunctionParameterLocation<boolean>;
@@ -206,46 +232,46 @@ declare function mapDataFrameRead(args: readonly RFunctionArgument<ParentInforma
206
232
  noDupNames: FunctionParameterLocation<boolean>;
207
233
  noEmptyNames?: boolean;
208
234
  }, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
209
- declare function mapDataFrameColBind(args: readonly RFunctionArgument<ParentInformation>[], params: {
235
+ declare function mapDataFrameColBind(args: readonly PotentiallyEmptyRArgument<ParentInformation>[], params: {
210
236
  special: string[];
211
237
  }, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
212
- declare function mapDataFrameRowBind(args: readonly RFunctionArgument<ParentInformation>[], params: {
238
+ declare function mapDataFrameRowBind(args: readonly PotentiallyEmptyRArgument<ParentInformation>[], params: {
213
239
  special: string[];
214
240
  }, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
215
- declare function mapDataFrameHeadTail(args: readonly RFunctionArgument<ParentInformation>[], params: {
241
+ declare function mapDataFrameHeadTail(args: readonly PotentiallyEmptyRArgument<ParentInformation>[], params: {
216
242
  dataFrame: FunctionParameterLocation;
217
243
  amount: FunctionParameterLocation<number>;
218
244
  }, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
219
- declare function mapDataFrameSubset(args: readonly RFunctionArgument<ParentInformation>[], params: {
245
+ declare function mapDataFrameSubset(args: readonly PotentiallyEmptyRArgument<ParentInformation>[], params: {
220
246
  dataFrame: FunctionParameterLocation;
221
247
  subset: FunctionParameterLocation;
222
248
  select: FunctionParameterLocation;
223
249
  drop: FunctionParameterLocation<boolean>;
224
250
  }, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
225
- declare function mapDataFrameFilter(args: readonly RFunctionArgument<ParentInformation>[], params: {
251
+ declare function mapDataFrameFilter(args: readonly PotentiallyEmptyRArgument<ParentInformation>[], params: {
226
252
  dataFrame: FunctionParameterLocation;
227
253
  special: string[];
228
254
  }, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
229
- declare function mapDataFrameSelect(args: readonly RFunctionArgument<ParentInformation>[], params: {
255
+ declare function mapDataFrameSelect(args: readonly PotentiallyEmptyRArgument<ParentInformation>[], params: {
230
256
  dataFrame: FunctionParameterLocation;
231
257
  special: string[];
232
258
  }, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
233
- declare function mapDataFrameMutate(args: readonly RFunctionArgument<ParentInformation>[], params: {
259
+ declare function mapDataFrameMutate(args: readonly PotentiallyEmptyRArgument<ParentInformation>[], params: {
234
260
  dataFrame: FunctionParameterLocation;
235
261
  special: string[];
236
262
  checkNames?: boolean;
237
263
  noDupNames?: boolean;
238
264
  }, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
239
- declare function mapDataFrameGroupBy(args: readonly RFunctionArgument<ParentInformation>[], params: {
265
+ declare function mapDataFrameGroupBy(args: readonly PotentiallyEmptyRArgument<ParentInformation>[], params: {
240
266
  dataFrame: FunctionParameterLocation;
241
267
  by: FunctionParameterLocation;
242
268
  special: string[];
243
269
  }, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
244
- declare function mapDataFrameSummarize(args: readonly RFunctionArgument<ParentInformation>[], params: {
270
+ declare function mapDataFrameSummarize(args: readonly PotentiallyEmptyRArgument<ParentInformation>[], params: {
245
271
  dataFrame: FunctionParameterLocation;
246
272
  special: string[];
247
273
  }, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
248
- declare function mapDataFrameJoin(args: readonly RFunctionArgument<ParentInformation>[], params: {
274
+ declare function mapDataFrameJoin(args: readonly PotentiallyEmptyRArgument<ParentInformation>[], params: {
249
275
  dataFrame: FunctionParameterLocation;
250
276
  otherDataFrame: FunctionParameterLocation;
251
277
  by: FunctionParameterLocation;
@@ -253,7 +279,7 @@ declare function mapDataFrameJoin(args: readonly RFunctionArgument<ParentInforma
253
279
  joinLeft: FunctionParameterLocation<boolean>;
254
280
  joinRight: FunctionParameterLocation<boolean>;
255
281
  }, inference: DataFrameShapeInferenceVisitor, info: ResolveInfo): DataFrameOperations;
256
- declare function mapDataFrameIdentity(args: readonly RFunctionArgument<ParentInformation>[], params: {
282
+ declare function mapDataFrameIdentity(args: readonly PotentiallyEmptyRArgument<ParentInformation>[], params: {
257
283
  dataFrame: FunctionParameterLocation;
258
284
  special: string[];
259
285
  disallowNamedArgs?: boolean;
@@ -10,8 +10,10 @@ const retriever_1 = require("../../../r-bridge/retriever");
10
10
  const assert_1 = require("../../../util/assert");
11
11
  const dataframe_domain_1 = require("../dataframe-domain");
12
12
  const resolve_args_1 = require("../resolve-args");
13
+ const semantics_1 = require("../semantics");
13
14
  const arguments_1 = require("./arguments");
14
15
  const identifier_1 = require("../../../dataflow/environments/identifier");
16
+ const r_argument_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
15
17
  /**
16
18
  * Represents the different types of data frames in R
17
19
  */
@@ -26,43 +28,48 @@ var DataFrameType;
26
28
  * including information about the origin library of the functions and the type of the returned data frame.
27
29
  */
28
30
  const DataFrameFunctionMapper = {
29
- 'data.frame': { mapper: mapDataFrameCreate, library: 'base', returnType: DataFrameType.DataFrame },
30
- 'as.data.frame': { mapper: mapDataFrameConvert, library: 'base', returnType: DataFrameType.DataFrame },
31
- 'read.table': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame },
32
- 'read.csv': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame },
33
- 'read.csv2': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame },
34
- 'read.delim': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame },
35
- 'read.delim2': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame },
36
- 'read_table': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble },
37
- 'read_csv': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble },
38
- 'read_csv2': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble },
39
- 'read_tsv': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble },
40
- 'read_delim': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble },
31
+ 'data.frame': { mapper: mapDataFrameCreate, library: 'base', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
32
+ 'as.data.frame': { mapper: mapDataFrameConvert, library: 'base', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
33
+ 'read.table': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
34
+ 'read.csv': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
35
+ 'read.csv2': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
36
+ 'read.delim': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
37
+ 'read.delim2': { mapper: mapDataFrameRead, library: 'utils', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
38
+ 'read_table': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble, alwaysDataFrame: true },
39
+ 'read_csv': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble, alwaysDataFrame: true },
40
+ 'read_csv2': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble, alwaysDataFrame: true },
41
+ 'read_tsv': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble, alwaysDataFrame: true },
42
+ 'read_delim': { mapper: mapDataFrameRead, library: 'readr', returnType: DataFrameType.Tibble, alwaysDataFrame: true },
41
43
  'cbind': { mapper: mapDataFrameColBind, library: 'base', returnType: DataFrameType.DataFrame },
42
44
  'rbind': { mapper: mapDataFrameRowBind, library: 'base', returnType: DataFrameType.DataFrame },
43
45
  'head': { mapper: mapDataFrameHeadTail, library: 'utils', returnType: DataFrameType.DataFrame },
44
46
  'tail': { mapper: mapDataFrameHeadTail, library: 'utils', returnType: DataFrameType.DataFrame },
45
47
  'subset': { mapper: mapDataFrameSubset, library: 'base', returnType: DataFrameType.DataFrame },
46
- 'filter': { mapper: mapDataFrameFilter, library: 'dplyr', returnType: DataFrameType.DataFrame },
47
- 'select': { mapper: mapDataFrameSelect, library: 'dplyr', returnType: DataFrameType.DataFrame },
48
- 'mutate': { mapper: mapDataFrameMutate, library: 'dplyr', returnType: DataFrameType.DataFrame },
49
- 'transform': { mapper: mapDataFrameMutate, library: 'base', returnType: DataFrameType.DataFrame },
50
- 'group_by': { mapper: mapDataFrameGroupBy, library: 'dplyr', returnType: DataFrameType.Tibble },
51
- 'summarise': { mapper: mapDataFrameSummarize, library: 'dplyr', returnType: DataFrameType.DataFrame },
52
- 'summarize': { mapper: mapDataFrameSummarize, library: 'dplyr', returnType: DataFrameType.DataFrame },
53
- 'inner_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame },
54
- 'left_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame },
55
- 'right_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame },
56
- 'full_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame },
57
- 'merge': { mapper: mapDataFrameJoin, library: 'base', returnType: DataFrameType.DataFrame },
58
- 'relocate': { mapper: mapDataFrameIdentity, library: 'dplyr', returnType: DataFrameType.DataFrame },
59
- 'arrange': { mapper: mapDataFrameIdentity, library: 'dplyr', returnType: DataFrameType.DataFrame }
48
+ 'filter': { mapper: mapDataFrameFilter, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
49
+ 'select': { mapper: mapDataFrameSelect, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
50
+ 'mutate': { mapper: mapDataFrameMutate, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
51
+ 'transform': { mapper: mapDataFrameMutate, library: 'base', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
52
+ 'group_by': { mapper: mapDataFrameGroupBy, library: 'dplyr', returnType: DataFrameType.Tibble, alwaysDataFrame: true },
53
+ 'summarise': { mapper: mapDataFrameSummarize, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
54
+ 'summarize': { mapper: mapDataFrameSummarize, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
55
+ 'inner_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
56
+ 'left_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
57
+ 'right_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
58
+ 'full_join': { mapper: mapDataFrameJoin, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
59
+ 'merge': { mapper: mapDataFrameJoin, library: 'base', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
60
+ 'relocate': { mapper: mapDataFrameIdentity, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true },
61
+ 'arrange': { mapper: mapDataFrameIdentity, library: 'dplyr', returnType: DataFrameType.DataFrame, alwaysDataFrame: true }
60
62
  };
61
63
  /**
62
64
  * List of other data frame functions that are not explicitly supported but may return data frames.
63
65
  */
64
66
  const OtherDataFrameFunctions = [
65
67
  {
68
+ type: 'entry_point',
69
+ names: ['as.data.frame.matrix'], // S3 dispatch of `as.data.frame`
70
+ library: 'base',
71
+ returnType: DataFrameType.DataFrame
72
+ }, {
66
73
  type: 'entry_point',
67
74
  names: ['anova', 'AIC', 'BIC'],
68
75
  library: 'anova',
@@ -72,11 +79,6 @@ const OtherDataFrameFunctions = [
72
79
  names: ['Anova', 'Manova'],
73
80
  library: 'car',
74
81
  returnType: DataFrameType.DataFrame
75
- }, {
76
- type: 'entry_point',
77
- names: ['lmer'],
78
- library: 'lme4',
79
- returnType: DataFrameType.DataFrame
80
82
  }, {
81
83
  type: 'entry_point',
82
84
  names: ['data_frame', 'as_data_frame'],
@@ -115,7 +117,7 @@ const OtherDataFrameFunctions = [
115
117
  dataFrame: { pos: 0, name: 'object' }
116
118
  }, {
117
119
  type: 'transformation',
118
- names: ['unique', 't'],
120
+ names: ['unique', 'droplevels'],
119
121
  library: 'base',
120
122
  returnType: DataFrameType.DataFrame,
121
123
  dataFrame: { pos: 0, name: 'x' }
@@ -151,6 +153,7 @@ const OtherDataFrameFunctions = [
151
153
  ],
152
154
  library: 'dplyr',
153
155
  returnType: DataFrameType.DataFrame,
156
+ alwaysDataFrame: true,
154
157
  dataFrame: { pos: 0, name: '.data' }
155
158
  }, {
156
159
  type: 'transformation',
@@ -163,6 +166,7 @@ const OtherDataFrameFunctions = [
163
166
  ],
164
167
  library: 'dplyr',
165
168
  returnType: DataFrameType.Tibble,
169
+ alwaysDataFrame: true,
166
170
  dataFrame: { pos: 0, name: '.tbl' }
167
171
  }, {
168
172
  type: 'transformation',
@@ -173,12 +177,14 @@ const OtherDataFrameFunctions = [
173
177
  ],
174
178
  library: 'dplyr',
175
179
  returnType: DataFrameType.DataFrame,
180
+ alwaysDataFrame: true,
176
181
  dataFrame: { pos: 0, name: 'x' }
177
182
  }, {
178
183
  type: 'transformation',
179
184
  names: ['bind_cols', 'bind_rows'],
180
185
  library: 'dplyr',
181
- returnType: DataFrameType.DataFrame
186
+ returnType: DataFrameType.DataFrame,
187
+ alwaysDataFrame: true
182
188
  }, {
183
189
  type: 'transformation',
184
190
  names: [
@@ -193,6 +199,7 @@ const OtherDataFrameFunctions = [
193
199
  names: ['add_column', 'add_row', 'add_case'],
194
200
  library: 'tibble',
195
201
  returnType: DataFrameType.Tibble,
202
+ alwaysDataFrame: true,
196
203
  dataFrame: { pos: 0, name: '.data' }
197
204
  }, {
198
205
  type: 'transformation',
@@ -200,6 +207,20 @@ const OtherDataFrameFunctions = [
200
207
  library: 'data.table',
201
208
  returnType: DataFrameType.DataTable,
202
209
  dataFrame: { pos: 0, name: 'data' }
210
+ }, {
211
+ type: 'modification',
212
+ names: ['setNames'],
213
+ library: 'stats',
214
+ constraintType: semantics_1.ConstraintType.OperandModification,
215
+ returnType: DataFrameType.DataFrame,
216
+ dataFrame: { pos: 0, name: 'object' }
217
+ }, {
218
+ type: 'modification',
219
+ names: ['unname'],
220
+ library: 'base',
221
+ constraintType: semantics_1.ConstraintType.OperandModification,
222
+ returnType: DataFrameType.DataFrame,
223
+ dataFrame: { pos: 0, name: 'obj' }
203
224
  }
204
225
  ];
205
226
  /**
@@ -529,30 +550,33 @@ function mapDataFrameFunctionCall(node, inference, dfg, ctx) {
529
550
  return;
530
551
  }
531
552
  const resolveInfo = { graph: dfg, idMap: dfg.idMap, full: true, resolve: config_1.VariableResolve.Alias, ctx };
532
- const n = identifier_1.Identifier.getName(node.functionName.content);
533
- if (isDataFrameFunction(n)) {
534
- const functionName = n;
535
- const mapper = DataFrameFunctionMapper[functionName].mapper;
553
+ const functionName = identifier_1.Identifier.getName(node.functionName.content);
554
+ if (isDataFrameFunction(functionName)) {
555
+ const mapping = DataFrameFunctionMapper[functionName];
536
556
  const params = DataFrameFunctionParamsMapper[functionName];
537
557
  const args = (0, arguments_1.getFunctionArguments)(node, dfg);
538
558
  if ((0, arguments_1.hasCriticalArgument)(args, params.critical, resolveInfo)) {
539
559
  return [{ operation: 'unknown', operand: undefined }];
540
560
  }
541
561
  else {
542
- return mapper(args, params, inference, resolveInfo);
562
+ return mapping.mapper(args, params, inference, resolveInfo) ?? (mapping.alwaysDataFrame ? [{ operation: 'unknown', operand: undefined }] : undefined);
543
563
  }
544
564
  }
545
565
  else {
546
- const mapping = getOtherDataFrameFunction(identifier_1.Identifier.getName(node.functionName.content));
566
+ const mapping = getOtherDataFrameFunction(functionName);
547
567
  if (mapping === undefined) {
548
568
  return;
549
569
  }
550
570
  else if (mapping.type === 'entry_point') {
551
571
  return [{ operation: 'unknown', operand: undefined }];
552
572
  }
553
- else if (mapping.type === 'transformation' || mapping.type === 'modification') {
573
+ else if (mapping.type === 'transformation') {
574
+ const args = (0, arguments_1.getFunctionArguments)(node, dfg);
575
+ return mapDataFrameUnknown(args, mapping, inference, resolveInfo) ?? (mapping.alwaysDataFrame ? [{ operation: 'unknown', operand: undefined }] : undefined);
576
+ }
577
+ else if (mapping.type === 'modification') {
554
578
  const args = (0, arguments_1.getFunctionArguments)(node, dfg);
555
- return mapDataFrameUnknown(args, mapping, inference, resolveInfo);
579
+ return mapDataFrameUnknown(args, { ...mapping, constraintType: semantics_1.ConstraintType.OperandModification }, inference, resolveInfo);
556
580
  }
557
581
  else {
558
582
  (0, assert_1.assertUnreachable)(mapping);
@@ -873,7 +897,7 @@ function mapDataFrameSelect(args, params, inference, info) {
873
897
  const accessedCols = [...selectedCols ?? [], ...unselectedCols ?? []];
874
898
  const mixedAccess = accessedCols.some(col => typeof col === 'string') && accessedCols.some(col => typeof col === 'number');
875
899
  const duplicateAccess = accessedCols.some((col, _, list) => col !== undefined && list.filter(other => other === col).length > 1);
876
- const renamedCols = selectArgs.some(arguments_1.isNamedArgument);
900
+ const renamedCols = selectArgs.some(r_argument_1.RArgument.isNamed);
877
901
  // map to top if columns are selected mixed by string and number, or are selected duplicate
878
902
  if (mixedAccess || duplicateAccess) {
879
903
  selectedCols = undefined;
@@ -974,8 +998,8 @@ function mapDataFrameGroupBy(args, params, inference, info) {
974
998
  const result = [];
975
999
  const byArgs = args.filter(arg => arg !== dataFrame);
976
1000
  const accessedNames = byArgs.flatMap(arg => (0, arguments_1.getUnresolvedSymbolsInExpression)(arg, info.graph)).map(identifier_1.Identifier.toString);
977
- const byNames = byArgs.map(arg => (0, arguments_1.isNamedArgument)(arg) ? (0, resolve_args_1.resolveIdToArgName)(arg, info) : (0, resolve_args_1.resolveIdToArgValueSymbolName)(arg, info));
978
- const mutatedCols = byArgs.some(arguments_1.isNamedArgument) || byNames.some(assert_1.isUndefined);
1001
+ const byNames = byArgs.map(arg => r_argument_1.RArgument.isNamed(arg) ? (0, resolve_args_1.resolveIdToArgName)(arg, info) : (0, resolve_args_1.resolveIdToArgValueSymbolName)(arg, info));
1002
+ const mutatedCols = byArgs.some(r_argument_1.RArgument.isNamed) || byNames.some(assert_1.isUndefined);
979
1003
  if (accessedNames.length > 0) {
980
1004
  result.push({
981
1005
  operation: 'accessCols',
@@ -1076,7 +1100,7 @@ function mapDataFrameIdentity(args, params, inference, info) {
1076
1100
  if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference)) {
1077
1101
  return;
1078
1102
  }
1079
- else if (params.disallowNamedArgs && args.some(arguments_1.isNamedArgument)) {
1103
+ else if (params.disallowNamedArgs && args.some(r_argument_1.RArgument.isNamed)) {
1080
1104
  return [{ operation: 'unknown', operand: dataFrame.value.info.id }];
1081
1105
  }
1082
1106
  return [{
@@ -1125,21 +1149,23 @@ function getRequestFromRead(fileNameArg, textArg, params, info) {
1125
1149
  else if (textArg !== undefined && textArg !== r_function_call_1.EmptyArgument) {
1126
1150
  const text = (0, resolve_args_1.resolveIdToArgValue)(textArg, info);
1127
1151
  if (typeof text === 'string') {
1128
- source = text;
1129
1152
  request = (0, retriever_1.requestFromInput)((0, resolve_args_1.unescapeSpecialChars)(text));
1130
1153
  }
1131
1154
  }
1132
- request = request ? info.ctx.files.resolveRequest(request).r : undefined;
1155
+ if (request?.request === 'file' && info.ctx.files.hasCached(request.content)) {
1156
+ request = info.ctx.files.resolveRequest(request).r;
1157
+ }
1133
1158
  return { source, request };
1134
1159
  }
1135
1160
  /**
1136
1161
  * Gets all entries from a line of a CSV file using a custom separator char, quote char, and comment char
1137
1162
  */
1138
1163
  function getEntriesFromCsvLine(line, sep = ',', quote = '"', comment = '', trim = true) {
1164
+ sep = sep.length > 0 ? sep : '\\s'; // default to whitespace separator
1139
1165
  sep = (0, arguments_1.escapeRegExp)(sep, true); // only allow tokens like `\s`, `\t`, or `\n` in separator, quote, and comment chars
1140
1166
  quote = (0, arguments_1.escapeRegExp)(quote);
1141
1167
  comment = (0, arguments_1.escapeRegExp)(comment);
1142
- const quantifier = sep === '\\s' ? '+' : '*'; // do not allow unquoted empty entries in whitespace-sparated files
1168
+ const quantifier = sep === '\\s' ? '+' : '*'; // do not allow unquoted empty entries in whitespace-separated files
1143
1169
  const LineCommentRegex = new RegExp(`[${comment}].*`);
1144
1170
  const CsvEntryRegex = new RegExp(`(?<=^|[${sep}])(?:[${quote}]((?:[^${quote}]|[${quote}]{2})*)[${quote}]|([^${sep}]${quantifier}))`, 'g');
1145
1171
  const DoubleQuoteRegex = new RegExp(`([${quote}])\\1`, 'g'); // regex for doubled quotes like `""` or `''`
@@ -4,6 +4,7 @@ exports.mapDataFrameReplacementFunction = mapDataFrameReplacementFunction;
4
4
  const config_1 = require("../../../config");
5
5
  const vertex_1 = require("../../../dataflow/graph/vertex");
6
6
  const make_argument_1 = require("../../../dataflow/internal/process/functions/call/argument/make-argument");
7
+ const r_argument_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
7
8
  const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
8
9
  const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
9
10
  const resolve_args_1 = require("../resolve-args");
@@ -107,7 +108,7 @@ function mapDataFrameNamedColumnAssignment(access, expression, inference, info)
107
108
  }
108
109
  function mapDataFrameIndexColRowAssignment(access, expression, inference, info) {
109
110
  const dataFrame = access.accessed;
110
- const args = access.access;
111
+ const args = access.access.filter(arg => r_argument_1.RArgument.isEmpty(arg) || r_argument_1.RArgument.isUnnamed(arg));
111
112
  if (!(0, arguments_1.isDataFrameArgument)(dataFrame, inference) || args.every(arg => arg === r_function_call_1.EmptyArgument)) {
112
113
  return;
113
114
  }
@@ -1,4 +1,4 @@
1
- import { DataFrameDomain } from './dataframe-domain';
1
+ import type { DataFrameDomain } from './dataframe-domain';
2
2
  /**
3
3
  * Represents the different types of resulting constraints that are inferred by abstract data frame operations.
4
4
  */