2021-02-04 12:41:00 +00:00
|
|
|
package inline
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/compiler/testdata/inline/a"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/compiler/testdata/inline/b"
|
|
|
|
)
|
|
|
|
|
|
|
|
func NoArgsNoReturn() {}
|
|
|
|
func NoArgsReturn1() int {
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
func Sum(a, b int) int {
|
|
|
|
return a + b
|
|
|
|
}
|
|
|
|
func sum(x, y int) int {
|
|
|
|
return x + y
|
|
|
|
}
|
|
|
|
func SumSquared(a, b int) int {
|
|
|
|
return sum(a, b) * (a + b)
|
|
|
|
}
|
|
|
|
|
|
|
|
var A = 1
|
|
|
|
|
|
|
|
func GetSumSameName() int {
|
|
|
|
return a.GetA() + b.GetA() + A
|
|
|
|
}
|
|
|
|
|
|
|
|
func DropInsideInline() int {
|
|
|
|
sum(1, 2)
|
|
|
|
sum(3, 4)
|
|
|
|
return 7
|
|
|
|
}
|
2021-02-08 10:51:25 +00:00
|
|
|
|
|
|
|
func VarSum(a int, b ...int) int {
|
|
|
|
sum := a
|
|
|
|
for i := range b {
|
|
|
|
sum += b[i]
|
|
|
|
}
|
|
|
|
return sum
|
|
|
|
}
|
2021-02-08 14:25:42 +00:00
|
|
|
|
2021-04-05 19:56:59 +00:00
|
|
|
func SumVar(a, b int) int {
|
|
|
|
return VarSum(a, b)
|
|
|
|
}
|
|
|
|
|
2021-02-08 14:25:42 +00:00
|
|
|
func Concat(n int) int {
|
|
|
|
return n*100 + b.A*10 + A
|
|
|
|
}
|
2022-07-06 14:56:53 +00:00
|
|
|
|
|
|
|
type T struct {
|
|
|
|
N int
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *T) Inc(i int) int {
|
|
|
|
n := t.N
|
|
|
|
t.N += i
|
|
|
|
return n
|
|
|
|
}
|
2022-07-11 16:28:15 +00:00
|
|
|
|
|
|
|
func NewT() T {
|
|
|
|
return T{N: 42}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t T) GetN() int {
|
|
|
|
return t.N
|
|
|
|
}
|