| 539 | |
| 540 | // a cyclic value is applied inline |
| 541 | private applyKey(key: string, value: string, node: BaseNode): this { |
| 542 | const apply = |
| 543 | node.entersAlias && node.hasAlias ? |
| 544 | `(${this.resolution(node, node.id, value)})` |
| 545 | : this.inv(node, { arg: value }) |
| 546 | const fails = () => this.line("ctx.path.pop()").return(false) |
| 547 | this.line(`ctx.path.push(${key})`) |
| 548 | // only transforming a value Apply finds valid finds its morphs' errors |
| 549 | if (!node.hasAlias) { |
| 550 | this.if( |
| 551 | `${this.ref(transformsValid)}(ctx) && ${this.allows(node, value)}`, |
| 552 | () => |
| 553 | this.line( |
| 554 | `${this.ref(transformedInApply)}(ctx, ${this.inv(node, { arg: value, kind: "Transform" })})` |
| 555 | ) |
| 556 | ).elseIf(`!${apply}`, fails) |
| 557 | } else { |
| 558 | this.if( |
| 559 | node.tfs ? |
| 560 | `!(${this.ref(transformIfAllowed)}(ctx, ${this.ref(node)}, ${value}) || ${apply})` |
| 561 | : `!${apply}`, |
| 562 | fails |
| 563 | ) |
| 564 | } |
| 565 | return this.line("ctx.path.pop()") |
| 566 | } |
| 567 | |
| 568 | initTf(transformedChildren: readonly BaseNode[]): this { |
| 569 | this.checksErrs = transformedChildren.some( |