()
| 123 | closes = true |
| 124 | |
| 125 | get resolution(): BaseRoot { |
| 126 | if (this.c.resolution) return this.c.resolution |
| 127 | if (resolvingAliases.includes(this)) { |
| 128 | const names = resolvingAliases.map(aliasNameOf) |
| 129 | const cycle = names.slice(names.lastIndexOf(aliasNameOf(this))) |
| 130 | const start = cycle.indexOf([...cycle].sort()[0]) |
| 131 | const path = [...cycle.slice(start), ...cycle.slice(0, start)] |
| 132 | return throwParseError(writeShallowCycleErrorMessage(path[0], path)) |
| 133 | } |
| 134 | const isFinal = isResolutionFinal() |
| 135 | const readsIo = |
| 136 | isIoFinal() && |
| 137 | (this.isIo || |
| 138 | hasArkKind(nodesById.get(this.reference) ?? this.target, "root")) |
| 139 | resolvingAliases.push(this) |
| 140 | inProgress.resolutions++ |
| 141 | if (readsIo) inProgress.ioReads++ |
| 142 | let resolution: BaseRoot |
| 143 | let resolved = false |
| 144 | try { |
| 145 | resolution = this._resolve() |
| 146 | if (resolution.is("alias")) resolution = resolution.resolution |
| 147 | if (this.resolve) resolution.c.isAliasResolution = true |
| 148 | if (this.resolve ? isFinal : this.$.resolved) { |
| 149 | this.c.resolution = resolution |
| 150 | // kept before what's waiting to be checked is, here or by whatever |
| 151 | // is resolving it, so if that fails or is discarded it's resolved, |
| 152 | // and checked, again rather than read as if it had passed |
| 153 | ownUnchecked(() => { |
| 154 | this.c.resolution = undefined |
| 155 | }) |
| 156 | } |
| 157 | resolved = true |
| 158 | } finally { |
| 159 | resolvingAliases.pop() |
| 160 | leaveResolution(resolved) |
| 161 | if (readsIo) inProgress.ioReads-- |
| 162 | } |
| 163 | assertUnchecked() |
| 164 | return resolution |
| 165 | } |
| 166 | |
| 167 | protected _resolve(): BaseRoot { |
| 168 | if (this.resolve) return this.resolve() |
no test coverage detected