@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.
Files changed (158) hide show
  1. package/README.md +20 -20
  2. package/abstract-interpretation/absint-visitor.d.ts +20 -68
  3. package/abstract-interpretation/absint-visitor.js +44 -54
  4. package/abstract-interpretation/data-frame/dataframe-domain.d.ts +0 -9
  5. package/abstract-interpretation/data-frame/dataframe-domain.js +1 -14
  6. package/abstract-interpretation/data-frame/mappers/function-mapper.js +1 -1
  7. package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +2 -0
  8. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +5 -2
  9. package/abstract-interpretation/data-frame/shape-inference.d.ts +15 -7
  10. package/abstract-interpretation/data-frame/shape-inference.js +20 -17
  11. package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
  12. package/abstract-interpretation/domains/abstract-domain.js +1 -2
  13. package/abstract-interpretation/domains/product-domain.d.ts +1 -1
  14. package/abstract-interpretation/domains/product-domain.js +1 -1
  15. package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
  16. package/abstract-interpretation/domains/set-range-domain.js +1 -1
  17. package/abstract-interpretation/domains/state-abstract-domain.d.ts +3 -1
  18. package/abstract-interpretation/domains/state-abstract-domain.js +6 -0
  19. package/abstract-interpretation/normalized-ast-fold.d.ts +2 -1
  20. package/abstract-interpretation/normalized-ast-fold.js +8 -1
  21. package/cli/repl/commands/repl-query.js +7 -9
  22. package/cli/wiki.d.ts +2 -1
  23. package/cli/wiki.js +2 -0
  24. package/control-flow/cfg-dead-code.js +3 -0
  25. package/control-flow/extract-cfg.js +27 -7
  26. package/control-flow/semantic-cfg-guided-visitor.d.ts +57 -4
  27. package/control-flow/semantic-cfg-guided-visitor.js +89 -28
  28. package/control-flow/useless-loop.d.ts +2 -1
  29. package/control-flow/useless-loop.js +13 -6
  30. package/dataflow/environments/built-in-config.d.ts +6 -5
  31. package/dataflow/environments/built-in.d.ts +107 -34
  32. package/dataflow/environments/built-in.js +115 -39
  33. package/dataflow/environments/default-builtin-config.d.ts +113 -67
  34. package/dataflow/environments/default-builtin-config.js +71 -66
  35. package/dataflow/environments/diff.js +2 -2
  36. package/dataflow/environments/environment.js +7 -7
  37. package/dataflow/environments/identifier.d.ts +4 -2
  38. package/dataflow/environments/identifier.js +2 -0
  39. package/dataflow/environments/reference-to-maybe.d.ts +2 -2
  40. package/dataflow/environments/reference-to-maybe.js +11 -11
  41. package/dataflow/environments/resolve-by-name.js +17 -6
  42. package/dataflow/eval/resolve/alias-tracking.js +1 -1
  43. package/dataflow/eval/resolve/resolve.js +6 -6
  44. package/dataflow/eval/values/intervals/interval-constants.js +3 -3
  45. package/dataflow/eval/values/scalar/{scalar-consatnts.d.ts → scalar-constants.d.ts} +2 -2
  46. package/dataflow/eval/values/scalar/{scalar-consatnts.js → scalar-constants.js} +3 -3
  47. package/dataflow/eval/values/sets/set-constants.d.ts +4 -2
  48. package/dataflow/eval/values/sets/set-constants.js +4 -2
  49. package/dataflow/extractor.js +1 -1
  50. package/dataflow/fn/exceptions-of-function.d.ts +1 -1
  51. package/dataflow/fn/exceptions-of-function.js +3 -3
  52. package/dataflow/graph/call-graph.js +2 -2
  53. package/dataflow/graph/dataflowgraph-builder.d.ts +4 -4
  54. package/dataflow/graph/dataflowgraph-builder.js +14 -14
  55. package/dataflow/graph/diff-dataflow-graph.js +3 -3
  56. package/dataflow/graph/graph.d.ts +1 -1
  57. package/dataflow/graph/graph.js +4 -4
  58. package/dataflow/graph/vertex.d.ts +3 -3
  59. package/dataflow/info.d.ts +3 -3
  60. package/dataflow/info.js +11 -11
  61. package/dataflow/internal/linker.d.ts +9 -0
  62. package/dataflow/internal/linker.js +33 -7
  63. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +16 -12
  64. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
  65. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +11 -10
  66. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +20 -17
  67. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
  68. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +4 -3
  69. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +1 -1
  70. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -9
  71. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.d.ts +5 -1
  72. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +11 -6
  73. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +0 -7
  74. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +39 -6
  75. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +2 -1
  76. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +12 -1
  77. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +36 -12
  78. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +1 -1
  79. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +3 -2
  80. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -1
  81. package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +18 -0
  82. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +67 -0
  83. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +1 -1
  84. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +11 -10
  85. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
  86. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +3 -2
  87. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +5 -4
  88. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +3 -2
  89. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -1
  90. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +7 -6
  91. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -1
  92. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +3 -2
  93. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +18 -0
  94. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +103 -0
  95. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +8 -7
  96. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +4 -3
  97. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +13 -12
  98. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +6 -5
  99. package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -1
  100. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +1 -1
  101. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +7 -6
  102. package/dataflow/internal/process/functions/call/common.js +7 -7
  103. package/dataflow/internal/process/functions/call/known-call-handling.js +7 -8
  104. package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +1 -2
  105. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +6 -6
  106. package/dataflow/internal/process/functions/process-argument.js +2 -2
  107. package/dataflow/internal/process/functions/process-parameter.js +3 -3
  108. package/dataflow/internal/process/process-symbol.js +3 -3
  109. package/dataflow/internal/process/process-uninteresting-leaf.d.ts +3 -1
  110. package/dataflow/internal/process/process-uninteresting-leaf.js +3 -1
  111. package/dataflow/internal/process/process-value.d.ts +1 -1
  112. package/dataflow/internal/process/process-value.js +4 -4
  113. package/dataflow/origin/dfg-get-symbol-refs.js +1 -1
  114. package/dataflow/processor.d.ts +1 -1
  115. package/documentation/doc-util/doc-structure.js +1 -1
  116. package/documentation/doc-util/doc-types.d.ts +10 -3
  117. package/documentation/doc-util/doc-types.js +110 -33
  118. package/documentation/wiki-absint.d.ts +6 -0
  119. package/documentation/wiki-absint.js +149 -0
  120. package/documentation/wiki-dataflow-graph.js +11 -10
  121. package/documentation/wiki-interface.js +2 -1
  122. package/documentation/wiki-mk/doc-context.d.ts +3 -3
  123. package/documentation/wiki-mk/doc-context.js +2 -2
  124. package/documentation/wiki-mk/doc-maker.js +2 -2
  125. package/documentation/wiki-normalized-ast.d.ts +9 -0
  126. package/documentation/wiki-normalized-ast.js +40 -52
  127. package/linter/linter-rules.d.ts +1 -1
  128. package/linter/rules/seeded-randomness.js +5 -4
  129. package/linter/rules/useless-loop.d.ts +3 -3
  130. package/package.json +3 -3
  131. package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
  132. package/queries/catalog/control-flow-query/control-flow-query-executor.js +1 -1
  133. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +4 -0
  134. package/queries/catalog/dependencies-query/dependencies-query-format.js +5 -0
  135. package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
  136. package/queries/catalog/dependencies-query/function-info/test-functions.js +82 -0
  137. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +3 -2
  138. package/queries/catalog/df-shape-query/df-shape-query-format.js +3 -3
  139. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +1 -1
  140. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +1 -1
  141. package/r-bridge/data/data.d.ts +6 -1
  142. package/r-bridge/data/data.js +8 -2
  143. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +7 -0
  144. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +19 -0
  145. package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +4 -0
  146. package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +7 -0
  147. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -1
  148. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +2 -1
  149. package/r-bridge/lang-4.x/convert-values.d.ts +5 -0
  150. package/search/flowr-search-filters.d.ts +2 -2
  151. package/slicing/static/static-slicer.js +2 -2
  152. package/util/mermaid/cfg.d.ts +10 -3
  153. package/util/mermaid/cfg.js +39 -10
  154. package/util/mermaid/dfg.js +5 -5
  155. package/util/simple-df/dfg-view.js +1 -1
  156. package/util/text/ansi.d.ts +4 -0
  157. package/util/text/ansi.js +7 -0
  158. 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)).map(s => s.replace(RegexConvIn, '\\$&')).filter(s => s.length > 0).join('|')})$`);
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: 'builtin:default',
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: 'builtin:default',
123
+ processor: built_in_1.BuiltInProcName.Default,
123
124
  config: { readAllArguments: true },
124
125
  assumePrimitive: false
125
126
  },
126
- { type: 'function', names: ['rm'], processor: 'builtin:rm', config: {}, assumePrimitive: true },
127
- { type: 'function', names: ['options'], processor: 'builtin:default', config: { hasUnknownSideEffects: true, forceArgs: 'all' }, assumePrimitive: false },
128
- { type: 'function', names: ['mapply', 'Mapply'], processor: 'builtin:apply', config: { indexOfFunction: 0, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
129
- { type: 'function', names: ['lapply', 'sapply', 'vapply'], processor: 'builtin:apply', config: { indexOfFunction: 1, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
130
- { type: 'function', names: ['Lapply', 'Sapply', 'Vapply'], processor: 'builtin:apply', config: { indexOfFunction: 1, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false }, /* functool wrappers */
131
- { type: 'function', names: ['apply', 'tapply', 'Tapply'], processor: 'builtin:apply', config: { indexOfFunction: 2, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
132
- { type: 'function', names: ['print', 'message', 'warning', 'warn', 'info'], processor: 'builtin:default', config: { returnsNthArgument: 0, forceArgs: 'all', hasUnknownSideEffects: { type: 'link-to-last-call', callName: /^sink$/ } }, assumePrimitive: false },
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: 'builtin:default',
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: 'builtin:default', config: {
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: 'builtin:default',
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: 'builtin:default',
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: 'builtin:default',
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: 'builtin:default', config: { returnsNthArgument: 0 }, assumePrimitive: true },
218
- { type: 'function', names: ['load', 'load_all', 'setwd', 'set.seed'], processor: 'builtin:default', config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: false },
219
- { type: 'function', names: ['body', 'formals', 'environment'], processor: 'builtin:default', config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: true },
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: 'builtin:default',
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: 'builtin:eval', config: { includeFunctionCall: true }, assumePrimitive: true },
232
- { type: 'function', names: ['cat'], processor: 'builtin:default', config: { forceArgs: 'all', hasUnknownSideEffects: { type: 'link-to-last-call', callName: /^sink$/ } }, assumePrimitive: false },
233
- { type: 'function', names: ['switch'], processor: 'builtin:default', config: { forceArgs: [true] }, assumePrimitive: false },
234
- { type: 'function', names: ['return'], processor: 'builtin:default', config: { returnsNthArgument: 0, cfg: 1 /* ExitPointType.Return */, useAsProcessor: 'builtin:return' }, assumePrimitive: true },
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: 'builtin:default',
239
- config: { useAsProcessor: 'builtin:stop', cfg: 4 /* ExitPointType.Error */, forceArgs: ['all'] },
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: 'builtin:try', config: { block: 'expr', handlers: {} }, assumePrimitive: true },
243
- { type: 'function', names: ['tryCatch', 'tryCatchLog'], processor: 'builtin:try', config: { block: 'expr', handlers: { error: 'error', finally: 'finally' } }, assumePrimitive: true },
244
- { type: 'function', names: ['stopifnot'], processor: 'builtin:stopifnot', config: {}, assumePrimitive: false },
245
- { type: 'function', names: ['break'], processor: 'builtin:default', config: { useAsProcessor: 'builtin:break', cfg: 2 /* ExitPointType.Break */ }, assumePrimitive: false },
246
- { type: 'function', names: ['next'], processor: 'builtin:default', config: { cfg: 3 /* ExitPointType.Next */ }, assumePrimitive: false },
247
- { type: 'function', names: ['{'], processor: 'builtin:expression-list', config: {}, assumePrimitive: true },
248
- { type: 'function', names: ['source'], processor: 'builtin:source', config: { includeFunctionCall: true, forceFollow: false }, assumePrimitive: false },
249
- { type: 'function', names: ['[', '[['], processor: 'builtin:access', config: { treatIndicesAsString: false }, assumePrimitive: true },
250
- { type: 'function', names: ['$', '@'], processor: 'builtin:access', config: { treatIndicesAsString: true }, assumePrimitive: true },
251
- { type: 'function', names: ['if', 'ifelse'], processor: 'builtin:if-then-else', config: {}, assumePrimitive: true },
252
- { type: 'function', names: ['get'], processor: 'builtin:get', config: {}, assumePrimitive: false },
253
- { type: 'function', names: ['library', 'require'], processor: 'builtin:library', config: {}, assumePrimitive: false },
254
- { type: 'function', names: ['<-', '='], processor: 'builtin:assignment', config: { canBeReplacement: true }, assumePrimitive: true },
255
- { type: 'function', names: [':='], processor: 'builtin:assignment', config: {}, assumePrimitive: true },
256
- { type: 'function', names: ['assign', 'setGeneric', 'setValidity'], processor: 'builtin:assignment', config: { targetVariable: true, mayHaveMoreArgs: true }, assumePrimitive: true },
257
- { type: 'function', names: ['setMethod'], processor: 'builtin:assignment-like', config: { targetVariable: true, canBeReplacement: false, target: { idx: 0, name: 'f' }, source: { idx: 2, name: 'definition' } }, assumePrimitive: true },
258
- { type: 'function', names: ['delayedAssign'], processor: 'builtin:assignment', config: { quoteSource: true, targetVariable: true }, assumePrimitive: true },
259
- { type: 'function', names: ['<<-'], processor: 'builtin:assignment', config: { superAssignment: true, canBeReplacement: true }, assumePrimitive: true },
260
- { type: 'function', names: ['->'], processor: 'builtin:assignment', config: { swapSourceAndTarget: true, canBeReplacement: true }, assumePrimitive: true },
261
- { type: 'function', names: ['->>'], processor: 'builtin:assignment', config: { superAssignment: true, swapSourceAndTarget: true, canBeReplacement: true }, assumePrimitive: true },
262
- { type: 'function', names: ['&&', '&'], processor: 'builtin:special-bin-op', config: { lazy: true, evalRhsWhen: true }, assumePrimitive: true },
263
- { type: 'function', names: ['||', '|'], processor: 'builtin:special-bin-op', config: { lazy: true, evalRhsWhen: false }, assumePrimitive: true },
264
- { type: 'function', names: ['|>', '%>%'], processor: 'builtin:pipe', config: {}, assumePrimitive: true },
265
- { type: 'function', names: ['function', '\\'], processor: 'builtin:function-definition', config: {}, assumePrimitive: true },
266
- { type: 'function', names: ['quote', 'substitute', 'bquote'], processor: 'builtin:quote', config: { quoteArgumentsWithIndex: 0 }, assumePrimitive: true },
267
- { type: 'function', names: ['for'], processor: 'builtin:for-loop', config: {}, assumePrimitive: true },
268
- { type: 'function', names: ['repeat'], processor: 'builtin:repeat-loop', config: {}, assumePrimitive: true },
269
- { type: 'function', names: ['while'], processor: 'builtin:while-loop', config: {}, assumePrimitive: true },
270
- { type: 'function', names: ['do.call'], processor: 'builtin:apply', config: { indexOfFunction: 0, unquoteFunction: true }, assumePrimitive: true },
271
- { type: 'function', names: ['UseMethod', 'NextMethod'], processor: 'builtin:apply', config: { indexOfFunction: 0, unquoteFunction: true, resolveInEnvironment: 'global' }, assumePrimitive: true },
272
- { type: 'function', names: ['.Primitive', '.Internal'], processor: 'builtin:apply', config: { indexOfFunction: 0, unquoteFunction: true, resolveInEnvironment: 'global' }, assumePrimitive: true },
273
- { type: 'function', names: ['interference'], processor: 'builtin:apply', config: { unquoteFunction: true, nameOfFunctionArgument: 'propensity_integrand', libFn: true }, assumePrimitive: false },
274
- { type: 'function', names: ['ddply'], processor: 'builtin:apply', config: { unquoteFunction: true, indexOfFunction: 2, nameOfFunctionArgument: '.fun', libFn: true }, assumePrimitive: false },
275
- { type: 'function', names: ['list'], processor: 'builtin:list', config: {}, assumePrimitive: true },
276
- { type: 'function', names: ['c'], processor: 'builtin:vector', config: {}, assumePrimitive: true, evalHandler: 'builtin:c' },
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: 'builtin:assignment',
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: 'builtin:default',
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: 'builtin:default',
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: 'builtin:register-hook',
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 'unnamed';
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' ? 'builtin:replacement' : fn?.processor;
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.controlDependencies, b.controlDependencies, info);
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.controlDependencies, bVal.controlDependencies, { ...info, position: `${info.position} For ${key}. ` });
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
- controlDependencies: s.controlDependencies?.slice()
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.controlDependencies === undefined && !pointerTracking) {
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.controlDependencies === undefined) {
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.controlDependencies === undefined) {
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.controlDependencies !== undefined) : true;
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
- controlDependencies: v.controlDependencies ? applyCds.concat(v.controlDependencies) : applyCds.slice()
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.controlDependencies));
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
- controlDependencies?: ControlDependency[] | undefined;
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#controlDependencies|control dependencies}).
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#controlDependencies|control dependencies}).
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#controlDependencies|control dependencies}).
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.controlDependencies) {
29
- appToCdsUnique(definition.controlDependencies, defaultCd);
28
+ if (definition.cds) {
29
+ appToCdsUnique(definition.cds, defaultCd);
30
30
  }
31
31
  else {
32
- definition.controlDependencies = defaultCd ? Array.from(defaultCd) : [];
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.controlDependencies) {
40
- appToCdsUnique(node.controlDependencies, defaultCd);
39
+ if (node.cds) {
40
+ appToCdsUnique(node.cds, defaultCd);
41
41
  }
42
42
  else {
43
- node.controlDependencies = defaultCd ? Array.from(defaultCd) : [];
43
+ node.cds = defaultCd ? Array.from(defaultCd) : [];
44
44
  }
45
45
  }
46
- if (ref.controlDependencies) {
46
+ if (ref.cds) {
47
47
  if (defaultCd) {
48
- return { ...ref, controlDependencies: concatCdsUnique(ref.controlDependencies, defaultCd) };
48
+ return { ...ref, cds: concatCdsUnique(ref.cds, defaultCd) };
49
49
  }
50
50
  }
51
51
  else {
52
- return { ...ref, controlDependencies: defaultCd ? Array.from(defaultCd) : [] };
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#controlDependencies|control dependencies}).
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
- const definition = current.memory.get(name);
42
- if (definition !== undefined) {
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.controlDependencies))) {
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 = definitions.concat(filtered);
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.controlDependencies))) {
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.controlDependencies;
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 scalar_consatnts_1 = require("../values/scalar/scalar-consatnts");
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(scalar_consatnts_1.liftScalar));
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, scalar_consatnts_1.liftScalar)(argValue);
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(scalar_consatnts_1.liftScalar));
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, scalar_consatnts_1.liftScalar)({ ...argValue, num: -argValue.num });
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, scalar_consatnts_1.liftScalar)({ ...element, num: -element.num })));
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 scalar_consatnts_1 = require("../scalar/scalar-consatnts");
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, 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);
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, scalar_consatnts_1.liftScalar)(v);
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-consatnts.js.map
41
+ //# sourceMappingURL=scalar-constants.js.map