@eagleoutice/flowr 2.15.10 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/README.md +23 -26
  2. package/abstract-interpretation/data-frame/arguments.js +11 -7
  3. package/control-flow/happens-before.d.ts +5 -0
  4. package/control-flow/happens-before.js +48 -34
  5. package/control-flow/useless-loop.d.ts +1 -1
  6. package/control-flow/useless-loop.js +29 -42
  7. package/dataflow/environments/built-in-props.d.ts +9 -0
  8. package/dataflow/environments/built-in-props.js +25 -19
  9. package/dataflow/environments/built-in.d.ts +2 -2
  10. package/dataflow/environments/built-in.js +41 -77
  11. package/dataflow/environments/default-builtin-config.d.ts +181 -29
  12. package/dataflow/environments/default-builtin-config.js +38 -24
  13. package/dataflow/environments/environment.d.ts +6 -4
  14. package/dataflow/environments/environment.js +54 -121
  15. package/dataflow/environments/identifier.d.ts +4 -2
  16. package/dataflow/environments/identifier.js +23 -69
  17. package/dataflow/environments/reference-to-maybe.d.ts +9 -0
  18. package/dataflow/environments/reference-to-maybe.js +23 -51
  19. package/dataflow/environments/resolve-by-name.js +37 -76
  20. package/dataflow/eval/resolve/resolve-argument.d.ts +3 -1
  21. package/dataflow/eval/resolve/resolve-argument.js +61 -64
  22. package/dataflow/eval/resolve/resolve-working-directory.d.ts +8 -2
  23. package/dataflow/eval/resolve/resolve-working-directory.js +12 -20
  24. package/dataflow/eval/resolve/resolve.d.ts +4 -0
  25. package/dataflow/eval/resolve/resolve.js +23 -14
  26. package/dataflow/extractor.js +176 -59
  27. package/dataflow/fn/class-declaration.d.ts +8 -2
  28. package/dataflow/fn/class-declaration.js +96 -97
  29. package/dataflow/fn/exceptions-of-function.js +68 -37
  30. package/dataflow/fn/frame-reflection.d.ts +12 -4
  31. package/dataflow/fn/frame-reflection.js +51 -41
  32. package/dataflow/fn/function-props.js +15 -33
  33. package/dataflow/fn/function-semantics.d.ts +11 -3
  34. package/dataflow/fn/function-semantics.js +6 -0
  35. package/dataflow/fn/higher-order-function.js +13 -17
  36. package/dataflow/fn/strict-function.d.ts +13 -0
  37. package/dataflow/fn/strict-function.js +285 -122
  38. package/dataflow/graph/call-graph.d.ts +7 -6
  39. package/dataflow/graph/call-graph.js +35 -46
  40. package/dataflow/graph/graph.d.ts +6 -1
  41. package/dataflow/graph/graph.js +57 -66
  42. package/dataflow/info.d.ts +8 -1
  43. package/dataflow/info.js +24 -30
  44. package/dataflow/internal/control-flow.d.ts +31 -4
  45. package/dataflow/internal/control-flow.js +61 -39
  46. package/dataflow/internal/linker.d.ts +15 -9
  47. package/dataflow/internal/linker.js +253 -241
  48. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +80 -14
  49. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +446 -78
  50. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +3 -1
  51. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +51 -48
  52. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +2 -2
  53. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +119 -185
  54. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +7 -9
  55. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +1 -1
  56. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +122 -147
  57. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +55 -25
  58. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +289 -251
  59. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
  60. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +30 -32
  61. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +68 -67
  62. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +72 -126
  63. package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -3
  64. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +10 -10
  65. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +4 -4
  66. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -35
  67. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +8 -3
  68. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +1 -1
  69. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +12 -28
  70. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +1 -1
  71. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +40 -118
  72. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -3
  73. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +16 -24
  74. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +2 -0
  75. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +93 -102
  76. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +7 -3
  77. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +173 -114
  78. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +1 -3
  79. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +22 -27
  80. package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +1 -1
  81. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +34 -9
  82. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +1 -1
  83. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +119 -93
  84. package/dataflow/internal/process/functions/call/common.d.ts +1 -3
  85. package/dataflow/internal/process/functions/call/common.js +36 -76
  86. package/dataflow/internal/process/functions/call/deferred.d.ts +6 -2
  87. package/dataflow/internal/process/functions/call/deferred.js +54 -57
  88. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +4 -2
  89. package/dataflow/internal/process/functions/call/known-call-handling.js +65 -68
  90. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +3 -5
  91. package/dataflow/internal/process/functions/call/named-call-handling.js +35 -21
  92. package/dataflow/internal/process/functions/call/quoted.d.ts +2 -0
  93. package/dataflow/internal/process/functions/call/quoted.js +162 -172
  94. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +17 -38
  95. package/dataflow/internal/process/functions/process-parameter.js +25 -32
  96. package/dataflow/internal/process/process-symbol.js +3 -6
  97. package/dataflow/internal/program-order.d.ts +26 -0
  98. package/dataflow/internal/program-order.js +49 -0
  99. package/documentation/wiki-setup.js +23 -0
  100. package/linter/linter-rules.d.ts +17 -8
  101. package/linter/rules/absolute-path.js +63 -87
  102. package/linter/rules/file-path-validity.d.ts +4 -2
  103. package/linter/rules/file-path-validity.js +114 -80
  104. package/linter/rules/namespace-access.js +21 -33
  105. package/linter/rules/naming-convention.d.ts +1 -1
  106. package/linter/rules/naming-convention.js +60 -48
  107. package/linter/rules/network-functions.js +11 -7
  108. package/linter/rules/no-leaked-credentials.js +15 -18
  109. package/linter/rules/problematic-inputs.d.ts +2 -1
  110. package/linter/rules/problematic-inputs.js +39 -59
  111. package/linter/rules/roxygen-arguments.d.ts +9 -4
  112. package/linter/rules/roxygen-arguments.js +29 -48
  113. package/linter/rules/seeded-randomness.d.ts +7 -4
  114. package/linter/rules/seeded-randomness.js +128 -89
  115. package/linter/rules/stop-with-call-arg.d.ts +4 -2
  116. package/linter/rules/stop-with-call-arg.js +25 -22
  117. package/linter/rules/unclosed-connection.js +31 -24
  118. package/linter/rules/undefined-symbol.d.ts +4 -6
  119. package/linter/rules/undefined-symbol.js +58 -75
  120. package/linter/rules/unescaped-arguments.js +18 -44
  121. package/linter/rules/unused-definition.d.ts +6 -0
  122. package/linter/rules/unused-definition.js +105 -145
  123. package/linter/rules/unused-import.d.ts +3 -0
  124. package/linter/rules/unused-import.js +25 -43
  125. package/package.json +5 -2
  126. package/project/flowr-analyzer.js +6 -2
  127. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -2
  128. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +8 -12
  129. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +7 -5
  130. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +34 -56
  131. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +16 -41
  132. package/queries/base-query-format.js +1 -2
  133. package/queries/catalog/absint-query/absint-query-format.js +1 -1
  134. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
  135. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +2 -0
  136. package/queries/catalog/dataflow-query/dataflow-query-format.js +4 -7
  137. package/queries/catalog/dependencies-query/dependencies-query-executor.js +50 -114
  138. package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +5 -9
  139. package/queries/catalog/dependencies-query/function-info/library-functions.js +6 -0
  140. package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
  141. package/queries/catalog/dependencies-query/function-info/write-functions.js +7 -3
  142. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +4 -4
  143. package/queries/catalog/input-sources-query/simple-input-classifier.js +192 -301
  144. package/r-bridge/lang-4.x/ast/model/model.d.ts +3 -1
  145. package/r-bridge/lang-4.x/ast/model/model.js +19 -43
  146. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
  147. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -0
  148. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +5 -12
  149. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
  150. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
  151. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
  152. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
  153. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
  154. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
  155. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
  156. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
  157. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
  158. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
  159. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
  160. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
  161. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
  162. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
  163. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
  164. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
  165. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
  166. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
  167. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
  168. package/r-bridge/roxygen2/roxygen-parse.js +28 -42
  169. package/r-bridge/shell.js +6 -0
  170. package/search/search-executor/search-enrichers.js +25 -37
  171. package/slicing/static/slice-call.d.ts +4 -3
  172. package/slicing/static/slice-call.js +56 -88
  173. package/slicing/static/static-slicer.js +115 -79
  174. package/slicing/static/visiting-queue.d.ts +4 -6
  175. package/slicing/static/visiting-queue.js +9 -13
  176. package/util/proc.js +2 -1
  177. package/util/r-base-packages.d.ts +2 -0
  178. package/util/r-base-packages.js +23 -13
  179. package/util/text/playground-link.d.ts +12 -3
  180. package/util/text/playground-link.js +18 -27
  181. package/util/version.js +4 -10
@@ -14,7 +14,7 @@ import type { RForLoop } from './nodes/r-for-loop';
14
14
  import type { RRepeatLoop } from './nodes/r-repeat-loop';
15
15
  import type { RWhileLoop } from './nodes/r-while-loop';
16
16
  import type { RIfThenElse } from './nodes/r-if-then-else';
17
- import type { RFunctionDefinition } from './nodes/r-function-definition';
17
+ import { RFunctionDefinition } from './nodes/r-function-definition';
18
18
  import type { EmptyArgument, RFunctionCall } from './nodes/r-function-call';
19
19
  import type { RParameter } from './nodes/r-parameter';
20
20
  import type { RArgument } from './nodes/r-argument';
@@ -263,6 +263,8 @@ export declare const RNode: {
263
263
  * which `isTarget` holds, `undefined` if the walk reaches the root of the file without a match.
264
264
  */
265
265
  readonly findEnclosing: <OtherInfo>(this: void, id: NodeId, idMap: AstIdMap<OtherInfo & ParentInformation>, isTarget: (node: RNode<OtherInfo & ParentInformation>) => boolean) => NodeId | undefined;
266
+ /** The function definition strictly enclosing `id`, i.e., `id` itself excluded. */
267
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: NodeId, idMap: AstIdMap<OtherInfo & ParentInformation>) => NodeId | undefined;
266
268
  /**
267
269
  * A helper function to retrieve the type of a given node.
268
270
  */
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RNode = exports.ROther = exports.RFunctions = exports.RConstructs = exports.RLoopConstructs = exports.RSingleNode = exports.RConstant = void 0;
4
4
  const range_1 = require("../../../../util/range");
5
5
  const type_1 = require("./type");
6
+ const r_function_definition_1 = require("./nodes/r-function-definition");
6
7
  const r_access_1 = require("./nodes/r-access");
7
8
  const visitor_1 = require("./processing/visitor");
8
9
  const assert_1 = require("../../../../util/assert");
@@ -18,11 +19,7 @@ exports.RConstant = {
18
19
  * If you need the specific type, please either use the respective type guards (e.g., {@link RNumber.is}) or check the `type` node directly.
19
20
  */
20
21
  is(node) {
21
- if (!node) {
22
- return false;
23
- }
24
- const t = node.type;
25
- return t === type_1.RType.Number || t === type_1.RType.String || t === type_1.RType.Logical;
22
+ return node !== undefined && exports.RConstant.constantTypes.has(node.type);
26
23
  },
27
24
  /**
28
25
  * A set of all types of constants in the normalized AST, i.e. number, string, and logical constants.
@@ -39,11 +36,7 @@ exports.RSingleNode = {
39
36
  * If you need the specific type, please either use the respective type guards (e.g., {@link RComment.is}) or check the `type` node directly.
40
37
  */
41
38
  is(node) {
42
- if (!node) {
43
- return false;
44
- }
45
- const t = node.type;
46
- return t === type_1.RType.Comment || t === type_1.RType.Symbol || exports.RConstant.constantTypes.has(t) || t === type_1.RType.Break || t === type_1.RType.Next || t === type_1.RType.LineDirective;
39
+ return node !== undefined && exports.RSingleNode.singleNodeTypes.has(node.type);
47
40
  },
48
41
  /**
49
42
  * A set of all types of single nodes in the normalized AST, i.e. comment, symbol, constant, break, next, and line directive nodes.
@@ -57,11 +50,7 @@ exports.RLoopConstructs = {
57
50
  * If you need the specific type, please either use the respective type guards (e.g., {@link RForLoop.is}) or check the `type` node directly.
58
51
  */
59
52
  is(node) {
60
- if (!node) {
61
- return false;
62
- }
63
- const t = node.type;
64
- return t === type_1.RType.ForLoop || t === type_1.RType.RepeatLoop || t === type_1.RType.WhileLoop;
53
+ return node !== undefined && exports.RLoopConstructs.loopConstructTypes.has(node.type);
65
54
  },
66
55
  /**
67
56
  * A set of all types of loop constructs in the normalized AST, i.e. for, repeat and while loops.
@@ -75,11 +64,7 @@ exports.RConstructs = {
75
64
  * If you need the specific type, please either use the respective type guards (e.g., {@link RForLoop.is}) or check the `type` node directly.
76
65
  */
77
66
  is(node) {
78
- if (!node) {
79
- return false;
80
- }
81
- const t = node.type;
82
- return exports.RLoopConstructs.loopConstructTypes.has(t) || t === type_1.RType.IfThenElse;
67
+ return node !== undefined && exports.RConstructs.constructTypes.has(node.type);
83
68
  },
84
69
  /**
85
70
  * A set of all types of constructs in the normalized AST, i.e. for, repeat and while loops and if-then-else constructs.
@@ -93,11 +78,7 @@ exports.RFunctions = {
93
78
  * If you need the specific type, please either use the respective type guards (e.g., {@link RFunctionDefinition.is}) or check the `type` node directly.
94
79
  */
95
80
  is(node) {
96
- if (!node) {
97
- return false;
98
- }
99
- const t = node.type;
100
- return t === type_1.RType.FunctionDefinition || t === type_1.RType.FunctionCall || t === type_1.RType.Parameter || t === type_1.RType.Argument;
81
+ return node !== undefined && exports.RFunctions.functionTypes.has(node.type);
101
82
  },
102
83
  /**
103
84
  * A set of all types of function-related nodes in the normalized AST, i.e. function definitions, function calls, parameters, and arguments.
@@ -187,15 +168,18 @@ exports.RNode = {
187
168
  * which `isTarget` holds, `undefined` if the walk reaches the root of the file without a match.
188
169
  */
189
170
  findEnclosing(id, idMap, isTarget) {
190
- let node = idMap.get(id);
191
- while (node !== undefined) {
171
+ for (let node = idMap.get(id); node !== undefined; node = exports.RNode.directParent(node, idMap)) {
192
172
  if (isTarget(node)) {
193
173
  return node.info.id;
194
174
  }
195
- node = node.info.parent !== undefined ? idMap.get(node.info.parent) : undefined;
196
175
  }
197
176
  return undefined;
198
177
  },
178
+ /** The function definition strictly enclosing `id`, i.e., `id` itself excluded. */
179
+ strictlyEnclosingFunction(id, idMap) {
180
+ const parent = idMap.get(id)?.info.parent;
181
+ return parent === undefined ? undefined : exports.RNode.findEnclosing(parent, idMap, r_function_definition_1.RFunctionDefinition.is);
182
+ },
199
183
  /**
200
184
  * A helper function to retrieve the type of a given node.
201
185
  */
@@ -263,22 +247,16 @@ exports.RNode = {
263
247
  * @see {@link iterateParents} - to get all parents of a node
264
248
  */
265
249
  directParent(node, idMap) {
266
- const parentId = node.info.parent;
267
- if (parentId === undefined) {
268
- return undefined;
269
- }
270
- return idMap.get(parentId);
250
+ return node.info.parent === undefined ? undefined : idMap.get(node.info.parent);
271
251
  },
272
252
  /**
273
253
  * Returns an iterable of all parents of a node, starting with the direct parent and ending with the root node.
274
254
  */
275
255
  *iterateParents(node, idMap) {
276
- let currentNode = node;
277
- while (currentNode) {
278
- currentNode = exports.RNode.directParent(currentNode, idMap);
279
- if (currentNode) {
280
- yield currentNode;
281
- }
256
+ let current = node === undefined ? undefined : exports.RNode.directParent(node, idMap);
257
+ while (current !== undefined) {
258
+ yield current;
259
+ current = exports.RNode.directParent(current, idMap);
282
260
  }
283
261
  },
284
262
  /**
@@ -286,10 +264,8 @@ exports.RNode = {
286
264
  * this function calculates the depth of a node by counting the number of parents until the root node is reached.
287
265
  */
288
266
  depth(node, idMap) {
289
- let depth = 0;
290
- let currentNode = node;
291
- while (currentNode) {
292
- currentNode = exports.RNode.directParent(currentNode, idMap);
267
+ let depth = 1;
268
+ for (const _ of exports.RNode.iterateParents(node, idMap)) {
293
269
  depth++;
294
270
  }
295
271
  return depth;
@@ -50,6 +50,7 @@ export declare const RAccess: {
50
50
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
51
51
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
52
52
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
53
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
53
54
  readonly getType: (this: void, node: RNode) => RType;
54
55
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
55
56
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -54,6 +54,8 @@ export declare const RArgument: {
54
54
  * Type guard for unnamed arguments, i.e. arguments without a name.
55
55
  */
56
56
  readonly isUnnamed: <Info = object>(this: void, node: RNode<Info> | typeof EmptyArgument | undefined) => node is RUnnamedArgument<Info>;
57
+ /** The value of an argument, the node itself for anything else, `undefined` for an empty argument. */
58
+ readonly valueOf: <Info = object>(this: void, node: RNode<Info> | typeof EmptyArgument | undefined) => RNode<Info> | undefined;
57
59
  /**
58
60
  * Type guard for arguments with a value, i.e. arguments that are not just placeholders without a value.
59
61
  */
@@ -71,6 +73,7 @@ export declare const RArgument: {
71
73
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
72
74
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & ParentInformation>) => RNode<OtherInfo & ParentInformation>;
73
75
  readonly findEnclosing: <OtherInfo>(this: void, id: NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & ParentInformation>, isTarget: (node: RNode<OtherInfo & ParentInformation>) => boolean) => NodeId | undefined;
76
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & ParentInformation>) => NodeId | undefined;
74
77
  readonly getType: (this: void, node: RNode) => RType;
75
78
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
76
79
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & ParentInformation>>) => Set<NodeId>;
@@ -44,6 +44,10 @@ exports.RArgument = {
44
44
  isUnnamed(node) {
45
45
  return node !== r_function_call_1.EmptyArgument && exports.RArgument.is(node) && node.name === undefined && node.value !== undefined;
46
46
  },
47
+ /** The value of an argument, the node itself for anything else, `undefined` for an empty argument. */
48
+ valueOf(node) {
49
+ return node === r_function_call_1.EmptyArgument ? undefined : exports.RArgument.is(node) ? node.value : node;
50
+ },
47
51
  /**
48
52
  * Type guard for arguments with a value, i.e. arguments that are not just placeholders without a value.
49
53
  */
@@ -51,18 +55,7 @@ exports.RArgument = {
51
55
  return exports.RArgument.is(node) && node.value !== undefined;
52
56
  },
53
57
  getWithId(args, id) {
54
- if (id === undefined) {
55
- return undefined;
56
- }
57
- for (const arg of args) {
58
- if (exports.RArgument.isEmpty(arg)) {
59
- continue;
60
- }
61
- if (arg.info.id === id) {
62
- return arg;
63
- }
64
- }
65
- return undefined;
58
+ return id === undefined ? undefined : args.filter(exports.RArgument.isNotEmpty).find(arg => arg.info.id === id);
66
59
  },
67
60
  /**
68
61
  * Retrieve the value of the argument with the given id from the list of arguments.
@@ -31,6 +31,7 @@ export declare const RBinaryOp: {
31
31
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
32
32
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
33
33
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
34
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
34
35
  readonly getType: (this: void, node: RNode) => RType;
35
36
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
36
37
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -23,6 +23,7 @@ export declare const RBreak: {
23
23
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
24
24
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
25
25
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
26
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
26
27
  readonly getType: (this: void, node: RNode) => RType;
27
28
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
28
29
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -25,6 +25,7 @@ export declare const RComment: {
25
25
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
26
26
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
27
27
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
28
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
28
29
  readonly getType: (this: void, node: RNode) => RType;
29
30
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
30
31
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -39,6 +39,7 @@ export declare const RExpressionList: {
39
39
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
40
40
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
41
41
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
42
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
42
43
  readonly getType: (this: void, node: RNode) => RType;
43
44
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
44
45
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -33,6 +33,7 @@ export declare const RForLoop: {
33
33
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
34
34
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
35
35
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
36
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
36
37
  readonly getType: (this: void, node: RNode) => RType;
37
38
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
38
39
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -64,6 +64,7 @@ export declare const RFunctionCall: {
64
64
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
65
65
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
66
66
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
67
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
67
68
  readonly getType: (this: void, node: RNode) => RType;
68
69
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
69
70
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -46,6 +46,7 @@ export declare const RFunctionDefinition: {
46
46
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
47
47
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & ParentInformation>, idMap: AstIdMap<OtherInfo & ParentInformation>) => RNode<OtherInfo & ParentInformation>;
48
48
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: AstIdMap<OtherInfo & ParentInformation>, isTarget: (node: RNode<OtherInfo & ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
49
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: AstIdMap<OtherInfo & ParentInformation>) => import("../processing/node-id").NodeId | undefined;
49
50
  readonly getType: (this: void, node: RNode) => RType;
50
51
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
51
52
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -29,6 +29,7 @@ export declare const RIfThenElse: {
29
29
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
30
30
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
31
31
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
32
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
32
33
  readonly getType: (this: void, node: RNode) => RType;
33
34
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
34
35
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -25,6 +25,7 @@ export declare const RLineDirective: {
25
25
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
26
26
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
27
27
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
28
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
28
29
  readonly getType: (this: void, node: RNode) => RType;
29
30
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
30
31
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -33,6 +33,7 @@ export declare const RLogical: {
33
33
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
34
34
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
35
35
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
36
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
36
37
  readonly getType: (this: void, node: RNode) => RType;
37
38
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
38
39
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -23,6 +23,7 @@ export declare const RNext: {
23
23
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
24
24
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
25
25
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
26
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
26
27
  readonly getType: (this: void, node: RNode) => RType;
27
28
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
28
29
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -32,6 +32,7 @@ export declare const RNumber: {
32
32
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
33
33
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
34
34
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
35
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
35
36
  readonly getType: (this: void, node: RNode) => RType;
36
37
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
37
38
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -42,6 +42,7 @@ export declare const RParameter: {
42
42
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
43
43
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
44
44
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
45
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
45
46
  readonly getType: (this: void, node: RNode) => RType;
46
47
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
47
48
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -41,6 +41,7 @@ export declare const RPipe: {
41
41
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
42
42
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
43
43
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
44
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
44
45
  readonly getType: (this: void, node: RNode) => RType;
45
46
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
46
47
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -27,6 +27,7 @@ export declare const RRepeatLoop: {
27
27
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
28
28
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
29
29
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
30
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
30
31
  readonly getType: (this: void, node: RNode) => RType;
31
32
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
32
33
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -32,6 +32,7 @@ export declare const RString: {
32
32
  span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
33
33
  topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
34
34
  findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
35
+ strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
35
36
  getType: (this: void, node: RNode) => RType;
36
37
  visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
37
38
  collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -37,6 +37,7 @@ export declare const RSymbol: {
37
37
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
38
38
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
39
39
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
40
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
40
41
  readonly getType: (this: void, node: RNode) => RType;
41
42
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
42
43
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -30,6 +30,7 @@ export declare const RUnaryOp: {
30
30
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
31
31
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
32
32
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
33
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
33
34
  readonly getType: (this: void, node: RNode) => RType;
34
35
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
35
36
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -28,6 +28,7 @@ export declare const RWhileLoop: {
28
28
  readonly span: <OtherInfo>(this: void, node: RNode<OtherInfo> | undefined) => import("../../../../..").SourceRange | undefined;
29
29
  readonly topLevelStatement: <OtherInfo>(this: void, node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => RNode<OtherInfo & import("../processing/decorate").ParentInformation>;
30
30
  readonly findEnclosing: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>, isTarget: (node: RNode<OtherInfo & import("../processing/decorate").ParentInformation>) => boolean) => import("../processing/node-id").NodeId | undefined;
31
+ readonly strictlyEnclosingFunction: <OtherInfo>(this: void, id: import("../processing/node-id").NodeId, idMap: import("../processing/decorate").AstIdMap<OtherInfo & import("../processing/decorate").ParentInformation>) => import("../processing/node-id").NodeId | undefined;
31
32
  readonly getType: (this: void, node: RNode) => RType;
32
33
  readonly visitAst: <OtherInfo = object>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo>>, onVisit?: import("../processing/visitor").OnEnter<OtherInfo>, onExit?: import("../processing/visitor").OnExit<OtherInfo>) => void;
33
34
  readonly collectAllIds: <OtherInfo>(this: void, nodes: import("../model").SingleOrArrayOrNothing<RNode<OtherInfo & import("../processing/decorate").ParentInformation>>) => Set<import("../processing/node-id").NodeId>;
@@ -5,9 +5,10 @@ exports.parseRoxygenCommentsOfNode = parseRoxygenCommentsOfNode;
5
5
  exports.parseRoxygenComment = parseRoxygenComment;
6
6
  const roxygen_ast_1 = require("./roxygen-ast");
7
7
  const r_comment_1 = require("../lang-4.x/ast/model/nodes/r-comment");
8
- const assert_1 = require("../../util/assert");
9
8
  const args_1 = require("../../util/text/args");
10
9
  const range_1 = require("../../util/range");
10
+ /** the prefix roxygen2 reads a documentation comment by: any number of `#` followed by `'` */
11
+ const RoxygenPrefix = /^#+'/;
11
12
  function prepareCommentContext(commentText) {
12
13
  const contents = [];
13
14
  for (const line of commentText) {
@@ -16,10 +17,9 @@ function prepareCommentContext(commentText) {
16
17
  continue;
17
18
  }
18
19
  else if (!trimmed.startsWith('#')) {
19
- // we are done with the roxygen comment
20
20
  break;
21
21
  }
22
- contents.push((trimmed.startsWith('#\'') ? trimmed.slice(2) : trimmed.slice(1)).trimEnd());
22
+ contents.push((RoxygenPrefix.test(trimmed) ? trimmed.replace(RoxygenPrefix, '') : trimmed.slice(1)).trimEnd());
23
23
  }
24
24
  return contents;
25
25
  }
@@ -34,18 +34,18 @@ function prepareCommentContext(commentText) {
34
34
  function parseRoxygenCommentsOfNode(node, idMap) {
35
35
  let comments;
36
36
  let cur = node;
37
+ /* only roxygen comments document, and the root of a file holds what belongs to no statement in particular */
37
38
  do {
38
- comments = cur?.info.adToks
39
- ?.filter(r_comment_1.RComment.is).filter(r => (0, assert_1.isNotUndefined)(r.lexeme));
39
+ comments = cur?.info.parent === undefined ? undefined : cur.info.adToks
40
+ ?.filter(r_comment_1.RComment.is).filter(r => RoxygenPrefix.test(r.lexeme ?? ''));
40
41
  cur = cur?.info.parent ? idMap?.get(cur.info.parent) : undefined;
41
42
  } while ((comments === undefined || comments.length === 0) && cur !== undefined);
42
43
  if (comments === undefined || comments.length === 0) {
43
44
  return undefined;
44
45
  }
45
- const commentContent = comments.map(c => c.lexeme);
46
46
  return {
47
47
  type: 'roxygen-block',
48
- tags: parseRoxygenComment(commentContent),
48
+ tags: parseRoxygenComment(comments.map(c => c.lexeme)),
49
49
  attachedTo: cur?.info.id,
50
50
  requestNode: node.info.id,
51
51
  range: [
@@ -60,9 +60,8 @@ function parseRoxygenCommentsOfNode(node, idMap) {
60
60
  * @see {@link parseRoxygenCommentsOfNode} - to parse comments attached to a node
61
61
  */
62
62
  function parseRoxygenComment(commentText) {
63
- const contents = prepareCommentContext(commentText);
64
63
  const state = {
65
- lines: contents,
64
+ lines: prepareCommentContext(commentText),
66
65
  tags: [],
67
66
  idx: 0
68
67
  };
@@ -101,42 +100,33 @@ function collectUntilNextTag(state) {
101
100
  }
102
101
  return [collected, undefined];
103
102
  }
104
- function addTag(state, tag) {
105
- state.tags.push(tag);
106
- }
107
- function val(state, tagName, lineToVal = l => l.join('\n').trim()) {
103
+ function val(state, [name, rest], lineToVal = l => l.join('\n').trim()) {
108
104
  const [lines, nextTag] = collectUntilNextTag(state);
109
- if (tagName[1]) {
110
- lines.unshift(tagName[1]);
105
+ if (rest) {
106
+ lines.unshift(rest);
111
107
  }
112
- if (tagName[0] !== roxygen_ast_1.KnownRoxygenTags.Text || lines.length > 0) {
113
- const n = tagName[0];
114
- if ((0, roxygen_ast_1.isKnownRoxygenText)(n)) {
115
- const val = lineToVal(lines);
116
- addTag(state, (val !== undefined ? {
117
- type: n,
118
- value: val
119
- } : { type: n }));
120
- }
121
- else {
122
- addTag(state, {
123
- type: roxygen_ast_1.KnownRoxygenTags.Unknown,
124
- value: {
125
- tag: n,
126
- content: lines.join(' ')
127
- }
128
- });
129
- }
108
+ if (name === roxygen_ast_1.KnownRoxygenTags.Text && lines.length === 0) {
109
+ return nextTag;
110
+ }
111
+ if ((0, roxygen_ast_1.isKnownRoxygenText)(name)) {
112
+ const value = lineToVal(lines);
113
+ state.tags.push((value === undefined ? { type: name } : { type: name, value }));
114
+ }
115
+ else {
116
+ state.tags.push({ type: roxygen_ast_1.KnownRoxygenTags.Unknown, value: { tag: name, content: lines.join(' ') } });
130
117
  }
131
118
  return nextTag;
132
119
  }
133
120
  const spaceVals = (s, t) => val(s, t, l => (0, args_1.splitAtEscapeSensitive)(l.join(' ')));
134
121
  const flagVal = (s, t) => val(s, t, () => undefined);
135
- const section = (s, t) => val(s, t, l => {
136
- return { title: l[0].trim(), content: l.slice(1).join('\n').trim() };
137
- });
122
+ const section = (s, t) => val(s, t, l => ({ title: l[0].trim(), content: l.slice(1).join('\n').trim() }));
138
123
  const firstAndRest = (firstName, secondName) => (s, t) => val(s, t, l => {
139
- const vals = (0, args_1.splitAtEscapeSensitive)(l.join('\n'));
124
+ const text = l.join('\n').trim();
125
+ const quoted = /^`([^`]*)`/.exec(text);
126
+ if (quoted) {
127
+ return { [firstName]: quoted[1], [secondName]: text.slice(quoted[0].length).trim() };
128
+ }
129
+ const vals = (0, args_1.splitAtEscapeSensitive)(text);
140
130
  return { [firstName]: vals[0], [secondName]: vals.slice(1).join(' ').trim() };
141
131
  });
142
132
  exports.firstAndRest = firstAndRest;
@@ -211,10 +201,6 @@ const TagMap = {
211
201
  };
212
202
  /** returns the next tag */
213
203
  function parseRoxygenTag(state, tagName) {
214
- if (tagName === undefined) {
215
- return undefined;
216
- }
217
- const parser = TagMap[tagName[0]] ?? val;
218
- return parser(state, tagName);
204
+ return tagName === undefined ? undefined : (TagMap[tagName[0]] ?? val)(state, tagName);
219
205
  }
220
206
  //# sourceMappingURL=roxygen-parse.js.map
package/r-bridge/shell.js CHANGED
@@ -380,6 +380,12 @@ class RShellSession {
380
380
  onDrained();
381
381
  };
382
382
  return new Promise((resolve, reject) => {
383
+ if (this.bareSession.exitCode !== null || this.bareSession.signalCode !== null) {
384
+ reject(new Error(`the R session has exited (${this.bareSession.exitCode ?? this.bareSession.signalCode}), it cannot answer anymore`));
385
+ drained = true;
386
+ onDrained();
387
+ return;
388
+ }
383
389
  const makeTimer = () => setTimeout(() => {
384
390
  if (timeout.onTimeout) {
385
391
  timeout.onTimeout(resolve, reject, result);