@eagleoutice/flowr 2.10.10 → 2.11.0
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 +37 -29
- package/cli/common/options.d.ts +2 -108
- package/cli/common/options.js +3 -27
- package/cli/common/scripts-info.d.ts +2 -123
- package/cli/common/scripts-info.js +0 -17
- package/cli/flowr-main-options.d.ts +5 -0
- package/cli/flowr-main-options.js +10 -0
- package/cli/flowr.js +1 -1
- package/cli/repl/print-version.d.ts +3 -1
- package/cli/repl/print-version.js +21 -2
- package/cli/repl/server/connection.d.ts +2 -0
- package/cli/repl/server/connection.js +40 -31
- package/cli/script-core/summarizer-core.js +13 -32
- package/cli/wiki.d.ts +2 -1
- package/cli/wiki.js +2 -0
- package/config.d.ts +13 -0
- package/config.js +8 -0
- package/control-flow/semantic-cfg-guided-visitor.js +1 -0
- package/core/steps/pipeline/default-pipelines.d.ts +146 -146
- package/data/pkgdb/pkgdb-latest.json.br +0 -0
- package/data/pkgdb/pkgdb-tiny.json.br +0 -0
- package/dataflow/environments/append.d.ts +1 -2
- package/dataflow/environments/append.js +3 -10
- package/dataflow/environments/apply-kill.d.ts +21 -0
- package/dataflow/environments/apply-kill.js +155 -0
- package/dataflow/environments/built-in-proc-name.d.ts +2 -0
- package/dataflow/environments/built-in-proc-name.js +2 -0
- package/dataflow/environments/built-in.d.ts +2 -0
- package/dataflow/environments/built-in.js +2 -0
- package/dataflow/environments/default-builtin-config.d.ts +63 -3
- package/dataflow/environments/default-builtin-config.js +40 -8
- package/dataflow/environments/environment.d.ts +49 -32
- package/dataflow/environments/environment.js +133 -18
- package/dataflow/environments/identifier.d.ts +10 -0
- package/dataflow/environments/identifier.js +23 -0
- package/dataflow/environments/overwrite.js +2 -10
- package/dataflow/environments/resolve-by-name.d.ts +1 -1
- package/dataflow/environments/resolve-by-name.js +10 -2
- package/dataflow/environments/scoping.d.ts +9 -2
- package/dataflow/environments/scoping.js +15 -2
- package/dataflow/extractor.js +23 -2
- package/dataflow/graph/df-helper.d.ts +8 -0
- package/dataflow/graph/df-helper.js +8 -0
- package/dataflow/graph/graph.d.ts +4 -1
- package/dataflow/graph/graph.js +5 -1
- package/dataflow/info.d.ts +26 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +7 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +9 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +30 -47
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +17 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +6 -1
- 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 +8 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +37 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +391 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +131 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +25 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +94 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +10 -3
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +30 -0
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +279 -0
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +17 -0
- package/documentation/data/faq/faqs.js +3 -0
- package/documentation/data/interface/doc-writing-code.js +4 -80
- package/documentation/doc-util/doc-structure.js +1 -2
- package/documentation/wiki-core.js +2 -1
- package/documentation/wiki-dataflow-graph.js +35 -1
- package/documentation/wiki-interface.js +3 -2
- package/documentation/wiki-linter.js +2 -0
- package/documentation/wiki-overview.js +1 -14
- package/documentation/wiki-package-database.d.ts +9 -0
- package/documentation/wiki-package-database.js +63 -0
- package/documentation/wiki-query.js +1 -0
- package/linter/linter-rules.d.ts +23 -0
- package/linter/linter-rules.js +3 -1
- package/linter/rules/absolute-path.js +2 -1
- package/linter/rules/undefined-symbol.d.ts +39 -0
- package/linter/rules/undefined-symbol.js +80 -0
- package/package.json +3 -4
- package/project/cache/flowr-analyzer-cache.d.ts +2 -0
- package/project/cache/flowr-analyzer-cache.js +9 -1
- package/project/context/flowr-analyzer-dependencies-context.d.ts +16 -8
- package/project/context/flowr-analyzer-dependencies-context.js +36 -4
- package/project/context/flowr-analyzer-environment-context.d.ts +2 -4
- package/project/context/flowr-analyzer-environment-context.js +3 -4
- package/project/context/flowr-analyzer-files-context.d.ts +1 -0
- package/project/context/flowr-file.d.ts +2 -0
- package/project/context/flowr-file.js +2 -0
- package/project/flowr-analyzer-builder.js +3 -0
- package/project/flowr-analyzer.d.ts +2 -1
- package/project/flowr-analyzer.js +3 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +13 -15
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +36 -13
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +27 -0
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +41 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +18 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +62 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +63 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +174 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +6 -0
- package/project/plugins/package-version-plugins/package.d.ts +3 -0
- package/project/plugins/package-version-plugins/package.js +12 -0
- package/project/plugins/package-version-plugins/pkgdb.d.ts +133 -0
- package/project/plugins/package-version-plugins/pkgdb.js +370 -0
- package/project/plugins/plugin-registry.d.ts +4 -1
- package/project/plugins/plugin-registry.js +7 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +8 -0
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -0
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +8 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +31 -3
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/other-path-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/other-path-functions.js +27 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -4
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +3 -1
- package/queries/catalog/linter-query/linter-query-executor.js +1 -0
- package/r-bridge/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +13 -4
- package/search/search-executor/search-enrichers.d.ts +1 -1
- package/search/search-executor/search-enrichers.js +7 -4
- package/util/mermaid/mermaid.d.ts +4 -0
- package/util/mermaid/mermaid.js +8 -1
- package/util/version.js +10 -2
- package/cli/common/features.d.ts +0 -9
- package/cli/common/features.js +0 -35
- package/cli/script-core/statistics-core.d.ts +0 -6
- package/cli/script-core/statistics-core.js +0 -104
- package/cli/script-core/statistics-helper-core.d.ts +0 -6
- package/cli/script-core/statistics-helper-core.js +0 -86
- package/cli/statistics-app.d.ts +0 -11
- package/cli/statistics-app.js +0 -16
- package/cli/statistics-helper-app.d.ts +0 -11
- package/cli/statistics-helper-app.js +0 -14
- package/statistics/features/common-syntax-probability.d.ts +0 -38
- package/statistics/features/common-syntax-probability.js +0 -169
- package/statistics/features/feature.d.ts +0 -179
- package/statistics/features/feature.js +0 -38
- package/statistics/features/post-processing.d.ts +0 -18
- package/statistics/features/post-processing.js +0 -26
- package/statistics/features/supported/assignments/assignments.d.ts +0 -12
- package/statistics/features/supported/assignments/assignments.js +0 -56
- package/statistics/features/supported/assignments/post-process.d.ts +0 -6
- package/statistics/features/supported/assignments/post-process.js +0 -126
- package/statistics/features/supported/comments/comments.d.ts +0 -18
- package/statistics/features/supported/comments/comments.js +0 -143
- package/statistics/features/supported/comments/post-process.d.ts +0 -6
- package/statistics/features/supported/comments/post-process.js +0 -51
- package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
- package/statistics/features/supported/control-flow/control-flow.js +0 -69
- package/statistics/features/supported/control-flow/post-process.d.ts +0 -6
- package/statistics/features/supported/control-flow/post-process.js +0 -66
- package/statistics/features/supported/data-access/data-access.d.ts +0 -15
- package/statistics/features/supported/data-access/data-access.js +0 -122
- package/statistics/features/supported/data-access/post-process.d.ts +0 -6
- package/statistics/features/supported/data-access/post-process.js +0 -108
- package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -34
- package/statistics/features/supported/defined-functions/defined-functions.js +0 -145
- package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/defined-functions/post-process.js +0 -168
- package/statistics/features/supported/expression-list/post-process.d.ts +0 -6
- package/statistics/features/supported/expression-list/post-process.js +0 -45
- package/statistics/features/supported/expression-list/statistics-expression-list.d.ts +0 -9
- package/statistics/features/supported/expression-list/statistics-expression-list.js +0 -37
- package/statistics/features/supported/loops/loops.d.ts +0 -20
- package/statistics/features/supported/loops/loops.js +0 -81
- package/statistics/features/supported/loops/post-process.d.ts +0 -6
- package/statistics/features/supported/loops/post-process.js +0 -73
- package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/used-functions/post-process.js +0 -176
- package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
- package/statistics/features/supported/used-functions/used-functions.js +0 -99
- package/statistics/features/supported/used-packages/post-process.d.ts +0 -6
- package/statistics/features/supported/used-packages/post-process.js +0 -122
- package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
- package/statistics/features/supported/used-packages/used-packages.js +0 -140
- package/statistics/features/supported/values/post-process.d.ts +0 -6
- package/statistics/features/supported/values/post-process.js +0 -73
- package/statistics/features/supported/values/values.d.ts +0 -14
- package/statistics/features/supported/values/values.js +0 -111
- package/statistics/features/supported/variables/post-process.d.ts +0 -15
- package/statistics/features/supported/variables/post-process.js +0 -126
- package/statistics/features/supported/variables/variables.d.ts +0 -15
- package/statistics/features/supported/variables/variables.js +0 -62
- package/statistics/meta-statistics.d.ts +0 -32
- package/statistics/meta-statistics.js +0 -16
- package/statistics/output/file-provider.d.ts +0 -36
- package/statistics/output/file-provider.js +0 -96
- package/statistics/output/print-stats.d.ts +0 -29
- package/statistics/output/print-stats.js +0 -81
- package/statistics/output/statistics-file.d.ts +0 -36
- package/statistics/output/statistics-file.js +0 -68
- package/statistics/statistics.d.ts +0 -29
- package/statistics/statistics.js +0 -108
- package/statistics/summarizer/auto-detect.d.ts +0 -5
- package/statistics/summarizer/auto-detect.js +0 -34
- package/statistics/summarizer/first-phase/process.d.ts +0 -6
- package/statistics/summarizer/first-phase/process.js +0 -81
- package/statistics/summarizer/post-process/clusterer.d.ts +0 -25
- package/statistics/summarizer/post-process/clusterer.js +0 -40
- package/statistics/summarizer/post-process/file-based-count.d.ts +0 -16
- package/statistics/summarizer/post-process/file-based-count.js +0 -47
- package/statistics/summarizer/post-process/histogram.d.ts +0 -57
- package/statistics/summarizer/post-process/histogram.js +0 -126
- package/statistics/summarizer/post-process/post-process-output.d.ts +0 -14
- package/statistics/summarizer/post-process/post-process-output.js +0 -102
- package/statistics/summarizer/second-phase/process.d.ts +0 -15
- package/statistics/summarizer/second-phase/process.js +0 -118
- package/statistics/summarizer/summarizer.d.ts +0 -34
- package/statistics/summarizer/summarizer.js +0 -141
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cancelRevivedKills = cancelRevivedKills;
|
|
4
|
+
exports.applyKills = applyKills;
|
|
5
|
+
exports.makeKillsMaybe = makeKillsMaybe;
|
|
6
|
+
const info_1 = require("../info");
|
|
7
|
+
const identifier_1 = require("./identifier");
|
|
8
|
+
/**
|
|
9
|
+
* Drops the kills that a later write revives: a re-definition cancels a pending `named` removal of that name,
|
|
10
|
+
* and any write cancels a wholesale (`all`/`unknown`) removal. Used when bubbling kills out of an expression
|
|
11
|
+
* list so a merging parent only sees the removals still in effect at the list's exit.
|
|
12
|
+
*/
|
|
13
|
+
function cancelRevivedKills(kills, writes) {
|
|
14
|
+
const written = new Set();
|
|
15
|
+
for (const w of writes) {
|
|
16
|
+
if (w.name !== undefined) {
|
|
17
|
+
written.add(w.name);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (written.size === 0) {
|
|
21
|
+
return kills;
|
|
22
|
+
}
|
|
23
|
+
return kills.filter(k => k.kind === 'named' && k.reference.name !== undefined && !written.has(k.reference.name));
|
|
24
|
+
}
|
|
25
|
+
function isBuiltInDef(d) {
|
|
26
|
+
return d.type === identifier_1.ReferenceType.BuiltInFunction || d.type === identifier_1.ReferenceType.BuiltInConstant;
|
|
27
|
+
}
|
|
28
|
+
function mergeCds(base, toAdd) {
|
|
29
|
+
const result = base ? Array.from(base) : [];
|
|
30
|
+
for (const c of toAdd) {
|
|
31
|
+
if (!result.some(e => e.id === c.id && e.when === c.when)) {
|
|
32
|
+
result.push(c);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
/** copy-on-write copy of the definition carrying the additional cds, marking it as maybe */
|
|
38
|
+
function weakenDefinition(def, cds) {
|
|
39
|
+
return { ...def, cds: mergeCds(def.cds, cds) };
|
|
40
|
+
}
|
|
41
|
+
/** attaches `cds` to every user definition of `name` along the environment chain */
|
|
42
|
+
function weakenName(env, name, cds) {
|
|
43
|
+
const [plainName, ns] = identifier_1.Identifier.toArray(name);
|
|
44
|
+
let current = env;
|
|
45
|
+
while (current && !current.builtInEnv) {
|
|
46
|
+
if (ns === undefined || current.n === ns) {
|
|
47
|
+
const defs = current.memory.get(plainName);
|
|
48
|
+
if (defs !== undefined && defs.some(d => !isBuiltInDef(d))) {
|
|
49
|
+
current.memory.set(plainName, defs.map(d => isBuiltInDef(d) ? d : weakenDefinition(d, cds)));
|
|
50
|
+
current.cache?.delete(plainName);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
current = current.parent;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** attaches `cds` to every user definition in the current frame */
|
|
57
|
+
function weakenAll(env, cds) {
|
|
58
|
+
if (env.builtInEnv) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
for (const [key, defs] of env.memory) {
|
|
62
|
+
if (defs.some(d => !isBuiltInDef(d))) {
|
|
63
|
+
env.memory.set(key, defs.map(d => isBuiltInDef(d) ? d : weakenDefinition(d, cds)));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
env.cache?.clear();
|
|
67
|
+
}
|
|
68
|
+
/** removes every user definition from the current frame (e.g., `rm(list = ls())`) */
|
|
69
|
+
function removeAllInFrame(env) {
|
|
70
|
+
if (env.builtInEnv) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
for (const [key, defs] of env.memory) {
|
|
74
|
+
if (defs.every(isBuiltInDef)) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const kept = defs.filter(isBuiltInDef);
|
|
78
|
+
if (kept.length === 0) {
|
|
79
|
+
env.memory.delete(key);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
env.memory.set(key, kept);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
env.cache?.clear();
|
|
86
|
+
}
|
|
87
|
+
function applyNamedKill(env, name, refs) {
|
|
88
|
+
// certain if any kill is unconditional or the kills together cover every branch
|
|
89
|
+
const certain = refs.some(r => (0, info_1.happensInEveryBranch)(r.cds)) || (0, info_1.happensInEveryBranch)(refs.flatMap(r => r.cds ?? []));
|
|
90
|
+
if (certain) {
|
|
91
|
+
env.remove(name);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// the definition survives unless the killing branch executed
|
|
95
|
+
for (const ref of refs) {
|
|
96
|
+
weakenName(env, name, (ref.cds ?? []).map(info_1.negateControlDependency));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Applies the given {@link KillReference|kills} to a copy of `env`. `named` kills remove (or, when conditional,
|
|
102
|
+
* weaken to maybe) a single definition; `all` kills clear the current frame; `unknown` kills weaken every
|
|
103
|
+
* in-scope definition to maybe. Returns `env` unchanged when there is nothing to apply.
|
|
104
|
+
*/
|
|
105
|
+
function applyKills(env, kills) {
|
|
106
|
+
if (!kills || kills.length === 0) {
|
|
107
|
+
return env;
|
|
108
|
+
}
|
|
109
|
+
const current = env.current.clone(true);
|
|
110
|
+
// group named kills by name so removals that together cover all branches become a hard removal
|
|
111
|
+
const named = new Map();
|
|
112
|
+
for (const kill of kills) {
|
|
113
|
+
switch (kill.kind) {
|
|
114
|
+
case 'named':
|
|
115
|
+
if (kill.reference.name !== undefined) {
|
|
116
|
+
const group = named.get(kill.reference.name);
|
|
117
|
+
if (group) {
|
|
118
|
+
group.push(kill.reference);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
named.set(kill.reference.name, [kill.reference]);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
case 'all':
|
|
126
|
+
if ((0, info_1.happensInEveryBranch)(kill.cds)) {
|
|
127
|
+
removeAllInFrame(current);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
weakenAll(current, (kill.cds ?? []).map(info_1.negateControlDependency));
|
|
131
|
+
}
|
|
132
|
+
break;
|
|
133
|
+
case 'unknown':
|
|
134
|
+
weakenAll(current, kill.cds ?? []);
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
for (const [name, refs] of named) {
|
|
139
|
+
applyNamedKill(current, name, refs);
|
|
140
|
+
}
|
|
141
|
+
return { current, level: env.level };
|
|
142
|
+
}
|
|
143
|
+
/** Attaches `cds` to a list of kills, turning them into conditional (maybe) kills. */
|
|
144
|
+
function makeKillsMaybe(kills, cds) {
|
|
145
|
+
if (!kills || kills.length === 0) {
|
|
146
|
+
return [];
|
|
147
|
+
}
|
|
148
|
+
return kills.map(k => {
|
|
149
|
+
if (k.kind === 'named') {
|
|
150
|
+
return { kind: 'named', reference: { ...k.reference, cds: mergeCds(k.reference.cds, cds) } };
|
|
151
|
+
}
|
|
152
|
+
return { ...k, cds: mergeCds(k.cds, cds) };
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=apply-kill.js.map
|
|
@@ -76,6 +76,8 @@ export declare enum BuiltInProcName {
|
|
|
76
76
|
Source = "builtin:source",
|
|
77
77
|
/** for special binary operators like `%x%`, see {@link processSpecialBinOp} */
|
|
78
78
|
SpecialBinOp = "builtin:s-bop",
|
|
79
|
+
/** for env-returning builtins (`globalenv`/`baseenv`/`emptyenv`) that point into the search-path stack, see {@link processStackEnv} */
|
|
80
|
+
StackEnv = "builtin:stack-env",
|
|
79
81
|
/** for `stop` calls */
|
|
80
82
|
Stop = "builtin:stop",
|
|
81
83
|
/** for `stopifnot` calls, see {@link processStopIfNot} */
|
|
@@ -80,6 +80,8 @@ var BuiltInProcName;
|
|
|
80
80
|
BuiltInProcName["Source"] = "builtin:source";
|
|
81
81
|
/** for special binary operators like `%x%`, see {@link processSpecialBinOp} */
|
|
82
82
|
BuiltInProcName["SpecialBinOp"] = "builtin:s-bop";
|
|
83
|
+
/** for env-returning builtins (`globalenv`/`baseenv`/`emptyenv`) that point into the search-path stack, see {@link processStackEnv} */
|
|
84
|
+
BuiltInProcName["StackEnv"] = "builtin:stack-env";
|
|
83
85
|
/** for `stop` calls */
|
|
84
86
|
BuiltInProcName["Stop"] = "builtin:stop";
|
|
85
87
|
/** for `stopifnot` calls, see {@link processStopIfNot} */
|
|
@@ -45,6 +45,7 @@ import { processS7Dispatch } from '../internal/process/functions/call/built-in/b
|
|
|
45
45
|
import { BuiltInProcName } from './built-in-proc-name';
|
|
46
46
|
import { processPurrrFormula } from '../internal/process/functions/call/built-in/built-in-purrr-formula';
|
|
47
47
|
import { processNewEnv } from '../internal/process/functions/call/built-in/built-in-new-env';
|
|
48
|
+
import { processStackEnv } from '../internal/process/functions/call/built-in/built-in-stack-env';
|
|
48
49
|
import { processAttach } from '../internal/process/functions/call/built-in/built-in-attach';
|
|
49
50
|
import { processWithEnv } from '../internal/process/functions/call/built-in/built-in-with';
|
|
50
51
|
import { processNamespaceAccess } from '../internal/process/functions/call/built-in/built-in-namespace-access';
|
|
@@ -122,6 +123,7 @@ export declare const BuiltInProcessorMapper: {
|
|
|
122
123
|
readonly "builtin:try": typeof processTryCatch;
|
|
123
124
|
readonly "builtin:attach": typeof processAttach;
|
|
124
125
|
readonly "builtin:nenv": typeof processNewEnv;
|
|
126
|
+
readonly "builtin:stack-env": typeof processStackEnv;
|
|
125
127
|
readonly "builtin:with": typeof processWithEnv;
|
|
126
128
|
readonly "builtin:vector": typeof processVector;
|
|
127
129
|
readonly "builtin:wl": typeof processWhileLoop;
|
|
@@ -43,6 +43,7 @@ const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
|
43
43
|
const built_in_proc_name_1 = require("./built-in-proc-name");
|
|
44
44
|
const built_in_purrr_formula_1 = require("../internal/process/functions/call/built-in/built-in-purrr-formula");
|
|
45
45
|
const built_in_new_env_1 = require("../internal/process/functions/call/built-in/built-in-new-env");
|
|
46
|
+
const built_in_stack_env_1 = require("../internal/process/functions/call/built-in/built-in-stack-env");
|
|
46
47
|
const built_in_attach_1 = require("../internal/process/functions/call/built-in/built-in-attach");
|
|
47
48
|
const built_in_with_1 = require("../internal/process/functions/call/built-in/built-in-with");
|
|
48
49
|
const built_in_namespace_access_1 = require("../internal/process/functions/call/built-in/built-in-namespace-access");
|
|
@@ -149,6 +150,7 @@ exports.BuiltInProcessorMapper = {
|
|
|
149
150
|
[built_in_proc_name_1.BuiltInProcName.Try]: built_in_try_catch_1.processTryCatch,
|
|
150
151
|
[built_in_proc_name_1.BuiltInProcName.Attach]: built_in_attach_1.processAttach,
|
|
151
152
|
[built_in_proc_name_1.BuiltInProcName.NewEnv]: built_in_new_env_1.processNewEnv,
|
|
153
|
+
[built_in_proc_name_1.BuiltInProcName.StackEnv]: built_in_stack_env_1.processStackEnv,
|
|
152
154
|
[built_in_proc_name_1.BuiltInProcName.With]: built_in_with_1.processWithEnv,
|
|
153
155
|
[built_in_proc_name_1.BuiltInProcName.Vector]: built_in_vector_1.processVector,
|
|
154
156
|
[built_in_proc_name_1.BuiltInProcName.WhileLoop]: built_in_while_loop_1.processWhileLoop,
|
|
@@ -6,6 +6,27 @@ import { CascadeAction } from '../../queries/catalog/call-context-query/cascade-
|
|
|
6
6
|
import { KnownHooks } from '../hooks';
|
|
7
7
|
import { Identifier } from './identifier';
|
|
8
8
|
import { BuiltInProcName } from './built-in-proc-name';
|
|
9
|
+
/** Which stack environment an env-returning/-transforming builtin denotes (see {@link StackEnvBuiltins}). */
|
|
10
|
+
export declare enum StackEnvKind {
|
|
11
|
+
Global = 0,
|
|
12
|
+
Base = 1,
|
|
13
|
+
Empty = 2,
|
|
14
|
+
Current = 3,
|
|
15
|
+
Parent = 4,
|
|
16
|
+
Named = 5
|
|
17
|
+
}
|
|
18
|
+
/** Maps the env-returning/-transforming base builtins and constants to the stack environment each denotes. */
|
|
19
|
+
export declare const StackEnvBuiltins: {
|
|
20
|
+
readonly globalenv: StackEnvKind.Global;
|
|
21
|
+
readonly baseenv: StackEnvKind.Base;
|
|
22
|
+
readonly emptyenv: StackEnvKind.Empty;
|
|
23
|
+
readonly environment: StackEnvKind.Current;
|
|
24
|
+
readonly 'parent.env': StackEnvKind.Parent;
|
|
25
|
+
readonly 'as.environment': StackEnvKind.Named;
|
|
26
|
+
readonly '.GlobalEnv': StackEnvKind.Global;
|
|
27
|
+
readonly '.BaseEnv': StackEnvKind.Base;
|
|
28
|
+
readonly '.BaseNamespaceEnv': StackEnvKind.Base;
|
|
29
|
+
};
|
|
9
30
|
export declare const GgPlotCreate: readonly ["ggplot", "ggplotly", "ggMarginal", "ggcorrplot", "ggseasonplot", "ggdendrogram", "qmap", "qplot", "quickplot", "autoplot", "grid.arrange", "fviz_pca_biplot", "fviz_pca", "fviz_pca_ind", "fviz_pca_var", "fviz_screeplot", "fviz_mca_biplot", "fviz_mca", "fviz_mca_ind", "fviz_mca_var", "fviz_cluster", "fviz_dend", "ggsurvplot"];
|
|
10
31
|
export declare const TinyPlotCrate: readonly ["tinyplot", "plt"];
|
|
11
32
|
export declare const GraphicsPlotCreate: string[];
|
|
@@ -460,10 +481,43 @@ export declare const DefaultBuiltinConfig: [{
|
|
|
460
481
|
readonly assumePrimitive: false;
|
|
461
482
|
}, {
|
|
462
483
|
readonly type: "function";
|
|
463
|
-
readonly names: [Identifier, Identifier
|
|
484
|
+
readonly names: [Identifier, Identifier];
|
|
464
485
|
readonly processor: BuiltInProcName.Library;
|
|
465
486
|
readonly config: {};
|
|
466
487
|
readonly assumePrimitive: false;
|
|
488
|
+
}, {
|
|
489
|
+
readonly type: "function";
|
|
490
|
+
readonly names: [Identifier];
|
|
491
|
+
readonly processor: BuiltInProcName.Library;
|
|
492
|
+
readonly config: {
|
|
493
|
+
readonly characterOnly: true;
|
|
494
|
+
};
|
|
495
|
+
readonly assumePrimitive: false;
|
|
496
|
+
}, {
|
|
497
|
+
readonly type: "function";
|
|
498
|
+
readonly names: [Identifier, Identifier];
|
|
499
|
+
readonly processor: BuiltInProcName.Library;
|
|
500
|
+
readonly config: {
|
|
501
|
+
readonly namespaceOnly: true;
|
|
502
|
+
readonly characterOnly: true;
|
|
503
|
+
};
|
|
504
|
+
readonly assumePrimitive: false;
|
|
505
|
+
}, {
|
|
506
|
+
readonly type: "function";
|
|
507
|
+
readonly names: [Identifier];
|
|
508
|
+
readonly processor: BuiltInProcName.Library;
|
|
509
|
+
readonly config: {
|
|
510
|
+
readonly fromImports: true;
|
|
511
|
+
};
|
|
512
|
+
readonly assumePrimitive: false;
|
|
513
|
+
}, {
|
|
514
|
+
readonly type: "function";
|
|
515
|
+
readonly names: [Identifier, Identifier];
|
|
516
|
+
readonly processor: BuiltInProcName.Library;
|
|
517
|
+
readonly config: {
|
|
518
|
+
readonly boxUse: true;
|
|
519
|
+
};
|
|
520
|
+
readonly assumePrimitive: false;
|
|
467
521
|
}, {
|
|
468
522
|
readonly type: "function";
|
|
469
523
|
readonly names: ["<-", "="];
|
|
@@ -1024,7 +1078,13 @@ export declare const DefaultBuiltinConfig: [{
|
|
|
1024
1078
|
readonly assumePrimitive: true;
|
|
1025
1079
|
}, {
|
|
1026
1080
|
readonly type: "function";
|
|
1027
|
-
readonly names: [
|
|
1081
|
+
readonly names: Identifier[];
|
|
1082
|
+
readonly processor: BuiltInProcName.StackEnv;
|
|
1083
|
+
readonly config: {};
|
|
1084
|
+
readonly assumePrimitive: true;
|
|
1085
|
+
}, {
|
|
1086
|
+
readonly type: "function";
|
|
1087
|
+
readonly names: [Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier];
|
|
1028
1088
|
readonly processor: BuiltInProcName.Default;
|
|
1029
1089
|
readonly config: {};
|
|
1030
1090
|
readonly assumePrimitive: true;
|
|
@@ -1211,7 +1271,7 @@ export declare const DefaultBuiltinConfig: [{
|
|
|
1211
1271
|
};
|
|
1212
1272
|
}, {
|
|
1213
1273
|
readonly type: "function";
|
|
1214
|
-
readonly names: [Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier
|
|
1274
|
+
readonly names: [Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier, Identifier];
|
|
1215
1275
|
readonly processor: BuiltInProcName.Default;
|
|
1216
1276
|
readonly config: {
|
|
1217
1277
|
readonly hasUnknownSideEffects: true;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DefaultBuiltinConfig = exports.GgPlotAddons = exports.GraphicsPlotAddons = exports.PlotFunctionsWithAddParam = exports.GgPlotImplicitAddons = exports.TinyPlotAddons = exports.PlotCreate = exports.GraphicsPlotCreate = exports.TinyPlotCrate = exports.GgPlotCreate = void 0;
|
|
3
|
+
exports.DefaultBuiltinConfig = exports.GgPlotAddons = exports.GraphicsPlotAddons = exports.PlotFunctionsWithAddParam = exports.GgPlotImplicitAddons = exports.TinyPlotAddons = exports.PlotCreate = exports.GraphicsPlotCreate = exports.TinyPlotCrate = exports.GgPlotCreate = exports.StackEnvBuiltins = exports.StackEnvKind = void 0;
|
|
4
4
|
exports.getDefaultProcessor = getDefaultProcessor;
|
|
5
5
|
const identify_link_to_last_call_relation_1 = require("../../queries/catalog/call-context-query/identify-link-to-last-call-relation");
|
|
6
6
|
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
@@ -9,6 +9,28 @@ const unnamed_call_handling_1 = require("../internal/process/functions/call/unna
|
|
|
9
9
|
const hooks_1 = require("../hooks");
|
|
10
10
|
const identifier_1 = require("./identifier");
|
|
11
11
|
const built_in_proc_name_1 = require("./built-in-proc-name");
|
|
12
|
+
/** Which stack environment an env-returning/-transforming builtin denotes (see {@link StackEnvBuiltins}). */
|
|
13
|
+
var StackEnvKind;
|
|
14
|
+
(function (StackEnvKind) {
|
|
15
|
+
StackEnvKind[StackEnvKind["Global"] = 0] = "Global";
|
|
16
|
+
StackEnvKind[StackEnvKind["Base"] = 1] = "Base";
|
|
17
|
+
StackEnvKind[StackEnvKind["Empty"] = 2] = "Empty";
|
|
18
|
+
StackEnvKind[StackEnvKind["Current"] = 3] = "Current";
|
|
19
|
+
StackEnvKind[StackEnvKind["Parent"] = 4] = "Parent";
|
|
20
|
+
StackEnvKind[StackEnvKind["Named"] = 5] = "Named";
|
|
21
|
+
})(StackEnvKind || (exports.StackEnvKind = StackEnvKind = {}));
|
|
22
|
+
/** Maps the env-returning/-transforming base builtins and constants to the stack environment each denotes. */
|
|
23
|
+
exports.StackEnvBuiltins = {
|
|
24
|
+
globalenv: StackEnvKind.Global,
|
|
25
|
+
baseenv: StackEnvKind.Base,
|
|
26
|
+
emptyenv: StackEnvKind.Empty,
|
|
27
|
+
environment: StackEnvKind.Current,
|
|
28
|
+
'parent.env': StackEnvKind.Parent,
|
|
29
|
+
'as.environment': StackEnvKind.Named,
|
|
30
|
+
'.GlobalEnv': StackEnvKind.Global,
|
|
31
|
+
'.BaseEnv': StackEnvKind.Base,
|
|
32
|
+
'.BaseNamespaceEnv': StackEnvKind.Base
|
|
33
|
+
};
|
|
12
34
|
exports.GgPlotCreate = [
|
|
13
35
|
'ggplot', 'ggplotly', 'ggMarginal', 'ggcorrplot', 'ggseasonplot', 'ggdendrogram', 'qmap', 'qplot', 'quickplot', 'autoplot', 'grid.arrange',
|
|
14
36
|
'fviz_pca_biplot', 'fviz_pca', 'fviz_pca_ind', 'fviz_pca_var', 'fviz_screeplot', 'fviz_mca_biplot', 'fviz_mca', 'fviz_mca_ind', 'fviz_mca_var', 'fviz_cluster', 'fviz_dend',
|
|
@@ -372,8 +394,16 @@ exports.DefaultBuiltinConfig = [
|
|
|
372
394
|
processor: built_in_proc_name_1.BuiltInProcName.IfThenElse, config: { args: { cond: 'condition', yes: 'true', no: 'false' } }, assumePrimitive: true },
|
|
373
395
|
{ type: 'function', names: [identifier_1.Identifier.from(['get', "base" /* PkgName.Base */])],
|
|
374
396
|
processor: built_in_proc_name_1.BuiltInProcName.Get, config: {}, assumePrimitive: false },
|
|
375
|
-
{ type: 'function', names: [identifier_1.Identifier.from(['
|
|
397
|
+
{ type: 'function', names: [identifier_1.Identifier.from(['library', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['require', "base" /* PkgName.Base */])],
|
|
376
398
|
processor: built_in_proc_name_1.BuiltInProcName.Library, config: {}, assumePrimitive: false },
|
|
399
|
+
{ type: 'function', names: [identifier_1.Identifier.from(['attachNamespace', "base" /* PkgName.Base */])],
|
|
400
|
+
processor: built_in_proc_name_1.BuiltInProcName.Library, config: { characterOnly: true }, assumePrimitive: false },
|
|
401
|
+
{ type: 'function', names: [identifier_1.Identifier.from(['requireNamespace', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['loadNamespace', "base" /* PkgName.Base */])],
|
|
402
|
+
processor: built_in_proc_name_1.BuiltInProcName.Library, config: { namespaceOnly: true, characterOnly: true }, assumePrimitive: false },
|
|
403
|
+
{ type: 'function', names: [identifier_1.Identifier.from(['from', "import" /* PkgName.Import */])],
|
|
404
|
+
processor: built_in_proc_name_1.BuiltInProcName.Library, config: { fromImports: true }, assumePrimitive: false },
|
|
405
|
+
{ type: 'function', names: [identifier_1.Identifier.from(['use', "box" /* PkgName.Box */]), identifier_1.Identifier.from(['use', "base" /* PkgName.Base */])],
|
|
406
|
+
processor: built_in_proc_name_1.BuiltInProcName.Library, config: { boxUse: true }, assumePrimitive: false },
|
|
377
407
|
{ type: 'function', names: ['<-', '='],
|
|
378
408
|
processor: built_in_proc_name_1.BuiltInProcName.Assignment, config: { canBeReplacement: true }, assumePrimitive: true },
|
|
379
409
|
{ type: 'function', names: [identifier_1.Identifier.from([':=', "data.table" /* PkgName.DataTable */])],
|
|
@@ -560,9 +590,13 @@ exports.DefaultBuiltinConfig = [
|
|
|
560
590
|
processor: built_in_proc_name_1.BuiltInProcName.With, config: {}, assumePrimitive: false },
|
|
561
591
|
{ type: 'function', names: [identifier_1.Identifier.from(['new.env', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['new_environment', "rlang" /* PkgName.Rlang */])],
|
|
562
592
|
processor: built_in_proc_name_1.BuiltInProcName.NewEnv, config: {}, assumePrimitive: true },
|
|
593
|
+
/* env-returning builtins pointing into the current search-path stack (`e <- globalenv(); e$x`) */
|
|
594
|
+
{ type: 'function', names: Object.entries(exports.StackEnvBuiltins)
|
|
595
|
+
.filter(([n, kind]) => !n.startsWith('.') && (kind === StackEnvKind.Global || kind === StackEnvKind.Base || kind === StackEnvKind.Empty))
|
|
596
|
+
.map(([n]) => identifier_1.Identifier.from([n, "base" /* PkgName.Base */])),
|
|
597
|
+
processor: built_in_proc_name_1.BuiltInProcName.StackEnv, config: {}, assumePrimitive: true },
|
|
563
598
|
{ type: 'function', names: [
|
|
564
|
-
identifier_1.Identifier.from(['
|
|
565
|
-
identifier_1.Identifier.from(['emptyenv', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['parent.env', "base" /* PkgName.Base */]),
|
|
599
|
+
identifier_1.Identifier.from(['parent.env', "base" /* PkgName.Base */]),
|
|
566
600
|
identifier_1.Identifier.from(['parent.frame', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['environmentName', "base" /* PkgName.Base */]),
|
|
567
601
|
identifier_1.Identifier.from(['as.environment', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['pos.to.env', "base" /* PkgName.Base */]),
|
|
568
602
|
identifier_1.Identifier.from(['sys.frame', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['sys.frames', "base" /* PkgName.Base */]),
|
|
@@ -625,10 +659,8 @@ exports.DefaultBuiltinConfig = [
|
|
|
625
659
|
names: [
|
|
626
660
|
identifier_1.Identifier.from(['sys.on.exit', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['par', "graphics" /* PkgName.Graphics */]),
|
|
627
661
|
identifier_1.Identifier.from(['tpar', "tinyplot" /* PkgName.TinyPlot */]), identifier_1.Identifier.from(['sink', "base" /* PkgName.Base */]),
|
|
628
|
-
/* library
|
|
629
|
-
identifier_1.Identifier.from(['
|
|
630
|
-
identifier_1.Identifier.from(['attachNamespace', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['asNamespace', "base" /* PkgName.Base */]),
|
|
631
|
-
identifier_1.Identifier.from(['use', "base" /* PkgName.Base */]),
|
|
662
|
+
/* library/require/(require|load|attach)Namespace/use are handled above */
|
|
663
|
+
identifier_1.Identifier.from(['asNamespace', "base" /* PkgName.Base */]),
|
|
632
664
|
/* env attachment */
|
|
633
665
|
identifier_1.Identifier.from(['unname', "base" /* PkgName.Base */]), identifier_1.Identifier.from(['data', "utils" /* PkgName.Utils */]),
|
|
634
666
|
/* file creation/removal (base) */
|
|
@@ -5,26 +5,32 @@ import type { ControlDependency } from '../info';
|
|
|
5
5
|
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
6
6
|
/** A single entry/scope within an {@link REnvironmentInformation} */
|
|
7
7
|
export interface IEnvironment {
|
|
8
|
-
/** Unique
|
|
8
|
+
/** Unique internally generated identifier, used for debugging not comparison */
|
|
9
9
|
readonly id: number;
|
|
10
10
|
/** Lexical parent of the environment, if any (can be manipulated by R code) */
|
|
11
11
|
parent: IEnvironment;
|
|
12
12
|
/** Maps to exactly one definition of an identifier if the source is known, otherwise to a list of all possible definitions */
|
|
13
13
|
memory: BuiltInMemory;
|
|
14
|
-
/**
|
|
15
|
-
* Is this a built-in environment that is not allowed to change? Please use this carefully and only for the top-most envs!
|
|
16
|
-
*/
|
|
14
|
+
/** Built-in environment that must not change; only for the top-most envs. */
|
|
17
15
|
builtInEnv?: true | undefined;
|
|
18
16
|
}
|
|
19
|
-
|
|
17
|
+
export declare enum EnvType {
|
|
18
|
+
Namespace = "ns",
|
|
19
|
+
Imports = "imp",
|
|
20
|
+
/** `requireNamespace("pkg")`: `pkg::fn` resolves, bare `fn` does not */
|
|
21
|
+
LoadedNamespace = "lns"
|
|
22
|
+
}
|
|
23
|
+
interface Jsonified {
|
|
20
24
|
id: NodeId;
|
|
21
25
|
parent: Jsonified | undefined;
|
|
22
26
|
builtInEnv?: true;
|
|
23
27
|
memory: BuiltInMemory;
|
|
24
|
-
|
|
28
|
+
n?: string;
|
|
29
|
+
t?: EnvType;
|
|
30
|
+
globalEnv?: true;
|
|
31
|
+
}
|
|
25
32
|
/**
|
|
26
|
-
*
|
|
27
|
-
* Otherwise, rely on {@link IEnvironment#builtInEnv}
|
|
33
|
+
* Use only if you do not know the object type; otherwise rely on {@link IEnvironment#builtInEnv}.
|
|
28
34
|
*/
|
|
29
35
|
export declare function isDefaultBuiltInEnvironment(obj: unknown): boolean;
|
|
30
36
|
/** @see REnvironmentInformation */
|
|
@@ -32,23 +38,27 @@ export declare class Environment implements IEnvironment {
|
|
|
32
38
|
readonly id: number;
|
|
33
39
|
/** Optional name for namespaced/non-anonymous environments, please only set if you know what you are doing */
|
|
34
40
|
n?: string;
|
|
41
|
+
/** which search-path layer this env is (package/namespace/imports), if any */
|
|
42
|
+
t?: EnvType;
|
|
35
43
|
/** if created by a closure, the node id of that closure */
|
|
36
44
|
private c?;
|
|
37
45
|
parent: Environment;
|
|
38
46
|
memory: BuiltInMemory;
|
|
39
47
|
cache?: Map<Identifier, IdentifierDefinition[]>;
|
|
40
48
|
builtInEnv?: true;
|
|
49
|
+
/** marks the global environment (`.GlobalEnv`); attached packages (see {@link EnvType}) live below it */
|
|
50
|
+
globalEnv?: true;
|
|
41
51
|
constructor(parent: Environment, isBuiltInDefault?: true | undefined);
|
|
52
|
+
/** Marks this as an attached-package layer (see {@link EnvType}) for package `name`. */
|
|
53
|
+
asLibrary(name: string, type: EnvType): this;
|
|
54
|
+
/** Marks this as the global environment (`.GlobalEnv`); see {@link globalEnv}. */
|
|
55
|
+
asGlobal(): this;
|
|
42
56
|
/** please only use if you know what you are doing */
|
|
43
57
|
setClosureNodeId(nodeId: NodeId): void;
|
|
44
|
-
/**
|
|
45
|
-
* Provides the closure linked to this environment.
|
|
46
|
-
* This is of importance if, for example, if you want to know the function definition associated with this environment.
|
|
47
|
-
*/
|
|
58
|
+
/** Provides the closure linked to this environment. */
|
|
48
59
|
get closure(): NodeId | undefined;
|
|
49
60
|
/**
|
|
50
|
-
* Create a clone of this environment.
|
|
51
|
-
* (never mutated in place) and hence shared with the clone.
|
|
61
|
+
* Create a clone of this environment.
|
|
52
62
|
* @param recurseParents - Whether to also clone parent environments
|
|
53
63
|
*/
|
|
54
64
|
clone(recurseParents: boolean): Environment;
|
|
@@ -64,34 +74,43 @@ export declare class Environment implements IEnvironment {
|
|
|
64
74
|
name: Identifier;
|
|
65
75
|
}): Environment;
|
|
66
76
|
/**
|
|
67
|
-
*
|
|
68
|
-
* <b>But</b> if all definitions within other are maybe, then they are appended to the current definitions (updating them to be `maybe` from now on as well), similar to {@link appendEnvironment}.
|
|
69
|
-
* This always recurses parents.
|
|
77
|
+
* Definitions within `other` replace those here by name; if all of `other`'s are maybe, they are appended instead (turning existing ones maybe too), like {@link appendEnvironment}. Always recurses parents.
|
|
70
78
|
*/
|
|
71
79
|
overwrite(other: Environment | undefined, applyCds?: readonly ControlDependency[]): Environment;
|
|
72
80
|
/**
|
|
73
|
-
* Adds all writes of `other` to this environment (
|
|
74
|
-
* This always recurses parents.
|
|
81
|
+
* Adds all writes of `other` to this environment (`other`'s operations *might* happen). Always recurses parents.
|
|
75
82
|
*/
|
|
76
83
|
append(other: Environment | undefined): Environment;
|
|
84
|
+
/**
|
|
85
|
+
* Unions two attached-package blocks, keeping every package once (memory merged for a package in both).
|
|
86
|
+
*/
|
|
87
|
+
private mergePackageBlocks;
|
|
77
88
|
remove(id: Identifier): this;
|
|
78
89
|
removeAll(names: readonly {
|
|
79
90
|
name: Identifier;
|
|
80
91
|
}[]): Environment;
|
|
81
92
|
toJSON(): Jsonified;
|
|
82
93
|
}
|
|
94
|
+
/** Walks up to the global environment (see {@link Environment#globalEnv}), falling back to the last non-builtin env. */
|
|
95
|
+
declare function findGlobalEnvironment(this: void, env: Environment): Environment;
|
|
96
|
+
/**
|
|
97
|
+
* Splices a package block (`blockTop`..`blockBottom`) directly below the global environment. Returns a fresh `current`, cloning only the path down to global.
|
|
98
|
+
*/
|
|
99
|
+
declare function attachPackageBelowGlobal(this: void, current: Environment, blockTop: Environment, blockBottom: Environment): Environment;
|
|
100
|
+
/**
|
|
101
|
+
* Helpers for navigating and manipulating {@link REnvironmentInformation|environments} around the global environment and attached-package search path.
|
|
102
|
+
*/
|
|
103
|
+
export declare const REnvironment: {
|
|
104
|
+
readonly name: "REnvironment";
|
|
105
|
+
/** Walks up to the global environment (`.GlobalEnv`); see {@link findGlobalEnvironment}. */
|
|
106
|
+
readonly findGlobal: typeof findGlobalEnvironment;
|
|
107
|
+
/** Attaches a package block below the global environment; see {@link attachPackageBelowGlobal}. */
|
|
108
|
+
readonly attachBelowGlobal: typeof attachPackageBelowGlobal;
|
|
109
|
+
};
|
|
83
110
|
/**
|
|
84
111
|
* An environment describes a ({@link IEnvironment#parent|scoped}) mapping of names to their definitions ({@link BuiltIns}).
|
|
85
112
|
*
|
|
86
|
-
*
|
|
87
|
-
* the `baseenv`, the `emptyenv`, and other default environments (see https://adv-r.hadley.nz/environments.html).
|
|
88
|
-
* Yet, during the dataflow analysis, we want sometimes to know more (static {@link IdentifierDefinition|reference information})
|
|
89
|
-
* and sometimes know less (to be honest, we do not want that,
|
|
90
|
-
* but statically determining all attached environments is theoretically impossible --- consider attachments by user input).
|
|
91
|
-
*
|
|
92
|
-
* One important environment is the {@link BuiltIns|BuiltInEnvironment} which contains the default definitions for R's built-in functions and constants.
|
|
93
|
-
* This environment is created and provided by the {@link FlowrAnalyzerEnvironmentContext}.
|
|
94
|
-
* During serialization, you may want to rely on the {@link builtInEnvJsonReplacer} to avoid the huge built-in environment.
|
|
113
|
+
* The {@link BuiltIns|BuiltInEnvironment} holds R's built-in functions and constants; during serialization use {@link builtInEnvJsonReplacer} to avoid inlining it.
|
|
95
114
|
* @see {@link define} - to define a new {@link IdentifierDefinition|identifier definition} within an environment
|
|
96
115
|
* @see {@link resolveByName} - to resolve an {@link Identifier|identifier/name} to its {@link IdentifierDefinition|definitions} within an environment
|
|
97
116
|
* @see {@link makeReferenceMaybe} - to attach control dependencies to a reference
|
|
@@ -101,13 +120,11 @@ export declare class Environment implements IEnvironment {
|
|
|
101
120
|
* @see {@link overwriteEnvironment} - to overwrite the definitions in the current environment with those of another one
|
|
102
121
|
*/
|
|
103
122
|
export interface REnvironmentInformation {
|
|
104
|
-
/**
|
|
123
|
+
/** The currently active environment (the stack is represented by the {@link IEnvironment#parent} chain). */
|
|
105
124
|
readonly current: Environment;
|
|
106
125
|
/** nesting level of the environment, will be `0` for the global/root environment */
|
|
107
126
|
readonly level: number;
|
|
108
127
|
}
|
|
109
|
-
/**
|
|
110
|
-
* Helps to serialize an environment, but replaces the built-in environment with a placeholder.
|
|
111
|
-
*/
|
|
128
|
+
/** Serializes an environment, replacing the built-in environment with a placeholder. */
|
|
112
129
|
export declare function builtInEnvJsonReplacer(k: unknown, v: unknown): unknown;
|
|
113
130
|
export {};
|