compiler: allow to inline var arg functions
This commit is contained in:
parent
339187a56d
commit
6e560c6c9f
4 changed files with 57 additions and 4 deletions
|
@ -91,6 +91,22 @@ func TestInline(t *testing.T) {
|
|||
checkCallCount(t, src, 1, 2)
|
||||
eval(t, src, big.NewInt(51))
|
||||
})
|
||||
t.Run("var args, empty", func(t *testing.T) {
|
||||
src := fmt.Sprintf(srcTmpl, `return inline.VarSum(11)`)
|
||||
checkCallCount(t, src, 0, 1)
|
||||
eval(t, src, big.NewInt(11))
|
||||
})
|
||||
t.Run("var args, direct", func(t *testing.T) {
|
||||
src := fmt.Sprintf(srcTmpl, `return inline.VarSum(11, 14, 17)`)
|
||||
checkCallCount(t, src, 0, 1)
|
||||
eval(t, src, big.NewInt(42))
|
||||
})
|
||||
t.Run("var args, array", func(t *testing.T) {
|
||||
src := fmt.Sprintf(srcTmpl, `arr := []int{14, 17}
|
||||
return inline.VarSum(11, arr...)`)
|
||||
checkCallCount(t, src, 0, 1)
|
||||
eval(t, src, big.NewInt(42))
|
||||
})
|
||||
}
|
||||
|
||||
func TestInlineConversion(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue