Files
dolt/nomdl/codegen/header.tmpl
Chris Masone b3307b4feb Always generate Package ref and cache it
The initial patch did this lazily, but that's kinda dumb.
People won't compile in generated code they don't use.
2015-09-24 08:45:58 -07:00

23 lines
670 B
Cheetah

// This file was generated by nomdl/codegen.
package {{.Name}}
import "github.com/attic-labs/noms/types"
{{if .HasTypes}}
var __{{.Name}}PackageInFile_{{.FileID}}_CachedRef = __{{.Name}}PackageInFile_{{.FileID}}_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 __{{.Name}}PackageInFile_{{.FileID}}_Ref() types.Ref {
p := types.PackageDef{
Types: types.MapOfStringToTypeRefDef{
{{range $name, $t := .NamedTypes}}
"{{$name}}": __typeRefOf{{$name}}(),{{end}}
},
}.New()
return types.Ref{R: types.RegisterPackage(&p)}
}
{{end}}