@eagleoutice/flowr 2.8.6 → 2.8.8
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 +20 -20
- package/abstract-interpretation/absint-visitor.d.ts +20 -68
- package/abstract-interpretation/absint-visitor.js +44 -54
- package/abstract-interpretation/data-frame/dataframe-domain.d.ts +0 -9
- package/abstract-interpretation/data-frame/dataframe-domain.js +1 -14
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +1 -1
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +2 -0
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +5 -2
- package/abstract-interpretation/data-frame/shape-inference.d.ts +15 -7
- package/abstract-interpretation/data-frame/shape-inference.js +20 -17
- package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
- package/abstract-interpretation/domains/abstract-domain.js +1 -2
- package/abstract-interpretation/domains/product-domain.d.ts +1 -1
- package/abstract-interpretation/domains/product-domain.js +1 -1
- package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-range-domain.js +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +3 -1
- package/abstract-interpretation/domains/state-abstract-domain.js +6 -0
- package/abstract-interpretation/normalized-ast-fold.d.ts +2 -1
- package/abstract-interpretation/normalized-ast-fold.js +8 -1
- package/cli/repl/commands/repl-query.js +7 -9
- package/cli/wiki.d.ts +2 -1
- package/cli/wiki.js +2 -0
- package/control-flow/cfg-dead-code.js +3 -0
- package/control-flow/extract-cfg.js +27 -7
- package/control-flow/semantic-cfg-guided-visitor.d.ts +57 -4
- package/control-flow/semantic-cfg-guided-visitor.js +89 -28
- package/control-flow/useless-loop.d.ts +2 -1
- package/control-flow/useless-loop.js +13 -6
- package/dataflow/environments/built-in-config.d.ts +6 -5
- package/dataflow/environments/built-in.d.ts +107 -34
- package/dataflow/environments/built-in.js +115 -39
- package/dataflow/environments/default-builtin-config.d.ts +113 -67
- package/dataflow/environments/default-builtin-config.js +71 -66
- package/dataflow/environments/diff.js +2 -2
- package/dataflow/environments/environment.js +7 -7
- package/dataflow/environments/identifier.d.ts +4 -2
- package/dataflow/environments/identifier.js +2 -0
- package/dataflow/environments/reference-to-maybe.d.ts +2 -2
- package/dataflow/environments/reference-to-maybe.js +11 -11
- package/dataflow/environments/resolve-by-name.js +17 -6
- package/dataflow/eval/resolve/alias-tracking.js +1 -1
- package/dataflow/eval/resolve/resolve.js +6 -6
- package/dataflow/eval/values/intervals/interval-constants.js +3 -3
- package/dataflow/eval/values/scalar/{scalar-consatnts.d.ts → scalar-constants.d.ts} +2 -2
- package/dataflow/eval/values/scalar/{scalar-consatnts.js → scalar-constants.js} +3 -3
- package/dataflow/eval/values/sets/set-constants.d.ts +4 -2
- package/dataflow/eval/values/sets/set-constants.js +4 -2
- package/dataflow/extractor.js +1 -1
- package/dataflow/fn/exceptions-of-function.d.ts +1 -1
- package/dataflow/fn/exceptions-of-function.js +3 -3
- package/dataflow/graph/call-graph.js +2 -2
- package/dataflow/graph/dataflowgraph-builder.d.ts +4 -4
- package/dataflow/graph/dataflowgraph-builder.js +14 -14
- package/dataflow/graph/diff-dataflow-graph.js +3 -3
- package/dataflow/graph/graph.d.ts +1 -1
- package/dataflow/graph/graph.js +4 -4
- package/dataflow/graph/vertex.d.ts +3 -3
- package/dataflow/info.d.ts +3 -3
- package/dataflow/info.js +11 -11
- package/dataflow/internal/linker.d.ts +9 -0
- package/dataflow/internal/linker.js +33 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +16 -12
- 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 +11 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +20 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.d.ts +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +11 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +0 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +39 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +12 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +36 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +18 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +67 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +11 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +18 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +103 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +8 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +13 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +7 -6
- package/dataflow/internal/process/functions/call/common.js +7 -7
- package/dataflow/internal/process/functions/call/known-call-handling.js +7 -8
- package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +1 -2
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +6 -6
- package/dataflow/internal/process/functions/process-argument.js +2 -2
- package/dataflow/internal/process/functions/process-parameter.js +3 -3
- package/dataflow/internal/process/process-symbol.js +3 -3
- package/dataflow/internal/process/process-uninteresting-leaf.d.ts +3 -1
- package/dataflow/internal/process/process-uninteresting-leaf.js +3 -1
- package/dataflow/internal/process/process-value.d.ts +1 -1
- package/dataflow/internal/process/process-value.js +4 -4
- package/dataflow/origin/dfg-get-symbol-refs.js +1 -1
- package/dataflow/processor.d.ts +1 -1
- package/documentation/doc-util/doc-structure.js +1 -1
- package/documentation/doc-util/doc-types.d.ts +10 -3
- package/documentation/doc-util/doc-types.js +110 -33
- package/documentation/wiki-absint.d.ts +6 -0
- package/documentation/wiki-absint.js +149 -0
- package/documentation/wiki-dataflow-graph.js +11 -10
- package/documentation/wiki-interface.js +2 -1
- package/documentation/wiki-mk/doc-context.d.ts +3 -3
- package/documentation/wiki-mk/doc-context.js +2 -2
- package/documentation/wiki-mk/doc-maker.js +2 -2
- package/documentation/wiki-normalized-ast.d.ts +9 -0
- package/documentation/wiki-normalized-ast.js +40 -52
- package/linter/linter-rules.d.ts +1 -1
- package/linter/rules/seeded-randomness.js +5 -4
- package/linter/rules/useless-loop.d.ts +3 -3
- package/package.json +3 -3
- package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +4 -0
- package/queries/catalog/dependencies-query/dependencies-query-format.js +5 -0
- package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/test-functions.js +82 -0
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +3 -2
- package/queries/catalog/df-shape-query/df-shape-query-format.js +3 -3
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +1 -1
- package/r-bridge/data/data.d.ts +6 -1
- package/r-bridge/data/data.js +8 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +7 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +19 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +7 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +2 -1
- package/r-bridge/lang-4.x/convert-values.d.ts +5 -0
- package/search/flowr-search-filters.d.ts +2 -2
- package/slicing/static/static-slicer.js +2 -2
- package/util/mermaid/cfg.d.ts +10 -3
- package/util/mermaid/cfg.js +39 -10
- package/util/mermaid/dfg.js +5 -5
- package/util/simple-df/dfg-view.js +1 -1
- package/util/text/ansi.d.ts +4 -0
- package/util/text/ansi.js +7 -0
- package/util/version.js +1 -1
|
@@ -5,6 +5,7 @@ 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");
|
|
7
7
|
const cascade_action_1 = require("../../queries/catalog/call-context-query/cascade-action");
|
|
8
|
+
const built_in_1 = require("./built-in");
|
|
8
9
|
const unnamed_call_handling_1 = require("../internal/process/functions/call/unnamed-call-handling");
|
|
9
10
|
const hooks_1 = require("../hooks");
|
|
10
11
|
exports.GgPlotCreate = [
|
|
@@ -89,7 +90,7 @@ exports.GgPlotAddons = [
|
|
|
89
90
|
const PlotAddons = exports.GraphicsPlotAddons.concat(exports.GgPlotImplicitAddons, ...exports.PlotFunctionsWithAddParam);
|
|
90
91
|
const RegexConvIn = /[-/\\^$*+?.()|[\]{}]/g;
|
|
91
92
|
function toRegex(n) {
|
|
92
|
-
return new RegExp(`^(${Array.from(new Set(n)
|
|
93
|
+
return new RegExp(`^(${Array.from(new Set(n), s => s.replaceAll(RegexConvIn, String.raw `\$&`)).filter(s => s.length > 0).join('|')})$`);
|
|
93
94
|
}
|
|
94
95
|
/**
|
|
95
96
|
* Contains the built-in definitions recognized by flowR
|
|
@@ -110,7 +111,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
110
111
|
'pdf', 'jpeg', 'png', 'windows', 'postscript', 'xfig', 'bitmap', 'pictex', 'cairo_pdf', 'svg', 'bmp', 'tiff', 'X11', 'quartz',
|
|
111
112
|
'jitter'
|
|
112
113
|
],
|
|
113
|
-
processor:
|
|
114
|
+
processor: built_in_1.BuiltInProcName.Default,
|
|
114
115
|
config: { readAllArguments: true },
|
|
115
116
|
assumePrimitive: true
|
|
116
117
|
},
|
|
@@ -119,20 +120,20 @@ exports.DefaultBuiltinConfig = [
|
|
|
119
120
|
names: [
|
|
120
121
|
't', 'aperm' /* transpose function, permutation generation */
|
|
121
122
|
],
|
|
122
|
-
processor:
|
|
123
|
+
processor: built_in_1.BuiltInProcName.Default,
|
|
123
124
|
config: { readAllArguments: true },
|
|
124
125
|
assumePrimitive: false
|
|
125
126
|
},
|
|
126
|
-
{ type: 'function', names: ['rm'], processor:
|
|
127
|
-
{ type: 'function', names: ['options'], processor:
|
|
128
|
-
{ type: 'function', names: ['mapply', 'Mapply'], processor:
|
|
129
|
-
{ type: 'function', names: ['lapply', 'sapply', 'vapply'], processor:
|
|
130
|
-
{ type: 'function', names: ['Lapply', 'Sapply', 'Vapply'], processor:
|
|
131
|
-
{ type: 'function', names: ['apply', 'tapply', 'Tapply'], processor:
|
|
132
|
-
{ type: 'function', names: ['print', 'message', 'warning', 'warn', 'info'], processor:
|
|
127
|
+
{ type: 'function', names: ['rm'], processor: built_in_1.BuiltInProcName.Rm, config: {}, assumePrimitive: true },
|
|
128
|
+
{ type: 'function', names: ['options'], processor: built_in_1.BuiltInProcName.Default, config: { hasUnknownSideEffects: true, forceArgs: 'all' }, assumePrimitive: false },
|
|
129
|
+
{ type: 'function', names: ['mapply', 'Mapply'], processor: built_in_1.BuiltInProcName.Apply, config: { indexOfFunction: 0, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
|
|
130
|
+
{ type: 'function', names: ['lapply', 'sapply', 'vapply'], processor: built_in_1.BuiltInProcName.Apply, config: { indexOfFunction: 1, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
|
|
131
|
+
{ type: 'function', names: ['Lapply', 'Sapply', 'Vapply'], processor: built_in_1.BuiltInProcName.Apply, config: { indexOfFunction: 1, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false }, /* functool wrappers */
|
|
132
|
+
{ type: 'function', names: ['apply', 'tapply', 'Tapply'], processor: built_in_1.BuiltInProcName.Apply, config: { indexOfFunction: 2, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
|
|
133
|
+
{ type: 'function', names: ['print', 'message', 'warning', 'warn', 'info'], processor: built_in_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, forceArgs: 'all', hasUnknownSideEffects: { type: 'link-to-last-call', callName: /^sink$/ } }, assumePrimitive: false },
|
|
133
134
|
// graphics base
|
|
134
135
|
{ type: 'function', names: exports.PlotCreate,
|
|
135
|
-
processor:
|
|
136
|
+
processor: built_in_1.BuiltInProcName.Default,
|
|
136
137
|
config: {
|
|
137
138
|
forceArgs: 'all',
|
|
138
139
|
hasUnknownSideEffects: {
|
|
@@ -149,7 +150,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
149
150
|
}, assumePrimitive: true },
|
|
150
151
|
// graphics addons
|
|
151
152
|
{ type: 'function', names: PlotAddons,
|
|
152
|
-
processor:
|
|
153
|
+
processor: built_in_1.BuiltInProcName.Default, config: {
|
|
153
154
|
forceArgs: 'all',
|
|
154
155
|
treatAsFnCall: {
|
|
155
156
|
'facet_grid': ['labeller']
|
|
@@ -178,7 +179,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
178
179
|
{
|
|
179
180
|
type: 'function',
|
|
180
181
|
names: exports.GgPlotAddons,
|
|
181
|
-
processor:
|
|
182
|
+
processor: built_in_1.BuiltInProcName.Default,
|
|
182
183
|
config: {
|
|
183
184
|
libFn: true,
|
|
184
185
|
forceArgs: 'all',
|
|
@@ -191,7 +192,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
191
192
|
{
|
|
192
193
|
type: 'function',
|
|
193
194
|
names: exports.TinyPlotAddons,
|
|
194
|
-
processor:
|
|
195
|
+
processor: built_in_1.BuiltInProcName.Default,
|
|
195
196
|
config: {
|
|
196
197
|
libFn: true,
|
|
197
198
|
forceArgs: 'all',
|
|
@@ -204,7 +205,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
204
205
|
{
|
|
205
206
|
type: 'function',
|
|
206
207
|
names: ['image_write', 'image_capture', 'dev.capture', 'dev.off'],
|
|
207
|
-
processor:
|
|
208
|
+
processor: built_in_1.BuiltInProcName.Default,
|
|
208
209
|
config: {
|
|
209
210
|
libFn: true,
|
|
210
211
|
forceArgs: 'all',
|
|
@@ -214,12 +215,12 @@ exports.DefaultBuiltinConfig = [
|
|
|
214
215
|
}
|
|
215
216
|
}, assumePrimitive: true
|
|
216
217
|
},
|
|
217
|
-
{ type: 'function', names: ['('], processor:
|
|
218
|
-
{ type: 'function', names: ['load', 'load_all', 'setwd', 'set.seed'], processor:
|
|
219
|
-
{ type: 'function', names: ['body', 'formals', 'environment'], processor:
|
|
218
|
+
{ type: 'function', names: ['('], processor: built_in_1.BuiltInProcName.Default, config: { returnsNthArgument: 0 }, assumePrimitive: true },
|
|
219
|
+
{ type: 'function', names: ['load', 'load_all', 'setwd', 'set.seed'], processor: built_in_1.BuiltInProcName.Default, config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: false },
|
|
220
|
+
{ type: 'function', names: ['body', 'formals', 'environment'], processor: built_in_1.BuiltInProcName.Default, config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: true },
|
|
220
221
|
{ type: 'function',
|
|
221
222
|
names: ['.Call', '.External', '.C', '.Fortran'],
|
|
222
|
-
processor:
|
|
223
|
+
processor: built_in_1.BuiltInProcName.Default,
|
|
223
224
|
config: { hasUnknownSideEffects: true, forceArgs: [true],
|
|
224
225
|
treatAsFnCall: {
|
|
225
226
|
'.Call': ['.NAME'],
|
|
@@ -228,56 +229,60 @@ exports.DefaultBuiltinConfig = [
|
|
|
228
229
|
'.Fortran': ['.NAME']
|
|
229
230
|
}
|
|
230
231
|
}, assumePrimitive: true },
|
|
231
|
-
{ type: 'function', names: ['eval'], processor:
|
|
232
|
-
{ type: 'function', names: ['cat'], processor:
|
|
233
|
-
{ type: 'function', names: ['switch'], processor:
|
|
234
|
-
{ type: 'function', names: ['return'], processor:
|
|
232
|
+
{ type: 'function', names: ['eval'], processor: built_in_1.BuiltInProcName.Eval, config: { includeFunctionCall: true }, assumePrimitive: true },
|
|
233
|
+
{ type: 'function', names: ['cat'], processor: built_in_1.BuiltInProcName.Default, config: { forceArgs: 'all', hasUnknownSideEffects: { type: 'link-to-last-call', callName: /^sink$/ } }, assumePrimitive: false },
|
|
234
|
+
{ type: 'function', names: ['switch'], processor: built_in_1.BuiltInProcName.Default, config: { forceArgs: [true] }, assumePrimitive: false },
|
|
235
|
+
{ type: 'function', names: ['return'], processor: built_in_1.BuiltInProcName.Default, config: { returnsNthArgument: 0, cfg: 1 /* ExitPointType.Return */, useAsProcessor: 'builtin:return' }, assumePrimitive: true },
|
|
235
236
|
{
|
|
236
237
|
type: 'function',
|
|
237
238
|
names: ['stop', 'abort', 'cli_abort', 'throw', 'stop_bad_type', 'stop_bad_element_type', 'stop_bad_element_length'],
|
|
238
|
-
processor:
|
|
239
|
-
config: { useAsProcessor:
|
|
239
|
+
processor: built_in_1.BuiltInProcName.Default,
|
|
240
|
+
config: { useAsProcessor: built_in_1.BuiltInProcName.Stop, cfg: 4 /* ExitPointType.Error */, forceArgs: ['all'] },
|
|
240
241
|
assumePrimitive: false
|
|
241
242
|
},
|
|
242
|
-
{ type: 'function', names: ['try'], processor:
|
|
243
|
-
{ type: 'function', names: ['tryCatch', 'tryCatchLog'], processor:
|
|
244
|
-
{ type: 'function', names: ['stopifnot'], processor:
|
|
245
|
-
{ type: 'function', names: ['break'], processor:
|
|
246
|
-
{ type: 'function', names: ['next'], processor:
|
|
247
|
-
{ type: 'function', names: ['{'], processor:
|
|
248
|
-
{ type: 'function', names: ['source'], processor:
|
|
249
|
-
{ type: 'function', names: ['[', '[['], processor:
|
|
250
|
-
{ type: 'function', names: ['$', '@'], processor:
|
|
251
|
-
{ type: 'function', names: ['if'
|
|
252
|
-
{ type: 'function', names: ['
|
|
253
|
-
{ type: 'function', names: ['
|
|
254
|
-
{ type: 'function', names: ['
|
|
255
|
-
{ type: 'function', names: ['
|
|
256
|
-
{ type: 'function', names: ['
|
|
257
|
-
{ type: 'function', names: ['
|
|
258
|
-
{ type: 'function', names: ['
|
|
259
|
-
{ type: 'function', names: ['
|
|
260
|
-
{ type: 'function', names: ['
|
|
261
|
-
{ type: 'function', names: ['
|
|
262
|
-
{ type: 'function', names: ['
|
|
263
|
-
{ type: 'function', names: ['
|
|
264
|
-
{ type: 'function', names: ['
|
|
265
|
-
{ type: 'function', names: ['
|
|
266
|
-
{ type: 'function', names: ['
|
|
267
|
-
{ type: 'function', names: ['
|
|
268
|
-
{ type: 'function', names: ['
|
|
269
|
-
{ type: 'function', names: ['
|
|
270
|
-
{ type: 'function', names: ['
|
|
271
|
-
{ type: 'function', names: ['
|
|
272
|
-
{ type: 'function', names: ['
|
|
273
|
-
{ type: 'function', names: ['
|
|
274
|
-
{ type: 'function', names: ['
|
|
275
|
-
{ type: 'function', names: ['
|
|
276
|
-
{ type: 'function', names: ['
|
|
243
|
+
{ type: 'function', names: ['try'], processor: built_in_1.BuiltInProcName.Try, config: { block: 'expr', handlers: {} }, assumePrimitive: true },
|
|
244
|
+
{ type: 'function', names: ['tryCatch', 'tryCatchLog'], processor: built_in_1.BuiltInProcName.Try, config: { block: 'expr', handlers: { error: 'error', finally: 'finally' } }, assumePrimitive: true },
|
|
245
|
+
{ type: 'function', names: ['stopifnot'], processor: built_in_1.BuiltInProcName.StopIfNot, config: {}, assumePrimitive: false },
|
|
246
|
+
{ type: 'function', names: ['break'], processor: built_in_1.BuiltInProcName.Default, config: { useAsProcessor: 'builtin:break', cfg: 2 /* ExitPointType.Break */ }, assumePrimitive: false },
|
|
247
|
+
{ type: 'function', names: ['next'], processor: built_in_1.BuiltInProcName.Default, config: { cfg: 3 /* ExitPointType.Next */ }, assumePrimitive: false },
|
|
248
|
+
{ type: 'function', names: ['{'], processor: built_in_1.BuiltInProcName.ExpressionList, config: {}, assumePrimitive: true },
|
|
249
|
+
{ type: 'function', names: ['source'], processor: built_in_1.BuiltInProcName.Source, config: { includeFunctionCall: true, forceFollow: false }, assumePrimitive: false },
|
|
250
|
+
{ type: 'function', names: ['[', '[['], processor: built_in_1.BuiltInProcName.Access, config: { treatIndicesAsString: false }, assumePrimitive: true },
|
|
251
|
+
{ type: 'function', names: ['$', '@'], processor: built_in_1.BuiltInProcName.Access, config: { treatIndicesAsString: true }, assumePrimitive: true },
|
|
252
|
+
{ type: 'function', names: ['if'], processor: built_in_1.BuiltInProcName.IfThenElse, config: {}, assumePrimitive: true },
|
|
253
|
+
{ type: 'function', names: ['ifelse', 'fifelse', 'IfElse'], processor: built_in_1.BuiltInProcName.IfThenElse, config: { args: { cond: 'test', yes: 'yes', no: 'no' } }, assumePrimitive: true },
|
|
254
|
+
{ type: 'function', names: ['if_else'], processor: built_in_1.BuiltInProcName.IfThenElse, config: { args: { cond: 'condition', yes: 'true', no: 'false' } }, assumePrimitive: true },
|
|
255
|
+
{ type: 'function', names: ['get'], processor: built_in_1.BuiltInProcName.Get, config: {}, assumePrimitive: false },
|
|
256
|
+
{ type: 'function', names: ['library', 'require'], processor: built_in_1.BuiltInProcName.Library, config: {}, assumePrimitive: false },
|
|
257
|
+
{ type: 'function', names: ['<-', '='], processor: built_in_1.BuiltInProcName.Assignment, config: { canBeReplacement: true }, assumePrimitive: true },
|
|
258
|
+
{ type: 'function', names: [':='], processor: built_in_1.BuiltInProcName.Assignment, config: {}, assumePrimitive: true },
|
|
259
|
+
{ type: 'function', names: ['assign', 'setGeneric', 'setValidity'], processor: built_in_1.BuiltInProcName.Assignment, config: { targetVariable: true, mayHaveMoreArgs: true }, assumePrimitive: true },
|
|
260
|
+
{ type: 'function', names: ['setMethod'], processor: built_in_1.BuiltInProcName.AssignmentLike, config: { targetVariable: true, canBeReplacement: false, target: { idx: 0, name: 'f' }, source: { idx: 2, name: 'definition' } }, assumePrimitive: true },
|
|
261
|
+
{ type: 'function', names: ['delayedAssign'], processor: built_in_1.BuiltInProcName.Assignment, config: { quoteSource: true, targetVariable: true }, assumePrimitive: true },
|
|
262
|
+
{ type: 'function', names: ['<<-'], processor: built_in_1.BuiltInProcName.Assignment, config: { superAssignment: true, canBeReplacement: true }, assumePrimitive: true },
|
|
263
|
+
{ type: 'function', names: ['->'], processor: built_in_1.BuiltInProcName.Assignment, config: { swapSourceAndTarget: true, canBeReplacement: true }, assumePrimitive: true },
|
|
264
|
+
{ type: 'function', names: ['->>'], processor: built_in_1.BuiltInProcName.Assignment, config: { superAssignment: true, swapSourceAndTarget: true, canBeReplacement: true }, assumePrimitive: true },
|
|
265
|
+
{ type: 'function', names: ['&&', '&'], processor: built_in_1.BuiltInProcName.SpecialBinOp, config: { lazy: true, evalRhsWhen: true }, assumePrimitive: true },
|
|
266
|
+
{ type: 'function', names: ['||', '|'], processor: built_in_1.BuiltInProcName.SpecialBinOp, config: { lazy: true, evalRhsWhen: false }, assumePrimitive: true },
|
|
267
|
+
{ type: 'function', names: ['|>', '%>%'], processor: built_in_1.BuiltInProcName.Pipe, config: {}, assumePrimitive: true },
|
|
268
|
+
{ type: 'function', names: ['function', '\\'], processor: built_in_1.BuiltInProcName.FunctionDefinition, config: {}, assumePrimitive: true },
|
|
269
|
+
{ type: 'function', names: ['quote', 'substitute', 'bquote'], processor: built_in_1.BuiltInProcName.Quote, config: { quoteArgumentsWithIndex: 0 }, assumePrimitive: true },
|
|
270
|
+
{ type: 'function', names: ['local'], processor: built_in_1.BuiltInProcName.Local, config: { args: { env: 'envir', expr: 'expr' } }, assumePrimitive: false },
|
|
271
|
+
{ type: 'function', names: ['for'], processor: built_in_1.BuiltInProcName.ForLoop, config: {}, assumePrimitive: true },
|
|
272
|
+
{ type: 'function', names: ['repeat'], processor: built_in_1.BuiltInProcName.RepeatLoop, config: {}, assumePrimitive: true },
|
|
273
|
+
{ type: 'function', names: ['while'], processor: built_in_1.BuiltInProcName.WhileLoop, config: {}, assumePrimitive: true },
|
|
274
|
+
{ type: 'function', names: ['do.call'], processor: built_in_1.BuiltInProcName.Apply, config: { indexOfFunction: 0, unquoteFunction: true }, assumePrimitive: true },
|
|
275
|
+
{ type: 'function', names: ['NextMethod'], processor: built_in_1.BuiltInProcName.Apply, config: { indexOfFunction: 0, unquoteFunction: true, resolveInEnvironment: 'global' }, assumePrimitive: true },
|
|
276
|
+
{ type: 'function', names: ['UseMethod'], processor: built_in_1.BuiltInProcName.S3Dispatch, config: { args: { generic: 'generic', object: 'object' } }, assumePrimitive: true },
|
|
277
|
+
{ type: 'function', names: ['.Primitive', '.Internal'], processor: built_in_1.BuiltInProcName.Apply, config: { indexOfFunction: 0, unquoteFunction: true, resolveInEnvironment: 'global' }, assumePrimitive: true },
|
|
278
|
+
{ type: 'function', names: ['interference'], processor: built_in_1.BuiltInProcName.Apply, config: { unquoteFunction: true, nameOfFunctionArgument: 'propensity_integrand', libFn: true }, assumePrimitive: false },
|
|
279
|
+
{ type: 'function', names: ['ddply'], processor: built_in_1.BuiltInProcName.Apply, config: { unquoteFunction: true, indexOfFunction: 2, nameOfFunctionArgument: '.fun', libFn: true }, assumePrimitive: false },
|
|
280
|
+
{ type: 'function', names: ['list'], processor: built_in_1.BuiltInProcName.List, config: {}, assumePrimitive: true },
|
|
281
|
+
{ type: 'function', names: ['c'], processor: built_in_1.BuiltInProcName.Vector, config: {}, assumePrimitive: true, evalHandler: 'builtin:c' },
|
|
277
282
|
{
|
|
278
283
|
type: 'function',
|
|
279
284
|
names: ['setnames', 'setNames', 'setkey', 'setkeyv', 'setindex', 'setindexv', 'setattr'],
|
|
280
|
-
processor:
|
|
285
|
+
processor: built_in_1.BuiltInProcName.Assignment,
|
|
281
286
|
config: {
|
|
282
287
|
canBeReplacement: false,
|
|
283
288
|
targetVariable: false,
|
|
@@ -296,7 +301,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
296
301
|
/* file creation/removal */
|
|
297
302
|
'dir.create', 'dir_create', 'Sys.chmod', 'unlink', 'file.remove', 'file.rename', 'file.copy', 'file.link', 'file.append', 'Sys.junction'
|
|
298
303
|
],
|
|
299
|
-
processor:
|
|
304
|
+
processor: built_in_1.BuiltInProcName.Default,
|
|
300
305
|
config: { hasUnknownSideEffects: true },
|
|
301
306
|
assumePrimitive: false
|
|
302
307
|
},
|
|
@@ -307,14 +312,14 @@ exports.DefaultBuiltinConfig = [
|
|
|
307
312
|
/* downloader and installer functions (R, devtools, BiocManager) */
|
|
308
313
|
'library.dynam', 'install.packages', 'install', 'install_github', 'install_gitlab', 'install_bitbucket', 'install_url', 'install_git', 'install_svn', 'install_local', 'install_version', 'update_packages',
|
|
309
314
|
],
|
|
310
|
-
processor:
|
|
315
|
+
processor: built_in_1.BuiltInProcName.Default,
|
|
311
316
|
config: { hasUnknownSideEffects: true, libFn: true },
|
|
312
317
|
assumePrimitive: false
|
|
313
318
|
},
|
|
314
319
|
{
|
|
315
320
|
type: 'function',
|
|
316
321
|
names: ['on.exit'],
|
|
317
|
-
processor:
|
|
322
|
+
processor: built_in_1.BuiltInProcName.RegisterHook,
|
|
318
323
|
config: {
|
|
319
324
|
hook: hooks_1.KnownHooks.OnFnExit,
|
|
320
325
|
args: {
|
|
@@ -348,10 +353,10 @@ exports.DefaultBuiltinConfig = [
|
|
|
348
353
|
*/
|
|
349
354
|
function getDefaultProcessor(name) {
|
|
350
355
|
if (name.startsWith(unnamed_call_handling_1.UnnamedFunctionCallPrefix)) {
|
|
351
|
-
return
|
|
356
|
+
return built_in_1.BuiltInProcName.Unnamed;
|
|
352
357
|
}
|
|
353
358
|
const fn = exports.DefaultBuiltinConfig.find(def => (def.names.includes(name) && def.type !== 'constant')
|
|
354
359
|
|| (def.type === 'replacement' && def.suffixes.flatMap(d => def.names.map(n => `${n}${d}`)).includes(name)));
|
|
355
|
-
return fn?.type === 'replacement' ?
|
|
360
|
+
return fn?.type === 'replacement' ? built_in_1.BuiltInProcName.Replacement : fn?.processor;
|
|
356
361
|
}
|
|
357
362
|
//# sourceMappingURL=default-builtin-config.js.map
|
|
@@ -23,7 +23,7 @@ function diffIdentifierReferences(a, b, info) {
|
|
|
23
23
|
if (a.nodeId !== b.nodeId) {
|
|
24
24
|
info.report.addComment(`${info.position}Different nodeIds: ${info.leftname}: ${a.nodeId} vs. ${info.rightname}: ${b.nodeId}`);
|
|
25
25
|
}
|
|
26
|
-
(0, info_1.diffControlDependencies)(a.
|
|
26
|
+
(0, info_1.diffControlDependencies)(a.cds, b.cds, info);
|
|
27
27
|
}
|
|
28
28
|
function diffMemory(a, b, info) {
|
|
29
29
|
for (const [key, value] of a.memory) {
|
|
@@ -44,7 +44,7 @@ function diffMemory(a, b, info) {
|
|
|
44
44
|
if (aVal.nodeId !== bVal.nodeId) {
|
|
45
45
|
info.report.addComment(`${info.position}Different ids for ${key}. ${info.leftname}: ${aVal.nodeId} vs. ${info.rightname}: ${bVal.nodeId}`);
|
|
46
46
|
}
|
|
47
|
-
(0, info_1.diffControlDependencies)(aVal.
|
|
47
|
+
(0, info_1.diffControlDependencies)(aVal.cds, bVal.cds, { ...info, position: `${info.position} For ${key}. ` });
|
|
48
48
|
if (aVal.definedAt !== bVal.definedAt) {
|
|
49
49
|
info.report.addComment(`${info.position}Different definition ids (definedAt) for ${key} (${aVal.nodeId}). ${info.leftname}: ${aVal.definedAt} vs. ${info.rightname}: ${bVal.definedAt}`);
|
|
50
50
|
}
|
|
@@ -51,7 +51,7 @@ class Environment {
|
|
|
51
51
|
.map(([k, v]) => [k,
|
|
52
52
|
v.map(s => ({
|
|
53
53
|
...s,
|
|
54
|
-
|
|
54
|
+
cds: s.cds?.slice()
|
|
55
55
|
}))
|
|
56
56
|
]));
|
|
57
57
|
return clone;
|
|
@@ -65,7 +65,7 @@ class Environment {
|
|
|
65
65
|
const { name } = definition;
|
|
66
66
|
const newEnvironment = this.clone(false);
|
|
67
67
|
// When there are defined indices, merge the definitions
|
|
68
|
-
if (definition.
|
|
68
|
+
if (definition.cds === undefined && !pointerTracking) {
|
|
69
69
|
newEnvironment.memory.set(name, [definition]);
|
|
70
70
|
}
|
|
71
71
|
else {
|
|
@@ -73,7 +73,7 @@ class Environment {
|
|
|
73
73
|
const inGraphDefinition = definition;
|
|
74
74
|
if (pointerTracking &&
|
|
75
75
|
existing !== undefined &&
|
|
76
|
-
inGraphDefinition.
|
|
76
|
+
inGraphDefinition.cds === undefined) {
|
|
77
77
|
if (inGraphDefinition.indicesCollection !== undefined) {
|
|
78
78
|
const defs = (0, define_1.mergeDefinitionsForPointer)(existing, inGraphDefinition);
|
|
79
79
|
newEnvironment.memory.set(name, defs);
|
|
@@ -83,7 +83,7 @@ class Environment {
|
|
|
83
83
|
existing.push(definition);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
else if (existing === undefined || definition.
|
|
86
|
+
else if (existing === undefined || definition.cds === undefined) {
|
|
87
87
|
newEnvironment.memory.set(name, [definition]);
|
|
88
88
|
}
|
|
89
89
|
else {
|
|
@@ -124,7 +124,7 @@ class Environment {
|
|
|
124
124
|
}
|
|
125
125
|
const map = new Map(this.memory);
|
|
126
126
|
for (const [key, values] of other.memory) {
|
|
127
|
-
const hasMaybe = applyCds === undefined ? values.length === 0 || values.some(v => v.
|
|
127
|
+
const hasMaybe = applyCds === undefined ? values.length === 0 || values.some(v => v.cds !== undefined) : true;
|
|
128
128
|
if (hasMaybe) {
|
|
129
129
|
const old = map.get(key);
|
|
130
130
|
// we need to make a copy to avoid side effects for old reference in other environments
|
|
@@ -141,7 +141,7 @@ class Environment {
|
|
|
141
141
|
else {
|
|
142
142
|
updatedOld.push({
|
|
143
143
|
...v,
|
|
144
|
-
|
|
144
|
+
cds: v.cds ? applyCds.concat(v.cds) : applyCds.slice()
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
}
|
|
@@ -186,7 +186,7 @@ class Environment {
|
|
|
186
186
|
if (definition !== undefined) {
|
|
187
187
|
this.memory.delete(name);
|
|
188
188
|
this.cache?.delete(name);
|
|
189
|
-
cont = !definition.every(d => (0, info_1.happensInEveryBranch)(d.
|
|
189
|
+
cont = !definition.every(d => (0, info_1.happensInEveryBranch)(d.cds));
|
|
190
190
|
}
|
|
191
191
|
if (cont) {
|
|
192
192
|
this.parent.remove(name);
|
|
@@ -33,7 +33,9 @@ export declare enum ReferenceType {
|
|
|
33
33
|
/** The identifier is defined by a built-in value/constant */
|
|
34
34
|
BuiltInConstant = 64,
|
|
35
35
|
/** The identifier is defined by a built-in function */
|
|
36
|
-
BuiltInFunction = 128
|
|
36
|
+
BuiltInFunction = 128,
|
|
37
|
+
/** Prefix to identify S3 methods, use this, to for example dispatch a call to `f` which will then link to `f.*` */
|
|
38
|
+
S3MethodPrefix = 256
|
|
37
39
|
}
|
|
38
40
|
/** Reverse mapping of the reference types so you can get the name from the bitmask (useful for debugging) */
|
|
39
41
|
export declare const ReferenceTypeReverseMapping: Map<ReferenceType, string>;
|
|
@@ -74,7 +76,7 @@ export interface IdentifierReference {
|
|
|
74
76
|
* If the reference is only effective, if, for example, an if-then-else condition is true, this references the root of the `if`.
|
|
75
77
|
* As a hacky intermediate solution (until we have pointer-analysis), an empty array may indicate a `maybe` which is due to pointer access (e.g., in `a[x] <- 3`).
|
|
76
78
|
*/
|
|
77
|
-
|
|
79
|
+
cds?: ControlDependency[] | undefined;
|
|
78
80
|
}
|
|
79
81
|
/**
|
|
80
82
|
* The definition of an {@link Identifier|identifier} within the {@link DataflowGraph|graph}.
|
|
@@ -32,6 +32,8 @@ var ReferenceType;
|
|
|
32
32
|
ReferenceType[ReferenceType["BuiltInConstant"] = 64] = "BuiltInConstant";
|
|
33
33
|
/** The identifier is defined by a built-in function */
|
|
34
34
|
ReferenceType[ReferenceType["BuiltInFunction"] = 128] = "BuiltInFunction";
|
|
35
|
+
/** Prefix to identify S3 methods, use this, to for example dispatch a call to `f` which will then link to `f.*` */
|
|
36
|
+
ReferenceType[ReferenceType["S3MethodPrefix"] = 256] = "S3MethodPrefix";
|
|
35
37
|
})(ReferenceType || (exports.ReferenceType = ReferenceType = {}));
|
|
36
38
|
/** Reverse mapping of the reference types so you can get the name from the bitmask (useful for debugging) */
|
|
37
39
|
exports.ReferenceTypeReverseMapping = new Map(Object.entries(ReferenceType).map(([k, v]) => [v, k]));
|
|
@@ -3,11 +3,11 @@ import type { DataflowGraph } from '../graph/graph';
|
|
|
3
3
|
import type { ControlDependency } from '../info';
|
|
4
4
|
import type { REnvironmentInformation } from './environment';
|
|
5
5
|
/**
|
|
6
|
-
* Marks the reference as maybe (i.e., as controlled by a set of {@link IdentifierReference#
|
|
6
|
+
* Marks the reference as maybe (i.e., as controlled by a set of {@link IdentifierReference#cds|control dependencies}).
|
|
7
7
|
*/
|
|
8
8
|
export declare function makeReferenceMaybe(ref: IdentifierReference, graph: DataflowGraph, environments: REnvironmentInformation, includeDefs: boolean, defaultCd?: ControlDependency[] | undefined): IdentifierReference;
|
|
9
9
|
/**
|
|
10
|
-
* Marks all references as maybe (i.e., as controlled by a set of {@link IdentifierReference#
|
|
10
|
+
* Marks all references as maybe (i.e., as controlled by a set of {@link IdentifierReference#cds|control dependencies}).
|
|
11
11
|
* @see {@link makeReferenceMaybe}
|
|
12
12
|
*/
|
|
13
13
|
export declare function makeAllMaybe(references: readonly IdentifierReference[] | undefined, graph: DataflowGraph, environments: REnvironmentInformation, includeDefs: boolean, applyCds?: ControlDependency[] | undefined): IdentifierReference[];
|
|
@@ -18,43 +18,43 @@ function concatCdsUnique(target, toAdd) {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Marks the reference as maybe (i.e., as controlled by a set of {@link IdentifierReference#
|
|
21
|
+
* Marks the reference as maybe (i.e., as controlled by a set of {@link IdentifierReference#cds|control dependencies}).
|
|
22
22
|
*/
|
|
23
23
|
function makeReferenceMaybe(ref, graph, environments, includeDefs, defaultCd = undefined) {
|
|
24
24
|
if (includeDefs) {
|
|
25
25
|
const definitions = ref.name ? (0, resolve_by_name_1.resolveByName)(ref.name, environments, ref.type) : undefined;
|
|
26
26
|
for (const definition of definitions ?? []) {
|
|
27
27
|
if (definition.type !== identifier_1.ReferenceType.BuiltInFunction && definition.type !== identifier_1.ReferenceType.BuiltInConstant) {
|
|
28
|
-
if (definition.
|
|
29
|
-
appToCdsUnique(definition.
|
|
28
|
+
if (definition.cds) {
|
|
29
|
+
appToCdsUnique(definition.cds, defaultCd);
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
|
-
definition.
|
|
32
|
+
definition.cds = defaultCd ? Array.from(defaultCd) : [];
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
const node = graph.getVertex(ref.nodeId, true);
|
|
38
38
|
if (node) {
|
|
39
|
-
if (node.
|
|
40
|
-
appToCdsUnique(node.
|
|
39
|
+
if (node.cds) {
|
|
40
|
+
appToCdsUnique(node.cds, defaultCd);
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
node.
|
|
43
|
+
node.cds = defaultCd ? Array.from(defaultCd) : [];
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
if (ref.
|
|
46
|
+
if (ref.cds) {
|
|
47
47
|
if (defaultCd) {
|
|
48
|
-
return { ...ref,
|
|
48
|
+
return { ...ref, cds: concatCdsUnique(ref.cds, defaultCd) };
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
|
-
return { ...ref,
|
|
52
|
+
return { ...ref, cds: defaultCd ? Array.from(defaultCd) : [] };
|
|
53
53
|
}
|
|
54
54
|
return ref;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* Marks all references as maybe (i.e., as controlled by a set of {@link IdentifierReference#
|
|
57
|
+
* Marks all references as maybe (i.e., as controlled by a set of {@link IdentifierReference#cds|control dependencies}).
|
|
58
58
|
* @see {@link makeReferenceMaybe}
|
|
59
59
|
*/
|
|
60
60
|
function makeAllMaybe(references, graph, environments, includeDefs, applyCds = undefined) {
|
|
@@ -19,7 +19,8 @@ const TargetTypePredicate = {
|
|
|
19
19
|
[identifier_1.ReferenceType.Parameter]: () => true,
|
|
20
20
|
[identifier_1.ReferenceType.Argument]: () => true,
|
|
21
21
|
[identifier_1.ReferenceType.BuiltInConstant]: ({ type }) => (0, identifier_1.isReferenceType)(type, BuiltInConstantTargetTypes),
|
|
22
|
-
[identifier_1.ReferenceType.BuiltInFunction]: ({ type }) => (0, identifier_1.isReferenceType)(type, BuiltInFunctionTargetTypes)
|
|
22
|
+
[identifier_1.ReferenceType.BuiltInFunction]: ({ type }) => (0, identifier_1.isReferenceType)(type, BuiltInFunctionTargetTypes),
|
|
23
|
+
[identifier_1.ReferenceType.S3MethodPrefix]: ({ type }) => (0, identifier_1.isReferenceType)(type, FunctionTargetTypes),
|
|
23
24
|
};
|
|
24
25
|
/**
|
|
25
26
|
* Resolves a given identifier name to a list of its possible definition location using R scoping and resolving rules.
|
|
@@ -38,15 +39,25 @@ function resolveByName(name, environment, target) {
|
|
|
38
39
|
let definitions = undefined;
|
|
39
40
|
const wantedType = TargetTypePredicate[target];
|
|
40
41
|
do {
|
|
41
|
-
|
|
42
|
-
if (
|
|
42
|
+
let definition;
|
|
43
|
+
if (target === identifier_1.ReferenceType.S3MethodPrefix) {
|
|
44
|
+
// S3 method prefixes only resolve to functions
|
|
45
|
+
definition = current.memory.entries()
|
|
46
|
+
.filter(([defName]) => defName.startsWith(name + '.'))
|
|
47
|
+
.flatMap(([, defs]) => defs)
|
|
48
|
+
.toArray();
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
definition = current.memory.get(name);
|
|
52
|
+
}
|
|
53
|
+
if (definition !== undefined && definition.length > 0) {
|
|
43
54
|
const filtered = definition.filter(wantedType);
|
|
44
|
-
if (filtered.length === definition.length && definition.every(d => (0, info_1.happensInEveryBranch)(d.
|
|
55
|
+
if (filtered.length === definition.length && (target !== identifier_1.ReferenceType.Function || definition.every(d => d.type !== identifier_1.ReferenceType.Parameter)) && definition.every(d => (0, info_1.happensInEveryBranch)(d.cds))) {
|
|
45
56
|
return definition;
|
|
46
57
|
}
|
|
47
58
|
else if (filtered.length > 0) {
|
|
48
59
|
if (definitions) {
|
|
49
|
-
definitions
|
|
60
|
+
definitions.push(...filtered);
|
|
50
61
|
}
|
|
51
62
|
else {
|
|
52
63
|
definitions = filtered;
|
|
@@ -76,7 +87,7 @@ function resolveByNameAnyType(name, environment) {
|
|
|
76
87
|
do {
|
|
77
88
|
const definition = current.memory.get(name);
|
|
78
89
|
if (definition) {
|
|
79
|
-
if (definition.every(d => (0, info_1.happensInEveryBranch)(d.
|
|
90
|
+
if (definition.every(d => (0, info_1.happensInEveryBranch)(d.cds))) {
|
|
80
91
|
environment.current.cache ??= new Map();
|
|
81
92
|
environment.current.cache?.set(name, definition);
|
|
82
93
|
return definition;
|
|
@@ -282,7 +282,7 @@ function trackAliasesInGraph(id, graph, ctx, idMap) {
|
|
|
282
282
|
continue;
|
|
283
283
|
}
|
|
284
284
|
const [vertex, outgoingEdges] = res;
|
|
285
|
-
const cds = vertex.
|
|
285
|
+
const cds = vertex.cds;
|
|
286
286
|
for (const cd of cds ?? []) {
|
|
287
287
|
const target = graph.idMap?.get(cd.id);
|
|
288
288
|
if (target === undefined) {
|
|
@@ -16,7 +16,7 @@ const r_value_2 = require("../values/r-value");
|
|
|
16
16
|
const string_constants_1 = require("../values/string/string-constants");
|
|
17
17
|
const vector_constants_1 = require("../values/vectors/vector-constants");
|
|
18
18
|
const alias_tracking_1 = require("./alias-tracking");
|
|
19
|
-
const
|
|
19
|
+
const scalar_constants_1 = require("../values/scalar/scalar-constants");
|
|
20
20
|
/**
|
|
21
21
|
* Helper function used by {@link resolveIdToValue}, please use that instead, if
|
|
22
22
|
* you want to resolve the value of an identifier / node
|
|
@@ -113,7 +113,7 @@ function resolveAsSeq(resolve, operator, ctx, environment, graph, idMap) {
|
|
|
113
113
|
const leftValue = (0, r_value_1.unliftRValue)(leftArg);
|
|
114
114
|
const rightValue = (0, r_value_1.unliftRValue)(rightArg);
|
|
115
115
|
if ((0, r_value_1.isRNumberValue)(leftValue) && (0, r_value_1.isRNumberValue)(rightValue)) {
|
|
116
|
-
return (0, vector_constants_1.vectorFrom)(createNumberSequence(leftValue, rightValue).map(
|
|
116
|
+
return (0, vector_constants_1.vectorFrom)(createNumberSequence(leftValue, rightValue).map(scalar_constants_1.liftScalar));
|
|
117
117
|
}
|
|
118
118
|
return r_value_2.Top;
|
|
119
119
|
}
|
|
@@ -138,10 +138,10 @@ function resolveAsPlus(resolve, operator, ctx, environment, graph, idMap) {
|
|
|
138
138
|
const arg = (0, alias_tracking_1.resolveIdToValue)(operator.operand, resolveInfo);
|
|
139
139
|
const argValue = (0, r_value_1.unliftRValue)(arg);
|
|
140
140
|
if ((0, r_value_1.isRNumberValue)(argValue)) {
|
|
141
|
-
return (0,
|
|
141
|
+
return (0, scalar_constants_1.liftScalar)(argValue);
|
|
142
142
|
}
|
|
143
143
|
else if (Array.isArray(argValue) && argValue.every(r_value_1.isRNumberValue)) {
|
|
144
|
-
return (0, vector_constants_1.vectorFrom)(argValue.map(
|
|
144
|
+
return (0, vector_constants_1.vectorFrom)(argValue.map(scalar_constants_1.liftScalar));
|
|
145
145
|
}
|
|
146
146
|
return r_value_2.Top;
|
|
147
147
|
}
|
|
@@ -166,10 +166,10 @@ function resolveAsMinus(resolve, operator, ctx, environment, graph, idMap) {
|
|
|
166
166
|
const arg = (0, alias_tracking_1.resolveIdToValue)(operator.operand, resolveInfo);
|
|
167
167
|
const argValue = (0, r_value_1.unliftRValue)(arg);
|
|
168
168
|
if ((0, r_value_1.isRNumberValue)(argValue)) {
|
|
169
|
-
return (0,
|
|
169
|
+
return (0, scalar_constants_1.liftScalar)({ ...argValue, num: -argValue.num });
|
|
170
170
|
}
|
|
171
171
|
else if (Array.isArray(argValue) && argValue.every(r_value_1.isRNumberValue)) {
|
|
172
|
-
return (0, vector_constants_1.vectorFrom)(argValue.map(element => (0,
|
|
172
|
+
return (0, vector_constants_1.vectorFrom)(argValue.map(element => (0, scalar_constants_1.liftScalar)({ ...element, num: -element.num })));
|
|
173
173
|
}
|
|
174
174
|
return r_value_2.Top;
|
|
175
175
|
}
|
|
@@ -3,16 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.intervalFrom = intervalFrom;
|
|
4
4
|
exports.intervalFromValues = intervalFromValues;
|
|
5
5
|
const r_value_1 = require("../r-value");
|
|
6
|
-
const
|
|
6
|
+
const scalar_constants_1 = require("../scalar/scalar-constants");
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
function intervalFrom(start, end = start, startInclusive = true, endInclusive = true) {
|
|
11
|
-
return intervalFromValues(typeof start === 'number' ? (0,
|
|
11
|
+
return intervalFromValues(typeof start === 'number' ? (0, scalar_constants_1.getScalarFromInteger)(start) : (0, scalar_constants_1.liftScalar)(start), typeof end === 'number' ? (0, scalar_constants_1.getScalarFromInteger)(end) : (0, scalar_constants_1.liftScalar)(end), startInclusive, endInclusive);
|
|
12
12
|
}
|
|
13
13
|
function shiftNum(v) {
|
|
14
14
|
if ((0, r_value_1.isBottom)(v) || (0, r_value_1.isTop)(v)) {
|
|
15
|
-
return (0,
|
|
15
|
+
return (0, scalar_constants_1.liftScalar)(v);
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
18
18
|
return v;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type Lift, type ValueNumber } from '../r-value';
|
|
2
2
|
import type { RNumberValue } from '../../../../r-bridge/lang-4.x/convert-values';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Given a (ts) number, return a scalar R number value.
|
|
5
5
|
*/
|
|
6
6
|
export declare function getScalarFromInteger(num: number, markedAsInt?: boolean, complexNumber?: boolean): ValueNumber<RNumberValue>;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Take a lifted R number value and wrap it into a ValueNumber.
|
|
9
9
|
*/
|
|
10
10
|
export declare function liftScalar(value: Lift<RNumberValue>): ValueNumber;
|
|
11
11
|
export declare const ValueIntegerOne: ValueNumber<RNumberValue>;
|
|
@@ -5,7 +5,7 @@ exports.getScalarFromInteger = getScalarFromInteger;
|
|
|
5
5
|
exports.liftScalar = liftScalar;
|
|
6
6
|
const r_value_1 = require("../r-value");
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Given a (ts) number, return a scalar R number value.
|
|
9
9
|
*/
|
|
10
10
|
function getScalarFromInteger(num, markedAsInt = Number.isInteger(num), complexNumber = false) {
|
|
11
11
|
return {
|
|
@@ -18,7 +18,7 @@ function getScalarFromInteger(num, markedAsInt = Number.isInteger(num), complexN
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Take a lifted R number value and wrap it into a ValueNumber.
|
|
22
22
|
*/
|
|
23
23
|
function liftScalar(value) {
|
|
24
24
|
return {
|
|
@@ -38,4 +38,4 @@ exports.ValueNumberEpsilon = getScalarFromInteger(epsilon, false);
|
|
|
38
38
|
exports.ValueNumberOneHalf = getScalarFromInteger(0.5, false);
|
|
39
39
|
exports.ValueIntegerTop = liftScalar(r_value_1.Top);
|
|
40
40
|
exports.ValueIntegerBottom = liftScalar(r_value_1.Bottom);
|
|
41
|
-
//# sourceMappingURL=scalar-
|
|
41
|
+
//# sourceMappingURL=scalar-constants.js.map
|