(keyExpr: string, accessExpression: string, node: BaseNode)
| 483 | } |
| 484 | |
| 485 | travKey(keyExpr: string, accessExpression: string, node: BaseNode): this { |
| 486 | const fails = this.keyFails(keyExpr, accessExpression, node) |
| 487 | if (fails !== undefined) return this.if(fails, () => this.return(false)) |
| 488 | if (this.trav === "Apply") |
| 489 | return this.applyKey(keyExpr, accessExpression, node) |
| 490 | // read once, so the string remembered is the one its pattern rejected |
| 491 | if (this.loopDepth > 0 && isRefinedPattern(node)) { |
| 492 | const allows = this.traversal(node, "Allows") |
| 493 | return this.const("value", accessExpression).if(`!${allows}(value)`, () => |
| 494 | this.return(`${this.ref(rejected)}(${allows}, value)`) |
| 495 | ) |
| 496 | } |
| 497 | // a value whose predicates read ctx is checked at its key's path |
| 498 | this.line(`${this.ctx}.path.push(${keyExpr})`) |
| 499 | this.check(node, { arg: accessExpression }) |
| 500 | return this.line(`${this.ctx}.path.pop()`) |
| 501 | } |
| 502 | |
| 503 | keyFails(key: string, value: string, node: BaseNode): string | undefined { |
| 504 | if (this.trav !== "Apply") { |
no test coverage detected