github.com/Konstantin8105/c4go@v0.0.0-20240505174241-768bb1c65a51/transpiler/translation_unit.go (about) 1 package transpiler 2 3 import ( 4 goast "go/ast" 5 6 "github.com/Konstantin8105/c4go/ast" 7 "github.com/Konstantin8105/c4go/program" 8 errorTree "github.com/Konstantin8105/errors" 9 ) 10 11 func transpileTranslationUnitDecl(p *program.Program, n *ast.TranslationUnitDecl) ( 12 decls []goast.Decl, err error) { 13 14 childs := n.Children() 15 et := errorTree.New("transpileTranslationUnitDecl") 16 for i := range childs { 17 ds, err := transpileToNode(childs[i], p) 18 if err != nil { 19 et.Add(err) 20 continue 21 } 22 decls = append(decls, ds...) 23 } 24 if et.IsError() { 25 err = et 26 } 27 28 return 29 }