Files
dolt/nomdl/codegen/header.tmpl
Erik Arvidsson 91e7ffb8e1 NomDL Codegen: Parameterize the types package
This allows us to use the codegen from types/ without manual touchups
2015-10-23 11:04:30 -04:00

31 lines
824 B
Cheetah

{{$typesPackage := .TypesPackage}}
// This file was generated by nomdl/codegen.
package {{.Name}}
{{if .HasImports}}
import (
{{range $imp := .Imports}}"{{$imp}}"
{{end}}
"github.com/attic-labs/noms/ref"
"github.com/attic-labs/noms/types"
)
{{end}}
{{if .HasTypes}}
var __{{.Name}}PackageInFile_{{.FileID}}_CachedRef ref.Ref
// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
p := {{$typesPackage}}NewPackage([]{{$typesPackage}}TypeRef{ {{range $t := .Types}}
{{toTypesTypeRef $t "" ""}},{{end}}
}, []ref.Ref{ {{range $deps := .Dependencies}}
ref.Parse("{{$deps}}"),{{end}}
})
__{{.Name}}PackageInFile_{{.FileID}}_CachedRef = {{$typesPackage}}RegisterPackage(&p)
}
{{end}}