@eagleoutice/flowr 2.2.13 → 2.2.15
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 +4 -4
- package/cli/repl/commands/repl-cfg.d.ts +2 -2
- package/cli/repl/commands/repl-cfg.js +4 -4
- package/cli/repl/commands/repl-commands.js +3 -3
- package/cli/repl/commands/repl-execute.js +2 -1
- package/cli/repl/server/connection.js +1 -1
- package/cli/script-core/statistics-helper-core.js +1 -1
- package/config.js +1 -1
- package/control-flow/basic-cfg-guided-visitor.d.ts +3 -3
- package/control-flow/cfg-dead-code.d.ts +4 -0
- package/control-flow/cfg-dead-code.js +81 -0
- package/control-flow/cfg-simplification.d.ts +17 -6
- package/control-flow/cfg-simplification.js +23 -19
- package/control-flow/control-flow-graph.d.ts +2 -1
- package/control-flow/control-flow-graph.js +1 -0
- package/control-flow/dfg-cfg-guided-visitor.d.ts +4 -4
- package/control-flow/dfg-cfg-guided-visitor.js +1 -1
- package/control-flow/extract-cfg.d.ts +2 -2
- package/control-flow/extract-cfg.js +70 -67
- package/control-flow/semantic-cfg-guided-visitor.d.ts +17 -8
- package/control-flow/semantic-cfg-guided-visitor.js +50 -17
- package/control-flow/simple-visitor.d.ts +4 -0
- package/control-flow/simple-visitor.js +14 -0
- package/control-flow/syntax-cfg-guided-visitor.d.ts +2 -2
- package/dataflow/environments/built-in-config.d.ts +1 -0
- package/dataflow/environments/built-in.d.ts +10 -1
- package/dataflow/environments/built-in.js +9 -3
- package/dataflow/environments/default-builtin-config.js +1 -1
- package/dataflow/environments/resolve-by-name.d.ts +0 -36
- package/dataflow/environments/resolve-by-name.js +0 -240
- package/dataflow/eval/resolve/alias-tracking.d.ts +87 -0
- package/dataflow/eval/resolve/alias-tracking.js +349 -0
- package/dataflow/eval/resolve/resolve.d.ts +34 -0
- package/dataflow/eval/resolve/resolve.js +93 -0
- package/dataflow/eval/values/general.d.ts +27 -0
- package/dataflow/eval/values/general.js +73 -0
- package/dataflow/eval/values/intervals/interval-constants.d.ts +4 -0
- package/dataflow/eval/values/intervals/interval-constants.js +27 -0
- package/dataflow/eval/values/logical/logical-constants.d.ts +7 -0
- package/dataflow/eval/values/logical/logical-constants.js +31 -0
- package/dataflow/eval/values/r-value.d.ts +58 -0
- package/dataflow/eval/values/r-value.js +90 -0
- package/dataflow/eval/values/scalar/scalar-consatnts.d.ts +15 -0
- package/dataflow/eval/values/scalar/scalar-consatnts.js +35 -0
- package/dataflow/eval/values/sets/set-constants.d.ts +7 -0
- package/dataflow/eval/values/sets/set-constants.js +34 -0
- package/dataflow/eval/values/string/string-constants.d.ts +8 -0
- package/dataflow/eval/values/string/string-constants.js +40 -0
- package/dataflow/eval/values/vectors/vector-constants.d.ts +14 -0
- package/dataflow/eval/values/vectors/vector-constants.js +35 -0
- package/dataflow/graph/unknown-replacement.d.ts +11 -0
- package/dataflow/graph/unknown-replacement.js +12 -0
- package/dataflow/graph/unknown-side-effect.d.ts +7 -0
- package/dataflow/graph/unknown-side-effect.js +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +8 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +4 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +12 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +9 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +12 -15
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +23 -0
- package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
- package/documentation/doc-util/doc-cfg.d.ts +1 -1
- package/documentation/doc-util/doc-cfg.js +3 -3
- package/documentation/doc-util/doc-query.d.ts +6 -3
- package/documentation/doc-util/doc-query.js +3 -1
- package/documentation/print-cfg-wiki.js +31 -31
- package/documentation/print-dataflow-graph-wiki.js +4 -3
- package/documentation/print-engines-wiki.js +1 -1
- package/documentation/print-linter-wiki.d.ts +1 -0
- package/documentation/print-linter-wiki.js +76 -0
- package/documentation/print-query-wiki.js +80 -0
- package/linter/linter-executor.d.ts +9 -0
- package/linter/linter-executor.js +26 -0
- package/linter/linter-format.d.ts +65 -0
- package/linter/linter-format.js +9 -0
- package/linter/linter-rules.d.ts +42 -0
- package/linter/linter-rules.js +14 -0
- package/linter/rules/1-deprecated-functions.d.ts +34 -0
- package/linter/rules/1-deprecated-functions.js +54 -0
- package/linter/rules/2-file-path-validity.d.ts +48 -0
- package/linter/rules/2-file-path-validity.js +93 -0
- package/package.json +2 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -2
- package/queries/catalog/call-context-query/call-context-query-format.js +5 -1
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +2 -0
- package/queries/catalog/cluster-query/cluster-query-format.js +5 -1
- package/queries/catalog/config-query/config-query-format.d.ts +1 -0
- package/queries/catalog/config-query/config-query-format.js +2 -1
- package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +3 -0
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +20 -0
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +81 -0
- package/queries/catalog/control-flow-query/control-flow-query-format.js +34 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -1
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +2 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.js +9 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +33 -32
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -0
- package/queries/catalog/dependencies-query/dependencies-query-format.js +10 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -1
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -0
- package/queries/catalog/id-map-query/id-map-query-format.js +2 -1
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -0
- package/queries/catalog/lineage-query/lineage-query-format.js +5 -1
- package/queries/catalog/linter-query/linter-query-executor.d.ts +3 -0
- package/queries/catalog/linter-query/linter-query-executor.js +28 -0
- package/queries/catalog/linter-query/linter-query-format.d.ts +80 -0
- package/queries/catalog/linter-query/linter-query-format.js +44 -0
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +2 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -1
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
- package/queries/catalog/origin-query/origin-query-format.js +5 -1
- package/queries/catalog/project-query/project-query-executor.js +1 -1
- package/queries/catalog/project-query/project-query-format.d.ts +1 -0
- package/queries/catalog/project-query/project-query-format.js +2 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +3 -3
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +3 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -23
- package/queries/catalog/search-query/search-query-format.d.ts +1 -0
- package/queries/catalog/search-query/search-query-format.js +5 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +9 -1
- package/queries/query.d.ts +143 -1
- package/queries/query.js +4 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +11 -4
- package/r-bridge/retriever.js +1 -1
- package/search/flowr-search-builder.d.ts +31 -2
- package/search/flowr-search-builder.js +30 -0
- package/search/flowr-search.d.ts +7 -1
- package/search/search-executor/search-enrichers.d.ts +73 -0
- package/search/search-executor/search-enrichers.js +101 -0
- package/search/search-executor/search-generators.d.ts +6 -1
- package/search/search-executor/search-generators.js +21 -1
- package/search/search-executor/search-mappers.d.ts +19 -0
- package/search/search-executor/search-mappers.js +21 -0
- package/search/search-executor/search-transformer.d.ts +12 -0
- package/search/search-executor/search-transformer.js +11 -1
- package/slicing/criterion/parse.d.ts +8 -0
- package/slicing/criterion/parse.js +20 -0
- package/util/version.js +1 -1
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAliases = getAliases;
|
|
4
|
+
exports.resolveIdToValue = resolveIdToValue;
|
|
5
|
+
exports.trackAliasInEnvironments = trackAliasInEnvironments;
|
|
6
|
+
exports.trackAliasesInGraph = trackAliasesInGraph;
|
|
7
|
+
exports.resolveToConstants = resolveToConstants;
|
|
8
|
+
const config_1 = require("../../../config");
|
|
9
|
+
const node_id_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
10
|
+
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
11
|
+
const fingerprint_1 = require("../../../slicing/static/fingerprint");
|
|
12
|
+
const visiting_queue_1 = require("../../../slicing/static/visiting-queue");
|
|
13
|
+
const assert_1 = require("../../../util/assert");
|
|
14
|
+
const environment_1 = require("../../environments/environment");
|
|
15
|
+
const identifier_1 = require("../../environments/identifier");
|
|
16
|
+
const resolve_by_name_1 = require("../../environments/resolve-by-name");
|
|
17
|
+
const edge_1 = require("../../graph/edge");
|
|
18
|
+
const unknown_replacement_1 = require("../../graph/unknown-replacement");
|
|
19
|
+
const unknown_side_effect_1 = require("../../graph/unknown-side-effect");
|
|
20
|
+
const vertex_1 = require("../../graph/vertex");
|
|
21
|
+
const general_1 = require("../values/general");
|
|
22
|
+
const r_value_1 = require("../values/r-value");
|
|
23
|
+
const set_constants_1 = require("../values/sets/set-constants");
|
|
24
|
+
const resolve_1 = require("./resolve");
|
|
25
|
+
const AliasHandler = {
|
|
26
|
+
[vertex_1.VertexType.Value]: (sourceId) => [sourceId],
|
|
27
|
+
[vertex_1.VertexType.Use]: getUseAlias,
|
|
28
|
+
[vertex_1.VertexType.FunctionCall]: getFunctionCallAlias,
|
|
29
|
+
[vertex_1.VertexType.FunctionDefinition]: () => undefined,
|
|
30
|
+
[vertex_1.VertexType.VariableDefinition]: () => undefined
|
|
31
|
+
};
|
|
32
|
+
function getFunctionCallAlias(sourceId, dataflow, environment) {
|
|
33
|
+
const identifier = (0, node_id_1.recoverName)(sourceId, dataflow.idMap);
|
|
34
|
+
if (identifier === undefined) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
const defs = (0, resolve_by_name_1.resolveByName)(identifier, environment, identifier_1.ReferenceType.Function);
|
|
38
|
+
if (defs === undefined || defs.length !== 1) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
return [sourceId];
|
|
42
|
+
}
|
|
43
|
+
function getUseAlias(sourceId, dataflow, environment) {
|
|
44
|
+
const definitions = [];
|
|
45
|
+
// Source is Symbol -> resolve definitions of symbol
|
|
46
|
+
const identifier = (0, node_id_1.recoverName)(sourceId, dataflow.idMap);
|
|
47
|
+
if (identifier === undefined) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
const defs = (0, resolve_by_name_1.resolveByName)(identifier, environment);
|
|
51
|
+
if (defs === undefined) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
for (const def of defs) {
|
|
55
|
+
// If one definition is not constant (or a variable aliasing a constant)
|
|
56
|
+
// we can't say for sure what value the source has
|
|
57
|
+
if (def.type === identifier_1.ReferenceType.Variable) {
|
|
58
|
+
if (def.value === undefined) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
definitions.push(...def.value);
|
|
62
|
+
}
|
|
63
|
+
else if (def.type === identifier_1.ReferenceType.Constant || def.type === identifier_1.ReferenceType.BuiltInConstant) {
|
|
64
|
+
definitions.push(def.nodeId);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return definitions;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Gets the definitions / aliases of a node
|
|
74
|
+
*
|
|
75
|
+
* This function is called by the built-in-assignment processor so that we can
|
|
76
|
+
* track assignments inside the environment. The returned ids are stored in
|
|
77
|
+
* the sourceIds value field of their InGraphIdentifierDefinition. This enables
|
|
78
|
+
* us later, in the {@link trackAliasInEnvironments} function, to get all the
|
|
79
|
+
* aliases of an identifier.
|
|
80
|
+
*
|
|
81
|
+
* @param sourceIds - node ids to get the definitions for
|
|
82
|
+
* @param dataflow - dataflow graph
|
|
83
|
+
* @param environment - environment
|
|
84
|
+
* @returns node id of alias
|
|
85
|
+
*/
|
|
86
|
+
function getAliases(sourceIds, dataflow, environment) {
|
|
87
|
+
const definitions = new Set();
|
|
88
|
+
for (const sourceId of sourceIds) {
|
|
89
|
+
const info = dataflow.getVertex(sourceId);
|
|
90
|
+
if (info === undefined) {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
const defs = AliasHandler[info.tag](sourceId, dataflow, environment);
|
|
94
|
+
for (const def of defs ?? []) {
|
|
95
|
+
definitions.add(def);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return [...definitions];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Evaluates the value of a node in the set domain.
|
|
102
|
+
*
|
|
103
|
+
* resolveIdToValue tries to resolve the value using the data it has been given.
|
|
104
|
+
* If the environment is provided the approximation is more precise, as we can
|
|
105
|
+
* track aliases in the environment.
|
|
106
|
+
* Otherwise, the graph is used to try and resolve the nodes value.
|
|
107
|
+
* If neither is provided the value cannot be resolved.
|
|
108
|
+
*
|
|
109
|
+
* This function is also used by the Resolve Value Query and the Dependency Query
|
|
110
|
+
* to resolve values. For e.g. in the Dependency Query it is used to resolve calls
|
|
111
|
+
* like `lapply(c("a", "b", "c"), library, character.only = TRUE)`
|
|
112
|
+
*
|
|
113
|
+
* @param id - The node id or node to resolve
|
|
114
|
+
* @param environment - The current environment used for name resolution
|
|
115
|
+
* @param graph - The graph to resolve in
|
|
116
|
+
* @param idMap - The id map to resolve the node if given as an id
|
|
117
|
+
* @param full - Whether to track aliases on resolve
|
|
118
|
+
*/
|
|
119
|
+
function resolveIdToValue(id, { environment, graph, idMap, full = true }) {
|
|
120
|
+
if (id === undefined) {
|
|
121
|
+
return r_value_1.Top;
|
|
122
|
+
}
|
|
123
|
+
idMap ??= graph?.idMap;
|
|
124
|
+
const node = typeof id === 'object' ? id : idMap?.get(id);
|
|
125
|
+
if (node === undefined) {
|
|
126
|
+
return r_value_1.Top;
|
|
127
|
+
}
|
|
128
|
+
switch (node.type) {
|
|
129
|
+
case type_1.RType.Argument:
|
|
130
|
+
case type_1.RType.Symbol:
|
|
131
|
+
if (environment) {
|
|
132
|
+
return full ? trackAliasInEnvironments(node.lexeme, environment, graph, idMap) : r_value_1.Top;
|
|
133
|
+
}
|
|
134
|
+
else if (graph && (0, config_1.getConfig)().solver.variables === config_1.VariableResolve.Alias) {
|
|
135
|
+
return full ? trackAliasesInGraph(node.info.id, graph, idMap) : r_value_1.Top;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return r_value_1.Top;
|
|
139
|
+
}
|
|
140
|
+
case type_1.RType.FunctionCall:
|
|
141
|
+
return (0, set_constants_1.setFrom)((0, resolve_1.resolveNode)(node, environment, graph, idMap));
|
|
142
|
+
case type_1.RType.String:
|
|
143
|
+
case type_1.RType.Number:
|
|
144
|
+
case type_1.RType.Logical:
|
|
145
|
+
return (0, set_constants_1.setFrom)((0, general_1.valueFromRNodeConstant)(node));
|
|
146
|
+
default:
|
|
147
|
+
return r_value_1.Top;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Please use {@link resolveIdToValue}
|
|
152
|
+
*
|
|
153
|
+
* Uses the aliases that were tracked in the environments (by the
|
|
154
|
+
* {@link getAliases} function) to resolve a node to a value.
|
|
155
|
+
*
|
|
156
|
+
*
|
|
157
|
+
* @param identifier - Identifier to resolve
|
|
158
|
+
* @param use - Environment to use
|
|
159
|
+
* @param graph - Dataflow graph
|
|
160
|
+
* @param idMap - id map of Dataflow graph
|
|
161
|
+
* @returns Value of Identifier or Top
|
|
162
|
+
*/
|
|
163
|
+
function trackAliasInEnvironments(identifier, use, graph, idMap) {
|
|
164
|
+
if (identifier === undefined) {
|
|
165
|
+
return r_value_1.Top;
|
|
166
|
+
}
|
|
167
|
+
const defs = (0, resolve_by_name_1.resolveByName)(identifier, use);
|
|
168
|
+
if (defs === undefined) {
|
|
169
|
+
return r_value_1.Top;
|
|
170
|
+
}
|
|
171
|
+
const values = new Set();
|
|
172
|
+
for (const def of defs) {
|
|
173
|
+
if (def.type === identifier_1.ReferenceType.BuiltInConstant) {
|
|
174
|
+
values.add((0, general_1.valueFromTsValue)(def.value));
|
|
175
|
+
}
|
|
176
|
+
else if (def.type === identifier_1.ReferenceType.BuiltInFunction) {
|
|
177
|
+
// Tracked in #1207
|
|
178
|
+
}
|
|
179
|
+
else if (def.value !== undefined) {
|
|
180
|
+
/* if there is at least one location for which we have no idea, we have to give up for now! */
|
|
181
|
+
if (def.value.length === 0) {
|
|
182
|
+
return r_value_1.Top;
|
|
183
|
+
}
|
|
184
|
+
for (const alias of def.value) {
|
|
185
|
+
const definitionOfAlias = idMap?.get(alias);
|
|
186
|
+
if (definitionOfAlias !== undefined) {
|
|
187
|
+
const value = (0, resolve_1.resolveNode)(definitionOfAlias, use, graph, idMap);
|
|
188
|
+
if ((0, r_value_1.isTop)(value)) {
|
|
189
|
+
return r_value_1.Top;
|
|
190
|
+
}
|
|
191
|
+
values.add(value);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (values.size == 0) {
|
|
197
|
+
return r_value_1.Top;
|
|
198
|
+
}
|
|
199
|
+
return (0, set_constants_1.setFrom)(...values);
|
|
200
|
+
}
|
|
201
|
+
(0, unknown_side_effect_1.onUnknownSideEffect)((_graph, env, _id, target) => {
|
|
202
|
+
if (target) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
let current = env.current;
|
|
206
|
+
while (current) {
|
|
207
|
+
current.memory.forEach(mem => mem.forEach((def) => {
|
|
208
|
+
if (def.type !== identifier_1.ReferenceType.BuiltInConstant
|
|
209
|
+
&& def.type !== identifier_1.ReferenceType.BuiltInFunction
|
|
210
|
+
&& def.value !== undefined) {
|
|
211
|
+
def.value.length = 0;
|
|
212
|
+
}
|
|
213
|
+
}));
|
|
214
|
+
current = current.parent;
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
(0, unknown_replacement_1.onReplacementOperator)((args) => {
|
|
218
|
+
if (!args.target) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
let current = args.env.current;
|
|
222
|
+
while (current) {
|
|
223
|
+
const defs = current.memory.get(args.target);
|
|
224
|
+
defs?.forEach(def => {
|
|
225
|
+
if (def.type !== identifier_1.ReferenceType.BuiltInConstant
|
|
226
|
+
&& def.type !== identifier_1.ReferenceType.BuiltInFunction
|
|
227
|
+
&& def.value !== undefined) {
|
|
228
|
+
def.value.length = 0;
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
current = current.parent;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
function isNestedInLoop(node, ast) {
|
|
235
|
+
const parent = node?.info.parent;
|
|
236
|
+
if (node === undefined || !parent) {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
const parentNode = ast.get(parent);
|
|
240
|
+
if (parentNode === undefined) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
if (parentNode.type === type_1.RType.WhileLoop || parentNode.type === type_1.RType.RepeatLoop) {
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
return isNestedInLoop(parentNode, ast);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Please use {@link resolveIdToValue}
|
|
250
|
+
*
|
|
251
|
+
* Tries to resolve the value of a node by traversing the dataflow graph
|
|
252
|
+
*
|
|
253
|
+
* @param id - node to resolve
|
|
254
|
+
* @param graph - dataflow graph
|
|
255
|
+
* @param idMap - idmap of dataflow graph
|
|
256
|
+
* @returns Value of node or Top/Bottom
|
|
257
|
+
*/
|
|
258
|
+
function trackAliasesInGraph(id, graph, idMap) {
|
|
259
|
+
idMap ??= graph.idMap;
|
|
260
|
+
(0, assert_1.guard)(idMap !== undefined, 'The ID map is required to get the lineage of a node');
|
|
261
|
+
const start = graph.getVertex(id);
|
|
262
|
+
(0, assert_1.guard)(start !== undefined, 'Unable to find start for alias tracking');
|
|
263
|
+
const queue = new visiting_queue_1.VisitingQueue(25);
|
|
264
|
+
const clean = (0, environment_1.initializeCleanEnvironments)();
|
|
265
|
+
const cleanFingerprint = (0, fingerprint_1.envFingerprint)(clean);
|
|
266
|
+
queue.add(id, clean, cleanFingerprint, false);
|
|
267
|
+
let forceBot = false;
|
|
268
|
+
const resultIds = [];
|
|
269
|
+
while (queue.nonEmpty()) {
|
|
270
|
+
const { id, baseEnvironment } = queue.next();
|
|
271
|
+
const res = graph.get(id);
|
|
272
|
+
if (!res) {
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
const [vertex, outgoingEdges] = res;
|
|
276
|
+
const cds = vertex.cds;
|
|
277
|
+
for (const cd of cds ?? []) {
|
|
278
|
+
const target = graph.idMap?.get(cd.id);
|
|
279
|
+
if (target === undefined) {
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
if (target.type === type_1.RType.WhileLoop || target.type === type_1.RType.RepeatLoop) {
|
|
283
|
+
forceBot = true;
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (!forceBot && (cds?.length === 0 && isNestedInLoop(idMap.get(id), idMap))) {
|
|
288
|
+
forceBot = true;
|
|
289
|
+
}
|
|
290
|
+
if (forceBot) {
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
if (vertex.tag === vertex_1.VertexType.Value) {
|
|
294
|
+
resultIds.push(id);
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
else if (vertex.tag === vertex_1.VertexType.FunctionDefinition) {
|
|
298
|
+
resultIds.push(id);
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
const isFn = vertex.tag === vertex_1.VertexType.FunctionCall;
|
|
302
|
+
// travel all read and defined-by edges
|
|
303
|
+
for (const [targetId, edge] of outgoingEdges) {
|
|
304
|
+
if (isFn) {
|
|
305
|
+
if (edge.types === edge_1.EdgeType.Returns || edge.types === edge_1.EdgeType.DefinedByOnCall || edge.types === edge_1.EdgeType.DefinedBy) {
|
|
306
|
+
queue.add(targetId, baseEnvironment, cleanFingerprint, false);
|
|
307
|
+
}
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
// currently, they have to be exact!
|
|
311
|
+
if (edge.types === edge_1.EdgeType.Reads || edge.types === edge_1.EdgeType.DefinedBy || edge.types === edge_1.EdgeType.DefinedByOnCall) {
|
|
312
|
+
queue.add(targetId, baseEnvironment, cleanFingerprint, false);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (forceBot || resultIds.length === 0) {
|
|
317
|
+
return r_value_1.Bottom;
|
|
318
|
+
}
|
|
319
|
+
const values = new Set();
|
|
320
|
+
for (const id of resultIds) {
|
|
321
|
+
const node = idMap.get(id);
|
|
322
|
+
if (node !== undefined) {
|
|
323
|
+
values.add((0, general_1.valueFromRNodeConstant)(node));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return (0, set_constants_1.setFrom)(...values);
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Please use {@link resolveIdToValue}
|
|
330
|
+
*
|
|
331
|
+
* Resolve an Identifier to a constant, if the identifier is a constant
|
|
332
|
+
*
|
|
333
|
+
* @param name - Identifier to resolve
|
|
334
|
+
* @param environment - Environment to use
|
|
335
|
+
* @returns Value of Constant or Top
|
|
336
|
+
*/
|
|
337
|
+
function resolveToConstants(name, environment) {
|
|
338
|
+
if (name === undefined) {
|
|
339
|
+
return r_value_1.Top;
|
|
340
|
+
}
|
|
341
|
+
const definitions = (0, resolve_by_name_1.resolveByName)(name, environment, identifier_1.ReferenceType.Constant);
|
|
342
|
+
if (definitions === undefined) {
|
|
343
|
+
return r_value_1.Top;
|
|
344
|
+
}
|
|
345
|
+
const values = new Set();
|
|
346
|
+
definitions.forEach(def => values.add((0, general_1.valueFromTsValue)(def.value ?? r_value_1.Top)));
|
|
347
|
+
return (0, set_constants_1.setFrom)(...values);
|
|
348
|
+
}
|
|
349
|
+
//# sourceMappingURL=alias-tracking.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AstIdMap, RNodeWithParent } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
2
|
+
import type { REnvironmentInformation } from '../../environments/environment';
|
|
3
|
+
import type { DataflowGraph } from '../../graph/graph';
|
|
4
|
+
import type { Value } from '../values/r-value';
|
|
5
|
+
/**
|
|
6
|
+
* Helper function used by {@link resolveIdToValue}, please use that instead, if
|
|
7
|
+
* you want to resolve the value of a identifier / node
|
|
8
|
+
*
|
|
9
|
+
* This function converts an RNode to its Value, but also recursivly resolves
|
|
10
|
+
* aliases and vectors (in case of a vector).
|
|
11
|
+
*
|
|
12
|
+
* @param a - Ast node to resolve
|
|
13
|
+
* @param env - Environment to use
|
|
14
|
+
* @param graph - Dataflow Graph to use
|
|
15
|
+
* @param map - Idmap of Dataflow Graph
|
|
16
|
+
* @returns resolved value or top/bottom
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveNode(a: RNodeWithParent, env?: REnvironmentInformation, graph?: DataflowGraph, map?: AstIdMap): Value;
|
|
19
|
+
/**
|
|
20
|
+
* Helper function used by {@link resolveIdToValue}, please use that instead, if
|
|
21
|
+
* you want to resolve the value of a identifier / node
|
|
22
|
+
*
|
|
23
|
+
* This function converts an rnode to a Value Vector {@link vectorFrom}
|
|
24
|
+
* It also recursivly resolves any symbols, values, function calls (only c), in
|
|
25
|
+
* order to construct the value of the vector to resolve by calling {@link resolveIdToValue}
|
|
26
|
+
* or {@link resolveNode}
|
|
27
|
+
*
|
|
28
|
+
* @param a - Node of the vector to resolve
|
|
29
|
+
* @param env - Environment to use
|
|
30
|
+
* @param graph - Dataflow graph
|
|
31
|
+
* @param map - Idmap of Dataflow Graph
|
|
32
|
+
* @returns ValueVector or Top
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveAsVector(a: RNodeWithParent, env: REnvironmentInformation, graph?: DataflowGraph, map?: AstIdMap): Value;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveNode = resolveNode;
|
|
4
|
+
exports.resolveAsVector = resolveAsVector;
|
|
5
|
+
const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
6
|
+
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
7
|
+
const assert_1 = require("../../../util/assert");
|
|
8
|
+
const built_in_1 = require("../../environments/built-in");
|
|
9
|
+
const dfg_get_origin_1 = require("../../origin/dfg-get-origin");
|
|
10
|
+
const interval_constants_1 = require("../values/intervals/interval-constants");
|
|
11
|
+
const logical_constants_1 = require("../values/logical/logical-constants");
|
|
12
|
+
const r_value_1 = require("../values/r-value");
|
|
13
|
+
const string_constants_1 = require("../values/string/string-constants");
|
|
14
|
+
const vector_constants_1 = require("../values/vectors/vector-constants");
|
|
15
|
+
const alias_tracking_1 = require("./alias-tracking");
|
|
16
|
+
/**
|
|
17
|
+
* Helper function used by {@link resolveIdToValue}, please use that instead, if
|
|
18
|
+
* you want to resolve the value of a identifier / node
|
|
19
|
+
*
|
|
20
|
+
* This function converts an RNode to its Value, but also recursivly resolves
|
|
21
|
+
* aliases and vectors (in case of a vector).
|
|
22
|
+
*
|
|
23
|
+
* @param a - Ast node to resolve
|
|
24
|
+
* @param env - Environment to use
|
|
25
|
+
* @param graph - Dataflow Graph to use
|
|
26
|
+
* @param map - Idmap of Dataflow Graph
|
|
27
|
+
* @returns resolved value or top/bottom
|
|
28
|
+
*/
|
|
29
|
+
function resolveNode(a, env, graph, map) {
|
|
30
|
+
if (a.type === type_1.RType.String) {
|
|
31
|
+
return (0, string_constants_1.stringFrom)(a.content.str);
|
|
32
|
+
}
|
|
33
|
+
else if (a.type === type_1.RType.Number) {
|
|
34
|
+
return (0, interval_constants_1.intervalFrom)(a.content.num, a.content.num);
|
|
35
|
+
}
|
|
36
|
+
else if (a.type === type_1.RType.Logical) {
|
|
37
|
+
return a.content.valueOf() ? logical_constants_1.ValueLogicalTrue : logical_constants_1.ValueLogicalFalse;
|
|
38
|
+
}
|
|
39
|
+
else if (a.type === type_1.RType.FunctionCall && env && graph) {
|
|
40
|
+
const origin = (0, dfg_get_origin_1.getOriginInDfg)(graph, a.info.id)?.[0];
|
|
41
|
+
if (origin === undefined || origin.type !== 3 /* OriginType.BuiltInFunctionOrigin */) {
|
|
42
|
+
return r_value_1.Top;
|
|
43
|
+
}
|
|
44
|
+
if (origin.proc in built_in_1.BuiltInEvalHandlerMapper) {
|
|
45
|
+
const handler = built_in_1.BuiltInEvalHandlerMapper[origin.proc];
|
|
46
|
+
return handler(a, env, graph, map);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return r_value_1.Top;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Helper function used by {@link resolveIdToValue}, please use that instead, if
|
|
53
|
+
* you want to resolve the value of a identifier / node
|
|
54
|
+
*
|
|
55
|
+
* This function converts an rnode to a Value Vector {@link vectorFrom}
|
|
56
|
+
* It also recursivly resolves any symbols, values, function calls (only c), in
|
|
57
|
+
* order to construct the value of the vector to resolve by calling {@link resolveIdToValue}
|
|
58
|
+
* or {@link resolveNode}
|
|
59
|
+
*
|
|
60
|
+
* @param a - Node of the vector to resolve
|
|
61
|
+
* @param env - Environment to use
|
|
62
|
+
* @param graph - Dataflow graph
|
|
63
|
+
* @param map - Idmap of Dataflow Graph
|
|
64
|
+
* @returns ValueVector or Top
|
|
65
|
+
*/
|
|
66
|
+
function resolveAsVector(a, env, graph, map) {
|
|
67
|
+
(0, assert_1.guard)(a.type === type_1.RType.FunctionCall);
|
|
68
|
+
const values = [];
|
|
69
|
+
for (const arg of a.arguments) {
|
|
70
|
+
if (arg === r_function_call_1.EmptyArgument) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (arg.value === undefined) {
|
|
74
|
+
return r_value_1.Top;
|
|
75
|
+
}
|
|
76
|
+
if (arg.value.type === type_1.RType.Symbol) {
|
|
77
|
+
const value = (0, alias_tracking_1.resolveIdToValue)(arg.info.id, { environment: env, idMap: map, graph: graph, full: true });
|
|
78
|
+
if ((0, r_value_1.isTop)(value)) {
|
|
79
|
+
return r_value_1.Top;
|
|
80
|
+
}
|
|
81
|
+
values.push(value);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
const val = resolveNode(arg.value, env, graph, map);
|
|
85
|
+
if ((0, r_value_1.isTop)(val)) {
|
|
86
|
+
return r_value_1.Top;
|
|
87
|
+
}
|
|
88
|
+
values.push(val);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return (0, vector_constants_1.vectorFrom)((0, vector_constants_1.flattenVectorElements)(values));
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { RNodeWithParent } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
2
|
+
import type { Lift, Value, ValueSet } from './r-value';
|
|
3
|
+
import { Bottom, Top } from './r-value';
|
|
4
|
+
/**
|
|
5
|
+
* Takes n potentially lifted ops and returns `Top` or `Bottom` if any is `Top` or `Bottom`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function bottomTopGuard(...a: Lift<unknown>[]): typeof Top | typeof Bottom | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Returns a value set, if a is not bottom or top, otherwise undefined.
|
|
10
|
+
* Useful when working with values returned by {@link resolveIdToValue}
|
|
11
|
+
*
|
|
12
|
+
* @param a - value set to check
|
|
13
|
+
* @returns value set if a is not top or bottom
|
|
14
|
+
*/
|
|
15
|
+
export declare function valueSetGuard(a: Lift<ValueSet<Value[]>>): ValueSet<Value[]> | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Constructs an Abstract Value from a normal TS value
|
|
18
|
+
* @param a - ts value
|
|
19
|
+
* @returns abstract value
|
|
20
|
+
*/
|
|
21
|
+
export declare function valueFromTsValue(a: unknown): Value;
|
|
22
|
+
/**
|
|
23
|
+
* Converts a constant from an RNode into an abstract value
|
|
24
|
+
* @param a - RNode constant
|
|
25
|
+
* @returns abstract value
|
|
26
|
+
*/
|
|
27
|
+
export declare function valueFromRNodeConstant(a: RNodeWithParent): Value;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bottomTopGuard = bottomTopGuard;
|
|
4
|
+
exports.valueSetGuard = valueSetGuard;
|
|
5
|
+
exports.valueFromTsValue = valueFromTsValue;
|
|
6
|
+
exports.valueFromRNodeConstant = valueFromRNodeConstant;
|
|
7
|
+
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
8
|
+
const interval_constants_1 = require("./intervals/interval-constants");
|
|
9
|
+
const logical_constants_1 = require("./logical/logical-constants");
|
|
10
|
+
const r_value_1 = require("./r-value");
|
|
11
|
+
const string_constants_1 = require("./string/string-constants");
|
|
12
|
+
/**
|
|
13
|
+
* Takes n potentially lifted ops and returns `Top` or `Bottom` if any is `Top` or `Bottom`.
|
|
14
|
+
*/
|
|
15
|
+
function bottomTopGuard(...a) {
|
|
16
|
+
if (a.some(r_value_1.isBottom)) {
|
|
17
|
+
return r_value_1.Bottom;
|
|
18
|
+
}
|
|
19
|
+
else if (a.some(r_value_1.isTop)) {
|
|
20
|
+
return r_value_1.Top;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Returns a value set, if a is not bottom or top, otherwise undefined.
|
|
25
|
+
* Useful when working with values returned by {@link resolveIdToValue}
|
|
26
|
+
*
|
|
27
|
+
* @param a - value set to check
|
|
28
|
+
* @returns value set if a is not top or bottom
|
|
29
|
+
*/
|
|
30
|
+
function valueSetGuard(a) {
|
|
31
|
+
return ((0, r_value_1.isBottom)(a) || (0, r_value_1.isTop)(a)) ? undefined : a;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Constructs an Abstract Value from a normal TS value
|
|
35
|
+
* @param a - ts value
|
|
36
|
+
* @returns abstract value
|
|
37
|
+
*/
|
|
38
|
+
function valueFromTsValue(a) {
|
|
39
|
+
if (a === undefined) {
|
|
40
|
+
return r_value_1.Bottom;
|
|
41
|
+
}
|
|
42
|
+
else if (a === null) {
|
|
43
|
+
return r_value_1.Top;
|
|
44
|
+
}
|
|
45
|
+
else if (typeof a === 'string') {
|
|
46
|
+
return (0, string_constants_1.stringFrom)(a);
|
|
47
|
+
}
|
|
48
|
+
else if (typeof a === 'number') {
|
|
49
|
+
return (0, interval_constants_1.intervalFrom)(a, a);
|
|
50
|
+
}
|
|
51
|
+
else if (typeof a === 'boolean') {
|
|
52
|
+
return a ? logical_constants_1.ValueLogicalTrue : logical_constants_1.ValueLogicalFalse;
|
|
53
|
+
}
|
|
54
|
+
return r_value_1.Top;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Converts a constant from an RNode into an abstract value
|
|
58
|
+
* @param a - RNode constant
|
|
59
|
+
* @returns abstract value
|
|
60
|
+
*/
|
|
61
|
+
function valueFromRNodeConstant(a) {
|
|
62
|
+
if (a.type === type_1.RType.String) {
|
|
63
|
+
return (0, string_constants_1.stringFrom)(a.content.str);
|
|
64
|
+
}
|
|
65
|
+
else if (a.type === type_1.RType.Number) {
|
|
66
|
+
return (0, interval_constants_1.intervalFrom)(a.content.num, a.content.num);
|
|
67
|
+
}
|
|
68
|
+
else if (a.type === type_1.RType.Logical) {
|
|
69
|
+
return a.content.valueOf() ? logical_constants_1.ValueLogicalTrue : logical_constants_1.ValueLogicalFalse;
|
|
70
|
+
}
|
|
71
|
+
return r_value_1.Top;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=general.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RNumberValue } from '../../../../r-bridge/lang-4.x/convert-values';
|
|
2
|
+
import type { Lift, ValueInterval, ValueNumber } from '../r-value';
|
|
3
|
+
export declare function intervalFrom(start: RNumberValue | number, end?: number | RNumberValue, startInclusive?: boolean, endInclusive?: boolean): ValueInterval;
|
|
4
|
+
export declare function intervalFromValues(start: Lift<ValueNumber>, end?: Lift<ValueNumber<Lift<RNumberValue>>>, startInclusive?: boolean, endInclusive?: boolean): ValueInterval;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.intervalFrom = intervalFrom;
|
|
4
|
+
exports.intervalFromValues = intervalFromValues;
|
|
5
|
+
const r_value_1 = require("../r-value");
|
|
6
|
+
const scalar_consatnts_1 = require("../scalar/scalar-consatnts");
|
|
7
|
+
function intervalFrom(start, end = start, startInclusive = true, endInclusive = true) {
|
|
8
|
+
return intervalFromValues(typeof start === 'number' ? (0, scalar_consatnts_1.getScalarFromInteger)(start) : (0, scalar_consatnts_1.liftScalar)(start), typeof end === 'number' ? (0, scalar_consatnts_1.getScalarFromInteger)(end) : (0, scalar_consatnts_1.liftScalar)(end), startInclusive, endInclusive);
|
|
9
|
+
}
|
|
10
|
+
function shiftNum(v) {
|
|
11
|
+
if ((0, r_value_1.isBottom)(v) || (0, r_value_1.isTop)(v)) {
|
|
12
|
+
return (0, scalar_consatnts_1.liftScalar)(v);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return v;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function intervalFromValues(start, end = start, startInclusive = true, endInclusive = true) {
|
|
19
|
+
return {
|
|
20
|
+
type: 'interval',
|
|
21
|
+
start: shiftNum(start),
|
|
22
|
+
end: shiftNum(end),
|
|
23
|
+
startInclusive,
|
|
24
|
+
endInclusive,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=interval-constants.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Lift, TernaryLogical, ValueLogical } from '../r-value';
|
|
2
|
+
export declare function liftLogical(log: Lift<TernaryLogical>): ValueLogical;
|
|
3
|
+
export declare const ValueLogicalTrue: ValueLogical;
|
|
4
|
+
export declare const ValueLogicalFalse: ValueLogical;
|
|
5
|
+
export declare const ValueLogicalMaybe: ValueLogical;
|
|
6
|
+
export declare const ValueLogicalTop: ValueLogical;
|
|
7
|
+
export declare const ValueLogicalBot: ValueLogical;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValueLogicalBot = exports.ValueLogicalTop = exports.ValueLogicalMaybe = exports.ValueLogicalFalse = exports.ValueLogicalTrue = void 0;
|
|
4
|
+
exports.liftLogical = liftLogical;
|
|
5
|
+
const r_value_1 = require("../r-value");
|
|
6
|
+
function liftLogical(log) {
|
|
7
|
+
if (log === r_value_1.Top) {
|
|
8
|
+
return exports.ValueLogicalTop;
|
|
9
|
+
}
|
|
10
|
+
else if (log === r_value_1.Bottom) {
|
|
11
|
+
return exports.ValueLogicalBot;
|
|
12
|
+
}
|
|
13
|
+
else if (log === 'maybe') {
|
|
14
|
+
return exports.ValueLogicalMaybe;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return log ? exports.ValueLogicalTrue : exports.ValueLogicalFalse;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function makeLogical(log) {
|
|
21
|
+
return {
|
|
22
|
+
type: 'logical',
|
|
23
|
+
value: log
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.ValueLogicalTrue = makeLogical(true);
|
|
27
|
+
exports.ValueLogicalFalse = makeLogical(false);
|
|
28
|
+
exports.ValueLogicalMaybe = makeLogical('maybe');
|
|
29
|
+
exports.ValueLogicalTop = makeLogical(r_value_1.Top);
|
|
30
|
+
exports.ValueLogicalBot = makeLogical(r_value_1.Bottom);
|
|
31
|
+
//# sourceMappingURL=logical-constants.js.map
|