diff --git a/clients/flickr/types.go b/clients/flickr/types.go index bff2e20d33..01d9dac77c 100644 --- a/clients/flickr/types.go +++ b/clients/flickr/types.go @@ -9,12 +9,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __mainPackageInFile_types_CachedRef = __mainPackageInFile_types_Ref() +var __mainPackageInFile_types_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 __mainPackageInFile_types_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("User", []types.Field{ @@ -37,7 +37,7 @@ func __mainPackageInFile_types_Ref() ref.Ref { }, []ref.Ref{ ref.Parse("sha1-b525f9bca5e451c21dd9af564f0960045fbaa304"), }) - return types.RegisterPackage(&p) + __mainPackageInFile_types_CachedRef = types.RegisterPackage(&p) } // User @@ -57,13 +57,14 @@ func NewUser() User { ), &ref.Ref{}} } -var __typeRefForUser = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0) +var __typeRefForUser types.TypeRef func (m User) TypeRef() types.TypeRef { return __typeRefForUser } func init() { + __typeRefForUser = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0) types.RegisterFromValFunction(__typeRefForUser, func(v types.Value) types.Value { return UserFromVal(v) }) @@ -154,13 +155,14 @@ func NewAlbum() Album { ), &ref.Ref{}} } -var __typeRefForAlbum = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 1) +var __typeRefForAlbum types.TypeRef func (m Album) TypeRef() types.TypeRef { return __typeRefForAlbum } func init() { + __typeRefForAlbum = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 1) types.RegisterFromValFunction(__typeRefForAlbum, func(v types.Value) types.Value { return AlbumFromVal(v) }) diff --git a/clients/gen/sha1_b525f9bca5e451c21dd9af564f0960045fbaa304/sha1_b525f9bca5e451c21dd9af564f0960045fbaa304.go b/clients/gen/sha1_b525f9bca5e451c21dd9af564f0960045fbaa304/sha1_b525f9bca5e451c21dd9af564f0960045fbaa304.go index a4f747ca8e..0faaa1caed 100644 --- a/clients/gen/sha1_b525f9bca5e451c21dd9af564f0960045fbaa304/sha1_b525f9bca5e451c21dd9af564f0960045fbaa304.go +++ b/clients/gen/sha1_b525f9bca5e451c21dd9af564f0960045fbaa304/sha1_b525f9bca5e451c21dd9af564f0960045fbaa304.go @@ -9,12 +9,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __sha1_b525f9bca5e451c21dd9af564f0960045fbaa304PackageInFile_sha1_b525f9bca5e451c21dd9af564f0960045fbaa304_CachedRef = __sha1_b525f9bca5e451c21dd9af564f0960045fbaa304PackageInFile_sha1_b525f9bca5e451c21dd9af564f0960045fbaa304_Ref() +var __sha1_b525f9bca5e451c21dd9af564f0960045fbaa304PackageInFile_sha1_b525f9bca5e451c21dd9af564f0960045fbaa304_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 __sha1_b525f9bca5e451c21dd9af564f0960045fbaa304PackageInFile_sha1_b525f9bca5e451c21dd9af564f0960045fbaa304_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("RemotePhoto", []types.Field{ @@ -37,7 +37,7 @@ func __sha1_b525f9bca5e451c21dd9af564f0960045fbaa304PackageInFile_sha1_b525f9bca }, []ref.Ref{ ref.Parse("sha1-fb09d21d144c518467325465327d46489cff7c47"), }) - return types.RegisterPackage(&p) + __sha1_b525f9bca5e451c21dd9af564f0960045fbaa304PackageInFile_sha1_b525f9bca5e451c21dd9af564f0960045fbaa304_CachedRef = types.RegisterPackage(&p) } // RemotePhoto @@ -89,13 +89,14 @@ func (s RemotePhoto) Def() (d RemotePhotoDef) { return } -var __typeRefForRemotePhoto = types.MakeTypeRef(__sha1_b525f9bca5e451c21dd9af564f0960045fbaa304PackageInFile_sha1_b525f9bca5e451c21dd9af564f0960045fbaa304_CachedRef, 0) +var __typeRefForRemotePhoto types.TypeRef func (m RemotePhoto) TypeRef() types.TypeRef { return __typeRefForRemotePhoto } func init() { + __typeRefForRemotePhoto = types.MakeTypeRef(__sha1_b525f9bca5e451c21dd9af564f0960045fbaa304PackageInFile_sha1_b525f9bca5e451c21dd9af564f0960045fbaa304_CachedRef, 0) types.RegisterFromValFunction(__typeRefForRemotePhoto, func(v types.Value) types.Value { return RemotePhotoFromVal(v) }) @@ -212,13 +213,14 @@ func (s Size) Def() (d SizeDef) { return } -var __typeRefForSize = types.MakeTypeRef(__sha1_b525f9bca5e451c21dd9af564f0960045fbaa304PackageInFile_sha1_b525f9bca5e451c21dd9af564f0960045fbaa304_CachedRef, 1) +var __typeRefForSize types.TypeRef func (m Size) TypeRef() types.TypeRef { return __typeRefForSize } func init() { + __typeRefForSize = types.MakeTypeRef(__sha1_b525f9bca5e451c21dd9af564f0960045fbaa304PackageInFile_sha1_b525f9bca5e451c21dd9af564f0960045fbaa304_CachedRef, 1) types.RegisterFromValFunction(__typeRefForSize, func(v types.Value) types.Value { return SizeFromVal(v) }) diff --git a/clients/gen/sha1_fb09d21d144c518467325465327d46489cff7c47/sha1_fb09d21d144c518467325465327d46489cff7c47.go b/clients/gen/sha1_fb09d21d144c518467325465327d46489cff7c47/sha1_fb09d21d144c518467325465327d46489cff7c47.go index c5559284ac..765a56d965 100644 --- a/clients/gen/sha1_fb09d21d144c518467325465327d46489cff7c47/sha1_fb09d21d144c518467325465327d46489cff7c47.go +++ b/clients/gen/sha1_fb09d21d144c518467325465327d46489cff7c47/sha1_fb09d21d144c518467325465327d46489cff7c47.go @@ -7,12 +7,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __sha1_fb09d21d144c518467325465327d46489cff7c47PackageInFile_sha1_fb09d21d144c518467325465327d46489cff7c47_CachedRef = __sha1_fb09d21d144c518467325465327d46489cff7c47PackageInFile_sha1_fb09d21d144c518467325465327d46489cff7c47_Ref() +var __sha1_fb09d21d144c518467325465327d46489cff7c47PackageInFile_sha1_fb09d21d144c518467325465327d46489cff7c47_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 __sha1_fb09d21d144c518467325465327d46489cff7c47PackageInFile_sha1_fb09d21d144c518467325465327d46489cff7c47_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("Geoposition", []types.Field{ @@ -29,7 +29,7 @@ func __sha1_fb09d21d144c518467325465327d46489cff7c47PackageInFile_sha1_fb09d21d1 types.Choices{}, ), }, []ref.Ref{}) - return types.RegisterPackage(&p) + __sha1_fb09d21d144c518467325465327d46489cff7c47PackageInFile_sha1_fb09d21d144c518467325465327d46489cff7c47_CachedRef = types.RegisterPackage(&p) } // Geoposition @@ -65,13 +65,14 @@ func (s Geoposition) Def() (d GeopositionDef) { return } -var __typeRefForGeoposition = types.MakeTypeRef(__sha1_fb09d21d144c518467325465327d46489cff7c47PackageInFile_sha1_fb09d21d144c518467325465327d46489cff7c47_CachedRef, 0) +var __typeRefForGeoposition types.TypeRef func (m Geoposition) TypeRef() types.TypeRef { return __typeRefForGeoposition } func init() { + __typeRefForGeoposition = types.MakeTypeRef(__sha1_fb09d21d144c518467325465327d46489cff7c47PackageInFile_sha1_fb09d21d144c518467325465327d46489cff7c47_CachedRef, 0) types.RegisterFromValFunction(__typeRefForGeoposition, func(v types.Value) types.Value { return GeopositionFromVal(v) }) @@ -156,13 +157,14 @@ func (s Georectangle) Def() (d GeorectangleDef) { return } -var __typeRefForGeorectangle = types.MakeTypeRef(__sha1_fb09d21d144c518467325465327d46489cff7c47PackageInFile_sha1_fb09d21d144c518467325465327d46489cff7c47_CachedRef, 1) +var __typeRefForGeorectangle types.TypeRef func (m Georectangle) TypeRef() types.TypeRef { return __typeRefForGeorectangle } func init() { + __typeRefForGeorectangle = types.MakeTypeRef(__sha1_fb09d21d144c518467325465327d46489cff7c47PackageInFile_sha1_fb09d21d144c518467325465327d46489cff7c47_CachedRef, 1) types.RegisterFromValFunction(__typeRefForGeorectangle, func(v types.Value) types.Value { return GeorectangleFromVal(v) }) diff --git a/clients/music/mp3_importer/types.go b/clients/music/mp3_importer/types.go index d5e12ff4c5..12b520ab78 100644 --- a/clients/music/mp3_importer/types.go +++ b/clients/music/mp3_importer/types.go @@ -7,12 +7,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __mainPackageInFile_types_CachedRef = __mainPackageInFile_types_Ref() +var __mainPackageInFile_types_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 __mainPackageInFile_types_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("Song", []types.Field{ @@ -25,7 +25,7 @@ func __mainPackageInFile_types_Ref() ref.Ref { types.Choices{}, ), }, []ref.Ref{}) - return types.RegisterPackage(&p) + __mainPackageInFile_types_CachedRef = types.RegisterPackage(&p) } // Song @@ -73,13 +73,14 @@ func (s Song) Def() (d SongDef) { return } -var __typeRefForSong = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0) +var __typeRefForSong types.TypeRef func (m Song) TypeRef() types.TypeRef { return __typeRefForSong } func init() { + __typeRefForSong = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0) types.RegisterFromValFunction(__typeRefForSong, func(v types.Value) types.Value { return SongFromVal(v) }) diff --git a/clients/pitchmap/index/types.go b/clients/pitchmap/index/types.go index 7ca0955430..59421206f4 100644 --- a/clients/pitchmap/index/types.go +++ b/clients/pitchmap/index/types.go @@ -7,12 +7,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __mainPackageInFile_types_CachedRef = __mainPackageInFile_types_Ref() +var __mainPackageInFile_types_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 __mainPackageInFile_types_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("Pitch", []types.Field{ @@ -22,7 +22,7 @@ func __mainPackageInFile_types_Ref() ref.Ref { types.Choices{}, ), }, []ref.Ref{}) - return types.RegisterPackage(&p) + __mainPackageInFile_types_CachedRef = types.RegisterPackage(&p) } // Pitch @@ -58,13 +58,14 @@ func (s Pitch) Def() (d PitchDef) { return } -var __typeRefForPitch = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0) +var __typeRefForPitch types.TypeRef func (m Pitch) TypeRef() types.TypeRef { return __typeRefForPitch } func init() { + __typeRefForPitch = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0) types.RegisterFromValFunction(__typeRefForPitch, func(v types.Value) types.Value { return PitchFromVal(v) }) diff --git a/clients/quad_tree/types.go b/clients/quad_tree/types.go index 79f00ddd3a..a64226ec63 100644 --- a/clients/quad_tree/types.go +++ b/clients/quad_tree/types.go @@ -10,12 +10,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __mainPackageInFile_types_CachedRef = __mainPackageInFile_types_Ref() +var __mainPackageInFile_types_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 __mainPackageInFile_types_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("Node", []types.Field{ @@ -49,7 +49,7 @@ func __mainPackageInFile_types_Ref() ref.Ref { }, []ref.Ref{ ref.Parse("sha1-fb09d21d144c518467325465327d46489cff7c47"), }) - return types.RegisterPackage(&p) + __mainPackageInFile_types_CachedRef = types.RegisterPackage(&p) } // Node @@ -85,13 +85,14 @@ func (s Node) Def() (d NodeDef) { return } -var __typeRefForNode = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0) +var __typeRefForNode types.TypeRef func (m Node) TypeRef() types.TypeRef { return __typeRefForNode } func init() { + __typeRefForNode = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0) types.RegisterFromValFunction(__typeRefForNode, func(v types.Value) types.Value { return NodeFromVal(v) }) @@ -192,13 +193,14 @@ func (s QuadTree) Def() (d QuadTreeDef) { return } -var __typeRefForQuadTree = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 1) +var __typeRefForQuadTree types.TypeRef func (m QuadTree) TypeRef() types.TypeRef { return __typeRefForQuadTree } func init() { + __typeRefForQuadTree = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 1) types.RegisterFromValFunction(__typeRefForQuadTree, func(v types.Value) types.Value { return QuadTreeFromVal(v) }) @@ -331,13 +333,14 @@ func (s SQuadTree) Def() (d SQuadTreeDef) { return } -var __typeRefForSQuadTree = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 2) +var __typeRefForSQuadTree types.TypeRef func (m SQuadTree) TypeRef() types.TypeRef { return __typeRefForSQuadTree } func init() { + __typeRefForSQuadTree = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 2) types.RegisterFromValFunction(__typeRefForSQuadTree, func(v types.Value) types.Value { return SQuadTreeFromVal(v) }) diff --git a/clients/sfcrime_importer/types.go b/clients/sfcrime_importer/types.go index 42f894a0f6..dd65464135 100644 --- a/clients/sfcrime_importer/types.go +++ b/clients/sfcrime_importer/types.go @@ -9,12 +9,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __mainPackageInFile_types_CachedRef = __mainPackageInFile_types_Ref() +var __mainPackageInFile_types_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 __mainPackageInFile_types_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("Incident", []types.Field{ @@ -35,7 +35,7 @@ func __mainPackageInFile_types_Ref() ref.Ref { }, []ref.Ref{ ref.Parse("sha1-fb09d21d144c518467325465327d46489cff7c47"), }) - return types.RegisterPackage(&p) + __mainPackageInFile_types_CachedRef = types.RegisterPackage(&p) } // Incident @@ -107,13 +107,14 @@ func (s Incident) Def() (d IncidentDef) { return } -var __typeRefForIncident = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0) +var __typeRefForIncident types.TypeRef func (m Incident) TypeRef() types.TypeRef { return __typeRefForIncident } func init() { + __typeRefForIncident = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0) types.RegisterFromValFunction(__typeRefForIncident, func(v types.Value) types.Value { return IncidentFromVal(v) }) diff --git a/clients/sfcrime_search/types.go b/clients/sfcrime_search/types.go index 871b5babff..e3abe3d0b0 100644 --- a/clients/sfcrime_search/types.go +++ b/clients/sfcrime_search/types.go @@ -9,12 +9,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __mainPackageInFile_types_CachedRef = __mainPackageInFile_types_Ref() +var __mainPackageInFile_types_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 __mainPackageInFile_types_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("Incident", []types.Field{ @@ -40,7 +40,7 @@ func __mainPackageInFile_types_Ref() ref.Ref { }, []ref.Ref{ ref.Parse("sha1-fb09d21d144c518467325465327d46489cff7c47"), }) - return types.RegisterPackage(&p) + __mainPackageInFile_types_CachedRef = types.RegisterPackage(&p) } // Incident @@ -88,13 +88,14 @@ func (s Incident) Def() (d IncidentDef) { return } -var __typeRefForIncident = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0) +var __typeRefForIncident types.TypeRef func (m Incident) TypeRef() types.TypeRef { return __typeRefForIncident } func init() { + __typeRefForIncident = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0) types.RegisterFromValFunction(__typeRefForIncident, func(v types.Value) types.Value { return IncidentFromVal(v) }) @@ -219,13 +220,14 @@ func (s SQuadTree) Def() (d SQuadTreeDef) { return } -var __typeRefForSQuadTree = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 1) +var __typeRefForSQuadTree types.TypeRef func (m SQuadTree) TypeRef() types.TypeRef { return __typeRefForSQuadTree } func init() { + __typeRefForSQuadTree = types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 1) types.RegisterFromValFunction(__typeRefForSQuadTree, func(v types.Value) types.Value { return SQuadTreeFromVal(v) }) diff --git a/datas/types.go b/datas/types.go index a676b0e05b..6c6e9e8ae8 100644 --- a/datas/types.go +++ b/datas/types.go @@ -8,12 +8,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __datasPackageInFile_types_CachedRef = __datasPackageInFile_types_Ref() +var __datasPackageInFile_types_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 __datasPackageInFile_types_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("Commit", []types.Field{ @@ -23,7 +23,7 @@ func __datasPackageInFile_types_Ref() ref.Ref { types.Choices{}, ), }, []ref.Ref{}) - return types.RegisterPackage(&p) + __datasPackageInFile_types_CachedRef = types.RegisterPackage(&p) } // Commit @@ -59,13 +59,14 @@ func (s Commit) Def() (d CommitDef) { return } -var __typeRefForCommit = types.MakeTypeRef(__datasPackageInFile_types_CachedRef, 0) +var __typeRefForCommit types.TypeRef func (m Commit) TypeRef() types.TypeRef { return __typeRefForCommit } func init() { + __typeRefForCommit = types.MakeTypeRef(__datasPackageInFile_types_CachedRef, 0) types.RegisterFromValFunction(__typeRefForCommit, func(v types.Value) types.Value { return CommitFromVal(v) }) diff --git a/nomdl/codegen/test/enum_struct.go b/nomdl/codegen/test/enum_struct.go index 4edc7fd9cc..83f4372e58 100644 --- a/nomdl/codegen/test/enum_struct.go +++ b/nomdl/codegen/test/enum_struct.go @@ -7,12 +7,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __testPackageInFile_enum_struct_CachedRef = __testPackageInFile_enum_struct_Ref() +var __testPackageInFile_enum_struct_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 __testPackageInFile_enum_struct_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeEnumTypeRef("Handedness", "right", "left", "switch"), types.MakeStructTypeRef("EnumStruct", @@ -22,7 +22,7 @@ func __testPackageInFile_enum_struct_Ref() ref.Ref { types.Choices{}, ), }, []ref.Ref{}) - return types.RegisterPackage(&p) + __testPackageInFile_enum_struct_CachedRef = types.RegisterPackage(&p) } // Handedness @@ -39,13 +39,14 @@ func NewHandedness() Handedness { return Handedness(0) } -var __typeRefForHandedness = types.MakeTypeRef(__testPackageInFile_enum_struct_CachedRef, 0) +var __typeRefForHandedness types.TypeRef func (e Handedness) TypeRef() types.TypeRef { return __typeRefForHandedness } func init() { + __typeRefForHandedness = types.MakeTypeRef(__testPackageInFile_enum_struct_CachedRef, 0) types.RegisterFromValFunction(__typeRefForHandedness, func(v types.Value) types.Value { return Handedness(uint32(v.(types.UInt32))) }) @@ -100,13 +101,14 @@ func (s EnumStruct) Def() (d EnumStructDef) { return } -var __typeRefForEnumStruct = types.MakeTypeRef(__testPackageInFile_enum_struct_CachedRef, 1) +var __typeRefForEnumStruct types.TypeRef func (m EnumStruct) TypeRef() types.TypeRef { return __typeRefForEnumStruct } func init() { + __typeRefForEnumStruct = types.MakeTypeRef(__testPackageInFile_enum_struct_CachedRef, 1) types.RegisterFromValFunction(__typeRefForEnumStruct, func(v types.Value) types.Value { return EnumStructFromVal(v) }) diff --git a/nomdl/codegen/test/gen/sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288/sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288.go b/nomdl/codegen/test/gen/sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288/sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288.go index 0b6defb589..66ca9b4337 100644 --- a/nomdl/codegen/test/gen/sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288/sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288.go +++ b/nomdl/codegen/test/gen/sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288/sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288.go @@ -7,12 +7,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288PackageInFile_sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288_CachedRef = __sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288PackageInFile_sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288_Ref() +var __sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288PackageInFile_sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288_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 __sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288PackageInFile_sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("S", []types.Field{ @@ -23,7 +23,7 @@ func __sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288PackageInFile_sha1_bbf9c3d7e ), types.MakeEnumTypeRef("E", "e1", "e2", "e3"), }, []ref.Ref{}) - return types.RegisterPackage(&p) + __sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288PackageInFile_sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288_CachedRef = types.RegisterPackage(&p) } // S @@ -59,13 +59,14 @@ func (s S) Def() (d SDef) { return } -var __typeRefForS = types.MakeTypeRef(__sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288PackageInFile_sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288_CachedRef, 0) +var __typeRefForS types.TypeRef func (m S) TypeRef() types.TypeRef { return __typeRefForS } func init() { + __typeRefForS = types.MakeTypeRef(__sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288PackageInFile_sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288_CachedRef, 0) types.RegisterFromValFunction(__typeRefForS, func(v types.Value) types.Value { return SFromVal(v) }) @@ -131,13 +132,14 @@ func NewE() E { return E(0) } -var __typeRefForE = types.MakeTypeRef(__sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288PackageInFile_sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288_CachedRef, 1) +var __typeRefForE types.TypeRef func (e E) TypeRef() types.TypeRef { return __typeRefForE } func init() { + __typeRefForE = types.MakeTypeRef(__sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288PackageInFile_sha1_bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288_CachedRef, 1) types.RegisterFromValFunction(__typeRefForE, func(v types.Value) types.Value { return E(uint32(v.(types.UInt32))) }) diff --git a/nomdl/codegen/test/gen/sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d/sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d.go b/nomdl/codegen/test/gen/sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d/sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d.go index 18836da1ea..42157de34f 100644 --- a/nomdl/codegen/test/gen/sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d/sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d.go +++ b/nomdl/codegen/test/gen/sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d/sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d.go @@ -9,12 +9,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __sha1_d31b592f480b7659b03b72a7d1271f31dde57b2dPackageInFile_sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d_CachedRef = __sha1_d31b592f480b7659b03b72a7d1271f31dde57b2dPackageInFile_sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d_Ref() +var __sha1_d31b592f480b7659b03b72a7d1271f31dde57b2dPackageInFile_sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d_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 __sha1_d31b592f480b7659b03b72a7d1271f31dde57b2dPackageInFile_sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("D", []types.Field{ @@ -32,7 +32,7 @@ func __sha1_d31b592f480b7659b03b72a7d1271f31dde57b2dPackageInFile_sha1_d31b592f4 }, []ref.Ref{ ref.Parse("sha1-bbf9c3d7eb6ed891f4b8490b5b81f21f89f7d288"), }) - return types.RegisterPackage(&p) + __sha1_d31b592f480b7659b03b72a7d1271f31dde57b2dPackageInFile_sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d_CachedRef = types.RegisterPackage(&p) } // D @@ -68,13 +68,14 @@ func (s D) Def() (d DDef) { return } -var __typeRefForD = types.MakeTypeRef(__sha1_d31b592f480b7659b03b72a7d1271f31dde57b2dPackageInFile_sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d_CachedRef, 0) +var __typeRefForD types.TypeRef func (m D) TypeRef() types.TypeRef { return __typeRefForD } func init() { + __typeRefForD = types.MakeTypeRef(__sha1_d31b592f480b7659b03b72a7d1271f31dde57b2dPackageInFile_sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d_CachedRef, 0) types.RegisterFromValFunction(__typeRefForD, func(v types.Value) types.Value { return DFromVal(v) }) @@ -155,13 +156,14 @@ func (s DUser) Def() (d DUserDef) { return } -var __typeRefForDUser = types.MakeTypeRef(__sha1_d31b592f480b7659b03b72a7d1271f31dde57b2dPackageInFile_sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d_CachedRef, 1) +var __typeRefForDUser types.TypeRef func (m DUser) TypeRef() types.TypeRef { return __typeRefForDUser } func init() { + __typeRefForDUser = types.MakeTypeRef(__sha1_d31b592f480b7659b03b72a7d1271f31dde57b2dPackageInFile_sha1_d31b592f480b7659b03b72a7d1271f31dde57b2d_CachedRef, 1) types.RegisterFromValFunction(__typeRefForDUser, func(v types.Value) types.Value { return DUserFromVal(v) }) diff --git a/nomdl/codegen/test/ref.go b/nomdl/codegen/test/ref.go index ad655326b3..0223883106 100644 --- a/nomdl/codegen/test/ref.go +++ b/nomdl/codegen/test/ref.go @@ -8,12 +8,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __testPackageInFile_ref_CachedRef = __testPackageInFile_ref_Ref() +var __testPackageInFile_ref_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 __testPackageInFile_ref_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("StructWithRef", []types.Field{ @@ -22,7 +22,7 @@ func __testPackageInFile_ref_Ref() ref.Ref { types.Choices{}, ), }, []ref.Ref{}) - return types.RegisterPackage(&p) + __testPackageInFile_ref_CachedRef = types.RegisterPackage(&p) } // StructWithRef @@ -54,13 +54,14 @@ func (s StructWithRef) Def() (d StructWithRefDef) { return } -var __typeRefForStructWithRef = types.MakeTypeRef(__testPackageInFile_ref_CachedRef, 0) +var __typeRefForStructWithRef types.TypeRef func (m StructWithRef) TypeRef() types.TypeRef { return __typeRefForStructWithRef } func init() { + __typeRefForStructWithRef = types.MakeTypeRef(__testPackageInFile_ref_CachedRef, 0) types.RegisterFromValFunction(__typeRefForStructWithRef, func(v types.Value) types.Value { return StructWithRefFromVal(v) }) diff --git a/nomdl/codegen/test/struct.go b/nomdl/codegen/test/struct.go index 163176f0a3..832a965fc5 100644 --- a/nomdl/codegen/test/struct.go +++ b/nomdl/codegen/test/struct.go @@ -7,12 +7,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __testPackageInFile_struct_CachedRef = __testPackageInFile_struct_Ref() +var __testPackageInFile_struct_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 __testPackageInFile_struct_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("Struct", []types.Field{ @@ -22,7 +22,7 @@ func __testPackageInFile_struct_Ref() ref.Ref { types.Choices{}, ), }, []ref.Ref{}) - return types.RegisterPackage(&p) + __testPackageInFile_struct_CachedRef = types.RegisterPackage(&p) } // Struct @@ -58,13 +58,14 @@ func (s Struct) Def() (d StructDef) { return } -var __typeRefForStruct = types.MakeTypeRef(__testPackageInFile_struct_CachedRef, 0) +var __typeRefForStruct types.TypeRef func (m Struct) TypeRef() types.TypeRef { return __typeRefForStruct } func init() { + __typeRefForStruct = types.MakeTypeRef(__testPackageInFile_struct_CachedRef, 0) types.RegisterFromValFunction(__typeRefForStruct, func(v types.Value) types.Value { return StructFromVal(v) }) diff --git a/nomdl/codegen/test/struct_optional.go b/nomdl/codegen/test/struct_optional.go index 4da0f6bef8..e18507b04b 100644 --- a/nomdl/codegen/test/struct_optional.go +++ b/nomdl/codegen/test/struct_optional.go @@ -7,12 +7,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __testPackageInFile_struct_optional_CachedRef = __testPackageInFile_struct_optional_Ref() +var __testPackageInFile_struct_optional_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 __testPackageInFile_struct_optional_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("OptionalStruct", []types.Field{ @@ -22,7 +22,7 @@ func __testPackageInFile_struct_optional_Ref() ref.Ref { types.Choices{}, ), }, []ref.Ref{}) - return types.RegisterPackage(&p) + __testPackageInFile_struct_optional_CachedRef = types.RegisterPackage(&p) } // OptionalStruct @@ -59,13 +59,14 @@ func (s OptionalStruct) Def() (d OptionalStructDef) { return } -var __typeRefForOptionalStruct = types.MakeTypeRef(__testPackageInFile_struct_optional_CachedRef, 0) +var __typeRefForOptionalStruct types.TypeRef func (m OptionalStruct) TypeRef() types.TypeRef { return __typeRefForOptionalStruct } func init() { + __typeRefForOptionalStruct = types.MakeTypeRef(__testPackageInFile_struct_optional_CachedRef, 0) types.RegisterFromValFunction(__typeRefForOptionalStruct, func(v types.Value) types.Value { return OptionalStructFromVal(v) }) diff --git a/nomdl/codegen/test/struct_primitives.go b/nomdl/codegen/test/struct_primitives.go index 7e33a5fe64..f15f2ac2e8 100644 --- a/nomdl/codegen/test/struct_primitives.go +++ b/nomdl/codegen/test/struct_primitives.go @@ -7,12 +7,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __testPackageInFile_struct_primitives_CachedRef = __testPackageInFile_struct_primitives_Ref() +var __testPackageInFile_struct_primitives_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 __testPackageInFile_struct_primitives_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("StructPrimitives", []types.Field{ @@ -34,7 +34,7 @@ func __testPackageInFile_struct_primitives_Ref() ref.Ref { types.Choices{}, ), }, []ref.Ref{}) - return types.RegisterPackage(&p) + __testPackageInFile_struct_primitives_CachedRef = types.RegisterPackage(&p) } // StructPrimitives @@ -118,13 +118,14 @@ func (s StructPrimitives) Def() (d StructPrimitivesDef) { return } -var __typeRefForStructPrimitives = types.MakeTypeRef(__testPackageInFile_struct_primitives_CachedRef, 0) +var __typeRefForStructPrimitives types.TypeRef func (m StructPrimitives) TypeRef() types.TypeRef { return __typeRefForStructPrimitives } func init() { + __typeRefForStructPrimitives = types.MakeTypeRef(__testPackageInFile_struct_primitives_CachedRef, 0) types.RegisterFromValFunction(__typeRefForStructPrimitives, func(v types.Value) types.Value { return StructPrimitivesFromVal(v) }) diff --git a/nomdl/codegen/test/struct_recursive.go b/nomdl/codegen/test/struct_recursive.go index c9e9baadbe..c4e5845fc5 100644 --- a/nomdl/codegen/test/struct_recursive.go +++ b/nomdl/codegen/test/struct_recursive.go @@ -7,12 +7,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __testPackageInFile_struct_recursive_CachedRef = __testPackageInFile_struct_recursive_Ref() +var __testPackageInFile_struct_recursive_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 __testPackageInFile_struct_recursive_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("Tree", []types.Field{ @@ -21,7 +21,7 @@ func __testPackageInFile_struct_recursive_Ref() ref.Ref { types.Choices{}, ), }, []ref.Ref{}) - return types.RegisterPackage(&p) + __testPackageInFile_struct_recursive_CachedRef = types.RegisterPackage(&p) } // Tree @@ -53,13 +53,14 @@ func (s Tree) Def() (d TreeDef) { return } -var __typeRefForTree = types.MakeTypeRef(__testPackageInFile_struct_recursive_CachedRef, 0) +var __typeRefForTree types.TypeRef func (m Tree) TypeRef() types.TypeRef { return __typeRefForTree } func init() { + __typeRefForTree = types.MakeTypeRef(__testPackageInFile_struct_recursive_CachedRef, 0) types.RegisterFromValFunction(__typeRefForTree, func(v types.Value) types.Value { return TreeFromVal(v) }) diff --git a/nomdl/codegen/test/struct_with_imports.go b/nomdl/codegen/test/struct_with_imports.go index ff974d9523..393e55da8a 100644 --- a/nomdl/codegen/test/struct_with_imports.go +++ b/nomdl/codegen/test/struct_with_imports.go @@ -9,12 +9,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __testPackageInFile_struct_with_imports_CachedRef = __testPackageInFile_struct_with_imports_Ref() +var __testPackageInFile_struct_with_imports_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 __testPackageInFile_struct_with_imports_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeEnumTypeRef("E", "E1", "Ignored"), types.MakeStructTypeRef("ImportUser", @@ -27,7 +27,7 @@ func __testPackageInFile_struct_with_imports_Ref() ref.Ref { }, []ref.Ref{ ref.Parse("sha1-d31b592f480b7659b03b72a7d1271f31dde57b2d"), }) - return types.RegisterPackage(&p) + __testPackageInFile_struct_with_imports_CachedRef = types.RegisterPackage(&p) } // E @@ -43,13 +43,14 @@ func NewE() E { return E(0) } -var __typeRefForE = types.MakeTypeRef(__testPackageInFile_struct_with_imports_CachedRef, 0) +var __typeRefForE types.TypeRef func (e E) TypeRef() types.TypeRef { return __typeRefForE } func init() { + __typeRefForE = types.MakeTypeRef(__testPackageInFile_struct_with_imports_CachedRef, 0) types.RegisterFromValFunction(__typeRefForE, func(v types.Value) types.Value { return E(uint32(v.(types.UInt32))) }) @@ -108,13 +109,14 @@ func (s ImportUser) Def() (d ImportUserDef) { return } -var __typeRefForImportUser = types.MakeTypeRef(__testPackageInFile_struct_with_imports_CachedRef, 1) +var __typeRefForImportUser types.TypeRef func (m ImportUser) TypeRef() types.TypeRef { return __typeRefForImportUser } func init() { + __typeRefForImportUser = types.MakeTypeRef(__testPackageInFile_struct_with_imports_CachedRef, 1) types.RegisterFromValFunction(__typeRefForImportUser, func(v types.Value) types.Value { return ImportUserFromVal(v) }) diff --git a/nomdl/codegen/test/struct_with_list.go b/nomdl/codegen/test/struct_with_list.go index 2323be1a19..174a19e173 100644 --- a/nomdl/codegen/test/struct_with_list.go +++ b/nomdl/codegen/test/struct_with_list.go @@ -7,12 +7,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __testPackageInFile_struct_with_list_CachedRef = __testPackageInFile_struct_with_list_Ref() +var __testPackageInFile_struct_with_list_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 __testPackageInFile_struct_with_list_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("StructWithList", []types.Field{ @@ -24,7 +24,7 @@ func __testPackageInFile_struct_with_list_Ref() ref.Ref { types.Choices{}, ), }, []ref.Ref{}) - return types.RegisterPackage(&p) + __testPackageInFile_struct_with_list_CachedRef = types.RegisterPackage(&p) } // StructWithList @@ -68,13 +68,14 @@ func (s StructWithList) Def() (d StructWithListDef) { return } -var __typeRefForStructWithList = types.MakeTypeRef(__testPackageInFile_struct_with_list_CachedRef, 0) +var __typeRefForStructWithList types.TypeRef func (m StructWithList) TypeRef() types.TypeRef { return __typeRefForStructWithList } func init() { + __typeRefForStructWithList = types.MakeTypeRef(__testPackageInFile_struct_with_list_CachedRef, 0) types.RegisterFromValFunction(__typeRefForStructWithList, func(v types.Value) types.Value { return StructWithListFromVal(v) }) diff --git a/nomdl/codegen/test/struct_with_union_field.go b/nomdl/codegen/test/struct_with_union_field.go index dc5732b146..ca8a471cdc 100644 --- a/nomdl/codegen/test/struct_with_union_field.go +++ b/nomdl/codegen/test/struct_with_union_field.go @@ -7,12 +7,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __testPackageInFile_struct_with_union_field_CachedRef = __testPackageInFile_struct_with_union_field_Ref() +var __testPackageInFile_struct_with_union_field_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 __testPackageInFile_struct_with_union_field_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("StructWithUnionField", []types.Field{ @@ -27,7 +27,7 @@ func __testPackageInFile_struct_with_union_field_Ref() ref.Ref { }, ), }, []ref.Ref{}) - return types.RegisterPackage(&p) + __testPackageInFile_struct_with_union_field_CachedRef = types.RegisterPackage(&p) } // StructWithUnionField @@ -99,13 +99,14 @@ func (s StructWithUnionField) __unionValueToDef() interface{} { panic("unreachable") } -var __typeRefForStructWithUnionField = types.MakeTypeRef(__testPackageInFile_struct_with_union_field_CachedRef, 0) +var __typeRefForStructWithUnionField types.TypeRef func (m StructWithUnionField) TypeRef() types.TypeRef { return __typeRefForStructWithUnionField } func init() { + __typeRefForStructWithUnionField = types.MakeTypeRef(__testPackageInFile_struct_with_union_field_CachedRef, 0) types.RegisterFromValFunction(__typeRefForStructWithUnionField, func(v types.Value) types.Value { return StructWithUnionFieldFromVal(v) }) diff --git a/nomdl/codegen/test/struct_with_unions.go b/nomdl/codegen/test/struct_with_unions.go index 04e26edb4f..2edb112c3c 100644 --- a/nomdl/codegen/test/struct_with_unions.go +++ b/nomdl/codegen/test/struct_with_unions.go @@ -7,12 +7,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __testPackageInFile_struct_with_unions_CachedRef = __testPackageInFile_struct_with_unions_Ref() +var __testPackageInFile_struct_with_unions_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 __testPackageInFile_struct_with_unions_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("StructWithUnions", []types.Field{ @@ -36,7 +36,7 @@ func __testPackageInFile_struct_with_unions_Ref() ref.Ref { }, ), }, []ref.Ref{}) - return types.RegisterPackage(&p) + __testPackageInFile_struct_with_unions_CachedRef = types.RegisterPackage(&p) } // StructWithUnions @@ -72,13 +72,14 @@ func (s StructWithUnions) Def() (d StructWithUnionsDef) { return } -var __typeRefForStructWithUnions = types.MakeTypeRef(__testPackageInFile_struct_with_unions_CachedRef, 0) +var __typeRefForStructWithUnions types.TypeRef func (m StructWithUnions) TypeRef() types.TypeRef { return __typeRefForStructWithUnions } func init() { + __typeRefForStructWithUnions = types.MakeTypeRef(__testPackageInFile_struct_with_unions_CachedRef, 0) types.RegisterFromValFunction(__typeRefForStructWithUnions, func(v types.Value) types.Value { return StructWithUnionsFromVal(v) }) @@ -183,13 +184,14 @@ func (s __unionOfBOfFloat64AndCOfString) __unionValueToDef() interface{} { panic("unreachable") } -var __typeRefFor__unionOfBOfFloat64AndCOfString = types.MakeTypeRef(__testPackageInFile_struct_with_unions_CachedRef, 1) +var __typeRefFor__unionOfBOfFloat64AndCOfString types.TypeRef func (m __unionOfBOfFloat64AndCOfString) TypeRef() types.TypeRef { return __typeRefFor__unionOfBOfFloat64AndCOfString } func init() { + __typeRefFor__unionOfBOfFloat64AndCOfString = types.MakeTypeRef(__testPackageInFile_struct_with_unions_CachedRef, 1) types.RegisterFromValFunction(__typeRefFor__unionOfBOfFloat64AndCOfString, func(v types.Value) types.Value { return __unionOfBOfFloat64AndCOfStringFromVal(v) }) @@ -326,13 +328,14 @@ func (s __unionOfEOfFloat64AndFOfString) __unionValueToDef() interface{} { panic("unreachable") } -var __typeRefFor__unionOfEOfFloat64AndFOfString = types.MakeTypeRef(__testPackageInFile_struct_with_unions_CachedRef, 2) +var __typeRefFor__unionOfEOfFloat64AndFOfString types.TypeRef func (m __unionOfEOfFloat64AndFOfString) TypeRef() types.TypeRef { return __typeRefFor__unionOfEOfFloat64AndFOfString } func init() { + __typeRefFor__unionOfEOfFloat64AndFOfString = types.MakeTypeRef(__testPackageInFile_struct_with_unions_CachedRef, 2) types.RegisterFromValFunction(__typeRefFor__unionOfEOfFloat64AndFOfString, func(v types.Value) types.Value { return __unionOfEOfFloat64AndFOfStringFromVal(v) }) diff --git a/nomdl/codegen/testDeps/leafDep/leafDep.go b/nomdl/codegen/testDeps/leafDep/leafDep.go index 09f084ac65..9d8460112a 100644 --- a/nomdl/codegen/testDeps/leafDep/leafDep.go +++ b/nomdl/codegen/testDeps/leafDep/leafDep.go @@ -7,12 +7,12 @@ import ( "github.com/attic-labs/noms/types" ) -var __testPackageInFile_leafDep_CachedRef = __testPackageInFile_leafDep_Ref() +var __testPackageInFile_leafDep_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 __testPackageInFile_leafDep_Ref() ref.Ref { +func init() { p := types.NewPackage([]types.TypeRef{ types.MakeStructTypeRef("S", []types.Field{ @@ -23,7 +23,7 @@ func __testPackageInFile_leafDep_Ref() ref.Ref { ), types.MakeEnumTypeRef("E", "e1", "e2", "e3"), }, []ref.Ref{}) - return types.RegisterPackage(&p) + __testPackageInFile_leafDep_CachedRef = types.RegisterPackage(&p) } // S @@ -59,13 +59,14 @@ func (s S) Def() (d SDef) { return } -var __typeRefForS = types.MakeTypeRef(__testPackageInFile_leafDep_CachedRef, 0) +var __typeRefForS types.TypeRef func (m S) TypeRef() types.TypeRef { return __typeRefForS } func init() { + __typeRefForS = types.MakeTypeRef(__testPackageInFile_leafDep_CachedRef, 0) types.RegisterFromValFunction(__typeRefForS, func(v types.Value) types.Value { return SFromVal(v) }) @@ -131,13 +132,14 @@ func NewE() E { return E(0) } -var __typeRefForE = types.MakeTypeRef(__testPackageInFile_leafDep_CachedRef, 1) +var __typeRefForE types.TypeRef func (e E) TypeRef() types.TypeRef { return __typeRefForE } func init() { + __typeRefForE = types.MakeTypeRef(__testPackageInFile_leafDep_CachedRef, 1) types.RegisterFromValFunction(__typeRefForE, func(v types.Value) types.Value { return E(uint32(v.(types.UInt32))) })