github.com/HaHadaxigua/yaegi@v1.0.1/_test/issue-1065.go (about)

     1  package main
     2  
     3  import "fmt"
     4  
     5  type AST struct {
     6  	Num      int
     7  	Children []AST
     8  }
     9  
    10  func newAST(num int, root AST, children ...AST) AST {
    11  	return AST{num, append([]AST{root}, children...)}
    12  }
    13  
    14  func main() {
    15  	ast := newAST(1, AST{}, AST{})
    16  	fmt.Println(ast)
    17  }
    18  
    19  // Output:
    20  // {1 [{0 []} {0 []}]}