Return returns execution of the function with the given value
(val *Value)
| 308 | |
| 309 | // Return returns execution of the function with the given value |
| 310 | func (b *Builder) Return(val *Value) { |
| 311 | if val != nil { |
| 312 | assertTypesEqual(val.Type(), b.function.Type.Signature.Result) |
| 313 | b.llvm.CreateStore(val.llvm, b.result) |
| 314 | } else if !b.result.IsNil() { |
| 315 | b.llvm.CreateStore(llvm.ConstNull(b.function.Type.Signature.Result.llvmTy()), b.result) |
| 316 | } |
| 317 | b.llvm.CreateBr(b.exit) |
| 318 | } |
| 319 | |
| 320 | // IsBlockTerminated returns true if the last instruction is a terminator |
| 321 | // (unconditional jump). It is illegal to write another instruction after a |