compiler: support all kinds of deferred builtins

This change extends defer support to all supported builitin functions.
Not all of them make sense (such as len, cap, real, imag, etc) but this
change for example adds support for `defer(delete(m, key))` which is
used in the Go 1.15 encoding/json package.
This commit is contained in:
Ayke van Laethem
2021-01-21 17:10:19 +01:00
committed by Ron Evans
parent d85ac4b3cc
commit 9bd36597d6
4 changed files with 75 additions and 49 deletions
+1 -2
View File
@@ -79,8 +79,7 @@ func (b *builder) createChanRecv(unop *ssa.UnOp) llvm.Value {
}
// createChanClose closes the given channel.
func (b *builder) createChanClose(param ssa.Value) {
ch := b.getValue(param)
func (b *builder) createChanClose(ch llvm.Value) {
b.createRuntimeCall("chanClose", []llvm.Value{ch}, "")
}