(candidate: SiteCandidate)
| 6610 | } |
| 6611 | |
| 6612 | private settle(candidate: SiteCandidate): boolean { |
| 6613 | const type = this.typeEndOf(candidate) |
| 6614 | if (type) { |
| 6615 | candidate.state = type |
| 6616 | candidate.fallbacks = candidate.fallbacks.filter(node => |
| 6617 | contains(type.node, node) |
| 6618 | ) |
| 6619 | this.interpreter.sitesByNode.set(type.node, type) |
| 6620 | } |
| 6621 | while (true) { |
| 6622 | const state = this.interpreter.evaluateSite(candidate.state) |
| 6623 | // reading a member a validator has makes no request |
| 6624 | if ( |
| 6625 | candidate.kind === "reference" && |
| 6626 | !state.requests.length && |
| 6627 | !state.unavailableReads.length && |
| 6628 | isMemberRead(state.node, candidate.root) |
| 6629 | ) |
| 6630 | return false |
| 6631 | const rejection = rejectionOf(state) |
| 6632 | const fallback = rejection && this.fallbackOf(candidate, rejection) |
| 6633 | if (!fallback) return true |
| 6634 | if (fallback === candidate.root) return false |
| 6635 | candidate.state = createSiteState(fallback, state.module) |
| 6636 | this.interpreter.sitesByNode.set(fallback, candidate.state) |
| 6637 | } |
| 6638 | } |
| 6639 | |
| 6640 | // e.g. `$.type("b")` in `$.type("b").assert(data)` |
| 6641 | private typeEndOf({ ends, state }: SiteCandidate): SiteState | undefined { |
no test coverage detected