an expression calling node's traversal, or a referenced one's by id
(node: BaseNode | NodeId, opts?: InvokeOptions)
| 328 | |
| 329 | /** an expression calling node's traversal, or a referenced one's by id */ |
| 330 | inv(node: BaseNode | NodeId, opts?: InvokeOptions): string { |
| 331 | const arg = opts?.arg ?? this.data |
| 332 | if (typeof node === "string") |
| 333 | return `${this.refToId(node, opts)}(${arg}, ${this.ctx})` |
| 334 | const kind = opts?.kind ?? this.trav |
| 335 | if (this.trav === "Transform" && kind === "Allows" && node.allowsCtx) |
| 336 | return this.allows(node, arg) |
| 337 | const reference = this.refToId(node.id, opts) |
| 338 | if (kind === "Transform" && node.tfsById) |
| 339 | return `${this.ref(transformResolution)}(${this.ctx}, "${this.nameOf(node.id)}", ${arg}, ${reference})` |
| 340 | return this.needsCtxFor(node, kind) ? |
| 341 | `${reference}(${arg}, ${this.ctx})` |
| 342 | : `${reference}(${arg})` |
| 343 | } |
| 344 | |
| 345 | // Allows adds no errors to ctx, so a predicate reading it runs in a branch |
| 346 | allows(node: BaseNode, arg: string = this.data): string { |
nothing calls this directly
no test coverage detected