compiler: allow to use conditional returns in inlined functions

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgeniy Stratonikov 2022-07-11 11:38:18 +03:00
parent 9414538309
commit ce24451fde
4 changed files with 90 additions and 10 deletions

22
pkg/compiler/testdata/inline/c/null.go vendored Normal file
View file

@ -0,0 +1,22 @@
package c
func Is42(a int) bool {
if a == 42 {
return true
}
return false
}
func MulIfSmall(n int) int {
if n < 10 {
return n * 2
}
return n
}
func Transform(a, b int) int {
if Is42(a) && !Is42(b) {
return MulIfSmall(b)
}
return MulIfSmall(a)
}