[SIL] Fix bridged begin_apply results.

The `yield_once_2` adds an extra result at the end, the deallocation.
Fix the indexing for the token and yielded results.
This commit is contained in:
Nate Chandler
2025-04-04 18:06:37 -07:00
parent 1b2f8c3a19
commit b7ca5672c5
4 changed files with 26 additions and 2 deletions

View File

@@ -1532,14 +1532,15 @@ final public class EndUnpairedAccessInst : Instruction {}
final public class BeginApplyInst : MultipleValueInstruction, FullApplySite {
public var numArguments: Int { bridged.BeginApplyInst_numArguments() }
public var isCalleeAllocated: Bool { bridged.BeginApplyInst_isCalleeAllocated() }
public var singleDirectResult: Value? { nil }
public var singleDirectErrorResult: Value? { nil }
public var token: Value { getResult(index: resultCount - 1) }
public var token: Value { getResult(index: resultCount - (isCalleeAllocated ? 2 : 1)) }
public var yieldedValues: Results {
Results(inst: self, numResults: resultCount - 1)
Results(inst: self, numResults: resultCount - (isCalleeAllocated ? 2 : 1))
}
}