( name: string, cached: BaseParseContext | undefined, mark: number | undefined )
| 804 | } |
| 805 | |
| 806 | private resolveUncached( |
| 807 | name: string, |
| 808 | cached: BaseParseContext | undefined, |
| 809 | mark: number | undefined |
| 810 | ): Exclude<CachedResolution, BaseParseContext> | undefined { |
| 811 | if (hasOwn(this.aliases, name)) $ark.reached?.alias(this, name) |
| 812 | if (cached) return this.resolveDefinition(name, cached, mark) |
| 813 | const isScopeAlias = hasOwn(this.aliases, name) |
| 814 | let def: unknown = |
| 815 | isScopeAlias ? this.aliases[name] |
| 816 | : !isPrivateKey(name) && hasOwn(this.ambient, name) ? this.ambient[name] |
| 817 | : undefined |
| 818 | |
| 819 | if (!def) return this.maybeResolveSubalias(name) |
| 820 | |
| 821 | // referencing a thunk's alias while it's called is a cycle, but a |
| 822 | // generic's body is called again |
| 823 | if (isScopeAlias && isThunk(def) && !(def instanceof LazyGenericRoot)) { |
| 824 | const preparsed = this.preparseOwn(def, { alias: name }) |
| 825 | const ctx = registerParseContext( |
| 826 | this.createParseCtx(preparsed as BaseParseContextInput) |
| 827 | ) |
| 828 | this.res[name] = ctx |
| 829 | ctx.phase = "resolving" |
| 830 | try { |
| 831 | def = defining(() => this.normValue(ctx.def)) |
| 832 | } catch (e) { |
| 833 | if (ctx.aliases) { |
| 834 | const retry = () => this.resolveRoot(name) |
| 835 | for (const alias of ctx.aliases) alias.c.aliasResolve = retry |
| 836 | } |
| 837 | nodesById.delete(ctx.id) |
| 838 | throw e |
| 839 | } finally { |
| 840 | // registered while the call runs, so an alias parsed during it resolves by name |
| 841 | delete this.res[name] |
| 842 | } |
| 843 | if (!hasArkKind(def, "generic") && !hasArkKind(def, "module")) { |
| 844 | ctx.def = def |
| 845 | ctx.phase = "unresolved" |
| 846 | this.res[name] = ctx |
| 847 | // parsing its definition discards checks still open, so they're made first |
| 848 | try { |
| 849 | assertUnchecked() |
| 850 | } catch (e) { |
| 851 | if (ctx.aliases) { |
| 852 | const retry = () => this.resolveRoot(name) |
| 853 | for (const alias of ctx.aliases) alias.c.aliasResolve = retry |
| 854 | } |
| 855 | nodesById.delete(ctx.id) |
| 856 | throw e |
| 857 | } |
| 858 | return this.maybeResolve(name) |
| 859 | } |
| 860 | nodesById.delete(ctx.id) |
| 861 | } else def = this.normValue(def) |
| 862 | |
| 863 | if (hasArkKind(def, "generic")) { |
nothing calls this directly
no test coverage detected