@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.
- package/README.md +31 -20
- package/abstract-interpretation/absint-visitor.d.ts +13 -8
- package/abstract-interpretation/absint-visitor.js +35 -26
- package/abstract-interpretation/data-frame/dataframe-domain.d.ts +1 -2
- package/abstract-interpretation/data-frame/dataframe-domain.js +14 -15
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +2 -15
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +11 -17
- package/abstract-interpretation/data-frame/mappers/arguments.js +18 -18
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +41 -15
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +74 -48
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +2 -1
- package/abstract-interpretation/data-frame/semantics.d.ts +1 -1
- package/abstract-interpretation/data-frame/semantics.js +31 -35
- package/abstract-interpretation/data-frame/shape-inference.js +1 -1
- package/abstract-interpretation/domains/interval-domain.d.ts +1 -0
- package/abstract-interpretation/domains/interval-domain.js +3 -0
- package/abstract-interpretation/domains/product-domain.d.ts +9 -0
- package/abstract-interpretation/domains/product-domain.js +26 -6
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +36 -22
- package/abstract-interpretation/domains/state-abstract-domain.js +169 -62
- package/abstract-interpretation/unsupported-functions.d.ts +10 -0
- package/abstract-interpretation/unsupported-functions.js +45 -0
- package/benchmark/slicer.js +10 -13
- package/cli/flowr.js +1 -1
- package/control-flow/control-flow-graph.js +13 -9
- package/control-flow/semantic-cfg-guided-visitor.d.ts +6 -0
- package/control-flow/semantic-cfg-guided-visitor.js +6 -0
- package/dataflow/environments/built-in-proc-name.d.ts +6 -0
- package/dataflow/environments/built-in-proc-name.js +6 -0
- package/dataflow/environments/built-in.d.ts +7 -5
- package/dataflow/environments/built-in.js +2 -0
- package/dataflow/environments/default-builtin-config.d.ts +442 -6
- package/dataflow/environments/default-builtin-config.js +158 -3
- package/dataflow/environments/overwrite.js +2 -5
- package/dataflow/graph/df-helper.d.ts +14 -4
- package/dataflow/graph/df-helper.js +36 -6
- package/dataflow/graph/graph.d.ts +10 -0
- package/dataflow/graph/graph.js +12 -0
- package/dataflow/instrument/instrument-dataflow-count.d.ts +10 -0
- package/dataflow/instrument/instrument-dataflow-count.js +10 -0
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +6 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +23 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +80 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +41 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +179 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +7 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +62 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.d.ts +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +15 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +2 -2
- package/dataflow/internal/process/functions/call/common.d.ts +2 -2
- package/dataflow/internal/process/functions/call/common.js +4 -3
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +2 -2
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +2 -2
- package/documentation/wiki-absint.js +6 -5
- package/documentation/wiki-analyzer.js +0 -2
- package/documentation/wiki-cfg.js +3 -3
- package/documentation/wiki-linter.js +1 -0
- package/documentation/wiki-normalized-ast.js +7 -7
- package/documentation/wiki-query.js +29 -0
- package/linter/linter-rules.d.ts +24 -1
- package/linter/linter-rules.js +3 -1
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +3 -4
- package/linter/rules/roxygen-arguments.d.ts +35 -0
- package/linter/rules/roxygen-arguments.js +100 -0
- package/package.json +4 -5
- package/project/context/flowr-analyzer-context.d.ts +1 -8
- package/project/context/flowr-analyzer-context.js +1 -7
- package/project/context/flowr-analyzer-environment-context.d.ts +5 -0
- package/project/context/flowr-analyzer-environment-context.js +6 -0
- package/project/context/flowr-analyzer-files-context.d.ts +6 -0
- package/project/context/flowr-analyzer-files-context.js +4 -2
- package/project/flowr-analyzer-builder.js +1 -4
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +10 -5
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/library-functions.js +2 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.js +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-format.js +7 -2
- package/queries/catalog/files-query/files-query-executor.js +0 -1
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +2 -0
- package/queries/catalog/input-sources-query/simple-input-classifier.js +5 -3
- package/r-bridge/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +13 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +14 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +9 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +13 -0
- package/r-bridge/lang-4.x/ast/model/versions.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/versions.js +3 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
- package/r-bridge/roxygen2/documentation-provider.js +15 -6
- package/r-bridge/roxygen2/roxygen-ast.d.ts +3 -1
- package/search/flowr-search-builder.js +3 -2
- package/util/mermaid/ast.js +2 -1
- package/util/record.d.ts +23 -0
- package/util/record.js +33 -0
- package/util/version.js +1 -1
- package/abstract-interpretation/domains/mapped-abstract-domain.d.ts +0 -41
- package/abstract-interpretation/domains/mapped-abstract-domain.js +0 -213
|
@@ -6,7 +6,6 @@ exports.getConstraintType = getConstraintType;
|
|
|
6
6
|
const assert_1 = require("../../util/assert");
|
|
7
7
|
const lattice_1 = require("../domains/lattice");
|
|
8
8
|
const positive_interval_domain_1 = require("../domains/positive-interval-domain");
|
|
9
|
-
const dataframe_domain_1 = require("./dataframe-domain");
|
|
10
9
|
/**
|
|
11
10
|
* Represents the different types of resulting constraints that are inferred by abstract data frame operations.
|
|
12
11
|
*/
|
|
@@ -73,7 +72,7 @@ function applyCreateSemantics(value, { colnames, rows }) {
|
|
|
73
72
|
const colnamesValue = setRange(colnames);
|
|
74
73
|
const colsValue = colnames !== undefined ? [colnames.length, colnames.length] : positive_interval_domain_1.PosIntervalTop;
|
|
75
74
|
const rowsValue = Array.isArray(rows) ? rows : typeof rows === 'number' ? [rows, rows] : positive_interval_domain_1.PosIntervalTop;
|
|
76
|
-
return
|
|
75
|
+
return value.create({
|
|
77
76
|
colnames: value.colnames.create(colnamesValue),
|
|
78
77
|
cols: value.cols.create(colsValue),
|
|
79
78
|
rows: value.rows.create(rowsValue)
|
|
@@ -84,14 +83,14 @@ function applyReadSemantics(value, { colnames, rows }) {
|
|
|
84
83
|
}
|
|
85
84
|
function applyAccessColsSemantics(value, { columns }) {
|
|
86
85
|
if (columns?.every(col => typeof col === 'string')) {
|
|
87
|
-
return
|
|
86
|
+
return value.create({
|
|
88
87
|
colnames: value.colnames.union(setRange(columns)),
|
|
89
88
|
cols: value.cols,
|
|
90
89
|
rows: value.rows
|
|
91
90
|
});
|
|
92
91
|
}
|
|
93
92
|
else if (columns?.every(col => typeof col === 'number')) {
|
|
94
|
-
return
|
|
93
|
+
return value.create({
|
|
95
94
|
colnames: value.colnames,
|
|
96
95
|
cols: columns.reduce((current, col) => current.max([col, col]), value.cols),
|
|
97
96
|
rows: value.rows
|
|
@@ -101,7 +100,7 @@ function applyAccessColsSemantics(value, { columns }) {
|
|
|
101
100
|
}
|
|
102
101
|
function applyAccessRowsSemantics(value, { rows }) {
|
|
103
102
|
if (rows !== undefined) {
|
|
104
|
-
return
|
|
103
|
+
return value.create({
|
|
105
104
|
colnames: value.colnames,
|
|
106
105
|
cols: value.cols,
|
|
107
106
|
rows: rows.reduce((current, row) => current.max([row, row]), value.rows)
|
|
@@ -111,20 +110,20 @@ function applyAccessRowsSemantics(value, { rows }) {
|
|
|
111
110
|
}
|
|
112
111
|
function applyAssignColsSemantics(value, { columns }) {
|
|
113
112
|
if (columns?.every(col => typeof col === 'string')) {
|
|
114
|
-
return
|
|
113
|
+
return value.create({
|
|
115
114
|
colnames: value.colnames.union(setRange(columns)),
|
|
116
115
|
cols: value.cols.add([0, columns.length]).max([columns.length, columns.length]),
|
|
117
116
|
rows: value.rows
|
|
118
117
|
});
|
|
119
118
|
}
|
|
120
119
|
else if (columns?.every(col => typeof col === 'number')) {
|
|
121
|
-
return
|
|
120
|
+
return value.create({
|
|
122
121
|
colnames: value.colnames.widenUp(),
|
|
123
122
|
cols: columns.reduce((current, col) => current.max([col, col]), value.cols),
|
|
124
123
|
rows: value.rows
|
|
125
124
|
});
|
|
126
125
|
}
|
|
127
|
-
return
|
|
126
|
+
return value.create({
|
|
128
127
|
colnames: value.colnames.widenUp(),
|
|
129
128
|
cols: value.cols.widenUp(),
|
|
130
129
|
rows: value.rows
|
|
@@ -132,13 +131,13 @@ function applyAssignColsSemantics(value, { columns }) {
|
|
|
132
131
|
}
|
|
133
132
|
function applyAssignRowsSemantics(value, { rows }) {
|
|
134
133
|
if (rows !== undefined) {
|
|
135
|
-
return
|
|
134
|
+
return value.create({
|
|
136
135
|
colnames: value.colnames,
|
|
137
136
|
cols: value.cols,
|
|
138
137
|
rows: rows.reduce((current, row) => current.max([row, row]), value.rows)
|
|
139
138
|
});
|
|
140
139
|
}
|
|
141
|
-
return
|
|
140
|
+
return value.create({
|
|
142
141
|
colnames: value.colnames,
|
|
143
142
|
cols: value.cols,
|
|
144
143
|
rows: value.rows.widenUp()
|
|
@@ -146,21 +145,21 @@ function applyAssignRowsSemantics(value, { rows }) {
|
|
|
146
145
|
}
|
|
147
146
|
function applySetColNamesSemantics(value, { colnames }, options) {
|
|
148
147
|
if (options?.partial) {
|
|
149
|
-
return
|
|
148
|
+
return value.create({
|
|
150
149
|
colnames: value.colnames.widenDown().union(setRange(colnames)),
|
|
151
150
|
cols: value.cols,
|
|
152
151
|
rows: value.rows
|
|
153
152
|
});
|
|
154
153
|
}
|
|
155
154
|
const allColNames = colnames?.every(assert_1.isNotUndefined) && value.cols.value !== lattice_1.Bottom && colnames.length >= value.cols.value[1];
|
|
156
|
-
return
|
|
155
|
+
return value.create({
|
|
157
156
|
colnames: allColNames ? value.colnames.create(setRange(colnames)) : value.colnames.create(setRange(colnames)).widenUp(),
|
|
158
157
|
cols: value.cols,
|
|
159
158
|
rows: value.rows
|
|
160
159
|
});
|
|
161
160
|
}
|
|
162
161
|
function applyAddColsSemantics(value, { colnames }) {
|
|
163
|
-
return
|
|
162
|
+
return value.create({
|
|
164
163
|
colnames: colnames !== undefined ? value.colnames.union(setRange(colnames)) : value.colnames.widenUp(),
|
|
165
164
|
cols: colnames !== undefined ? value.cols.add([colnames.length, colnames.length]) : value.cols.widenUp(),
|
|
166
165
|
rows: value.rows
|
|
@@ -168,14 +167,13 @@ function applyAddColsSemantics(value, { colnames }) {
|
|
|
168
167
|
}
|
|
169
168
|
function applyAddRowsSemantics(value, { rows }) {
|
|
170
169
|
if (value.cols.value !== lattice_1.Bottom && value.cols.value[0] === 0) {
|
|
171
|
-
return
|
|
172
|
-
...value,
|
|
170
|
+
return value.create({
|
|
173
171
|
colnames: value.colnames.top(),
|
|
174
172
|
cols: rows !== undefined ? value.cols.add([1, 1]) : value.cols.top(),
|
|
175
173
|
rows: rows !== undefined ? value.rows.add([rows, rows]) : value.rows.widenUp()
|
|
176
174
|
});
|
|
177
175
|
}
|
|
178
|
-
return
|
|
176
|
+
return value.create({
|
|
179
177
|
colnames: value.colnames,
|
|
180
178
|
cols: value.cols,
|
|
181
179
|
rows: rows !== undefined ? value.rows.add([rows, rows]) : value.rows.widenUp()
|
|
@@ -183,13 +181,13 @@ function applyAddRowsSemantics(value, { rows }) {
|
|
|
183
181
|
}
|
|
184
182
|
function applyRemoveColsSemantics(value, { colnames }, options) {
|
|
185
183
|
if (options?.maybe) {
|
|
186
|
-
return
|
|
184
|
+
return value.create({
|
|
187
185
|
colnames: colnames !== undefined ? value.colnames.subtract(setRange(colnames)) : value.colnames.widenDown(),
|
|
188
186
|
cols: colnames !== undefined ? value.cols.subtract([colnames.length, 0]) : value.cols.widenDown(),
|
|
189
187
|
rows: value.rows
|
|
190
188
|
});
|
|
191
189
|
}
|
|
192
|
-
return
|
|
190
|
+
return value.create({
|
|
193
191
|
colnames: colnames !== undefined ? value.colnames.subtract(setRange(colnames)) : value.colnames.widenDown(),
|
|
194
192
|
cols: colnames !== undefined ? value.cols.subtract([colnames.length, colnames.length]) : value.cols.widenDown(),
|
|
195
193
|
rows: value.rows
|
|
@@ -197,20 +195,20 @@ function applyRemoveColsSemantics(value, { colnames }, options) {
|
|
|
197
195
|
}
|
|
198
196
|
function applyRemoveRowsSemantics(value, { rows }, options) {
|
|
199
197
|
if (options?.maybe) {
|
|
200
|
-
return
|
|
198
|
+
return value.create({
|
|
201
199
|
colnames: value.colnames,
|
|
202
200
|
cols: value.cols,
|
|
203
201
|
rows: rows !== undefined ? value.rows.subtract([rows, 0]) : value.rows.widenDown()
|
|
204
202
|
});
|
|
205
203
|
}
|
|
206
|
-
return
|
|
204
|
+
return value.create({
|
|
207
205
|
colnames: value.colnames,
|
|
208
206
|
cols: value.cols,
|
|
209
207
|
rows: rows !== undefined ? value.rows.subtract([rows, rows]) : value.rows.widenDown()
|
|
210
208
|
});
|
|
211
209
|
}
|
|
212
210
|
function applyConcatColsSemantics(value, { other }) {
|
|
213
|
-
return
|
|
211
|
+
return value.create({
|
|
214
212
|
colnames: value.colnames.union(other.colnames),
|
|
215
213
|
cols: value.cols.add(other.cols),
|
|
216
214
|
rows: value.rows
|
|
@@ -218,14 +216,13 @@ function applyConcatColsSemantics(value, { other }) {
|
|
|
218
216
|
}
|
|
219
217
|
function applyConcatRowsSemantics(value, { other }) {
|
|
220
218
|
if (value.cols.value !== lattice_1.Bottom && value.cols.value[0] === 0) {
|
|
221
|
-
return
|
|
222
|
-
...value,
|
|
219
|
+
return value.create({
|
|
223
220
|
colnames: value.colnames.join(other.colnames),
|
|
224
221
|
cols: value.cols.join(other.cols),
|
|
225
222
|
rows: value.rows.add(other.rows)
|
|
226
223
|
});
|
|
227
224
|
}
|
|
228
|
-
return
|
|
225
|
+
return value.create({
|
|
229
226
|
colnames: value.colnames,
|
|
230
227
|
cols: value.cols,
|
|
231
228
|
rows: value.rows.add(other.rows)
|
|
@@ -233,20 +230,20 @@ function applyConcatRowsSemantics(value, { other }) {
|
|
|
233
230
|
}
|
|
234
231
|
function applySubsetColsSemantics(value, { colnames }, options) {
|
|
235
232
|
if (options?.duplicateCols) {
|
|
236
|
-
return
|
|
233
|
+
return value.create({
|
|
237
234
|
colnames: value.colnames.top(),
|
|
238
235
|
cols: colnames !== undefined ? value.cols.create([colnames.length, colnames.length]) : value.cols.top(),
|
|
239
236
|
rows: value.rows
|
|
240
237
|
});
|
|
241
238
|
}
|
|
242
239
|
else if (options?.renamedCols) {
|
|
243
|
-
return
|
|
240
|
+
return value.create({
|
|
244
241
|
colnames: value.colnames.top(),
|
|
245
242
|
cols: colnames !== undefined ? value.cols.min([colnames.length, colnames.length]) : value.cols.widenDown(),
|
|
246
243
|
rows: value.rows
|
|
247
244
|
});
|
|
248
245
|
}
|
|
249
|
-
return
|
|
246
|
+
return value.create({
|
|
250
247
|
colnames: colnames !== undefined ? value.colnames.intersect(setRange(colnames)) : value.colnames.widenDown(),
|
|
251
248
|
cols: colnames !== undefined ? value.cols.min([colnames.length, colnames.length]) : value.cols.widenDown(),
|
|
252
249
|
rows: value.rows
|
|
@@ -254,27 +251,27 @@ function applySubsetColsSemantics(value, { colnames }, options) {
|
|
|
254
251
|
}
|
|
255
252
|
function applySubsetRowsSemantics(value, { rows }, options) {
|
|
256
253
|
if (options?.duplicateRows) {
|
|
257
|
-
return
|
|
254
|
+
return value.create({
|
|
258
255
|
colnames: value.colnames,
|
|
259
256
|
cols: value.cols,
|
|
260
257
|
rows: rows !== undefined ? value.rows.create([rows, rows]) : value.rows.top()
|
|
261
258
|
});
|
|
262
259
|
}
|
|
263
|
-
return
|
|
260
|
+
return value.create({
|
|
264
261
|
colnames: value.colnames,
|
|
265
262
|
cols: value.cols,
|
|
266
263
|
rows: rows !== undefined ? value.rows.min([rows, rows]) : value.rows.widenDown()
|
|
267
264
|
});
|
|
268
265
|
}
|
|
269
266
|
function applyFilterRowsSemantics(value, { condition }) {
|
|
270
|
-
return
|
|
267
|
+
return value.create({
|
|
271
268
|
colnames: value.colnames,
|
|
272
269
|
cols: value.cols,
|
|
273
270
|
rows: condition ? value.rows : condition === false ? value.rows.create([0, 0]) : value.rows.widenDown()
|
|
274
271
|
});
|
|
275
272
|
}
|
|
276
273
|
function applyMutateColsSemantics(value, { colnames }) {
|
|
277
|
-
return
|
|
274
|
+
return value.create({
|
|
278
275
|
colnames: colnames !== undefined ? value.colnames.union(setRange(colnames)) : value.colnames.widenUp(),
|
|
279
276
|
cols: colnames !== undefined ? value.cols.add([0, colnames.length]).max([colnames.length, colnames.length]) : value.cols.widenUp(),
|
|
280
277
|
rows: value.rows
|
|
@@ -282,7 +279,7 @@ function applyMutateColsSemantics(value, { colnames }) {
|
|
|
282
279
|
}
|
|
283
280
|
function applyGroupBySemantics(value, { by }, options) {
|
|
284
281
|
if (options?.mutatedCols) {
|
|
285
|
-
return
|
|
282
|
+
return value.create({
|
|
286
283
|
colnames: value.colnames.union(setRange(by)),
|
|
287
284
|
cols: value.cols.add([0, by.length]),
|
|
288
285
|
rows: value.rows
|
|
@@ -292,7 +289,7 @@ function applyGroupBySemantics(value, { by }, options) {
|
|
|
292
289
|
return value;
|
|
293
290
|
}
|
|
294
291
|
function applySummarizeSemantics(value, { colnames }) {
|
|
295
|
-
return
|
|
292
|
+
return value.create({
|
|
296
293
|
colnames: colnames !== undefined ? value.colnames.join(setRange([])).union(setRange(colnames)) : value.colnames.widenUp(),
|
|
297
294
|
cols: colnames !== undefined ? value.cols.add([0, colnames.length]).min([colnames.length, +Infinity]) : value.cols.widenUp(),
|
|
298
295
|
rows: value.rows.min([1, +Infinity]).max([0, 1])
|
|
@@ -360,8 +357,7 @@ function applyJoinSemantics(value, { other, by }, options) {
|
|
|
360
357
|
default:
|
|
361
358
|
(0, assert_1.assertUnreachable)(joinType);
|
|
362
359
|
}
|
|
363
|
-
return
|
|
364
|
-
...value,
|
|
360
|
+
return value.create({
|
|
365
361
|
colnames: duplicateCols === undefined ? value.colnames.top() : duplicateCols.length > 0 ? value.colnames.union(other.colnames).subtract(setRange(duplicateCols)).widenUp() : value.colnames.union(other.colnames),
|
|
366
362
|
cols: by !== undefined ? value.cols.add(other.cols).subtract([by.length, by.length]) : mergeInterval(value.cols, other.cols),
|
|
367
363
|
rows: productRows ? productInterval(rows, value.rows, other.rows) : rows
|
|
@@ -16,7 +16,7 @@ class DataFrameShapeInferenceVisitor extends absint_visitor_1.AbstractInterpreta
|
|
|
16
16
|
*/
|
|
17
17
|
operations;
|
|
18
18
|
constructor({ trackOperations = true, ...config }) {
|
|
19
|
-
super(config);
|
|
19
|
+
super(config, dataframe_domain_1.DataFrameDomain.top());
|
|
20
20
|
if (trackOperations) {
|
|
21
21
|
this.operations = new Map();
|
|
22
22
|
}
|
|
@@ -65,5 +65,6 @@ export declare class IntervalDomain<Value extends IntervalLift = IntervalLift> e
|
|
|
65
65
|
isTop(): this is IntervalDomain<IntervalTop>;
|
|
66
66
|
isBottom(): this is IntervalDomain<IntervalBottom>;
|
|
67
67
|
isValue(): this is IntervalDomain<IntervalValue>;
|
|
68
|
+
isFinite(): this is IntervalDomain<IntervalValue>;
|
|
68
69
|
}
|
|
69
70
|
export {};
|
|
@@ -259,6 +259,9 @@ class IntervalDomain extends abstract_domain_1.AbstractDomain {
|
|
|
259
259
|
isValue() {
|
|
260
260
|
return this.value !== lattice_1.Bottom;
|
|
261
261
|
}
|
|
262
|
+
isFinite() {
|
|
263
|
+
return this.isValue() && Number.isFinite(this.value[0]) && Number.isFinite(this.value[1]);
|
|
264
|
+
}
|
|
262
265
|
}
|
|
263
266
|
exports.IntervalDomain = IntervalDomain;
|
|
264
267
|
//# sourceMappingURL=interval-domain.js.map
|
|
@@ -13,6 +13,7 @@ export type ConcreteProduct<Product extends AbstractProduct> = {
|
|
|
13
13
|
* @template Product - Type of the abstract product of the product domain mapping property names to abstract domains
|
|
14
14
|
*/
|
|
15
15
|
export declare abstract class ProductDomain<Product extends AbstractProduct> extends AbstractDomain<ConcreteProduct<Product>, Product, Product, Product> {
|
|
16
|
+
constructor(value: Product);
|
|
16
17
|
abstract create(value: Product): this;
|
|
17
18
|
bottom(): this;
|
|
18
19
|
top(): this;
|
|
@@ -26,7 +27,15 @@ export declare abstract class ProductDomain<Product extends AbstractProduct> ext
|
|
|
26
27
|
abstract(concrete: ReadonlySet<ConcreteProduct<Product>> | typeof Top): this;
|
|
27
28
|
toJson(): unknown;
|
|
28
29
|
toString(): string;
|
|
30
|
+
isTop(): boolean;
|
|
29
31
|
isTop(): this is this;
|
|
32
|
+
isBottom(): boolean;
|
|
30
33
|
isBottom(): this is this;
|
|
34
|
+
isValue(): boolean;
|
|
31
35
|
isValue(): this is this;
|
|
36
|
+
/**
|
|
37
|
+
* Optional reduction function for a reduced product domain.
|
|
38
|
+
*/
|
|
39
|
+
protected reduce(value: Product): Product;
|
|
40
|
+
private refine;
|
|
32
41
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ProductDomain = void 0;
|
|
4
4
|
const abstract_domain_1 = require("./abstract-domain");
|
|
5
5
|
const lattice_1 = require("./lattice");
|
|
6
|
+
const record_1 = require("../../util/record");
|
|
6
7
|
/**
|
|
7
8
|
* A product abstract domain as named Cartesian product of sub abstract domains.
|
|
8
9
|
* The sub abstract domains are represented by a record mapping property names to abstract domains.
|
|
@@ -10,6 +11,10 @@ const lattice_1 = require("./lattice");
|
|
|
10
11
|
* @template Product - Type of the abstract product of the product domain mapping property names to abstract domains
|
|
11
12
|
*/
|
|
12
13
|
class ProductDomain extends abstract_domain_1.AbstractDomain {
|
|
14
|
+
constructor(value) {
|
|
15
|
+
super(record_1.Record.mapProperties(value, entry => entry.create(entry.value)));
|
|
16
|
+
this._value = this.reduce(this.value);
|
|
17
|
+
}
|
|
13
18
|
bottom() {
|
|
14
19
|
const result = this.create(this.value);
|
|
15
20
|
for (const key in result.value) {
|
|
@@ -51,28 +56,28 @@ class ProductDomain extends abstract_domain_1.AbstractDomain {
|
|
|
51
56
|
for (const key in result.value) {
|
|
52
57
|
result._value[key] = result.value[key].join(other.value[key]);
|
|
53
58
|
}
|
|
54
|
-
return result;
|
|
59
|
+
return result.refine();
|
|
55
60
|
}
|
|
56
61
|
meet(other) {
|
|
57
62
|
const result = this.create(this.value);
|
|
58
63
|
for (const key in result.value) {
|
|
59
64
|
result._value[key] = result.value[key].meet(other.value[key]);
|
|
60
65
|
}
|
|
61
|
-
return result;
|
|
66
|
+
return result.refine();
|
|
62
67
|
}
|
|
63
68
|
widen(other) {
|
|
64
69
|
const result = this.create(this.value);
|
|
65
70
|
for (const key in result.value) {
|
|
66
71
|
result._value[key] = result.value[key].widen(other.value[key]);
|
|
67
72
|
}
|
|
68
|
-
return result;
|
|
73
|
+
return result.refine();
|
|
69
74
|
}
|
|
70
75
|
narrow(other) {
|
|
71
76
|
const result = this.create(this.value);
|
|
72
77
|
for (const key in result.value) {
|
|
73
78
|
result._value[key] = result.value[key].narrow(other.value[key]);
|
|
74
79
|
}
|
|
75
|
-
return result;
|
|
80
|
+
return result.refine();
|
|
76
81
|
}
|
|
77
82
|
concretize(limit) {
|
|
78
83
|
let result = new Set([{}]);
|
|
@@ -103,10 +108,10 @@ class ProductDomain extends abstract_domain_1.AbstractDomain {
|
|
|
103
108
|
const concreteValues = new Set(concrete.values().map(value => value[key]));
|
|
104
109
|
result._value[key] = result.value[key].abstract(concreteValues);
|
|
105
110
|
}
|
|
106
|
-
return result;
|
|
111
|
+
return result.refine();
|
|
107
112
|
}
|
|
108
113
|
toJson() {
|
|
109
|
-
return
|
|
114
|
+
return record_1.Record.mapProperties(this.value, entry => entry.toJson());
|
|
110
115
|
}
|
|
111
116
|
toString() {
|
|
112
117
|
return '(' + Object.entries(this.value).map(([key, value]) => `${key}: ${value.toString()}`).join(', ') + ')';
|
|
@@ -120,6 +125,21 @@ class ProductDomain extends abstract_domain_1.AbstractDomain {
|
|
|
120
125
|
isValue() {
|
|
121
126
|
return true;
|
|
122
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Optional reduction function for a reduced product domain.
|
|
130
|
+
*/
|
|
131
|
+
reduce(value) {
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
refine() {
|
|
135
|
+
if (!this.isTop() || this.isBottom()) {
|
|
136
|
+
const reduced = this.reduce(this.value);
|
|
137
|
+
if (reduced !== this.value) {
|
|
138
|
+
return this.create(reduced);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return this;
|
|
142
|
+
}
|
|
123
143
|
}
|
|
124
144
|
exports.ProductDomain = ProductDomain;
|
|
125
145
|
//# sourceMappingURL=product-domain.js.map
|
|
@@ -1,42 +1,55 @@
|
|
|
1
1
|
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
|
-
import type
|
|
3
|
-
import { Top } from './lattice';
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { AbstractDomain, type AnyAbstractDomain, type ConcreteDomain } from './abstract-domain';
|
|
3
|
+
import { Bottom, Top } from './lattice';
|
|
4
|
+
/** The type of the concrete state of the concrete domain of a state abstract domain that maps keys to a concrete value in the concrete domain */
|
|
5
|
+
export type ConcreteState<Domain extends AnyAbstractDomain> = ReadonlyMap<NodeId, ConcreteDomain<Domain>>;
|
|
6
|
+
/** The type of the actual values of the state abstract domain as map of keys to domain values */
|
|
7
|
+
type StateDomainValue<Domain extends AnyAbstractDomain> = ReadonlyMap<NodeId, Domain>;
|
|
8
|
+
/** The type of the Top element of the state abstract domain as (empty) map of keys to domain values */
|
|
9
|
+
type StateDomainTop = ReadonlyMap<NodeId, never>;
|
|
10
|
+
/** The type of the Bottom element of the state abstract domain as {@link Bottom} symbol */
|
|
11
|
+
type StateDomainBottom = typeof Bottom;
|
|
12
|
+
/** The type of the abstract values of the state abstract domain that are Top, Bottom, or actual values */
|
|
13
|
+
type StateDomainLift<Domain extends AnyAbstractDomain> = StateDomainValue<Domain> | StateDomainBottom;
|
|
6
14
|
/**
|
|
7
|
-
* A state abstract domain
|
|
8
|
-
* The Bottom element is defined as
|
|
9
|
-
* @template Domain - Type of the abstract domain to map the AST node IDs to
|
|
15
|
+
* A state abstract domain that maps AST node IDs of a program to abstract values of an abstract domain.
|
|
16
|
+
* The Bottom element is defined as {@link Bottom} symbol and the Top element as empty mapping.
|
|
17
|
+
* @template Domain - Type of the value abstract domain to map the AST node IDs to
|
|
10
18
|
* @see {@link NodeId} for the node IDs of the AST nodes
|
|
11
19
|
*/
|
|
12
|
-
export declare class StateAbstractDomain<Domain extends AnyAbstractDomain> extends
|
|
13
|
-
|
|
14
|
-
constructor(value:
|
|
15
|
-
create(value:
|
|
16
|
-
static top<Domain extends AnyAbstractDomain>(): StateAbstractDomain<Domain>;
|
|
17
|
-
|
|
20
|
+
export declare class StateAbstractDomain<Domain extends AnyAbstractDomain, Value extends StateDomainLift<Domain> = StateDomainLift<Domain>> extends AbstractDomain<ConcreteState<Domain>, StateDomainValue<Domain>, StateDomainTop, StateDomainBottom, Value> {
|
|
21
|
+
protected domain: Domain;
|
|
22
|
+
constructor(value: Value, domain: Domain);
|
|
23
|
+
create(value: StateDomainLift<Domain>): this;
|
|
24
|
+
static top<Domain extends AnyAbstractDomain>(domain: Domain): StateAbstractDomain<Domain, StateDomainTop>;
|
|
25
|
+
static bottom<Domain extends AnyAbstractDomain>(domain: Domain): StateAbstractDomain<Domain, StateDomainBottom>;
|
|
26
|
+
get(key: NodeId): Domain | undefined;
|
|
27
|
+
has(key: NodeId): boolean;
|
|
18
28
|
protected set(key: NodeId, value: Domain): void;
|
|
19
|
-
|
|
20
|
-
top(): this
|
|
29
|
+
protected remove(key: NodeId): void;
|
|
30
|
+
top(): this & StateAbstractDomain<Domain, StateDomainTop>;
|
|
31
|
+
bottom(): this & StateAbstractDomain<Domain, StateDomainBottom>;
|
|
21
32
|
equals(other: this): boolean;
|
|
22
33
|
leq(other: this): boolean;
|
|
23
34
|
join(other: this): this;
|
|
24
35
|
meet(other: this): this;
|
|
25
36
|
widen(other: this): this;
|
|
26
37
|
narrow(other: this): this;
|
|
27
|
-
concretize(limit: number): ReadonlySet<
|
|
28
|
-
abstract(concrete:
|
|
38
|
+
concretize(limit: number): ReadonlySet<ConcreteState<Domain>> | typeof Top;
|
|
39
|
+
abstract(concrete: ReadonlySet<ConcreteState<Domain>> | typeof Top): this;
|
|
29
40
|
toJson(): unknown;
|
|
30
41
|
toString(): string;
|
|
31
|
-
isTop(): this is this
|
|
32
|
-
isBottom(): this is this
|
|
33
|
-
isValue(): this is this
|
|
42
|
+
isTop(): this is this & StateAbstractDomain<Domain, StateDomainTop>;
|
|
43
|
+
isBottom(): this is this & StateAbstractDomain<Domain, StateDomainBottom>;
|
|
44
|
+
isValue(): this is this & StateAbstractDomain<Domain, StateDomainValue<Domain>>;
|
|
34
45
|
}
|
|
35
46
|
/**
|
|
36
47
|
* A mutable version of the {@link StateAbstractDomain} with {@link MutableStateAbstractDomain#set|`set`} and {@link MutableStateAbstractDomain#remove|`remove`}.
|
|
37
48
|
*/
|
|
38
|
-
export declare class MutableStateAbstractDomain<Domain extends AnyAbstractDomain> extends StateAbstractDomain<Domain> {
|
|
39
|
-
create(value:
|
|
49
|
+
export declare class MutableStateAbstractDomain<Domain extends AnyAbstractDomain, Value extends StateDomainLift<Domain> = StateDomainLift<Domain>> extends StateAbstractDomain<Domain, Value> {
|
|
50
|
+
create(value: StateDomainLift<Domain>): this;
|
|
51
|
+
static top<Domain extends AnyAbstractDomain>(domain: Domain): MutableStateAbstractDomain<Domain, StateDomainTop>;
|
|
52
|
+
static bottom<Domain extends AnyAbstractDomain>(domain: Domain): MutableStateAbstractDomain<Domain, StateDomainBottom>;
|
|
40
53
|
set(key: NodeId, value: Domain): void;
|
|
41
54
|
remove(key: NodeId): void;
|
|
42
55
|
}
|
|
@@ -45,3 +58,4 @@ export declare class MutableStateAbstractDomain<Domain extends AnyAbstractDomain
|
|
|
45
58
|
* @template StateDomain - The state abstract domain to get the value abstract domain type for
|
|
46
59
|
*/
|
|
47
60
|
export type ValueAbstractDomain<StateDomain extends StateAbstractDomain<AnyAbstractDomain>> = StateDomain extends StateAbstractDomain<infer Domain> ? Domain : never;
|
|
61
|
+
export {};
|