in Sources/SIL/SILParser.swift [56:72]
func parseInstructionDefs() throws -> ([OperatorDef], TerminatorDef) {
var operatorDefs = [OperatorDef]()
while true {
switch try parseInstructionDef() {
case let .operator(operatorDef):
operatorDefs.append(operatorDef)
case let .terminator(terminatorDef):
return (operatorDefs, terminatorDef)
}
if peek("bb") || peek("}") {
guard case let .unknown(instructionName) = operatorDefs.popLast()?.operator else {
throw parseError("block is missing a terminator")
}
return (operatorDefs, TerminatorDef(.unknown(instructionName), nil))
}
}
}