@eagleoutice/flowr 2.17.1 → 2.17.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 +9 -9
- package/control-flow/semantic-cfg-guided-visitor.js +2 -0
- package/data/r-reexports.generated.d.ts +4 -0
- package/data/r-reexports.generated.js +43 -0
- package/dataflow/environments/ambient-state-name.d.ts +4 -0
- package/dataflow/environments/ambient-state-name.js +4 -0
- package/dataflow/environments/built-in-proc-name.d.ts +4 -0
- package/dataflow/environments/built-in-proc-name.js +4 -0
- package/dataflow/environments/built-in-props.d.ts +2 -0
- package/dataflow/environments/built-in-props.js +3 -1
- package/dataflow/environments/built-in.d.ts +16 -6
- package/dataflow/environments/built-in.js +45 -4
- package/dataflow/environments/default-builtin-config.d.ts +846 -21
- package/dataflow/environments/default-builtin-config.js +120 -26
- package/dataflow/environments/environment.d.ts +19 -2
- package/dataflow/environments/environment.js +90 -19
- package/dataflow/environments/identifier.d.ts +18 -0
- package/dataflow/environments/query-fn-props.js +4 -3
- package/dataflow/environments/resolve-by-name.js +5 -3
- package/dataflow/eval/resolve/node-value.d.ts +1 -1
- package/dataflow/eval/resolve/node-value.js +2 -2
- package/dataflow/eval/resolve/resolve-argument.js +1 -1
- package/dataflow/extractor.js +20 -4
- package/dataflow/graph/df-helper.d.ts +42 -1
- package/dataflow/graph/df-helper.js +83 -0
- package/dataflow/info.d.ts +2 -0
- package/dataflow/info.js +4 -0
- package/dataflow/internal/linker.js +21 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +3 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +18 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +144 -30
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +10 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +8 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +43 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +67 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +4 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +27 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +2 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +1 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +28 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +138 -89
- package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +87 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +8 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +23 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +7 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +28 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +7 -5
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +18 -15
- package/dataflow/internal/process/functions/call/named-call-handling.js +8 -4
- package/dataflow/internal/process/functions/call/quoted.d.ts +2 -0
- package/dataflow/internal/process/functions/call/quoted.js +8 -7
- package/documentation/wiki-dataflow-graph.js +25 -1
- package/linter/rules/undefined-symbol.js +2 -2
- package/package.json +1 -1
- package/project/attached-packages.d.ts +11 -6
- package/project/attached-packages.js +37 -9
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +5 -0
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +13 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +25 -2
- package/project/sigdb/build.js +7 -6
- package/project/sigdb/decode.d.ts +2 -0
- package/project/sigdb/decode.js +9 -3
- package/project/sigdb/schema.d.ts +8 -3
- package/queries/catalog/signature-query/signature-query-executor.js +15 -1
- package/queries/catalog/signature-query/signature-query-format.d.ts +3 -2
- 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/model.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/model.js +6 -1
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +6 -1
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +12 -1
- package/reconstruct/reconstruct.js +2 -5
- package/search/search-executor/search-enrichers.js +17 -2
- package/search/search-executor/search-generators.js +6 -2
- package/slicing/static/slice-call.d.ts +16 -0
- package/slicing/static/slice-call.js +42 -0
- package/slicing/static/static-slicer.js +6 -0
- package/util/flowr-version.d.ts +1 -1
- package/util/flowr-version.js +2 -2
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ It offers a wide variety of features, for example:
|
|
|
38
38
|
|
|
39
39
|
```shell
|
|
40
40
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
41
|
-
flowR repl v2.17.
|
|
41
|
+
flowR repl v2.17.2, R grammar v14 (tree-sitter engine)
|
|
42
42
|
R> :query @linter "read.csv(\"/root/x.txt\")"
|
|
43
43
|
```
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ It offers a wide variety of features, for example:
|
|
|
46
46
|
<summary style='color:gray'>Output</summary>
|
|
47
47
|
|
|
48
48
|
```text
|
|
49
|
-
Query: linter (
|
|
49
|
+
Query: linter (47 ms)
|
|
50
50
|
╰ Deprecated Functions (deprecated-functions): no findings
|
|
51
51
|
╰ File Path Validity (file-path-validity):
|
|
52
52
|
╰ certain:
|
|
@@ -72,7 +72,7 @@ It offers a wide variety of features, for example:
|
|
|
72
72
|
╰ Namespace Access Validity (namespace-access): no findings
|
|
73
73
|
╰ Secret Exfiltration (secret-exfiltration): no findings
|
|
74
74
|
╰ Process State in Session (process-state-in-session): no findings
|
|
75
|
-
All queries together required ≈
|
|
75
|
+
All queries together required ≈47 ms (1ms accuracy, total 48 ms)
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
The linter will analyze the code and return any issues found.
|
|
@@ -86,7 +86,7 @@ It offers a wide variety of features, for example:
|
|
|
86
86
|
|
|
87
87
|
_Results (prettified and summarized):_
|
|
88
88
|
|
|
89
|
-
Query: **linter** (
|
|
89
|
+
Query: **linter** (39 ms)\
|
|
90
90
|
╰ **Deprecated Functions** (deprecated-functions): _no findings_\
|
|
91
91
|
╰ **File Path Validity** (file-path-validity):\
|
|
92
92
|
╰ certain:\
|
|
@@ -112,7 +112,7 @@ It offers a wide variety of features, for example:
|
|
|
112
112
|
╰ **Namespace Access Validity** (namespace-access): _no findings_\
|
|
113
113
|
╰ **Secret Exfiltration** (secret-exfiltration): _no findings_\
|
|
114
114
|
╰ **Process State in Session** (process-state-in-session): _no findings_\
|
|
115
|
-
_All queries together required ≈
|
|
115
|
+
_All queries together required ≈40 ms (1ms accuracy, total 40 ms)_
|
|
116
116
|
|
|
117
117
|
<details> <summary style="color:gray">Show Detailed Results as Json</summary>
|
|
118
118
|
|
|
@@ -205,7 +205,7 @@ It offers a wide variety of features, for example:
|
|
|
205
205
|
|
|
206
206
|
```shell
|
|
207
207
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
208
|
-
flowR repl v2.17.
|
|
208
|
+
flowR repl v2.17.2, R grammar v14 (tree-sitter engine)
|
|
209
209
|
R> :query @static-slice (11@sum) file://test/testfiles/example.R
|
|
210
210
|
```
|
|
211
211
|
|
|
@@ -218,7 +218,7 @@ It offers a wide variety of features, for example:
|
|
|
218
218
|
N <- 10
|
|
219
219
|
for(i in 1:(N-1)) sum <- sum + i + w
|
|
220
220
|
sum
|
|
221
|
-
All queries together required ≈
|
|
221
|
+
All queries together required ≈7 ms (1ms accuracy, total 8 ms)
|
|
222
222
|
```
|
|
223
223
|
|
|
224
224
|
</details>
|
|
@@ -226,7 +226,7 @@ It offers a wide variety of features, for example:
|
|
|
226
226
|
</details>
|
|
227
227
|
|
|
228
228
|
* 🚀 **fast call-graph, data-, and control-flow graphs**\
|
|
229
|
-
Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">
|
|
229
|
+
Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">123.9 ms</span></i> (as of Nov 5, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
|
|
230
230
|
_flowR_ can analyze the data- and control-flow of the average real-world R script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
|
|
231
231
|
and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) for more details on the [dataflow graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) as well as [call graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph#perspectives-cg).
|
|
232
232
|
( [▶ Explore in Browser](https://flowr-analysis.github.io/flowr/wiki/playground/#c=zDYSwRgTghhCeAUATADsWECUAoLBnAxlMAKYD6ALgPakC2UAHgAQA8AtIwGYCuAdvuSEo949DIyYB6RnXojsWaAHdGKlW0aIo5KADoO0GsXghEjALyMAjAC4AbABpGANyJdi5xvngBmRwA5HAHZHACZHAE5HABYMbHwSKB5VdQ4QYHJiCHglRxdgN0YAPkYQuISeABICImJTdWqSCmoZeHjiRIq8t3lcLho6OFJcbXJcFnZe-pgQXCM2xMdDRI8l4Qba2KxeLlnEJu1gNQm%2B7KhFTtdieUUIEAydfFwneEmB2CGR3EcAIleYWAeT2%2B2FQlHIrXKVUIJEQIMoIB4owh7UqJgwQA&p=13:1 "run this script in flowR's playground, no setup") )
|
|
@@ -257,7 +257,7 @@ It offers a wide variety of features, for example:
|
|
|
257
257
|
|
|
258
258
|
```shell
|
|
259
259
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
260
|
-
flowR repl v2.17.
|
|
260
|
+
flowR repl v2.17.2, R grammar v14 (tree-sitter engine)
|
|
261
261
|
R> :dataflow* test/testfiles/example.R
|
|
262
262
|
```
|
|
263
263
|
|
|
@@ -249,6 +249,8 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
|
|
|
249
249
|
case built_in_proc_name_1.BuiltInProcName.StackEnv:
|
|
250
250
|
case built_in_proc_name_1.BuiltInProcName.With:
|
|
251
251
|
case built_in_proc_name_1.BuiltInProcName.Attach:
|
|
252
|
+
case built_in_proc_name_1.BuiltInProcName.Detach:
|
|
253
|
+
case built_in_proc_name_1.BuiltInProcName.Prefer:
|
|
252
254
|
case built_in_proc_name_1.BuiltInProcName.EnvContents:
|
|
253
255
|
case built_in_proc_name_1.BuiltInProcName.ListToEnv:
|
|
254
256
|
case built_in_proc_name_1.BuiltInProcName.Default:
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RReexports = void 0;
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
/*
|
|
6
|
+
* GENERATED by scripts/gen-r-reexports.R with R version 4.6.1 (2026-06-24) -- do not edit.
|
|
7
|
+
* Per package, at the version installed then, the exported functions it re-exports, each with the package defining it.
|
|
8
|
+
*/
|
|
9
|
+
exports.RReexports = {
|
|
10
|
+
"broom": { version: "1.0.13", reexports: { "augment": "generics", "glance": "generics", "tidy": "generics" } },
|
|
11
|
+
"bslib": { version: "0.11.0", reexports: { "css": "htmltools", "font_collection": "sass", "font_face": "sass", "font_google": "sass", "font_link": "sass" } },
|
|
12
|
+
"cachem": { version: "1.1.0", reexports: { "is.key_missing": "fastmap", "key_missing": "fastmap" } },
|
|
13
|
+
"callr": { version: "3.8.0", reexports: { "poll": "processx", "run": "processx" } },
|
|
14
|
+
"dplyr": { version: "1.2.1", reexports: { "%>%": "magrittr", "add_row": "tibble", "all_of": "tidyselect", "any_of": "tidyselect", "as_data_frame": "tibble", "as_label": "rlang", "as_tibble": "tibble", "contains": "tidyselect", "data_frame": "tibble", "ends_with": "tidyselect", "enexpr": "rlang", "enexprs": "rlang", "enquo": "rlang", "enquos": "rlang", "ensym": "rlang", "ensyms": "rlang", "everything": "tidyselect", "expr": "rlang", "glimpse": "pillar", "intersect": "generics", "last_col": "tidyselect", "lst": "tibble", "matches": "tidyselect", "num_range": "tidyselect", "one_of": "tidyselect", "quo": "rlang", "quo_name": "rlang", "quos": "rlang", "setdiff": "generics", "setequal": "generics", "starts_with": "tidyselect", "sym": "rlang", "syms": "rlang", "tibble": "tibble", "tribble": "tibble", "type_sum": "pillar", "union": "generics", "where": "tidyselect" } },
|
|
15
|
+
"forcats": { version: "1.0.1", reexports: { "%>%": "magrittr" } },
|
|
16
|
+
"ggfun": { version: "0.2.1", reexports: { "gpar": "grid", "identify": "graphics" } },
|
|
17
|
+
"ggimage": { version: "0.3.5", reexports: { "as.ggplot": "ggplotify", "as.grob": "ggplotify" } },
|
|
18
|
+
"ggplot2": { version: "4.0.3", reexports: { "alpha": "scales", "arrow": "grid", "as_label": "rlang", "enexpr": "rlang", "enexprs": "rlang", "enquo": "rlang", "enquos": "rlang", "ensym": "rlang", "ensyms": "rlang", "expr": "rlang", "quo": "rlang", "quo_name": "rlang", "quos": "rlang", "sym": "rlang", "syms": "rlang", "unit": "grid", "vars": "dplyr" } },
|
|
19
|
+
"googledrive": { version: "2.2.0", reexports: { "%>%": "magrittr" } },
|
|
20
|
+
"googlesheets4": { version: "1.1.3", reexports: { "%>%": "magrittr", "anchored": "cellranger", "cell_cols": "cellranger", "cell_limits": "cellranger", "cell_rows": "cellranger" } },
|
|
21
|
+
"haven": { version: "2.5.5", reexports: { "as_factor": "forcats" } },
|
|
22
|
+
"hexSticker": { version: "0.5.1", reexports: { "geom_subview": "ggimage", "ggplot": "ggplot2", "theme_transparent": "ggimage" } },
|
|
23
|
+
"igraph": { version: "2.3.3", reexports: { "%>%": "magrittr" } },
|
|
24
|
+
"lubridate": { version: "1.9.5", reexports: { "intersect": "generics", "setdiff": "generics", "union": "generics" } },
|
|
25
|
+
"magick": { version: "2.9.1", reexports: { "%>%": "magrittr" } },
|
|
26
|
+
"modelr": { version: "0.1.11", reexports: { "%>%": "magrittr" } },
|
|
27
|
+
"openssl": { version: "2.4.2", reexports: { "askpass": "askpass" } },
|
|
28
|
+
"promises": { version: "1.5.0", reexports: { "%>%": "magrittr", "%T>%": "magrittr" } },
|
|
29
|
+
"purrr": { version: "1.2.2", reexports: { "%>%": "magrittr", "done": "rlang", "exec": "rlang", "is_atomic": "rlang", "is_bare_atomic": "rlang", "is_bare_character": "rlang", "is_bare_double": "rlang", "is_bare_integer": "rlang", "is_bare_list": "rlang", "is_bare_logical": "rlang", "is_bare_numeric": "rlang", "is_bare_vector": "rlang", "is_character": "rlang", "is_double": "rlang", "is_empty": "rlang", "is_formula": "rlang", "is_function": "rlang", "is_integer": "rlang", "is_list": "rlang", "is_logical": "rlang", "is_scalar_atomic": "rlang", "is_scalar_character": "rlang", "is_scalar_double": "rlang", "is_scalar_integer": "rlang", "is_scalar_list": "rlang", "is_scalar_logical": "rlang", "is_scalar_vector": "rlang", "is_vector": "rlang", "rep_along": "rlang", "set_names": "rlang", "zap": "rlang" } },
|
|
30
|
+
"ragg": { version: "1.5.2", reexports: { "font_feature": "systemfonts", "get_font_features": "textshaping", "register_font": "systemfonts", "register_variant": "systemfonts" } },
|
|
31
|
+
"readxl": { version: "1.6.0", reexports: { "anchored": "cellranger", "cell_cols": "cellranger", "cell_limits": "cellranger", "cell_rows": "cellranger" } },
|
|
32
|
+
"RSQLite": { version: "3.53.3", reexports: { "Id": "DBI" } },
|
|
33
|
+
"rvest": { version: "1.0.5", reexports: { "%>%": "magrittr", "read_html": "xml2", "url_absolute": "xml2" } },
|
|
34
|
+
"shiny": { version: "1.14.0", reexports: { "a": "htmltools", "br": "htmltools", "code": "htmltools", "div": "htmltools", "em": "htmltools", "h1": "htmltools", "h2": "htmltools", "h3": "htmltools", "h4": "htmltools", "h5": "htmltools", "h6": "htmltools", "hr": "htmltools", "HTML": "htmltools", "htmlTemplate": "htmltools", "img": "htmltools", "includeCSS": "htmltools", "includeHTML": "htmltools", "includeMarkdown": "htmltools", "includeScript": "htmltools", "includeText": "htmltools", "is.key_missing": "fastmap", "is.singleton": "htmltools", "key_missing": "fastmap", "p": "htmltools", "pre": "htmltools", "singleton": "htmltools", "span": "htmltools", "strong": "htmltools", "suppressDependencies": "htmltools", "tag": "htmltools", "tagAppendAttributes": "htmltools", "tagAppendChild": "htmltools", "tagAppendChildren": "htmltools", "tagGetAttribute": "htmltools", "tagHasAttribute": "htmltools", "tagList": "htmltools", "tagSetChildren": "htmltools", "validateCssUnit": "htmltools", "withTags": "htmltools" } },
|
|
35
|
+
"stringr": { version: "1.6.0", reexports: { "%>%": "magrittr" } },
|
|
36
|
+
"targets": { version: "1.12.0", reexports: { "all_of": "tidyselect", "any_of": "tidyselect", "contains": "tidyselect", "ends_with": "tidyselect", "everything": "tidyselect", "last_col": "tidyselect", "matches": "tidyselect", "num_range": "tidyselect", "one_of": "tidyselect", "starts_with": "tidyselect" } },
|
|
37
|
+
"testthat": { version: "3.3.2", reexports: { "%>%": "magrittr" } },
|
|
38
|
+
"tibble": { version: "3.3.1", reexports: { "%>%": "magrittr", "char": "pillar", "glimpse": "pillar", "has_name": "rlang", "num": "pillar", "obj_sum": "pillar", "set_char_opts": "pillar", "set_num_opts": "pillar", "size_sum": "pillar", "tbl_sum": "pillar", "type_sum": "pillar" } },
|
|
39
|
+
"tidyr": { version: "1.3.2", reexports: { "%>%": "magrittr", "all_of": "tidyselect", "any_of": "tidyselect", "as_tibble": "tibble", "contains": "tidyselect", "ends_with": "tidyselect", "everything": "tidyselect", "last_col": "tidyselect", "matches": "tidyselect", "num_range": "tidyselect", "one_of": "tidyselect", "starts_with": "tidyselect", "tibble": "tibble", "tribble": "tibble" } },
|
|
40
|
+
"tidyselect": { version: "1.2.1", reexports: { "enquo": "rlang", "quo": "rlang", "quo_name": "rlang", "quos": "rlang" } },
|
|
41
|
+
"vroom": { version: "1.7.1", reexports: { "contains": "tidyselect", "ends_with": "tidyselect", "everything": "tidyselect", "last_col": "tidyselect", "matches": "tidyselect", "num_range": "tidyselect", "one_of": "tidyselect", "starts_with": "tidyselect" } }
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=r-reexports.generated.js.map
|
|
@@ -42,6 +42,10 @@ export declare const AmbientStateName: {
|
|
|
42
42
|
readonly workingDirectory: "#wd";
|
|
43
43
|
/** whether console output is diverted into a file or connection, as `sink(file)` does and `sink()` undoes */
|
|
44
44
|
readonly sink: "#sink";
|
|
45
|
+
/** the project root `here::here()` builds its paths from, found from the working directory unless `here::i_am` names it */
|
|
46
|
+
readonly projectRoot: "#project-root";
|
|
47
|
+
/** where packages are installed and loaded from, which `.libPaths(new)` changes and every package load reads */
|
|
48
|
+
readonly libPaths: "#lib-paths";
|
|
45
49
|
/** the file creation mask `Sys.umask` sets */
|
|
46
50
|
readonly umask: "#umask";
|
|
47
51
|
/** the state of the random number generator, which `set.seed` sets and every draw advances */
|
|
@@ -57,6 +57,10 @@ exports.AmbientStateName = {
|
|
|
57
57
|
workingDirectory: '#wd',
|
|
58
58
|
/** whether console output is diverted into a file or connection, as `sink(file)` does and `sink()` undoes */
|
|
59
59
|
sink: '#sink',
|
|
60
|
+
/** the project root `here::here()` builds its paths from, found from the working directory unless `here::i_am` names it */
|
|
61
|
+
projectRoot: '#project-root',
|
|
62
|
+
/** where packages are installed and loaded from, which `.libPaths(new)` changes and every package load reads */
|
|
63
|
+
libPaths: '#lib-paths',
|
|
60
64
|
/** the file creation mask `Sys.umask` sets */
|
|
61
65
|
umask: '#umask',
|
|
62
66
|
/** the state of the random number generator, which `set.seed` sets and every draw advances */
|
|
@@ -98,6 +98,10 @@ export declare enum BuiltInProcName {
|
|
|
98
98
|
Try = "builtin:try",
|
|
99
99
|
/** for `attach` calls that inject environment contents into the search path, see {@link processAttach} */
|
|
100
100
|
Attach = "builtin:attach",
|
|
101
|
+
/** for `detach` and `unloadNamespace`, see {@link processDetach} */
|
|
102
|
+
Detach = "builtin:detach",
|
|
103
|
+
/** for `conflicted::conflict_prefer` and `conflicts_prefer`, see {@link processPrefer} */
|
|
104
|
+
Prefer = "builtin:prefer",
|
|
101
105
|
EnvContents = "builtin:env-contents",
|
|
102
106
|
ListToEnv = "builtin:list2env",
|
|
103
107
|
/** for `new.env` and related environment-creation calls, see {@link processNewEnv} */
|
|
@@ -102,6 +102,10 @@ var BuiltInProcName;
|
|
|
102
102
|
BuiltInProcName["Try"] = "builtin:try";
|
|
103
103
|
/** for `attach` calls that inject environment contents into the search path, see {@link processAttach} */
|
|
104
104
|
BuiltInProcName["Attach"] = "builtin:attach";
|
|
105
|
+
/** for `detach` and `unloadNamespace`, see {@link processDetach} */
|
|
106
|
+
BuiltInProcName["Detach"] = "builtin:detach";
|
|
107
|
+
/** for `conflicted::conflict_prefer` and `conflicts_prefer`, see {@link processPrefer} */
|
|
108
|
+
BuiltInProcName["Prefer"] = "builtin:prefer";
|
|
105
109
|
BuiltInProcName["EnvContents"] = "builtin:env-contents";
|
|
106
110
|
BuiltInProcName["ListToEnv"] = "builtin:list2env";
|
|
107
111
|
/** for `new.env` and related environment-creation calls, see {@link processNewEnv} */
|
|
@@ -176,6 +176,8 @@ export declare enum SemanticCallTag {
|
|
|
176
176
|
AttachesPackage = "attaches-package",
|
|
177
177
|
/** answers whether a package is available, like `require`, `requireNamespace`, or `find.package` */
|
|
178
178
|
ChecksPackage = "checks-package",
|
|
179
|
+
/** takes a package off the search path, like `detach` or `unloadNamespace` */
|
|
180
|
+
DetachesPackage = "detaches-package",
|
|
179
181
|
/** registers a class, generic, method, or global name without computing anything else, like `setClass` or `utils::globalVariables` */
|
|
180
182
|
Declares = "declares",
|
|
181
183
|
/** reads which environment it runs in, like `environment()` or `parent.frame()`, so moving the call into another frame changes its result */
|
|
@@ -184,6 +184,8 @@ var SemanticCallTag;
|
|
|
184
184
|
SemanticCallTag["AttachesPackage"] = "attaches-package";
|
|
185
185
|
/** answers whether a package is available, like `require`, `requireNamespace`, or `find.package` */
|
|
186
186
|
SemanticCallTag["ChecksPackage"] = "checks-package";
|
|
187
|
+
/** takes a package off the search path, like `detach` or `unloadNamespace` */
|
|
188
|
+
SemanticCallTag["DetachesPackage"] = "detaches-package";
|
|
187
189
|
/** registers a class, generic, method, or global name without computing anything else, like `setClass` or `utils::globalVariables` */
|
|
188
190
|
SemanticCallTag["Declares"] = "declares";
|
|
189
191
|
/** reads which environment it runs in, like `environment()` or `parent.frame()`, so moving the call into another frame changes its result */
|
|
@@ -243,7 +245,7 @@ exports.PropagatedProps = getPropMask([
|
|
|
243
245
|
SemanticCallTag.Process, SemanticCallTag.User, SemanticCallTag.CommandLine, SemanticCallTag.Graphics,
|
|
244
246
|
SemanticCallTag.Database, SemanticCallTag.Reads, SemanticCallTag.Writes, SemanticCallTag.Prints,
|
|
245
247
|
SemanticCallTag.Eval, SemanticCallTag.Html, SemanticCallTag.JavaScript, SemanticCallTag.LoadsPackage, SemanticCallTag.AttachesPackage,
|
|
246
|
-
SemanticCallTag.ChecksPackage
|
|
248
|
+
SemanticCallTag.ChecksPackage, SemanticCallTag.DetachesPackage
|
|
247
249
|
]);
|
|
248
250
|
/** Checks whether a {@link PropSelector} is a bitfield of {@link CallProp}s */
|
|
249
251
|
function isCallProp(selector) {
|
|
@@ -20,7 +20,7 @@ import type { ParentInformation, RNodeWithParent } from '../../r-bridge/lang-4.x
|
|
|
20
20
|
import type { PotentiallyEmptyRArgument } from '../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
|
|
21
21
|
import { RSymbol } from '../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
|
|
22
22
|
import { type BuiltIn, NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
23
|
-
import { processLibrary } from '../internal/process/functions/call/built-in/built-in-library';
|
|
23
|
+
import { processLibrary, processPrefer } from '../internal/process/functions/call/built-in/built-in-library';
|
|
24
24
|
import { processSourceCall } from '../internal/process/functions/call/built-in/built-in-source';
|
|
25
25
|
import { processApply } from '../internal/process/functions/call/built-in/built-in-apply';
|
|
26
26
|
import type { LinkTo } from '../../queries/catalog/call-context-query/call-context-query-format';
|
|
@@ -52,7 +52,7 @@ import { processClassRelation } from '../internal/process/functions/call/built-i
|
|
|
52
52
|
import { processS4Use } from '../internal/process/functions/call/built-in/built-in-s-four';
|
|
53
53
|
import { processStackEnv } from '../internal/process/functions/call/built-in/built-in-stack-env';
|
|
54
54
|
import { processEnvContents, processListToEnv } from '../internal/process/functions/call/built-in/built-in-env-contents';
|
|
55
|
-
import { processAttach } from '../internal/process/functions/call/built-in/built-in-attach';
|
|
55
|
+
import { processAttach, processDetach } from '../internal/process/functions/call/built-in/built-in-attach';
|
|
56
56
|
import { processWithEnv } from '../internal/process/functions/call/built-in/built-in-with';
|
|
57
57
|
import { processNamespaceAccess } from '../internal/process/functions/call/built-in/built-in-namespace-access';
|
|
58
58
|
import { processLoadCall } from '../internal/process/functions/call/built-in/built-in-load';
|
|
@@ -77,7 +77,12 @@ export interface BuiltInIdentifierConstant<T = unknown> extends IdentifierRefere
|
|
|
77
77
|
definedAt: BuiltIn;
|
|
78
78
|
value: T;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
/** The global state a call reads or writes, applied for every processor (see {@link PlacesAmbientItself}). */
|
|
81
|
+
export interface AmbientConfig {
|
|
82
|
+
/** how the call reads or writes global state like the graphics parameters, the options, or files, see {@link AmbientStateAccess} */
|
|
83
|
+
readonly ambient?: AmbientStateAccess | readonly AmbientStateAccess[];
|
|
84
|
+
}
|
|
85
|
+
export interface DefaultBuiltInProcessorConfiguration extends BuiltInFnInfo, AmbientConfig {
|
|
81
86
|
readonly cfg?: ExitPointType;
|
|
82
87
|
/** see {@link ProcessKnownFunctionCallInput#alternativeArgsFrom} */
|
|
83
88
|
readonly alternativeArgsFrom?: number;
|
|
@@ -90,8 +95,6 @@ export interface DefaultBuiltInProcessorConfiguration extends BuiltInFnInfo {
|
|
|
90
95
|
readonly hasUnknownSideEffects?: boolean | LinkTo<RegExp | string>;
|
|
91
96
|
/** without arguments, the result is the frame the call runs in, like `environment()`, so within a function it reads every binding of the frame */
|
|
92
97
|
readonly readsFrame?: boolean;
|
|
93
|
-
/** how the call reads or writes global state like the graphics parameters or the options, see {@link AmbientStateAccess} */
|
|
94
|
-
readonly ambient?: AmbientStateAccess | readonly AmbientStateAccess[];
|
|
95
98
|
/** the call changes that state for a scope only, see {@link AmbientScope} */
|
|
96
99
|
readonly scope?: AmbientScope;
|
|
97
100
|
/** record mapping the actual function name called to the arguments that should be treated as function calls */
|
|
@@ -103,6 +106,11 @@ export interface DefaultBuiltInProcessorConfiguration extends BuiltInFnInfo {
|
|
|
103
106
|
* data instead of variables, while everything else in them is evaluated in the caller's frame as usual.
|
|
104
107
|
*/
|
|
105
108
|
readonly markArgsAsMasked?: NseArguments | readonly number[];
|
|
109
|
+
/**
|
|
110
|
+
* The formals whose arguments name variables the call reads by their string value, like `save("x", list = v)`:
|
|
111
|
+
* a string literal anywhere, any other value except in `...`, where a symbol is the variable itself.
|
|
112
|
+
*/
|
|
113
|
+
readonly namesIn?: readonly string[];
|
|
106
114
|
/**
|
|
107
115
|
* Name that should be used for the origin (useful when needing to differentiate between
|
|
108
116
|
* functions like 'return' that use the default builtin processor)
|
|
@@ -116,7 +124,7 @@ export interface BuiltInEvalHandlerArgs extends ResolveInfo {
|
|
|
116
124
|
}
|
|
117
125
|
export type BuiltInEvalHandler = (args: BuiltInEvalHandlerArgs) => Value;
|
|
118
126
|
declare function defaultBuiltInProcessor<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, readAllArguments, cfg, alternativeArgsFrom, hasUnknownSideEffects, ambient, scope, treatAsFnCall, markArgsAsNSE: nse, markArgsAsMasked: masked, keepArgumentOut, sig, readsFrame }: DefaultBuiltInProcessorConfiguration): DataflowInformation;
|
|
119
|
-
declare function defaultBuiltInProcessorReadallArgs<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, markArgsAsNSE: nse, markArgsAsMasked: masked, sig,
|
|
127
|
+
declare function defaultBuiltInProcessorReadallArgs<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, markArgsAsNSE: nse, markArgsAsMasked: masked, sig, namesIn }: Pick<DefaultBuiltInProcessorConfiguration, 'useAsProcessor' | 'markArgsAsNSE' | 'markArgsAsMasked' | 'sig' | 'ambient' | 'namesIn'>): DataflowInformation;
|
|
120
128
|
export declare const BuiltInProcessorMapper: {
|
|
121
129
|
readonly "builtin:acc": typeof processAccess;
|
|
122
130
|
readonly "builtin:app": typeof processApply;
|
|
@@ -156,6 +164,8 @@ export declare const BuiltInProcessorMapper: {
|
|
|
156
164
|
readonly "builtin:env-contents": typeof processEnvContents;
|
|
157
165
|
readonly "builtin:list2env": typeof processListToEnv;
|
|
158
166
|
readonly "builtin:attach": typeof processAttach;
|
|
167
|
+
readonly "builtin:detach": typeof processDetach;
|
|
168
|
+
readonly "builtin:prefer": typeof processPrefer;
|
|
159
169
|
readonly "builtin:nenv": typeof processNewEnv;
|
|
160
170
|
readonly "builtin:class-gen": typeof processClassGenerator;
|
|
161
171
|
readonly "builtin:class-relation": typeof processClassRelation;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BuiltIns = exports.BuiltInEvalHandlerMapper = exports.BuiltInProcessorMapper = void 0;
|
|
4
|
+
const ambient_state_name_1 = require("./ambient-state-name");
|
|
4
5
|
const function_semantics_1 = require("../fn/function-semantics");
|
|
5
6
|
const known_call_handling_1 = require("../internal/process/functions/call/known-call-handling");
|
|
6
7
|
const built_in_access_1 = require("../internal/process/functions/call/built-in/built-in-access");
|
|
@@ -47,6 +48,10 @@ const built_in_recall_1 = require("../internal/process/functions/call/built-in/b
|
|
|
47
48
|
const built_in_s_seven_new_generic_1 = require("../internal/process/functions/call/built-in/built-in-s-seven-new-generic");
|
|
48
49
|
const built_in_s_seven_dispatch_1 = require("../internal/process/functions/call/built-in/built-in-s-seven-dispatch");
|
|
49
50
|
const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
51
|
+
const common_1 = require("../internal/process/functions/call/common");
|
|
52
|
+
const node_value_1 = require("../eval/resolve/node-value");
|
|
53
|
+
const resolve_helper_1 = require("./resolve-helper");
|
|
54
|
+
const linker_1 = require("../internal/linker");
|
|
50
55
|
const built_in_proc_name_1 = require("./built-in-proc-name");
|
|
51
56
|
const built_in_purrr_formula_1 = require("../internal/process/functions/call/built-in/built-in-purrr-formula");
|
|
52
57
|
const built_in_new_env_1 = require("../internal/process/functions/call/built-in/built-in-new-env");
|
|
@@ -206,7 +211,7 @@ function dropQuotedReferences(res, processedArguments, nsePositions, lastEnv) {
|
|
|
206
211
|
res.environment = lastEnv;
|
|
207
212
|
}
|
|
208
213
|
}
|
|
209
|
-
function defaultBuiltInProcessorReadallArgs(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, markArgsAsNSE: nse, markArgsAsMasked: masked, sig,
|
|
214
|
+
function defaultBuiltInProcessorReadallArgs(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, markArgsAsNSE: nse, markArgsAsMasked: masked, sig, namesIn }) {
|
|
210
215
|
const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
211
216
|
name, args, rootId, data, sig, origin: useAsProcessor, nonFunction: dataArgumentSymbols(args, sig), keepArgumentGraphs: nse !== undefined || masked !== undefined
|
|
212
217
|
});
|
|
@@ -214,8 +219,29 @@ function defaultBuiltInProcessorReadallArgs(name, args, rootId, data, { useAsPro
|
|
|
214
219
|
const first = firstParameterArgument(args, sig === undefined ? undefined : function_semantics_1.FunctionSemantics.call.signature.layout(sig));
|
|
215
220
|
(0, known_call_handling_1.markArgumentsAsNonStandardEvaluation)(information.graph, rootId, processedArguments, nse, { first });
|
|
216
221
|
(0, known_call_handling_1.markArgumentsAsNonStandardEvaluation)(information.graph, rootId, processedArguments, masked, { kind: known_call_handling_1.NseKind.DataMasked, first });
|
|
217
|
-
|
|
222
|
+
if (namesIn !== undefined && sig !== undefined) {
|
|
223
|
+
readNamedVariables(information, args, rootId, data, sig, namesIn);
|
|
224
|
+
}
|
|
225
|
+
return information;
|
|
218
226
|
}
|
|
227
|
+
/** Links the call to the variables its {@link DefaultBuiltInProcessorConfiguration#namesIn} arguments name, an unknown name being an unknown side effect. */
|
|
228
|
+
function readNamedVariables(information, args, rootId, data, sig, namesIn) {
|
|
229
|
+
const bound = function_semantics_1.FunctionSemantics.call.match.toSpec((0, common_1.convertFnArguments)(args), Object.fromEntries(sig.map(([n]) => [n, n])));
|
|
230
|
+
for (const formal of namesIn) {
|
|
231
|
+
for (const id of bound.get(formal) ?? []) {
|
|
232
|
+
const value = r_argument_1.RArgument.getValue(args, id);
|
|
233
|
+
const names = r_string_1.RString.is(value) ? [value.content.str] : formal === '...' || value === undefined ? [] : node_value_1.NodeValue.stringsOf(value.info.id, data);
|
|
234
|
+
if (names === undefined) {
|
|
235
|
+
(0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
|
|
236
|
+
}
|
|
237
|
+
for (const name of names ?? []) {
|
|
238
|
+
(0, linker_1.linkFieldReads)(information.graph, rootId, resolve_helper_1.Resolve.byName(name, data.environment), false);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/** The processors that apply the configured {@link BuiltInFnInfo#ambient} access themselves, where it belongs among their steps; the others have it applied after them. */
|
|
244
|
+
const PlacesAmbientItself = new Set([built_in_proc_name_1.BuiltInProcName.Default, built_in_proc_name_1.BuiltInProcName.Source]);
|
|
219
245
|
/**
|
|
220
246
|
* A call that reads or writes the files its arguments name accesses the {@link AmbientStateName.files|files on disk} as well.
|
|
221
247
|
* Closing a device writes the file its opening already wrote, and only a device's file name may number its pages (`plot%03d.png`).
|
|
@@ -240,6 +266,15 @@ function withFileAccess(config) {
|
|
|
240
266
|
type, numbered, sig: glob || sig === undefined ? undefined : split ? built_in_props_1.FnSig.resources(sig, type === "write-files" /* AmbientStateAccessType.WriteFiles */) : sig
|
|
241
267
|
}))] };
|
|
242
268
|
}
|
|
269
|
+
/** A call starting a process hands it every environment variable, a call loading a package looks for it in the library paths. */
|
|
270
|
+
function withImplicitReads(config) {
|
|
271
|
+
const { tags, ambient } = (config ?? {});
|
|
272
|
+
const reads = [
|
|
273
|
+
...tags?.includes(built_in_props_1.SemanticCallTag.Process) ? [ambient_state_name_1.AmbientStateName.allOf(ambient_state_name_1.KeyedState.Env)] : [],
|
|
274
|
+
...tags?.includes(built_in_props_1.SemanticCallTag.LoadsPackage) ? [ambient_state_name_1.AmbientStateName.libPaths] : []
|
|
275
|
+
];
|
|
276
|
+
return reads.length === 0 ? config : { ...config, ambient: [...[ambient ?? []].flat(), ...reads.map(state => ({ type: "read-state" /* AmbientStateAccessType.ReadState */, state }))] };
|
|
277
|
+
}
|
|
243
278
|
exports.BuiltInProcessorMapper = {
|
|
244
279
|
[built_in_proc_name_1.BuiltInProcName.Access]: built_in_access_1.processAccess,
|
|
245
280
|
[built_in_proc_name_1.BuiltInProcName.Apply]: built_in_apply_1.processApply,
|
|
@@ -279,6 +314,8 @@ exports.BuiltInProcessorMapper = {
|
|
|
279
314
|
[built_in_proc_name_1.BuiltInProcName.EnvContents]: built_in_env_contents_1.processEnvContents,
|
|
280
315
|
[built_in_proc_name_1.BuiltInProcName.ListToEnv]: built_in_env_contents_1.processListToEnv,
|
|
281
316
|
[built_in_proc_name_1.BuiltInProcName.Attach]: built_in_attach_1.processAttach,
|
|
317
|
+
[built_in_proc_name_1.BuiltInProcName.Detach]: built_in_attach_1.processDetach,
|
|
318
|
+
[built_in_proc_name_1.BuiltInProcName.Prefer]: built_in_library_1.processPrefer,
|
|
282
319
|
[built_in_proc_name_1.BuiltInProcName.NewEnv]: built_in_new_env_1.processNewEnv,
|
|
283
320
|
[built_in_proc_name_1.BuiltInProcName.ClassGenerator]: built_in_class_generator_1.processClassGenerator,
|
|
284
321
|
[built_in_proc_name_1.BuiltInProcName.ClassRelation]: built_in_class_relation_1.processClassRelation,
|
|
@@ -338,7 +375,11 @@ class BuiltIns {
|
|
|
338
375
|
(0, assert_1.guard)(mappedProcessor !== undefined, () => `Processor for ${processor} is undefined! Please pass a valid builtin name ${JSON.stringify(Object.keys(exports.BuiltInProcessorMapper))}!`);
|
|
339
376
|
const mappedEval = evalHandler === undefined ? undefined : exports.BuiltInEvalHandlerMapper[evalHandler];
|
|
340
377
|
(0, assert_1.guard)(evalHandler === undefined || mappedEval !== undefined, () => `Eval handler ${evalHandler} is unknown! Please pass a valid one of ${JSON.stringify(Object.keys(exports.BuiltInEvalHandlerMapper))}!`);
|
|
341
|
-
config = withFileAccess(config);
|
|
378
|
+
config = withImplicitReads(withFileAccess(config));
|
|
379
|
+
const ambient = PlacesAmbientItself.has(processor) ? undefined : config?.ambient;
|
|
380
|
+
const process = ambient === undefined
|
|
381
|
+
? (name, args, rootId, data) => mappedProcessor(name, args, rootId, data, config)
|
|
382
|
+
: (name, args, rootId, data) => (0, built_in_ambient_state_1.applyAmbientStateAccess)(mappedProcessor(name, args, rootId, data, config), args, rootId, data, ambient);
|
|
342
383
|
for (const name of names) {
|
|
343
384
|
const n = identifier_1.Identifier.getName(name);
|
|
344
385
|
const id = node_id_1.NodeId.toBuiltIn(n);
|
|
@@ -346,7 +387,7 @@ class BuiltIns {
|
|
|
346
387
|
type: identifier_1.ReferenceType.BuiltInFunction,
|
|
347
388
|
definedAt: id,
|
|
348
389
|
cds: undefined,
|
|
349
|
-
processor:
|
|
390
|
+
processor: process,
|
|
350
391
|
config,
|
|
351
392
|
evalHandler: mappedEval,
|
|
352
393
|
processorName: processor,
|