@eagleoutice/flowr 2.17.3 → 2.17.4
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 +9 -9
- package/cli/repl/commands/repl-signature.d.ts +1 -1
- package/cli/repl/completion.d.ts +23 -0
- package/cli/repl/completion.js +9 -0
- package/cli/repl/core.d.ts +0 -23
- package/cli/repl/core.js +0 -5
- package/cli/repl/parser/slice-query-parser.d.ts +1 -1
- package/cli/repl/parser/slice-query-parser.js +3 -3
- package/dataflow/environments/built-in-props.d.ts +8 -1
- package/dataflow/environments/built-in-props.js +9 -1
- package/dataflow/environments/built-in.d.ts +5 -3
- package/dataflow/environments/built-in.js +5 -4
- package/dataflow/environments/default-builtin-config.d.ts +21 -3
- package/dataflow/environments/default-builtin-config.js +49 -47
- package/dataflow/eval/resolve/resolve-argument.js +11 -6
- package/dataflow/eval/resolve/resolve-numbers.d.ts +1 -178
- package/dataflow/eval/resolve/resolve-numbers.js +2 -13
- package/dataflow/eval/resolve/resolve-strings.d.ts +1 -93
- package/dataflow/eval/resolve/resolve-strings.js +2 -17
- package/dataflow/eval/resolve/resolve-working-directory.js +3 -4
- package/dataflow/extractor.js +44 -26
- package/dataflow/graph/df-helper.d.ts +2 -1
- package/dataflow/graph/df-helper.js +2 -1
- package/dataflow/internal/linker.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +8 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +44 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +0 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +11 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +13 -3
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +15 -5
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +1 -24
- package/dataflow/internal/process/functions/call/known-call-handling.js +8 -34
- package/dataflow/internal/process/functions/call/nse-kind.d.ts +24 -0
- package/dataflow/internal/process/functions/call/nse-kind.js +30 -0
- package/documentation/wiki-query.js +3 -2
- package/linter/rules/absolute-path.js +5 -5
- package/linter/rules/cmd-check/dependency-declaration.js +2 -2
- package/linter/rules/cmd-check/package-runtime.js +2 -2
- package/linter/rules/deprecated-functions.js +2 -2
- package/linter/rules/file-path-validity.js +5 -5
- package/linter/rules/function-finder-util.js +2 -2
- package/linter/rules/overwritten-file.js +2 -4
- package/linter/rules/secret-exfiltration.d.ts +3 -2
- package/linter/rules/secret-exfiltration.js +8 -3
- package/linter/rules/unused-import.js +20 -6
- package/package.json +1 -1
- package/project/cache/flowr-analyzer-controlflow-cache.d.ts +0 -6
- package/project/cache/flowr-analyzer-controlflow-cache.js +7 -27
- package/project/context/flowr-analyzer-context.d.ts +2 -2
- package/project/context/flowr-analyzer-context.js +2 -2
- package/project/context/flowr-analyzer-files-context.d.ts +8 -0
- package/project/context/flowr-analyzer-files-context.js +51 -6
- package/project/flowr-analyzer.d.ts +0 -9
- package/project/flowr-analyzer.js +7 -28
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +0 -3
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +57 -163
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +2 -3
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +2 -3
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +3 -3
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +0 -1
- package/project/plugins/package-version-plugins/package.js +1 -1
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -3
- package/queries/catalog/absint-query/absint-query-format.d.ts +1 -1
- package/queries/catalog/config-query/config-query-format.d.ts +1 -1
- package/queries/catalog/config-query/config-query-format.js +4 -4
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +6 -5
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -4
- package/queries/catalog/dependencies-query/dependencies-query-format.js +11 -11
- package/queries/catalog/dependencies-query/dependency-values.d.ts +9 -0
- package/queries/catalog/dependencies-query/dependency-values.js +13 -0
- package/queries/catalog/dependencies-query/function-info/remote-functions.js +2 -2
- package/queries/catalog/dependencies-query/function-info/write-functions.js +8 -7
- package/queries/catalog/dependencies-query/implicit-echo.js +2 -1
- package/queries/catalog/dependencies-query/plot-description.d.ts +1 -1
- package/queries/catalog/dependencies-query/plot-description.js +2 -2
- package/queries/catalog/dice-query/dice-query-format.d.ts +1 -1
- package/queries/catalog/files-query/files-query-format.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-format.d.ts +2 -2
- package/queries/catalog/linter-query/linter-query-format.js +13 -9
- package/queries/catalog/signature-query/signature-query-executor.d.ts +1 -1
- package/queries/catalog/taint-query/taint-query-format.d.ts +1 -1
- package/queries/query-function-filter.d.ts +1 -1
- package/queries/query.d.ts +2 -2
- package/r-bridge/init.js +1 -1
- package/search/flowr-search-filters.js +2 -2
- package/search/search-executor/search-generators.d.ts +0 -1
- package/search/search-executor/search-generators.js +5 -6
- package/search/search-logger.d.ts +1 -0
- package/search/search-logger.js +6 -0
- package/util/flowr-version.d.ts +1 -1
- package/util/flowr-version.js +2 -2
|
@@ -198,182 +198,5 @@ export declare const NumericFns: {
|
|
|
198
198
|
* number, a logical (counting as its `0`/`1`), or a vector of numbers, which folds elementwise. Anything that
|
|
199
199
|
* does not resolve, a result that is not finite, and a vector length mismatch all stay `Top`.
|
|
200
200
|
*/
|
|
201
|
-
declare function resolveAsNumeric(this: void, args: BuiltInEvalHandlerArgs): Value;
|
|
202
|
-
/**
|
|
203
|
-
* Folding the numeric and bitwise built-ins, from an operator to `sqrt`.
|
|
204
|
-
*
|
|
205
|
-
* Wired into {@link BuiltInEvalHandlerMapper} and internal to evaluation: to ask what a node holds, use
|
|
206
|
-
* {@link NodeValue} or {@link Resolve}.
|
|
207
|
-
*/
|
|
208
|
-
export declare const NumericFold: {
|
|
209
|
-
/** every numeric built-in that is folded, see {@link NumericFns} */
|
|
210
|
-
readonly fns: {
|
|
211
|
-
readonly '+': {
|
|
212
|
-
readonly params: readonly ["e1", "e2"];
|
|
213
|
-
readonly fold: (a: number, b?: number) => number;
|
|
214
|
-
};
|
|
215
|
-
readonly '-': {
|
|
216
|
-
readonly params: readonly ["e1", "e2"];
|
|
217
|
-
readonly fold: (a: number, b?: number) => number;
|
|
218
|
-
};
|
|
219
|
-
readonly '*': {
|
|
220
|
-
readonly params: readonly ["e1", "e2"];
|
|
221
|
-
readonly fold: (a: number, b: number) => number;
|
|
222
|
-
};
|
|
223
|
-
readonly '/': {
|
|
224
|
-
readonly params: readonly ["e1", "e2"];
|
|
225
|
-
readonly fold: (a: number, b: number) => number;
|
|
226
|
-
};
|
|
227
|
-
readonly '^': {
|
|
228
|
-
readonly params: readonly ["e1", "e2"];
|
|
229
|
-
readonly fold: (a: number, b: number) => number;
|
|
230
|
-
};
|
|
231
|
-
readonly '**': {
|
|
232
|
-
readonly params: readonly ["e1", "e2"];
|
|
233
|
-
readonly fold: (a: number, b: number) => number;
|
|
234
|
-
};
|
|
235
|
-
readonly '%%': {
|
|
236
|
-
readonly params: readonly ["e1", "e2"];
|
|
237
|
-
readonly fold: typeof mod;
|
|
238
|
-
};
|
|
239
|
-
readonly '%/%': {
|
|
240
|
-
readonly params: readonly ["e1", "e2"];
|
|
241
|
-
readonly fold: (a: number, b: number) => number;
|
|
242
|
-
};
|
|
243
|
-
readonly abs: {
|
|
244
|
-
readonly params: readonly ["x"];
|
|
245
|
-
readonly fold: (x: number) => number;
|
|
246
|
-
};
|
|
247
|
-
readonly sqrt: {
|
|
248
|
-
readonly params: readonly ["x"];
|
|
249
|
-
readonly fold: (x: number) => number;
|
|
250
|
-
};
|
|
251
|
-
readonly floor: {
|
|
252
|
-
readonly params: readonly ["x"];
|
|
253
|
-
readonly fold: (x: number) => number;
|
|
254
|
-
};
|
|
255
|
-
readonly ceiling: {
|
|
256
|
-
readonly params: readonly ["x"];
|
|
257
|
-
readonly fold: (x: number) => number;
|
|
258
|
-
};
|
|
259
|
-
readonly trunc: {
|
|
260
|
-
readonly params: readonly ["x"];
|
|
261
|
-
readonly fold: (x: number) => number;
|
|
262
|
-
};
|
|
263
|
-
readonly sign: {
|
|
264
|
-
readonly params: readonly ["x"];
|
|
265
|
-
readonly fold: (x: number) => number;
|
|
266
|
-
};
|
|
267
|
-
readonly round: {
|
|
268
|
-
readonly params: readonly ["x", "digits"];
|
|
269
|
-
readonly fold: typeof roundHalfEven;
|
|
270
|
-
};
|
|
271
|
-
readonly signif: {
|
|
272
|
-
readonly params: readonly ["x", "digits"];
|
|
273
|
-
readonly fold: (x: number, digits?: number) => number | undefined;
|
|
274
|
-
};
|
|
275
|
-
readonly exp: {
|
|
276
|
-
readonly params: readonly ["x"];
|
|
277
|
-
readonly fold: (x: number) => number;
|
|
278
|
-
};
|
|
279
|
-
readonly expm1: {
|
|
280
|
-
readonly params: readonly ["x"];
|
|
281
|
-
readonly fold: (x: number) => number;
|
|
282
|
-
};
|
|
283
|
-
readonly log: {
|
|
284
|
-
readonly params: readonly ["x", "base"];
|
|
285
|
-
readonly fold: (x: number, base?: number) => number;
|
|
286
|
-
};
|
|
287
|
-
readonly log2: {
|
|
288
|
-
readonly params: readonly ["x"];
|
|
289
|
-
readonly fold: (x: number) => number;
|
|
290
|
-
};
|
|
291
|
-
readonly log10: {
|
|
292
|
-
readonly params: readonly ["x"];
|
|
293
|
-
readonly fold: (x: number) => number;
|
|
294
|
-
};
|
|
295
|
-
readonly log1p: {
|
|
296
|
-
readonly params: readonly ["x"];
|
|
297
|
-
readonly fold: (x: number) => number;
|
|
298
|
-
};
|
|
299
|
-
readonly sin: {
|
|
300
|
-
readonly params: readonly ["x"];
|
|
301
|
-
readonly fold: (x: number) => number;
|
|
302
|
-
};
|
|
303
|
-
readonly cos: {
|
|
304
|
-
readonly params: readonly ["x"];
|
|
305
|
-
readonly fold: (x: number) => number;
|
|
306
|
-
};
|
|
307
|
-
readonly tan: {
|
|
308
|
-
readonly params: readonly ["x"];
|
|
309
|
-
readonly fold: (x: number) => number;
|
|
310
|
-
};
|
|
311
|
-
readonly asin: {
|
|
312
|
-
readonly params: readonly ["x"];
|
|
313
|
-
readonly fold: (x: number) => number;
|
|
314
|
-
};
|
|
315
|
-
readonly acos: {
|
|
316
|
-
readonly params: readonly ["x"];
|
|
317
|
-
readonly fold: (x: number) => number;
|
|
318
|
-
};
|
|
319
|
-
readonly atan: {
|
|
320
|
-
readonly params: readonly ["x"];
|
|
321
|
-
readonly fold: (x: number) => number;
|
|
322
|
-
};
|
|
323
|
-
readonly atan2: {
|
|
324
|
-
readonly params: readonly ["y", "x"];
|
|
325
|
-
readonly fold: (y: number, x: number) => number;
|
|
326
|
-
};
|
|
327
|
-
readonly sinh: {
|
|
328
|
-
readonly params: readonly ["x"];
|
|
329
|
-
readonly fold: (x: number) => number;
|
|
330
|
-
};
|
|
331
|
-
readonly cosh: {
|
|
332
|
-
readonly params: readonly ["x"];
|
|
333
|
-
readonly fold: (x: number) => number;
|
|
334
|
-
};
|
|
335
|
-
readonly tanh: {
|
|
336
|
-
readonly params: readonly ["x"];
|
|
337
|
-
readonly fold: (x: number) => number;
|
|
338
|
-
};
|
|
339
|
-
readonly asinh: {
|
|
340
|
-
readonly params: readonly ["x"];
|
|
341
|
-
readonly fold: (x: number) => number;
|
|
342
|
-
};
|
|
343
|
-
readonly acosh: {
|
|
344
|
-
readonly params: readonly ["x"];
|
|
345
|
-
readonly fold: (x: number) => number;
|
|
346
|
-
};
|
|
347
|
-
readonly atanh: {
|
|
348
|
-
readonly params: readonly ["x"];
|
|
349
|
-
readonly fold: (x: number) => number;
|
|
350
|
-
};
|
|
351
|
-
readonly bitwAnd: {
|
|
352
|
-
readonly params: readonly ["a", "b"];
|
|
353
|
-
readonly fold: (...args: number[]) => number | undefined;
|
|
354
|
-
};
|
|
355
|
-
readonly bitwOr: {
|
|
356
|
-
readonly params: readonly ["a", "b"];
|
|
357
|
-
readonly fold: (...args: number[]) => number | undefined;
|
|
358
|
-
};
|
|
359
|
-
readonly bitwXor: {
|
|
360
|
-
readonly params: readonly ["a", "b"];
|
|
361
|
-
readonly fold: (...args: number[]) => number | undefined;
|
|
362
|
-
};
|
|
363
|
-
readonly bitwNot: {
|
|
364
|
-
readonly params: readonly ["a"];
|
|
365
|
-
readonly fold: (...args: number[]) => number | undefined;
|
|
366
|
-
};
|
|
367
|
-
readonly bitwShiftL: {
|
|
368
|
-
readonly params: readonly ["a", "n"];
|
|
369
|
-
readonly fold: (a: number, n: number) => number | undefined;
|
|
370
|
-
};
|
|
371
|
-
readonly bitwShiftR: {
|
|
372
|
-
readonly params: readonly ["a", "n"];
|
|
373
|
-
readonly fold: (a: number, n: number) => number | undefined;
|
|
374
|
-
};
|
|
375
|
-
};
|
|
376
|
-
/** What a numeric call amounts to; see {@link resolveAsNumeric}. */
|
|
377
|
-
readonly call: typeof resolveAsNumeric;
|
|
378
|
-
};
|
|
201
|
+
export declare function resolveAsNumeric(this: void, args: BuiltInEvalHandlerArgs): Value;
|
|
379
202
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.NumericFns = void 0;
|
|
4
|
+
exports.resolveAsNumeric = resolveAsNumeric;
|
|
4
5
|
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
5
6
|
const identifier_1 = require("../../environments/identifier");
|
|
6
7
|
const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
@@ -188,16 +189,4 @@ function resolveAsNumeric(args) {
|
|
|
188
189
|
/* a number is an exact interval everywhere else in the solver, so the elements are lifted the same way */
|
|
189
190
|
return folded === undefined ? r_value_2.Top : (0, vector_constants_1.vectorFrom)(folded.map(n => (0, interval_constants_1.intervalFrom)(n, n)));
|
|
190
191
|
}
|
|
191
|
-
/**
|
|
192
|
-
* Folding the numeric and bitwise built-ins, from an operator to `sqrt`.
|
|
193
|
-
*
|
|
194
|
-
* Wired into {@link BuiltInEvalHandlerMapper} and internal to evaluation: to ask what a node holds, use
|
|
195
|
-
* {@link NodeValue} or {@link Resolve}.
|
|
196
|
-
*/
|
|
197
|
-
exports.NumericFold = {
|
|
198
|
-
/** every numeric built-in that is folded, see {@link NumericFns} */
|
|
199
|
-
fns: exports.NumericFns,
|
|
200
|
-
/** What a numeric call amounts to; see {@link resolveAsNumeric}. */
|
|
201
|
-
call: resolveAsNumeric
|
|
202
|
-
};
|
|
203
192
|
//# sourceMappingURL=resolve-numbers.js.map
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { RNamedFunctionCall } from '../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
2
|
-
import type { RNode } from '../../../r-bridge/lang-4.x/ast/model/model';
|
|
3
1
|
import type { BuiltInEvalHandlerArgs } from '../../environments/built-in';
|
|
4
2
|
import { PkgName } from '../../environments/identifier';
|
|
5
3
|
import { type Value } from '../values/r-value';
|
|
@@ -105,101 +103,11 @@ export declare const StringFns: {
|
|
|
105
103
|
};
|
|
106
104
|
/** the entries that join what they are handed, the ones a name at construction time may be built from */
|
|
107
105
|
export declare const PasteLikeCalls: ReadonlySet<string>;
|
|
108
|
-
/**
|
|
109
|
-
* Folds a named {@link StringFns} call to its result, resolving each argument with `resolveArg`. `undefined`
|
|
110
|
-
* when the name is not one of them, an argument does not resolve, or the call does not match what the entry
|
|
111
|
-
* declares. Shared by the value solver ({@link resolveAsStringFn}) and construction-time name resolution.
|
|
112
|
-
*/
|
|
113
|
-
declare function foldStringCall<Info>(this: void, node: RNamedFunctionCall<Info>, resolveArg: (arg: RNode<Info>) => string | undefined): string | number | undefined;
|
|
114
106
|
/**
|
|
115
107
|
* Resolves any call of a {@link StringFns} entry to a {@link Value}, with its arguments in any order R accepts:
|
|
116
108
|
* a join like `paste0("cfg_", k)` when every part resolves to a single string constant (coercing a joined
|
|
117
109
|
* number or logical the way `as.character` would), and a transformation like `basename(p)` when its argument
|
|
118
110
|
* does. Anything that does not resolve stays `Top`.
|
|
119
111
|
*/
|
|
120
|
-
declare function resolveAsStringFn(this: void, args: BuiltInEvalHandlerArgs): Value;
|
|
121
|
-
/**
|
|
122
|
-
* Folding the string built-ins, from `paste` to `basename`.
|
|
123
|
-
*
|
|
124
|
-
* Wired into {@link BuiltInEvalHandlerMapper} and internal to evaluation: to ask what a node holds, use
|
|
125
|
-
* {@link NodeValue} or {@link Resolve}.
|
|
126
|
-
*/
|
|
127
|
-
export declare const StringFold: {
|
|
128
|
-
/** every string built-in that is folded, see {@link StringFns} */
|
|
129
|
-
readonly fns: {
|
|
130
|
-
readonly paste: {
|
|
131
|
-
readonly pkg: PkgName.Base;
|
|
132
|
-
readonly params: readonly ["...", "sep"];
|
|
133
|
-
readonly defaults: {
|
|
134
|
-
readonly sep: " ";
|
|
135
|
-
};
|
|
136
|
-
readonly ignored: readonly ["collapse"];
|
|
137
|
-
readonly fold: (parts: string[], sep: string) => string;
|
|
138
|
-
};
|
|
139
|
-
readonly paste0: {
|
|
140
|
-
readonly pkg: PkgName.Base;
|
|
141
|
-
readonly params: readonly ["...", "sep"];
|
|
142
|
-
readonly defaults: {
|
|
143
|
-
readonly sep: "";
|
|
144
|
-
};
|
|
145
|
-
readonly ignored: readonly ["collapse"];
|
|
146
|
-
readonly fold: (parts: string[], sep: string) => string;
|
|
147
|
-
};
|
|
148
|
-
readonly 'file.path': {
|
|
149
|
-
readonly pkg: PkgName.Base;
|
|
150
|
-
readonly params: readonly ["...", "fsep"];
|
|
151
|
-
readonly defaults: {
|
|
152
|
-
readonly fsep: "/";
|
|
153
|
-
};
|
|
154
|
-
readonly fold: (parts: string[], fsep: string) => string;
|
|
155
|
-
};
|
|
156
|
-
readonly sprintf: {
|
|
157
|
-
readonly pkg: PkgName.Base;
|
|
158
|
-
readonly params: readonly ["fmt", "..."];
|
|
159
|
-
readonly fold: (fmt: string, parts?: string[]) => string | undefined;
|
|
160
|
-
};
|
|
161
|
-
readonly here: {
|
|
162
|
-
readonly pkg: PkgName.Here;
|
|
163
|
-
readonly params: readonly ["..."];
|
|
164
|
-
readonly fold: (parts: string[]) => string;
|
|
165
|
-
};
|
|
166
|
-
readonly basename: {
|
|
167
|
-
readonly pkg: PkgName.Base;
|
|
168
|
-
readonly params: readonly ["path"];
|
|
169
|
-
readonly fold: typeof basename;
|
|
170
|
-
};
|
|
171
|
-
readonly dirname: {
|
|
172
|
-
readonly pkg: PkgName.Base;
|
|
173
|
-
readonly params: readonly ["path"];
|
|
174
|
-
readonly fold: typeof dirname;
|
|
175
|
-
};
|
|
176
|
-
readonly toupper: {
|
|
177
|
-
readonly pkg: PkgName.Base;
|
|
178
|
-
readonly params: readonly ["x"];
|
|
179
|
-
readonly fold: (s: string) => string;
|
|
180
|
-
};
|
|
181
|
-
readonly tolower: {
|
|
182
|
-
readonly pkg: PkgName.Base;
|
|
183
|
-
readonly params: readonly ["x"];
|
|
184
|
-
readonly fold: (s: string) => string;
|
|
185
|
-
};
|
|
186
|
-
readonly trimws: {
|
|
187
|
-
readonly pkg: PkgName.Base;
|
|
188
|
-
readonly params: readonly ["x"];
|
|
189
|
-
readonly fold: (s: string) => string;
|
|
190
|
-
};
|
|
191
|
-
/** R counts characters, so we count code points rather than UTF-16 units */
|
|
192
|
-
readonly nchar: {
|
|
193
|
-
readonly pkg: PkgName.Base;
|
|
194
|
-
readonly params: readonly ["x"];
|
|
195
|
-
readonly fold: (s: string) => number;
|
|
196
|
-
};
|
|
197
|
-
};
|
|
198
|
-
/** the calls pasting their arguments together, see {@link PasteLikeCalls} */
|
|
199
|
-
readonly pasteLike: ReadonlySet<string>;
|
|
200
|
-
/** What a string call amounts to; see {@link resolveAsStringFn}. */
|
|
201
|
-
readonly call: typeof resolveAsStringFn;
|
|
202
|
-
/** The string a call in the AST folds to; see {@link foldStringCall}. */
|
|
203
|
-
readonly fold: typeof foldStringCall;
|
|
204
|
-
};
|
|
112
|
+
export declare function resolveAsStringFn(this: void, args: BuiltInEvalHandlerArgs): Value;
|
|
205
113
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PasteLikeCalls = exports.StringFns = void 0;
|
|
4
|
+
exports.resolveAsStringFn = resolveAsStringFn;
|
|
4
5
|
const identifier_1 = require("../../environments/identifier");
|
|
5
6
|
const r_value_1 = require("../values/r-value");
|
|
6
7
|
const set_constants_1 = require("../values/sets/set-constants");
|
|
@@ -204,20 +205,4 @@ function resolveAsStringFn(args) {
|
|
|
204
205
|
const asValue = (f) => typeof f === 'number' ? (0, interval_constants_1.intervalFrom)(f, f) : (0, string_constants_1.stringFrom)(f);
|
|
205
206
|
return folded.length === 1 ? asValue(folded[0]) : (0, set_constants_1.setOf)(folded.map(asValue));
|
|
206
207
|
}
|
|
207
|
-
/**
|
|
208
|
-
* Folding the string built-ins, from `paste` to `basename`.
|
|
209
|
-
*
|
|
210
|
-
* Wired into {@link BuiltInEvalHandlerMapper} and internal to evaluation: to ask what a node holds, use
|
|
211
|
-
* {@link NodeValue} or {@link Resolve}.
|
|
212
|
-
*/
|
|
213
|
-
exports.StringFold = {
|
|
214
|
-
/** every string built-in that is folded, see {@link StringFns} */
|
|
215
|
-
fns: exports.StringFns,
|
|
216
|
-
/** the calls pasting their arguments together, see {@link PasteLikeCalls} */
|
|
217
|
-
pasteLike: exports.PasteLikeCalls,
|
|
218
|
-
/** What a string call amounts to; see {@link resolveAsStringFn}. */
|
|
219
|
-
call: resolveAsStringFn,
|
|
220
|
-
/** The string a call in the AST folds to; see {@link foldStringCall}. */
|
|
221
|
-
fold: foldStringCall
|
|
222
|
-
};
|
|
223
208
|
//# sourceMappingURL=resolve-strings.js.map
|
|
@@ -6,14 +6,13 @@ const happens_before_1 = require("../../../control-flow/happens-before");
|
|
|
6
6
|
const logic_1 = require("../../../util/logic");
|
|
7
7
|
const identifier_1 = require("../../environments/identifier");
|
|
8
8
|
const resolve_argument_1 = require("./resolve-argument");
|
|
9
|
-
const
|
|
9
|
+
const dependency_values_1 = require("../../../queries/catalog/dependencies-query/dependency-values");
|
|
10
10
|
const strings_1 = require("../../../util/text/strings");
|
|
11
11
|
const info_1 = require("../../info");
|
|
12
12
|
const edge_1 = require("../../graph/edge");
|
|
13
13
|
const model_1 = require("../../../r-bridge/lang-4.x/ast/model/model");
|
|
14
14
|
const defaultmap_1 = require("../../../util/collections/defaultmap");
|
|
15
15
|
const files_1 = require("../../../util/files");
|
|
16
|
-
const built_in_source_1 = require("../../internal/process/functions/call/built-in/built-in-source");
|
|
17
16
|
const arrays_1 = require("../../../util/collections/arrays");
|
|
18
17
|
const df_helper_1 = require("../../graph/df-helper");
|
|
19
18
|
/** functions recognized as changing the working directory; a registry so more (e.g. `withr::with_dir`) can be added */
|
|
@@ -115,7 +114,7 @@ function collect(graph, ctx) {
|
|
|
115
114
|
}
|
|
116
115
|
const resolved = (0, resolve_argument_1.getArgumentStringValue)(ctx.config.solver.variables, graph, vertex, spec.argIdx, spec.argName, true, ctx);
|
|
117
116
|
const values = resolved ? Array.from(resolved.values()).flatMap(s => Array.from(s)) : [];
|
|
118
|
-
const known = values.filter(v => v !== undefined && v !==
|
|
117
|
+
const known = values.filter(v => v !== undefined && v !== dependency_values_1.Unknown);
|
|
119
118
|
const dir = values.length > 0 && known.length === values.length && new Set(known).size === 1 ? known[0] : undefined;
|
|
120
119
|
const cds = vertex.cds ?? [];
|
|
121
120
|
const iterated = isIterated(cds, graph.idMap);
|
|
@@ -146,7 +145,7 @@ exports.WorkingDirectory = {
|
|
|
146
145
|
rootsResolver(graph, cfg, ctx) {
|
|
147
146
|
const changes = collect(graph, ctx);
|
|
148
147
|
return (id, file) => {
|
|
149
|
-
const base = file ?
|
|
148
|
+
const base = file ? files_1.RPath.dirname(file) : '.';
|
|
150
149
|
const roots = resolveAt(id, graph.getVertex(id)?.cds ?? [], base, changes, cfg).candidates;
|
|
151
150
|
return { roots, pinned: roots.length > 0 && (roots.length > 1 || roots[0] !== base) };
|
|
152
151
|
};
|
package/dataflow/extractor.js
CHANGED
|
@@ -98,23 +98,24 @@ function linkEnvironmentArgumentsWrittenByCallee(graph, environment) {
|
|
|
98
98
|
if (!tracksAnyEnvironment(environment)) {
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
+
const ownerOf = new Map();
|
|
101
102
|
for (const [, definition] of graph.verticesOfType(vertex_1.VertexType.FunctionDefinition)) {
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
continue;
|
|
103
|
+
for (const parameter of df_helper_1.Dataflow.parametersOf(definition)) {
|
|
104
|
+
ownerOf.set(parameter, definition);
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
106
|
+
}
|
|
107
|
+
if (ownerOf.size === 0) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
for (const [parameter, writes] of writesOfParameters(graph, ownerOf, environment).entries()) {
|
|
111
|
+
for (const argument of df_helper_1.Dataflow.argumentsBoundTo(graph, parameter)) {
|
|
112
|
+
if (!holdsEnvironment(graph, argument, environment)) {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
for (const call of df_helper_1.Dataflow.sourcesOf(graph, argument, edge_1.EdgeType.Argument).filter(c => vertex_1.DfgVertex.isFunctionCall(graph.getVertex(c)))) {
|
|
116
|
+
(0, unknown_side_effect_1.handleUnknownSideEffect)(graph, environment, call);
|
|
117
|
+
for (const write of writes) {
|
|
118
|
+
graph.addEdge(call, write, edge_1.EdgeType.Reads);
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
121
|
}
|
|
@@ -128,26 +129,43 @@ function tracksAnyEnvironment(environment) {
|
|
|
128
129
|
}
|
|
129
130
|
return false;
|
|
130
131
|
}
|
|
131
|
-
/**
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Collects, per parameter, the replacements (`x$f <- v`) and the side-effecting calls in the body of its function that write into it.
|
|
134
|
+
* Every vertex is visited once, as nested functions would otherwise revisit the body of each enclosing one.
|
|
135
|
+
*/
|
|
136
|
+
function writesOfParameters(graph, ownerOf, environment) {
|
|
137
|
+
const written = new defaultmap_1.DefaultMap(() => []);
|
|
138
|
+
const inBodyOf = (parameter, node) => ownerOf.get(parameter)?.subflow.graph.has(node) === true;
|
|
139
|
+
for (const [node, vertex] of graph.vertices(true)) {
|
|
135
140
|
if (vertex_1.DfgVertex.isVariableDefinition(vertex) && vertex.par) {
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
141
|
+
const parameters = df_helper_1.Dataflow.targetsOf(graph, node, edge_1.EdgeType.Reads).filter(t => inBodyOf(t, node));
|
|
142
|
+
if (parameters.length > 0) {
|
|
143
|
+
const replacements = df_helper_1.Dataflow.targetsOf(graph, node, edge_1.EdgeType.DefinedBy).filter(t => vertex_1.DfgVertex.hasOrigin(graph.getVertex(t), built_in_proc_name_1.BuiltInProcName.Replacement));
|
|
144
|
+
for (const parameter of parameters) {
|
|
145
|
+
written.get(parameter).push(...replacements);
|
|
146
|
+
}
|
|
139
147
|
}
|
|
140
148
|
}
|
|
141
149
|
else if (vertex_1.DfgVertex.isFunctionCall(vertex) && graph.unknownSideEffects.has(node_id_1.NodeId.normalize(node))) {
|
|
150
|
+
/* which arguments the callee writes is costly to ask, so only ask if an argument holds a parameter at all */
|
|
151
|
+
const parameters = new Map();
|
|
152
|
+
for (const target of vertex.args.map(graph_1.FunctionArgument.getReference)) {
|
|
153
|
+
const reached = target === undefined ? [] : [...definitionsReachedBy(target, graph)].filter(r => inBodyOf(r, node));
|
|
154
|
+
if (target !== undefined && reached.length > 0) {
|
|
155
|
+
parameters.set(target, reached);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (parameters.size === 0) {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
142
161
|
for (const target of argsWithProp(vertex, (0, query_fn_props_1.callFnProps)(node, { graph, environment }), built_in_props_1.ArgProp.Written)) {
|
|
143
|
-
for (const reached of
|
|
144
|
-
|
|
145
|
-
written.get(reached).push(node);
|
|
146
|
-
}
|
|
162
|
+
for (const reached of parameters.get(target) ?? []) {
|
|
163
|
+
written.get(reached).push(node);
|
|
147
164
|
}
|
|
148
165
|
}
|
|
149
166
|
}
|
|
150
167
|
}
|
|
168
|
+
return written;
|
|
151
169
|
}
|
|
152
170
|
function holdsEnvironment(graph, argument, environment) {
|
|
153
171
|
const node = graph.idMap?.get(argument);
|
|
@@ -159,7 +159,8 @@ export declare const Dataflow: {
|
|
|
159
159
|
readonly callGraphSummaries: typeof computeCallGraphSummaries;
|
|
160
160
|
/**
|
|
161
161
|
* The global state each function may leave changed when called, as pseudo variable names ({@link AmbientStateName}),
|
|
162
|
-
* including what the functions it calls change
|
|
162
|
+
* including what the functions it calls change, with what is only assumed of a body flowR cannot see (`f()` for a parameter `f`)
|
|
163
|
+
* and the global variables it binds apart. Writes only to the function's own frame are left out.
|
|
163
164
|
*/
|
|
164
165
|
readonly ambientWrites: typeof ambientWritesOfFunctions;
|
|
165
166
|
};
|
|
@@ -270,7 +270,8 @@ exports.Dataflow = {
|
|
|
270
270
|
callGraphSummaries: transitive_side_effects_1.computeCallGraphSummaries,
|
|
271
271
|
/**
|
|
272
272
|
* The global state each function may leave changed when called, as pseudo variable names ({@link AmbientStateName}),
|
|
273
|
-
* including what the functions it calls change
|
|
273
|
+
* including what the functions it calls change, with what is only assumed of a body flowR cannot see (`f()` for a parameter `f`)
|
|
274
|
+
* and the global variables it binds apart. Writes only to the function's own frame are left out.
|
|
274
275
|
*/
|
|
275
276
|
ambientWrites: transitive_side_effects_1.ambientWritesOfFunctions,
|
|
276
277
|
},
|
|
@@ -314,7 +314,8 @@ function getAllLinkedFunctionDefinitions(functionDefinitionReadIds, dataflowGrap
|
|
|
314
314
|
while (potential.length !== 0) {
|
|
315
315
|
const [cid, viaAccess, call] = potential.pop();
|
|
316
316
|
const done = viaAccess ? expandedViaAccess : expanded;
|
|
317
|
-
|
|
317
|
+
/* without a call nothing restricts the walk, so that visit covers those under any call */
|
|
318
|
+
if (done.has(at(cid, call)) || done.has(at(cid, undefined))) {
|
|
318
319
|
continue;
|
|
319
320
|
}
|
|
320
321
|
done.add(at(cid, call));
|
|
@@ -2,6 +2,7 @@ import type { DataflowProcessorInformation } from '../../../../../processor';
|
|
|
2
2
|
import { type ControlDependency, DataflowInformation, type ExitPoint } from '../../../../../info';
|
|
3
3
|
import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
4
|
import { type PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
5
|
+
import { type DataflowGraphVertexFunctionCall } from '../../../../../graph/vertex';
|
|
5
6
|
import { type FnSig } from '../../../../../environments/built-in-props';
|
|
6
7
|
import { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
7
8
|
import { Identifier, type IdentifierDefinition, type IdentifierReference, type InGraphIdentifierDefinition } from '../../../../../environments/identifier';
|
|
@@ -12,8 +13,15 @@ import type { DataflowGraph } from '../../../../../graph/graph';
|
|
|
12
13
|
import { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
13
14
|
import { KeyedState } from '../../../../../environments/ambient-state-name';
|
|
14
15
|
import { type AmbientKeys } from './built-in-ambient-keys';
|
|
16
|
+
/** Whether `definition` is a write only assumed of a body flowR cannot see, like `#rng` for `function(f) f()`, other than the one of `set.seed(1)`. */
|
|
17
|
+
export declare function isAssumedWrite(definition: IdentifierDefinition): boolean;
|
|
15
18
|
/** Whether calling `definition` runs a body flowR cannot see: a library function's, or whatever a parameter is bound to. */
|
|
16
19
|
export declare function hidesBody(definition: IdentifierDefinition): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the call `call` of a function body reaches a built-in only once linked where the function is called, through a parameter
|
|
22
|
+
* or a name the body cannot resolve. Through a variable (`p <- par; p(...)`) the body applied the built-in already, see {@link applyAmbientStateOfCalledBuiltIns}.
|
|
23
|
+
*/
|
|
24
|
+
export declare function reachesBuiltInLate(call: DataflowGraphVertexFunctionCall): boolean;
|
|
17
25
|
/** A call into code flowR cannot see may read any option, draw random numbers (with `draws` advancing the generator), and with `graphics` draw on the device. */
|
|
18
26
|
export declare function readsAllAmbientState<OtherInfo>(res: DataflowInformation, rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, graphics: boolean, draws?: boolean): DataflowInformation;
|
|
19
27
|
/** What an assignment writes beyond its target: only a global `.Random.seed` sets {@link AmbientStateName.rng}. */
|