(name: string, pending: BaseRoot)
| 661 | } |
| 662 | |
| 663 | private resolvePending(name: string, pending: BaseRoot): BaseRoot { |
| 664 | if (inProgress.definitions && !isResolvable(pending)) { |
| 665 | // read by its id once it can resolve, so held by what's cached until |
| 666 | // then rather than by the registry, which a throw that keeps it from |
| 667 | // resolving would leave holding it, and its scope, for good |
| 668 | const waiting = nodesById.get(pending.id) |
| 669 | if (hasArkKind(waiting, "context")) { |
| 670 | pendingContexts.set(pending, waiting) |
| 671 | nodesById.set(pending.id, waiting) |
| 672 | } |
| 673 | return this.node("alias", { reference: pending.id }, { reduced: true }) |
| 674 | } |
| 675 | const ctx = nodesById.get(pending.id) as BaseParseContext |
| 676 | const mark = $ark.reached?.mark() |
| 677 | // resolving it can instantiate a generic whose args are checked later, |
| 678 | // by when what that check would fail is its resolution |
| 679 | const unchecked = ownUnchecked( |
| 680 | e => { |
| 681 | ctx.phase = "failed" |
| 682 | ctx.error = e |
| 683 | // registered again, so an alias holding what it resolved to throws too |
| 684 | nodesById.set(ctx.id, ctx) |
| 685 | this.res[name] = ctx |
| 686 | }, |
| 687 | uncheckedPending(), |
| 688 | Infinity, |
| 689 | () => unresolve(ctx) |
| 690 | ) |
| 691 | try { |
| 692 | const resolution = resolving(() => |
| 693 | this.resolveContext(name, ctx, resolveShallowAliases(pending)) |
| 694 | ) |
| 695 | $ark.reached?.store(mark, this.res, name) |
| 696 | return resolution |
| 697 | } finally { |
| 698 | // what's queued from here on isn't its own |
| 699 | unchecked[2] = uncheckedPending() |
| 700 | } |
| 701 | } |
| 702 | |
| 703 | maybeResolve( |
| 704 | name: string |
nothing calls this directly
no test coverage detected