mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-26 03:30:09 -05:00
@@ -339,15 +339,6 @@ func (l ListOfRefOfIncident) Def() ListOfRefOfIncidentDef {
|
||||
return d
|
||||
}
|
||||
|
||||
func ListOfRefOfIncidentFromVal(val types.Value) ListOfRefOfIncident {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(ListOfRefOfIncident); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return ListOfRefOfIncident{val.(types.List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfRefOfIncident) InternalImplementation() types.List {
|
||||
return l.l
|
||||
}
|
||||
@@ -376,7 +367,7 @@ func (m ListOfRefOfIncident) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForListOfRefOfIncident = types.MakeCompoundTypeRef(types.ListKind, types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(__commonPackageInFile_incident_CachedRef, 0)))
|
||||
types.RegisterFromValFunction(__typeRefForListOfRefOfIncident, func(v types.Value) types.Value {
|
||||
return ListOfRefOfIncidentFromVal(v)
|
||||
return ListOfRefOfIncident{v.(types.List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -481,14 +472,6 @@ func (r RefOfIncident) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfIncidentFromVal(val types.Value) RefOfIncident {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfIncident); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfIncident(val.(types.Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfIncident.
|
||||
var __typeRefForRefOfIncident types.TypeRef
|
||||
|
||||
@@ -499,7 +482,7 @@ func (m RefOfIncident) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfIncident = types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(__commonPackageInFile_incident_CachedRef, 0))
|
||||
types.RegisterFromValFunction(__typeRefForRefOfIncident, func(v types.Value) types.Value {
|
||||
return RefOfIncidentFromVal(v)
|
||||
return NewRefOfIncident(v.(types.Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -363,15 +363,6 @@ func (m MapOfSizeToString) Def() MapOfSizeToStringDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func MapOfSizeToStringFromVal(val types.Value) MapOfSizeToString {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(MapOfSizeToString); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return MapOfSizeToString{val.(types.Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m MapOfSizeToString) InternalImplementation() types.Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -400,7 +391,7 @@ func (m MapOfSizeToString) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForMapOfSizeToString = types.MakeCompoundTypeRef(types.MapKind, types.MakeTypeRef(__commonPackageInFile_photo_CachedRef, 1), types.MakePrimitiveTypeRef(types.StringKind))
|
||||
types.RegisterFromValFunction(__typeRefForMapOfSizeToString, func(v types.Value) types.Value {
|
||||
return MapOfSizeToStringFromVal(v)
|
||||
return MapOfSizeToString{v.(types.Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -498,14 +489,6 @@ func (s SetOfString) Def() SetOfStringDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func SetOfStringFromVal(val types.Value) SetOfString {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(SetOfString); ok {
|
||||
return val
|
||||
}
|
||||
return SetOfString{val.(types.Set), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) InternalImplementation() types.Set {
|
||||
return s.s
|
||||
}
|
||||
@@ -534,7 +517,7 @@ func (m SetOfString) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForSetOfString = types.MakeCompoundTypeRef(types.SetKind, types.MakePrimitiveTypeRef(types.StringKind))
|
||||
types.RegisterFromValFunction(__typeRefForSetOfString, func(v types.Value) types.Value {
|
||||
return SetOfStringFromVal(v)
|
||||
return SetOfString{v.(types.Set), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -561,14 +561,6 @@ func (r RefOfValue) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfValueFromVal(val types.Value) RefOfValue {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfValue); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfValue(val.(types.Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfValue.
|
||||
var __typeRefForRefOfValue types.TypeRef
|
||||
|
||||
@@ -579,7 +571,7 @@ func (m RefOfValue) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfValue = types.MakeCompoundTypeRef(types.RefKind, types.MakePrimitiveTypeRef(types.ValueKind))
|
||||
types.RegisterFromValFunction(__typeRefForRefOfValue, func(v types.Value) types.Value {
|
||||
return RefOfValueFromVal(v)
|
||||
return NewRefOfValue(v.(types.Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -620,15 +612,6 @@ func (l ListOfNode) Def() ListOfNodeDef {
|
||||
return d
|
||||
}
|
||||
|
||||
func ListOfNodeFromVal(val types.Value) ListOfNode {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(ListOfNode); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return ListOfNode{val.(types.List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfNode) InternalImplementation() types.List {
|
||||
return l.l
|
||||
}
|
||||
@@ -657,7 +640,7 @@ func (m ListOfNode) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForListOfNode = types.MakeCompoundTypeRef(types.ListKind, types.MakeTypeRef(__commonPackageInFile_quad_tree_CachedRef, 0))
|
||||
types.RegisterFromValFunction(__typeRefForListOfNode, func(v types.Value) types.Value {
|
||||
return ListOfNodeFromVal(v)
|
||||
return ListOfNode{v.(types.List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -763,15 +746,6 @@ func (m MapOfStringToQuadTree) Def() MapOfStringToQuadTreeDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func MapOfStringToQuadTreeFromVal(val types.Value) MapOfStringToQuadTree {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(MapOfStringToQuadTree); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return MapOfStringToQuadTree{val.(types.Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m MapOfStringToQuadTree) InternalImplementation() types.Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -800,7 +774,7 @@ func (m MapOfStringToQuadTree) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForMapOfStringToQuadTree = types.MakeCompoundTypeRef(types.MapKind, types.MakePrimitiveTypeRef(types.StringKind), types.MakeTypeRef(__commonPackageInFile_quad_tree_CachedRef, 1))
|
||||
types.RegisterFromValFunction(__typeRefForMapOfStringToQuadTree, func(v types.Value) types.Value {
|
||||
return MapOfStringToQuadTreeFromVal(v)
|
||||
return MapOfStringToQuadTree{v.(types.Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -895,15 +869,6 @@ func (l ListOfRefOfValue) Def() ListOfRefOfValueDef {
|
||||
return d
|
||||
}
|
||||
|
||||
func ListOfRefOfValueFromVal(val types.Value) ListOfRefOfValue {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(ListOfRefOfValue); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return ListOfRefOfValue{val.(types.List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfRefOfValue) InternalImplementation() types.List {
|
||||
return l.l
|
||||
}
|
||||
@@ -932,7 +897,7 @@ func (m ListOfRefOfValue) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForListOfRefOfValue = types.MakeCompoundTypeRef(types.ListKind, types.MakeCompoundTypeRef(types.RefKind, types.MakePrimitiveTypeRef(types.ValueKind)))
|
||||
types.RegisterFromValFunction(__typeRefForListOfRefOfValue, func(v types.Value) types.Value {
|
||||
return ListOfRefOfValueFromVal(v)
|
||||
return ListOfRefOfValue{v.(types.List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1038,15 +1003,6 @@ func (m MapOfStringToRefOfSQuadTree) Def() MapOfStringToRefOfSQuadTreeDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func MapOfStringToRefOfSQuadTreeFromVal(val types.Value) MapOfStringToRefOfSQuadTree {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(MapOfStringToRefOfSQuadTree); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return MapOfStringToRefOfSQuadTree{val.(types.Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m MapOfStringToRefOfSQuadTree) InternalImplementation() types.Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -1075,7 +1031,7 @@ func (m MapOfStringToRefOfSQuadTree) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForMapOfStringToRefOfSQuadTree = types.MakeCompoundTypeRef(types.MapKind, types.MakePrimitiveTypeRef(types.StringKind), types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(__commonPackageInFile_quad_tree_CachedRef, 2)))
|
||||
types.RegisterFromValFunction(__typeRefForMapOfStringToRefOfSQuadTree, func(v types.Value) types.Value {
|
||||
return MapOfStringToRefOfSQuadTreeFromVal(v)
|
||||
return MapOfStringToRefOfSQuadTree{v.(types.Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1170,14 +1126,6 @@ func (r RefOfSQuadTree) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfSQuadTreeFromVal(val types.Value) RefOfSQuadTree {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfSQuadTree); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfSQuadTree(val.(types.Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfSQuadTree.
|
||||
var __typeRefForRefOfSQuadTree types.TypeRef
|
||||
|
||||
@@ -1188,7 +1136,7 @@ func (m RefOfSQuadTree) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfSQuadTree = types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(__commonPackageInFile_quad_tree_CachedRef, 2))
|
||||
types.RegisterFromValFunction(__typeRefForRefOfSQuadTree, func(v types.Value) types.Value {
|
||||
return RefOfSQuadTreeFromVal(v)
|
||||
return NewRefOfSQuadTree(v.(types.Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -363,15 +363,6 @@ func (m MapOfSizeToString) Def() MapOfSizeToStringDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func MapOfSizeToStringFromVal(val types.Value) MapOfSizeToString {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(MapOfSizeToString); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return MapOfSizeToString{val.(types.Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m MapOfSizeToString) InternalImplementation() types.Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -400,7 +391,7 @@ func (m MapOfSizeToString) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForMapOfSizeToString = types.MakeCompoundTypeRef(types.MapKind, types.MakeTypeRef(__mainPackageInFile_sha1_00419eb_CachedRef, 1), types.MakePrimitiveTypeRef(types.StringKind))
|
||||
types.RegisterFromValFunction(__typeRefForMapOfSizeToString, func(v types.Value) types.Value {
|
||||
return MapOfSizeToStringFromVal(v)
|
||||
return MapOfSizeToString{v.(types.Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -498,14 +489,6 @@ func (s SetOfString) Def() SetOfStringDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func SetOfStringFromVal(val types.Value) SetOfString {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(SetOfString); ok {
|
||||
return val
|
||||
}
|
||||
return SetOfString{val.(types.Set), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) InternalImplementation() types.Set {
|
||||
return s.s
|
||||
}
|
||||
@@ -534,7 +517,7 @@ func (m SetOfString) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForSetOfString = types.MakeCompoundTypeRef(types.SetKind, types.MakePrimitiveTypeRef(types.StringKind))
|
||||
types.RegisterFromValFunction(__typeRefForSetOfString, func(v types.Value) types.Value {
|
||||
return SetOfStringFromVal(v)
|
||||
return SetOfString{v.(types.Set), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -363,15 +363,6 @@ func (m MapOfStringToAlbum) Def() MapOfStringToAlbumDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func MapOfStringToAlbumFromVal(val types.Value) MapOfStringToAlbum {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(MapOfStringToAlbum); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return MapOfStringToAlbum{val.(types.Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m MapOfStringToAlbum) InternalImplementation() types.Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -400,7 +391,7 @@ func (m MapOfStringToAlbum) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForMapOfStringToAlbum = types.MakeCompoundTypeRef(types.MapKind, types.MakePrimitiveTypeRef(types.StringKind), types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 1))
|
||||
types.RegisterFromValFunction(__typeRefForMapOfStringToAlbum, func(v types.Value) types.Value {
|
||||
return MapOfStringToAlbumFromVal(v)
|
||||
return MapOfStringToAlbum{v.(types.Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -495,14 +486,6 @@ func (r RefOfUser) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfUserFromVal(val types.Value) RefOfUser {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfUser); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfUser(val.(types.Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfUser.
|
||||
var __typeRefForRefOfUser types.TypeRef
|
||||
|
||||
@@ -513,7 +496,7 @@ func (m RefOfUser) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfUser = types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0))
|
||||
types.RegisterFromValFunction(__typeRefForRefOfUser, func(v types.Value) types.Value {
|
||||
return RefOfUserFromVal(v)
|
||||
return NewRefOfUser(v.(types.Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -554,14 +537,6 @@ func (r RefOfSetOfRefOfRemotePhoto) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfSetOfRefOfRemotePhotoFromVal(val types.Value) RefOfSetOfRefOfRemotePhoto {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfSetOfRefOfRemotePhoto); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfSetOfRefOfRemotePhoto(val.(types.Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfSetOfRefOfRemotePhoto.
|
||||
var __typeRefForRefOfSetOfRefOfRemotePhoto types.TypeRef
|
||||
|
||||
@@ -572,7 +547,7 @@ func (m RefOfSetOfRefOfRemotePhoto) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfSetOfRefOfRemotePhoto = types.MakeCompoundTypeRef(types.RefKind, types.MakeCompoundTypeRef(types.SetKind, types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(ref.Parse("sha1-00419ebbb418539af67238164b20341913efeb4d"), 0))))
|
||||
types.RegisterFromValFunction(__typeRefForRefOfSetOfRefOfRemotePhoto, func(v types.Value) types.Value {
|
||||
return RefOfSetOfRefOfRemotePhotoFromVal(v)
|
||||
return NewRefOfSetOfRefOfRemotePhoto(v.(types.Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -616,14 +591,6 @@ func (s SetOfRefOfRemotePhoto) Def() SetOfRefOfRemotePhotoDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func SetOfRefOfRemotePhotoFromVal(val types.Value) SetOfRefOfRemotePhoto {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(SetOfRefOfRemotePhoto); ok {
|
||||
return val
|
||||
}
|
||||
return SetOfRefOfRemotePhoto{val.(types.Set), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfRemotePhoto) InternalImplementation() types.Set {
|
||||
return s.s
|
||||
}
|
||||
@@ -652,7 +619,7 @@ func (m SetOfRefOfRemotePhoto) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForSetOfRefOfRemotePhoto = types.MakeCompoundTypeRef(types.SetKind, types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(ref.Parse("sha1-00419ebbb418539af67238164b20341913efeb4d"), 0)))
|
||||
types.RegisterFromValFunction(__typeRefForSetOfRefOfRemotePhoto, func(v types.Value) types.Value {
|
||||
return SetOfRefOfRemotePhotoFromVal(v)
|
||||
return SetOfRefOfRemotePhoto{v.(types.Set), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -761,14 +728,6 @@ func (r RefOfRemotePhoto) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfRemotePhotoFromVal(val types.Value) RefOfRemotePhoto {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfRemotePhoto); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfRemotePhoto(val.(types.Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfRemotePhoto.
|
||||
var __typeRefForRefOfRemotePhoto types.TypeRef
|
||||
|
||||
@@ -779,7 +738,7 @@ func (m RefOfRemotePhoto) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfRemotePhoto = types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(ref.Parse("sha1-00419ebbb418539af67238164b20341913efeb4d"), 0))
|
||||
types.RegisterFromValFunction(__typeRefForRefOfRemotePhoto, func(v types.Value) types.Value {
|
||||
return RefOfRemotePhotoFromVal(v)
|
||||
return NewRefOfRemotePhoto(v.(types.Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ func listSongs(ds *dataset.Dataset) {
|
||||
func readSongsFromDataset(ds *dataset.Dataset) ListOfSong {
|
||||
songs := NewListOfSong()
|
||||
if commit, ok := ds.MaybeHead(); ok {
|
||||
songs = ListOfSongFromVal(commit.Value())
|
||||
songs = commit.Value().(ListOfSong)
|
||||
}
|
||||
return songs
|
||||
}
|
||||
|
||||
@@ -222,15 +222,6 @@ func (l ListOfSong) Def() ListOfSongDef {
|
||||
return d
|
||||
}
|
||||
|
||||
func ListOfSongFromVal(val types.Value) ListOfSong {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(ListOfSong); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return ListOfSong{val.(types.List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfSong) InternalImplementation() types.List {
|
||||
return l.l
|
||||
}
|
||||
@@ -259,7 +250,7 @@ func (m ListOfSong) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForListOfSong = types.MakeCompoundTypeRef(types.ListKind, types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0))
|
||||
types.RegisterFromValFunction(__typeRefForListOfSong, func(v types.Value) types.Value {
|
||||
return ListOfSongFromVal(v)
|
||||
return ListOfSong{v.(types.List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -401,15 +401,6 @@ func (m MapOfStringToAlbum) Def() MapOfStringToAlbumDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func MapOfStringToAlbumFromVal(val types.Value) MapOfStringToAlbum {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(MapOfStringToAlbum); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return MapOfStringToAlbum{val.(types.Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m MapOfStringToAlbum) InternalImplementation() types.Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -438,7 +429,7 @@ func (m MapOfStringToAlbum) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForMapOfStringToAlbum = types.MakeCompoundTypeRef(types.MapKind, types.MakePrimitiveTypeRef(types.StringKind), types.MakeTypeRef(__mainPackageInFile_picasa_CachedRef, 1))
|
||||
types.RegisterFromValFunction(__typeRefForMapOfStringToAlbum, func(v types.Value) types.Value {
|
||||
return MapOfStringToAlbumFromVal(v)
|
||||
return MapOfStringToAlbum{v.(types.Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -515,14 +506,6 @@ func NewSetOfRemotePhoto() SetOfRemotePhoto {
|
||||
return SetOfRemotePhoto{types.NewSet(), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func SetOfRemotePhotoFromVal(val types.Value) SetOfRemotePhoto {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(SetOfRemotePhoto); ok {
|
||||
return val
|
||||
}
|
||||
return SetOfRemotePhoto{val.(types.Set), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRemotePhoto) InternalImplementation() types.Set {
|
||||
return s.s
|
||||
}
|
||||
@@ -551,7 +534,7 @@ func (m SetOfRemotePhoto) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForSetOfRemotePhoto = types.MakeCompoundTypeRef(types.SetKind, types.MakeTypeRef(ref.Parse("sha1-00419ebbb418539af67238164b20341913efeb4d"), 0))
|
||||
types.RegisterFromValFunction(__typeRefForSetOfRemotePhoto, func(v types.Value) types.Value {
|
||||
return SetOfRemotePhotoFromVal(v)
|
||||
return SetOfRemotePhoto{v.(types.Set), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -660,14 +643,6 @@ func (r RefOfUser) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfUserFromVal(val types.Value) RefOfUser {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfUser); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfUser(val.(types.Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfUser.
|
||||
var __typeRefForRefOfUser types.TypeRef
|
||||
|
||||
@@ -678,7 +653,7 @@ func (m RefOfUser) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfUser = types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(__mainPackageInFile_picasa_CachedRef, 0))
|
||||
types.RegisterFromValFunction(__typeRefForRefOfUser, func(v types.Value) types.Value {
|
||||
return RefOfUserFromVal(v)
|
||||
return NewRefOfUser(v.(types.Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -719,14 +694,6 @@ func (r RefOfSetOfRefOfRemotePhoto) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfSetOfRefOfRemotePhotoFromVal(val types.Value) RefOfSetOfRefOfRemotePhoto {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfSetOfRefOfRemotePhoto); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfSetOfRefOfRemotePhoto(val.(types.Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfSetOfRefOfRemotePhoto.
|
||||
var __typeRefForRefOfSetOfRefOfRemotePhoto types.TypeRef
|
||||
|
||||
@@ -737,7 +704,7 @@ func (m RefOfSetOfRefOfRemotePhoto) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfSetOfRefOfRemotePhoto = types.MakeCompoundTypeRef(types.RefKind, types.MakeCompoundTypeRef(types.SetKind, types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(ref.Parse("sha1-00419ebbb418539af67238164b20341913efeb4d"), 0))))
|
||||
types.RegisterFromValFunction(__typeRefForRefOfSetOfRefOfRemotePhoto, func(v types.Value) types.Value {
|
||||
return RefOfSetOfRefOfRemotePhotoFromVal(v)
|
||||
return NewRefOfSetOfRefOfRemotePhoto(v.(types.Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -781,14 +748,6 @@ func (s SetOfRefOfRemotePhoto) Def() SetOfRefOfRemotePhotoDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func SetOfRefOfRemotePhotoFromVal(val types.Value) SetOfRefOfRemotePhoto {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(SetOfRefOfRemotePhoto); ok {
|
||||
return val
|
||||
}
|
||||
return SetOfRefOfRemotePhoto{val.(types.Set), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfRemotePhoto) InternalImplementation() types.Set {
|
||||
return s.s
|
||||
}
|
||||
@@ -817,7 +776,7 @@ func (m SetOfRefOfRemotePhoto) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForSetOfRefOfRemotePhoto = types.MakeCompoundTypeRef(types.SetKind, types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(ref.Parse("sha1-00419ebbb418539af67238164b20341913efeb4d"), 0)))
|
||||
types.RegisterFromValFunction(__typeRefForSetOfRefOfRemotePhoto, func(v types.Value) types.Value {
|
||||
return SetOfRefOfRemotePhotoFromVal(v)
|
||||
return SetOfRefOfRemotePhoto{v.(types.Set), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -926,14 +885,6 @@ func (r RefOfRemotePhoto) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfRemotePhotoFromVal(val types.Value) RefOfRemotePhoto {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfRemotePhoto); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfRemotePhoto(val.(types.Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfRemotePhoto.
|
||||
var __typeRefForRefOfRemotePhoto types.TypeRef
|
||||
|
||||
@@ -944,7 +895,7 @@ func (m RefOfRemotePhoto) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfRemotePhoto = types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(ref.Parse("sha1-00419ebbb418539af67238164b20341913efeb4d"), 0))
|
||||
types.RegisterFromValFunction(__typeRefForRefOfRemotePhoto, func(v types.Value) types.Value {
|
||||
return RefOfRemotePhotoFromVal(v)
|
||||
return NewRefOfRemotePhoto(v.(types.Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -363,15 +363,6 @@ func (m MapOfSizeToString) Def() MapOfSizeToStringDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func MapOfSizeToStringFromVal(val types.Value) MapOfSizeToString {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(MapOfSizeToString); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return MapOfSizeToString{val.(types.Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m MapOfSizeToString) InternalImplementation() types.Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -400,7 +391,7 @@ func (m MapOfSizeToString) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForMapOfSizeToString = types.MakeCompoundTypeRef(types.MapKind, types.MakeTypeRef(__mainPackageInFile_sha1_00419eb_CachedRef, 1), types.MakePrimitiveTypeRef(types.StringKind))
|
||||
types.RegisterFromValFunction(__typeRefForMapOfSizeToString, func(v types.Value) types.Value {
|
||||
return MapOfSizeToStringFromVal(v)
|
||||
return MapOfSizeToString{v.(types.Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -498,14 +489,6 @@ func (s SetOfString) Def() SetOfStringDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func SetOfStringFromVal(val types.Value) SetOfString {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(SetOfString); ok {
|
||||
return val
|
||||
}
|
||||
return SetOfString{val.(types.Set), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) InternalImplementation() types.Set {
|
||||
return s.s
|
||||
}
|
||||
@@ -534,7 +517,7 @@ func (m SetOfString) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForSetOfString = types.MakeCompoundTypeRef(types.SetKind, types.MakePrimitiveTypeRef(types.StringKind))
|
||||
types.RegisterFromValFunction(__typeRefForSetOfString, func(v types.Value) types.Value {
|
||||
return SetOfStringFromVal(v)
|
||||
return SetOfString{v.(types.Set), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -43,10 +43,9 @@ func processPitches(v types.Value) (pitches []Pitch) {
|
||||
for i := uint64(0); i < v.Len(); i++ {
|
||||
pitches = append(pitches, processPitches(v.Get(i))...)
|
||||
}
|
||||
case types.Map:
|
||||
m := MapOfStringToStringFromVal(v)
|
||||
if checkPitch(m) {
|
||||
pitches = append(pitches, getPitch(m))
|
||||
case MapOfStringToString:
|
||||
if checkPitch(v) {
|
||||
pitches = append(pitches, getPitch(v))
|
||||
}
|
||||
case nil:
|
||||
return // Yes, an at-bat can end with no pitches thrown.
|
||||
@@ -67,11 +66,11 @@ func processInning(m MapOfStringToValue) map[string][]Pitch {
|
||||
}
|
||||
|
||||
halves := []MapOfStringToValue{
|
||||
MapOfStringToValueFromVal(top),
|
||||
top.(MapOfStringToValue),
|
||||
}
|
||||
|
||||
if bot := m.Get("bottom"); bot != nil {
|
||||
halves = append(halves, MapOfStringToValueFromVal(bot))
|
||||
halves = append(halves, bot.(MapOfStringToValue))
|
||||
}
|
||||
|
||||
addPitch := func(ab MapOfStringToValue) {
|
||||
@@ -82,16 +81,15 @@ func processInning(m MapOfStringToValue) map[string][]Pitch {
|
||||
|
||||
for _, half := range halves {
|
||||
atbat := half.Get("atbat")
|
||||
switch atbat.(type) {
|
||||
case types.List:
|
||||
abs := ListOfMapOfStringToValueFromVal(atbat)
|
||||
for i := uint64(0); i < abs.Len(); i++ {
|
||||
ab := abs.Get(i)
|
||||
switch atbat := atbat.(type) {
|
||||
case ListOfMapOfStringToValue:
|
||||
for i := uint64(0); i < atbat.Len(); i++ {
|
||||
ab := atbat.Get(i)
|
||||
addPitch(ab)
|
||||
}
|
||||
case types.Map:
|
||||
case MapOfStringToValue:
|
||||
// Apparently, if there's only one, it's encoded directly as a singleton. Yay, data!
|
||||
addPitch(MapOfStringToValueFromVal(atbat))
|
||||
addPitch(atbat)
|
||||
default:
|
||||
}
|
||||
}
|
||||
@@ -105,14 +103,14 @@ func getIndex(input types.List) MapOfStringToListOfPitch {
|
||||
// Walk through the list in inputDataset and basically switch
|
||||
// on the top-level key to know if it's an inning or a pitcher.
|
||||
innings := input.MapP(512, func(item types.Value, i uint64) interface{} {
|
||||
m := MapOfStringToValueFromVal(item)
|
||||
m := item.(MapOfStringToValue)
|
||||
|
||||
if key := "inning"; m.Has(key) {
|
||||
return processInning(MapOfStringToValueFromVal(m.Get(key)))
|
||||
return processInning(m.Get(key).(MapOfStringToValue))
|
||||
}
|
||||
|
||||
if key := "Player"; m.Has(key) {
|
||||
id, name := processPitcher(MapOfStringToStringFromVal(m.Get(key)))
|
||||
id, name := processPitcher(m.Get(key).(MapOfStringToString))
|
||||
if id != "" && name != "" {
|
||||
mu.Lock()
|
||||
pitchers = pitchers.Set(id, name)
|
||||
@@ -170,7 +168,7 @@ func main() {
|
||||
inputDataset := dataset.NewDataset(ds, *inputID)
|
||||
outputDataset := dataset.NewDataset(ds, *outputID)
|
||||
|
||||
input := types.ListFromVal(inputDataset.Head().Value())
|
||||
input := inputDataset.Head().Value().(types.List)
|
||||
output := getIndex(input)
|
||||
|
||||
_, ok := outputDataset.Commit(output)
|
||||
|
||||
@@ -164,15 +164,6 @@ func (l ListOfMapOfStringToValue) Def() ListOfMapOfStringToValueDef {
|
||||
return d
|
||||
}
|
||||
|
||||
func ListOfMapOfStringToValueFromVal(val types.Value) ListOfMapOfStringToValue {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(ListOfMapOfStringToValue); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return ListOfMapOfStringToValue{val.(types.List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfMapOfStringToValue) InternalImplementation() types.List {
|
||||
return l.l
|
||||
}
|
||||
@@ -201,7 +192,7 @@ func (m ListOfMapOfStringToValue) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForListOfMapOfStringToValue = types.MakeCompoundTypeRef(types.ListKind, types.MakeCompoundTypeRef(types.MapKind, types.MakePrimitiveTypeRef(types.StringKind), types.MakePrimitiveTypeRef(types.ValueKind)))
|
||||
types.RegisterFromValFunction(__typeRefForListOfMapOfStringToValue, func(v types.Value) types.Value {
|
||||
return ListOfMapOfStringToValueFromVal(v)
|
||||
return ListOfMapOfStringToValue{v.(types.List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -307,15 +298,6 @@ func (m MapOfStringToListOfPitch) Def() MapOfStringToListOfPitchDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func MapOfStringToListOfPitchFromVal(val types.Value) MapOfStringToListOfPitch {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(MapOfStringToListOfPitch); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return MapOfStringToListOfPitch{val.(types.Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m MapOfStringToListOfPitch) InternalImplementation() types.Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -344,7 +326,7 @@ func (m MapOfStringToListOfPitch) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForMapOfStringToListOfPitch = types.MakeCompoundTypeRef(types.MapKind, types.MakePrimitiveTypeRef(types.StringKind), types.MakeCompoundTypeRef(types.ListKind, types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0)))
|
||||
types.RegisterFromValFunction(__typeRefForMapOfStringToListOfPitch, func(v types.Value) types.Value {
|
||||
return MapOfStringToListOfPitchFromVal(v)
|
||||
return MapOfStringToListOfPitch{v.(types.Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -440,15 +422,6 @@ func (m MapOfStringToString) Def() MapOfStringToStringDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func MapOfStringToStringFromVal(val types.Value) MapOfStringToString {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(MapOfStringToString); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return MapOfStringToString{val.(types.Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m MapOfStringToString) InternalImplementation() types.Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -477,7 +450,7 @@ func (m MapOfStringToString) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForMapOfStringToString = types.MakeCompoundTypeRef(types.MapKind, types.MakePrimitiveTypeRef(types.StringKind), types.MakePrimitiveTypeRef(types.StringKind))
|
||||
types.RegisterFromValFunction(__typeRefForMapOfStringToString, func(v types.Value) types.Value {
|
||||
return MapOfStringToStringFromVal(v)
|
||||
return MapOfStringToString{v.(types.Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -573,15 +546,6 @@ func (m MapOfStringToValue) Def() MapOfStringToValueDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func MapOfStringToValueFromVal(val types.Value) MapOfStringToValue {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(MapOfStringToValue); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return MapOfStringToValue{val.(types.Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m MapOfStringToValue) InternalImplementation() types.Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -610,7 +574,7 @@ func (m MapOfStringToValue) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForMapOfStringToValue = types.MakeCompoundTypeRef(types.MapKind, types.MakePrimitiveTypeRef(types.StringKind), types.MakePrimitiveTypeRef(types.ValueKind))
|
||||
types.RegisterFromValFunction(__typeRefForMapOfStringToValue, func(v types.Value) types.Value {
|
||||
return MapOfStringToValueFromVal(v)
|
||||
return MapOfStringToValue{v.(types.Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -705,15 +669,6 @@ func (l ListOfPitch) Def() ListOfPitchDef {
|
||||
return d
|
||||
}
|
||||
|
||||
func ListOfPitchFromVal(val types.Value) ListOfPitch {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(ListOfPitch); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return ListOfPitch{val.(types.List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfPitch) InternalImplementation() types.List {
|
||||
return l.l
|
||||
}
|
||||
@@ -742,7 +697,7 @@ func (m ListOfPitch) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForListOfPitch = types.MakeCompoundTypeRef(types.ListKind, types.MakeTypeRef(__mainPackageInFile_types_CachedRef, 0))
|
||||
types.RegisterFromValFunction(__typeRefForListOfPitch, func(v types.Value) types.Value {
|
||||
return ListOfPitchFromVal(v)
|
||||
return ListOfPitch{v.(types.List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ func main() {
|
||||
go func() {
|
||||
list.IterAllP(64, func(v types.Value, i uint64) {
|
||||
// Need to replace incident with generic type
|
||||
r := common.RefOfValueFromVal(v)
|
||||
r := v.(common.RefOfValue)
|
||||
incident := r.TargetValue(datastore).(common.Incident)
|
||||
nodeDef := &common.NodeDef{Geoposition: incident.Geoposition().Def(), Reference: r.TargetRef()}
|
||||
nChan <- nodeDef
|
||||
|
||||
@@ -103,7 +103,7 @@ func searchWithList(gp common.GeopositionDef, ds datas.DataStore) []common.Incid
|
||||
log.Fatalf("Value for %s argument is an empty list\n", argName)
|
||||
}
|
||||
results := []common.Incident{}
|
||||
incidentList := common.ListOfRefOfValueFromVal(val)
|
||||
incidentList := val.(common.ListOfRefOfValue)
|
||||
t0 := time.Now()
|
||||
for i := uint64(0); i < incidentList.Len(); i++ {
|
||||
if i%uint64(10000) == 0 {
|
||||
|
||||
@@ -363,15 +363,6 @@ func (m MapOfSizeToString) Def() MapOfSizeToStringDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func MapOfSizeToStringFromVal(val types.Value) MapOfSizeToString {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(MapOfSizeToString); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return MapOfSizeToString{val.(types.Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m MapOfSizeToString) InternalImplementation() types.Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -400,7 +391,7 @@ func (m MapOfSizeToString) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForMapOfSizeToString = types.MakeCompoundTypeRef(types.MapKind, types.MakeTypeRef(__mainPackageInFile_sha1_00419eb_CachedRef, 1), types.MakePrimitiveTypeRef(types.StringKind))
|
||||
types.RegisterFromValFunction(__typeRefForMapOfSizeToString, func(v types.Value) types.Value {
|
||||
return MapOfSizeToStringFromVal(v)
|
||||
return MapOfSizeToString{v.(types.Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -498,14 +489,6 @@ func (s SetOfString) Def() SetOfStringDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func SetOfStringFromVal(val types.Value) SetOfString {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(SetOfString); ok {
|
||||
return val
|
||||
}
|
||||
return SetOfString{val.(types.Set), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfString) InternalImplementation() types.Set {
|
||||
return s.s
|
||||
}
|
||||
@@ -534,7 +517,7 @@ func (m SetOfString) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForSetOfString = types.MakeCompoundTypeRef(types.SetKind, types.MakePrimitiveTypeRef(types.StringKind))
|
||||
types.RegisterFromValFunction(__typeRefForSetOfString, func(v types.Value) types.Value {
|
||||
return SetOfStringFromVal(v)
|
||||
return SetOfString{v.(types.Set), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -38,15 +38,6 @@ func (m MapOfStringToSetOfRefOfRemotePhoto) Def() MapOfStringToSetOfRefOfRemoteP
|
||||
return def
|
||||
}
|
||||
|
||||
func MapOfStringToSetOfRefOfRemotePhotoFromVal(val types.Value) MapOfStringToSetOfRefOfRemotePhoto {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(MapOfStringToSetOfRefOfRemotePhoto); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return MapOfStringToSetOfRefOfRemotePhoto{val.(types.Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m MapOfStringToSetOfRefOfRemotePhoto) InternalImplementation() types.Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -75,7 +66,7 @@ func (m MapOfStringToSetOfRefOfRemotePhoto) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForMapOfStringToSetOfRefOfRemotePhoto = types.MakeCompoundTypeRef(types.MapKind, types.MakePrimitiveTypeRef(types.StringKind), types.MakeCompoundTypeRef(types.SetKind, types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(ref.Parse("sha1-00419ebbb418539af67238164b20341913efeb4d"), 0))))
|
||||
types.RegisterFromValFunction(__typeRefForMapOfStringToSetOfRefOfRemotePhoto, func(v types.Value) types.Value {
|
||||
return MapOfStringToSetOfRefOfRemotePhotoFromVal(v)
|
||||
return MapOfStringToSetOfRefOfRemotePhoto{v.(types.Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -173,14 +164,6 @@ func (s SetOfRefOfRemotePhoto) Def() SetOfRefOfRemotePhotoDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func SetOfRefOfRemotePhotoFromVal(val types.Value) SetOfRefOfRemotePhoto {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(SetOfRefOfRemotePhoto); ok {
|
||||
return val
|
||||
}
|
||||
return SetOfRefOfRemotePhoto{val.(types.Set), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfRemotePhoto) InternalImplementation() types.Set {
|
||||
return s.s
|
||||
}
|
||||
@@ -209,7 +192,7 @@ func (m SetOfRefOfRemotePhoto) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForSetOfRefOfRemotePhoto = types.MakeCompoundTypeRef(types.SetKind, types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(ref.Parse("sha1-00419ebbb418539af67238164b20341913efeb4d"), 0)))
|
||||
types.RegisterFromValFunction(__typeRefForSetOfRefOfRemotePhoto, func(v types.Value) types.Value {
|
||||
return SetOfRefOfRemotePhotoFromVal(v)
|
||||
return SetOfRefOfRemotePhoto{v.(types.Set), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -318,14 +301,6 @@ func (r RefOfRemotePhoto) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfRemotePhotoFromVal(val types.Value) RefOfRemotePhoto {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfRemotePhoto); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfRemotePhoto(val.(types.Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfRemotePhoto.
|
||||
var __typeRefForRefOfRemotePhoto types.TypeRef
|
||||
|
||||
@@ -336,7 +311,7 @@ func (m RefOfRemotePhoto) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfRemotePhoto = types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(ref.Parse("sha1-00419ebbb418539af67238164b20341913efeb4d"), 0))
|
||||
types.RegisterFromValFunction(__typeRefForRefOfRemotePhoto, func(v types.Value) types.Value {
|
||||
return RefOfRemotePhotoFromVal(v)
|
||||
return NewRefOfRemotePhoto(v.(types.Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ type dataStoreCommon struct {
|
||||
}
|
||||
|
||||
func datasetsFromRef(datasetsRef ref.Ref, cs chunks.ChunkSource) *MapOfStringToRefOfCommit {
|
||||
c := MapOfStringToRefOfCommitFromVal(types.ReadValue(datasetsRef, cs))
|
||||
c := types.ReadValue(datasetsRef, cs).(MapOfStringToRefOfCommit)
|
||||
return &c
|
||||
}
|
||||
|
||||
|
||||
+3
-28
@@ -168,15 +168,6 @@ func (m MapOfStringToRefOfCommit) Def() MapOfStringToRefOfCommitDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func MapOfStringToRefOfCommitFromVal(val types.Value) MapOfStringToRefOfCommit {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(MapOfStringToRefOfCommit); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return MapOfStringToRefOfCommit{val.(types.Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m MapOfStringToRefOfCommit) InternalImplementation() types.Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -205,7 +196,7 @@ func (m MapOfStringToRefOfCommit) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForMapOfStringToRefOfCommit = types.MakeCompoundTypeRef(types.MapKind, types.MakePrimitiveTypeRef(types.StringKind), types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(__datasPackageInFile_types_CachedRef, 0)))
|
||||
types.RegisterFromValFunction(__typeRefForMapOfStringToRefOfCommit, func(v types.Value) types.Value {
|
||||
return MapOfStringToRefOfCommitFromVal(v)
|
||||
return MapOfStringToRefOfCommit{v.(types.Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -303,14 +294,6 @@ func (s SetOfRefOfCommit) Def() SetOfRefOfCommitDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func SetOfRefOfCommitFromVal(val types.Value) SetOfRefOfCommit {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(SetOfRefOfCommit); ok {
|
||||
return val
|
||||
}
|
||||
return SetOfRefOfCommit{val.(types.Set), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfCommit) InternalImplementation() types.Set {
|
||||
return s.s
|
||||
}
|
||||
@@ -339,7 +322,7 @@ func (m SetOfRefOfCommit) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForSetOfRefOfCommit = types.MakeCompoundTypeRef(types.SetKind, types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(__datasPackageInFile_types_CachedRef, 0)))
|
||||
types.RegisterFromValFunction(__typeRefForSetOfRefOfCommit, func(v types.Value) types.Value {
|
||||
return SetOfRefOfCommitFromVal(v)
|
||||
return SetOfRefOfCommit{v.(types.Set), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -448,14 +431,6 @@ func (r RefOfCommit) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfCommitFromVal(val types.Value) RefOfCommit {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfCommit); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfCommit(val.(types.Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfCommit.
|
||||
var __typeRefForRefOfCommit types.TypeRef
|
||||
|
||||
@@ -466,7 +441,7 @@ func (m RefOfCommit) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfCommit = types.MakeCompoundTypeRef(types.RefKind, types.MakeTypeRef(__datasPackageInFile_types_CachedRef, 0))
|
||||
types.RegisterFromValFunction(__typeRefForRefOfCommit, func(v types.Value) types.Value {
|
||||
return RefOfCommitFromVal(v)
|
||||
return NewRefOfCommit(v.(types.Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -67,8 +67,7 @@ func main() {
|
||||
pkgDS := dataset.NewDataset(ds, *pkgDSFlag)
|
||||
// Ensure that, if pkgDS has stuff in it, its head is a SetOfRefOfPackage.
|
||||
if h, ok := pkgDS.MaybeHead(); ok {
|
||||
// Will panic on failure. Can do better once generated collections implement types.Value.
|
||||
types.SetOfRefOfPackageFromVal(h.Value())
|
||||
d.Chk.IsType(types.SetOfRefOfPackage{}, h.Value())
|
||||
}
|
||||
|
||||
localPkgs := refSet{}
|
||||
@@ -162,7 +161,7 @@ func buildSetOfRefOfPackage(pkg pkg.Parsed, deps depsMap, ds dataset.Dataset) ty
|
||||
// Can do better once generated collections implement types.Value.
|
||||
s := types.NewSetOfRefOfPackage()
|
||||
if h, ok := ds.MaybeHead(); ok {
|
||||
s = types.SetOfRefOfPackageFromVal(h.Value())
|
||||
s = h.Value().(types.SetOfRefOfPackage)
|
||||
}
|
||||
for _, dep := range deps {
|
||||
// Writing the deps into ds should be redundant at this point, but do it to be sure.
|
||||
|
||||
@@ -228,7 +228,7 @@ func TestCommitNewPackages(t *testing.T) {
|
||||
p := parsePackageFile("name", inFile, pkgDS)
|
||||
localPkgs := refSet{p.Ref(): true}
|
||||
pkgDS = generate("name", inFile, filepath.Join(dir, "out.go"), dir, map[string]bool{}, p, localPkgs, pkgDS)
|
||||
s := types.SetOfRefOfPackageFromVal(pkgDS.Head().Value())
|
||||
s := pkgDS.Head().Value().(types.SetOfRefOfPackage)
|
||||
assert.EqualValues(1, s.Len())
|
||||
tr := s.Any().TargetValue(ds).Types()[0]
|
||||
assert.EqualValues(types.StructKind, tr.Kind())
|
||||
|
||||
+14
-10
@@ -31,15 +31,6 @@ func New{{.Name}}() {{.Name}} {
|
||||
}
|
||||
{{end}}
|
||||
|
||||
func {{.Name}}FromVal(val {{$typesPackage}}Value) {{.Name}} {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.({{.Name}}); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return {{.Name}}{val.({{$typesPackage}}List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l {{.Name}}) InternalImplementation() {{$typesPackage}}List {
|
||||
return l.l
|
||||
}
|
||||
@@ -58,7 +49,20 @@ func (l {{.Name}}) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
{{template "type_ref.tmpl" .}}
|
||||
// A Noms Value that describes {{.Name}}.
|
||||
var __typeRefFor{{.Name}} {{$typesPackage}}TypeRef
|
||||
|
||||
func (m {{.Name}}) TypeRef() {{$typesPackage}}TypeRef {
|
||||
return __typeRefFor{{.Name}}
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeRefFor{{.Name}} = {{toTypesTypeRef .Type .FileID .PackageName}}
|
||||
{{$typesPackage}}RegisterFromValFunction(__typeRefFor{{.Name}}, func(v {{$typesPackage}}Value) {{$typesPackage}}Value {
|
||||
return {{.Name}}{v.({{$typesPackage}}List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
func (l {{.Name}}) Len() uint64 {
|
||||
return l.l.Len()
|
||||
|
||||
+13
-10
@@ -32,15 +32,6 @@ func New{{.Name}}() {{.Name}} {
|
||||
}
|
||||
{{end}}
|
||||
|
||||
func {{.Name}}FromVal(val {{$typesPackage}}Value) {{.Name}} {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.({{.Name}}); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return {{.Name}}{val.({{$typesPackage}}Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m {{.Name}}) InternalImplementation() {{$typesPackage}}Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -59,7 +50,19 @@ func (m {{.Name}}) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
{{template "type_ref.tmpl" .}}
|
||||
// A Noms Value that describes {{.Name}}.
|
||||
var __typeRefFor{{.Name}} {{$typesPackage}}TypeRef
|
||||
|
||||
func (m {{.Name}}) TypeRef() {{$typesPackage}}TypeRef {
|
||||
return __typeRefFor{{.Name}}
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeRefFor{{.Name}} = {{toTypesTypeRef .Type .FileID .PackageName}}
|
||||
{{$typesPackage}}RegisterFromValFunction(__typeRefFor{{.Name}}, func(v {{$typesPackage}}Value) {{$typesPackage}}Value {
|
||||
return {{.Name}}{v.({{$typesPackage}}Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
func (m {{.Name}}) Empty() bool {
|
||||
return m.m.Empty()
|
||||
|
||||
+11
-7
@@ -29,15 +29,19 @@ func (r {{.Name}}) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func {{.Name}}FromVal(val {{$typesPackage}}Value) {{.Name}} {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.({{.Name}}); ok {
|
||||
return val
|
||||
}
|
||||
return New{{.Name}}(val.({{$typesPackage}}Ref).TargetRef())
|
||||
// A Noms Value that describes {{.Name}}.
|
||||
var __typeRefFor{{.Name}} {{$typesPackage}}TypeRef
|
||||
|
||||
func (m {{.Name}}) TypeRef() {{$typesPackage}}TypeRef {
|
||||
return __typeRefFor{{.Name}}
|
||||
}
|
||||
|
||||
{{template "type_ref.tmpl" .}}
|
||||
func init() {
|
||||
__typeRefFor{{.Name}} = {{toTypesTypeRef .Type .FileID .PackageName}}
|
||||
{{$typesPackage}}RegisterFromValFunction(__typeRefFor{{.Name}}, func(v {{$typesPackage}}Value) {{$typesPackage}}Value {
|
||||
return New{{.Name}}(v.({{$typesPackage}}Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
func (r {{.Name}}) TargetValue(cs chunks.ChunkSource) {{userType .ElemType}} {
|
||||
return {{valueToUser (printf "%sReadValue(r.target, cs)" $typesPackage) .ElemType}}
|
||||
|
||||
+13
-9
@@ -34,14 +34,6 @@ func New{{.Name}}() {{.Name}} {
|
||||
}
|
||||
{{end}}
|
||||
|
||||
func {{.Name}}FromVal(val {{$typesPackage}}Value) {{.Name}} {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.({{.Name}}); ok {
|
||||
return val
|
||||
}
|
||||
return {{.Name}}{val.({{$typesPackage}}Set), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s {{.Name}}) InternalImplementation() {{$typesPackage}}Set {
|
||||
return s.s
|
||||
}
|
||||
@@ -60,7 +52,19 @@ func (s {{.Name}}) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
{{template "type_ref.tmpl" .}}
|
||||
// A Noms Value that describes {{.Name}}.
|
||||
var __typeRefFor{{.Name}} {{$typesPackage}}TypeRef
|
||||
|
||||
func (m {{.Name}}) TypeRef() {{$typesPackage}}TypeRef {
|
||||
return __typeRefFor{{.Name}}
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeRefFor{{.Name}} = {{toTypesTypeRef .Type .FileID .PackageName}}
|
||||
{{$typesPackage}}RegisterFromValFunction(__typeRefFor{{.Name}}, func(v {{$typesPackage}}Value) {{$typesPackage}}Value {
|
||||
return {{.Name}}{v.({{$typesPackage}}Set), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
func (s {{.Name}}) Empty() bool {
|
||||
return s.s.Empty()
|
||||
|
||||
@@ -36,15 +36,6 @@ func (l ListOfInt64) Def() ListOfInt64Def {
|
||||
return d
|
||||
}
|
||||
|
||||
func ListOfInt64FromVal(val types.Value) ListOfInt64 {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(ListOfInt64); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return ListOfInt64{val.(types.List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfInt64) InternalImplementation() types.List {
|
||||
return l.l
|
||||
}
|
||||
@@ -73,7 +64,7 @@ func (m ListOfInt64) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForListOfInt64 = types.MakeCompoundTypeRef(types.ListKind, types.MakePrimitiveTypeRef(types.Int64Kind))
|
||||
types.RegisterFromValFunction(__typeRefForListOfInt64, func(v types.Value) types.Value {
|
||||
return ListOfInt64FromVal(v)
|
||||
return ListOfInt64{v.(types.List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -37,15 +37,6 @@ func (m MapOfBoolToString) Def() MapOfBoolToStringDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func MapOfBoolToStringFromVal(val types.Value) MapOfBoolToString {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(MapOfBoolToString); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return MapOfBoolToString{val.(types.Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m MapOfBoolToString) InternalImplementation() types.Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -74,7 +65,7 @@ func (m MapOfBoolToString) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForMapOfBoolToString = types.MakeCompoundTypeRef(types.MapKind, types.MakePrimitiveTypeRef(types.BoolKind), types.MakePrimitiveTypeRef(types.StringKind))
|
||||
types.RegisterFromValFunction(__typeRefForMapOfBoolToString, func(v types.Value) types.Value {
|
||||
return MapOfBoolToStringFromVal(v)
|
||||
return MapOfBoolToString{v.(types.Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -170,15 +161,6 @@ func (m MapOfStringToValue) Def() MapOfStringToValueDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func MapOfStringToValueFromVal(val types.Value) MapOfStringToValue {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(MapOfStringToValue); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return MapOfStringToValue{val.(types.Map), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (m MapOfStringToValue) InternalImplementation() types.Map {
|
||||
return m.m
|
||||
}
|
||||
@@ -207,7 +189,7 @@ func (m MapOfStringToValue) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForMapOfStringToValue = types.MakeCompoundTypeRef(types.MapKind, types.MakePrimitiveTypeRef(types.StringKind), types.MakePrimitiveTypeRef(types.ValueKind))
|
||||
types.RegisterFromValFunction(__typeRefForMapOfStringToValue, func(v types.Value) types.Value {
|
||||
return MapOfStringToValueFromVal(v)
|
||||
return MapOfStringToValue{v.(types.Map), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -147,14 +147,6 @@ func (r RefOfListOfString) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfListOfStringFromVal(val types.Value) RefOfListOfString {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfListOfString); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfListOfString(val.(types.Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfListOfString.
|
||||
var __typeRefForRefOfListOfString types.TypeRef
|
||||
|
||||
@@ -165,7 +157,7 @@ func (m RefOfListOfString) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfListOfString = types.MakeCompoundTypeRef(types.RefKind, types.MakeCompoundTypeRef(types.ListKind, types.MakePrimitiveTypeRef(types.StringKind)))
|
||||
types.RegisterFromValFunction(__typeRefForRefOfListOfString, func(v types.Value) types.Value {
|
||||
return RefOfListOfStringFromVal(v)
|
||||
return NewRefOfListOfString(v.(types.Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -206,15 +198,6 @@ func (l ListOfRefOfFloat32) Def() ListOfRefOfFloat32Def {
|
||||
return d
|
||||
}
|
||||
|
||||
func ListOfRefOfFloat32FromVal(val types.Value) ListOfRefOfFloat32 {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(ListOfRefOfFloat32); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return ListOfRefOfFloat32{val.(types.List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfRefOfFloat32) InternalImplementation() types.List {
|
||||
return l.l
|
||||
}
|
||||
@@ -243,7 +226,7 @@ func (m ListOfRefOfFloat32) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForListOfRefOfFloat32 = types.MakeCompoundTypeRef(types.ListKind, types.MakeCompoundTypeRef(types.RefKind, types.MakePrimitiveTypeRef(types.Float32Kind)))
|
||||
types.RegisterFromValFunction(__typeRefForListOfRefOfFloat32, func(v types.Value) types.Value {
|
||||
return ListOfRefOfFloat32FromVal(v)
|
||||
return ListOfRefOfFloat32{v.(types.List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -348,14 +331,6 @@ func (r RefOfSetOfFloat32) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfSetOfFloat32FromVal(val types.Value) RefOfSetOfFloat32 {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfSetOfFloat32); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfSetOfFloat32(val.(types.Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfSetOfFloat32.
|
||||
var __typeRefForRefOfSetOfFloat32 types.TypeRef
|
||||
|
||||
@@ -366,7 +341,7 @@ func (m RefOfSetOfFloat32) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfSetOfFloat32 = types.MakeCompoundTypeRef(types.RefKind, types.MakeCompoundTypeRef(types.SetKind, types.MakePrimitiveTypeRef(types.Float32Kind)))
|
||||
types.RegisterFromValFunction(__typeRefForRefOfSetOfFloat32, func(v types.Value) types.Value {
|
||||
return RefOfSetOfFloat32FromVal(v)
|
||||
return NewRefOfSetOfFloat32(v.(types.Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -407,15 +382,6 @@ func (l ListOfString) Def() ListOfStringDef {
|
||||
return d
|
||||
}
|
||||
|
||||
func ListOfStringFromVal(val types.Value) ListOfString {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(ListOfString); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return ListOfString{val.(types.List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfString) InternalImplementation() types.List {
|
||||
return l.l
|
||||
}
|
||||
@@ -444,7 +410,7 @@ func (m ListOfString) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForListOfString = types.MakeCompoundTypeRef(types.ListKind, types.MakePrimitiveTypeRef(types.StringKind))
|
||||
types.RegisterFromValFunction(__typeRefForListOfString, func(v types.Value) types.Value {
|
||||
return ListOfStringFromVal(v)
|
||||
return ListOfString{v.(types.List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -549,14 +515,6 @@ func (r RefOfFloat32) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfFloat32FromVal(val types.Value) RefOfFloat32 {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfFloat32); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfFloat32(val.(types.Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfFloat32.
|
||||
var __typeRefForRefOfFloat32 types.TypeRef
|
||||
|
||||
@@ -567,7 +525,7 @@ func (m RefOfFloat32) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfFloat32 = types.MakeCompoundTypeRef(types.RefKind, types.MakePrimitiveTypeRef(types.Float32Kind))
|
||||
types.RegisterFromValFunction(__typeRefForRefOfFloat32, func(v types.Value) types.Value {
|
||||
return RefOfFloat32FromVal(v)
|
||||
return NewRefOfFloat32(v.(types.Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -611,14 +569,6 @@ func (s SetOfFloat32) Def() SetOfFloat32Def {
|
||||
return def
|
||||
}
|
||||
|
||||
func SetOfFloat32FromVal(val types.Value) SetOfFloat32 {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(SetOfFloat32); ok {
|
||||
return val
|
||||
}
|
||||
return SetOfFloat32{val.(types.Set), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfFloat32) InternalImplementation() types.Set {
|
||||
return s.s
|
||||
}
|
||||
@@ -647,7 +597,7 @@ func (m SetOfFloat32) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForSetOfFloat32 = types.MakeCompoundTypeRef(types.SetKind, types.MakePrimitiveTypeRef(types.Float32Kind))
|
||||
types.RegisterFromValFunction(__typeRefForSetOfFloat32, func(v types.Value) types.Value {
|
||||
return SetOfFloat32FromVal(v)
|
||||
return SetOfFloat32{v.(types.Set), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -39,14 +39,6 @@ func (s SetOfBool) Def() SetOfBoolDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func SetOfBoolFromVal(val types.Value) SetOfBool {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(SetOfBool); ok {
|
||||
return val
|
||||
}
|
||||
return SetOfBool{val.(types.Set), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfBool) InternalImplementation() types.Set {
|
||||
return s.s
|
||||
}
|
||||
@@ -75,7 +67,7 @@ func (m SetOfBool) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForSetOfBool = types.MakeCompoundTypeRef(types.SetKind, types.MakePrimitiveTypeRef(types.BoolKind))
|
||||
types.RegisterFromValFunction(__typeRefForSetOfBool, func(v types.Value) types.Value {
|
||||
return SetOfBoolFromVal(v)
|
||||
return SetOfBool{v.(types.Set), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -164,15 +164,6 @@ func (l ListOfStruct) Def() ListOfStructDef {
|
||||
return d
|
||||
}
|
||||
|
||||
func ListOfStructFromVal(val types.Value) ListOfStruct {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(ListOfStruct); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return ListOfStruct{val.(types.List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfStruct) InternalImplementation() types.List {
|
||||
return l.l
|
||||
}
|
||||
@@ -201,7 +192,7 @@ func (m ListOfStruct) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForListOfStruct = types.MakeCompoundTypeRef(types.ListKind, types.MakeTypeRef(__genPackageInFile_struct_CachedRef, 0))
|
||||
types.RegisterFromValFunction(__typeRefForListOfStruct, func(v types.Value) types.Value {
|
||||
return ListOfStructFromVal(v)
|
||||
return ListOfStruct{v.(types.List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -146,15 +146,6 @@ func (l ListOfTree) Def() ListOfTreeDef {
|
||||
return d
|
||||
}
|
||||
|
||||
func ListOfTreeFromVal(val types.Value) ListOfTree {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(ListOfTree); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return ListOfTree{val.(types.List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfTree) InternalImplementation() types.List {
|
||||
return l.l
|
||||
}
|
||||
@@ -183,7 +174,7 @@ func (m ListOfTree) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForListOfTree = types.MakeCompoundTypeRef(types.ListKind, types.MakeTypeRef(__genPackageInFile_struct_recursive_CachedRef, 0))
|
||||
types.RegisterFromValFunction(__typeRefForListOfTree, func(v types.Value) types.Value {
|
||||
return ListOfTreeFromVal(v)
|
||||
return ListOfTree{v.(types.List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -116,145 +116,3 @@ func (s StructWithDupList) SetL(val ListOfUInt8) StructWithDupList {
|
||||
s.ref = &ref.Ref{}
|
||||
return s
|
||||
}
|
||||
|
||||
// ListOfUInt8
|
||||
|
||||
type ListOfUInt8 struct {
|
||||
l types.List
|
||||
ref *ref.Ref
|
||||
}
|
||||
|
||||
func NewListOfUInt8() ListOfUInt8 {
|
||||
return ListOfUInt8{types.NewList(), &ref.Ref{}}
|
||||
}
|
||||
|
||||
type ListOfUInt8Def []uint8
|
||||
|
||||
func (def ListOfUInt8Def) New() ListOfUInt8 {
|
||||
l := make([]types.Value, len(def))
|
||||
for i, d := range def {
|
||||
l[i] = types.UInt8(d)
|
||||
}
|
||||
return ListOfUInt8{types.NewList(l...), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Def() ListOfUInt8Def {
|
||||
d := make([]uint8, l.Len())
|
||||
for i := uint64(0); i < l.Len(); i++ {
|
||||
d[i] = uint8(l.l.Get(i).(types.UInt8))
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
func ListOfUInt8FromVal(val types.Value) ListOfUInt8 {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(ListOfUInt8); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return ListOfUInt8{val.(types.List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) InternalImplementation() types.List {
|
||||
return l.l
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Equals(other types.Value) bool {
|
||||
return other != nil && __typeRefForListOfUInt8.Equals(other.TypeRef()) && l.Ref() == other.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Ref() ref.Ref {
|
||||
return types.EnsureRef(l.ref, l)
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Chunks() (chunks []ref.Ref) {
|
||||
chunks = append(chunks, l.TypeRef().Chunks()...)
|
||||
chunks = append(chunks, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfUInt8.
|
||||
var __typeRefForListOfUInt8 types.TypeRef
|
||||
|
||||
func (m ListOfUInt8) TypeRef() types.TypeRef {
|
||||
return __typeRefForListOfUInt8
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeRefForListOfUInt8 = types.MakeCompoundTypeRef(types.ListKind, types.MakePrimitiveTypeRef(types.UInt8Kind))
|
||||
types.RegisterFromValFunction(__typeRefForListOfUInt8, func(v types.Value) types.Value {
|
||||
return ListOfUInt8FromVal(v)
|
||||
})
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Len() uint64 {
|
||||
return l.l.Len()
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Empty() bool {
|
||||
return l.Len() == uint64(0)
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Get(i uint64) uint8 {
|
||||
return uint8(l.l.Get(i).(types.UInt8))
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Slice(idx uint64, end uint64) ListOfUInt8 {
|
||||
return ListOfUInt8{l.l.Slice(idx, end), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Set(i uint64, val uint8) ListOfUInt8 {
|
||||
return ListOfUInt8{l.l.Set(i, types.UInt8(val)), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Append(v ...uint8) ListOfUInt8 {
|
||||
return ListOfUInt8{l.l.Append(l.fromElemSlice(v)...), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Insert(idx uint64, v ...uint8) ListOfUInt8 {
|
||||
return ListOfUInt8{l.l.Insert(idx, l.fromElemSlice(v)...), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Remove(idx uint64, end uint64) ListOfUInt8 {
|
||||
return ListOfUInt8{l.l.Remove(idx, end), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) RemoveAt(idx uint64) ListOfUInt8 {
|
||||
return ListOfUInt8{(l.l.RemoveAt(idx)), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) fromElemSlice(p []uint8) []types.Value {
|
||||
r := make([]types.Value, len(p))
|
||||
for i, v := range p {
|
||||
r[i] = types.UInt8(v)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
type ListOfUInt8IterCallback func(v uint8, i uint64) (stop bool)
|
||||
|
||||
func (l ListOfUInt8) Iter(cb ListOfUInt8IterCallback) {
|
||||
l.l.Iter(func(v types.Value, i uint64) bool {
|
||||
return cb(uint8(v.(types.UInt8)), i)
|
||||
})
|
||||
}
|
||||
|
||||
type ListOfUInt8IterAllCallback func(v uint8, i uint64)
|
||||
|
||||
func (l ListOfUInt8) IterAll(cb ListOfUInt8IterAllCallback) {
|
||||
l.l.IterAll(func(v types.Value, i uint64) {
|
||||
cb(uint8(v.(types.UInt8)), i)
|
||||
})
|
||||
}
|
||||
|
||||
type ListOfUInt8FilterCallback func(v uint8, i uint64) (keep bool)
|
||||
|
||||
func (l ListOfUInt8) Filter(cb ListOfUInt8FilterCallback) ListOfUInt8 {
|
||||
nl := NewListOfUInt8()
|
||||
l.IterAll(func(v uint8, i uint64) {
|
||||
if cb(v, i) {
|
||||
nl = nl.Append(v)
|
||||
}
|
||||
})
|
||||
return nl
|
||||
}
|
||||
|
||||
@@ -211,15 +211,6 @@ func (l ListOfD) Def() ListOfDDef {
|
||||
return d
|
||||
}
|
||||
|
||||
func ListOfDFromVal(val types.Value) ListOfD {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(ListOfD); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return ListOfD{val.(types.List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfD) InternalImplementation() types.List {
|
||||
return l.l
|
||||
}
|
||||
@@ -248,7 +239,7 @@ func (m ListOfD) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForListOfD = types.MakeCompoundTypeRef(types.ListKind, types.MakeTypeRef(ref.Parse("sha1-09d2fdd9743c4daec6deebbbc1a38f75ad088eca"), 0))
|
||||
types.RegisterFromValFunction(__typeRefForListOfD, func(v types.Value) types.Value {
|
||||
return ListOfDFromVal(v)
|
||||
return ListOfD{v.(types.List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -173,3 +173,136 @@ func (s StructWithList) SetI(val int64) StructWithList {
|
||||
s.ref = &ref.Ref{}
|
||||
return s
|
||||
}
|
||||
|
||||
// ListOfUInt8
|
||||
|
||||
type ListOfUInt8 struct {
|
||||
l types.List
|
||||
ref *ref.Ref
|
||||
}
|
||||
|
||||
func NewListOfUInt8() ListOfUInt8 {
|
||||
return ListOfUInt8{types.NewList(), &ref.Ref{}}
|
||||
}
|
||||
|
||||
type ListOfUInt8Def []uint8
|
||||
|
||||
func (def ListOfUInt8Def) New() ListOfUInt8 {
|
||||
l := make([]types.Value, len(def))
|
||||
for i, d := range def {
|
||||
l[i] = types.UInt8(d)
|
||||
}
|
||||
return ListOfUInt8{types.NewList(l...), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Def() ListOfUInt8Def {
|
||||
d := make([]uint8, l.Len())
|
||||
for i := uint64(0); i < l.Len(); i++ {
|
||||
d[i] = uint8(l.l.Get(i).(types.UInt8))
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) InternalImplementation() types.List {
|
||||
return l.l
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Equals(other types.Value) bool {
|
||||
return other != nil && __typeRefForListOfUInt8.Equals(other.TypeRef()) && l.Ref() == other.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Ref() ref.Ref {
|
||||
return types.EnsureRef(l.ref, l)
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Chunks() (chunks []ref.Ref) {
|
||||
chunks = append(chunks, l.TypeRef().Chunks()...)
|
||||
chunks = append(chunks, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfUInt8.
|
||||
var __typeRefForListOfUInt8 types.TypeRef
|
||||
|
||||
func (m ListOfUInt8) TypeRef() types.TypeRef {
|
||||
return __typeRefForListOfUInt8
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeRefForListOfUInt8 = types.MakeCompoundTypeRef(types.ListKind, types.MakePrimitiveTypeRef(types.UInt8Kind))
|
||||
types.RegisterFromValFunction(__typeRefForListOfUInt8, func(v types.Value) types.Value {
|
||||
return ListOfUInt8{v.(types.List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Len() uint64 {
|
||||
return l.l.Len()
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Empty() bool {
|
||||
return l.Len() == uint64(0)
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Get(i uint64) uint8 {
|
||||
return uint8(l.l.Get(i).(types.UInt8))
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Slice(idx uint64, end uint64) ListOfUInt8 {
|
||||
return ListOfUInt8{l.l.Slice(idx, end), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Set(i uint64, val uint8) ListOfUInt8 {
|
||||
return ListOfUInt8{l.l.Set(i, types.UInt8(val)), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Append(v ...uint8) ListOfUInt8 {
|
||||
return ListOfUInt8{l.l.Append(l.fromElemSlice(v)...), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Insert(idx uint64, v ...uint8) ListOfUInt8 {
|
||||
return ListOfUInt8{l.l.Insert(idx, l.fromElemSlice(v)...), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Remove(idx uint64, end uint64) ListOfUInt8 {
|
||||
return ListOfUInt8{l.l.Remove(idx, end), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) RemoveAt(idx uint64) ListOfUInt8 {
|
||||
return ListOfUInt8{(l.l.RemoveAt(idx)), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) fromElemSlice(p []uint8) []types.Value {
|
||||
r := make([]types.Value, len(p))
|
||||
for i, v := range p {
|
||||
r[i] = types.UInt8(v)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
type ListOfUInt8IterCallback func(v uint8, i uint64) (stop bool)
|
||||
|
||||
func (l ListOfUInt8) Iter(cb ListOfUInt8IterCallback) {
|
||||
l.l.Iter(func(v types.Value, i uint64) bool {
|
||||
return cb(uint8(v.(types.UInt8)), i)
|
||||
})
|
||||
}
|
||||
|
||||
type ListOfUInt8IterAllCallback func(v uint8, i uint64)
|
||||
|
||||
func (l ListOfUInt8) IterAll(cb ListOfUInt8IterAllCallback) {
|
||||
l.l.IterAll(func(v types.Value, i uint64) {
|
||||
cb(uint8(v.(types.UInt8)), i)
|
||||
})
|
||||
}
|
||||
|
||||
type ListOfUInt8FilterCallback func(v uint8, i uint64) (keep bool)
|
||||
|
||||
func (l ListOfUInt8) Filter(cb ListOfUInt8FilterCallback) ListOfUInt8 {
|
||||
nl := NewListOfUInt8()
|
||||
l.IterAll(func(v uint8, i uint64) {
|
||||
if cb(v, i) {
|
||||
nl = nl.Append(v)
|
||||
}
|
||||
})
|
||||
return nl
|
||||
}
|
||||
|
||||
@@ -306,14 +306,6 @@ func (s SetOfUInt8) Def() SetOfUInt8Def {
|
||||
return def
|
||||
}
|
||||
|
||||
func SetOfUInt8FromVal(val types.Value) SetOfUInt8 {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(SetOfUInt8); ok {
|
||||
return val
|
||||
}
|
||||
return SetOfUInt8{val.(types.Set), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfUInt8) InternalImplementation() types.Set {
|
||||
return s.s
|
||||
}
|
||||
@@ -342,7 +334,7 @@ func (m SetOfUInt8) TypeRef() types.TypeRef {
|
||||
func init() {
|
||||
__typeRefForSetOfUInt8 = types.MakeCompoundTypeRef(types.SetKind, types.MakePrimitiveTypeRef(types.UInt8Kind))
|
||||
types.RegisterFromValFunction(__typeRefForSetOfUInt8, func(v types.Value) types.Value {
|
||||
return SetOfUInt8FromVal(v)
|
||||
return SetOfUInt8{v.(types.Set), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -42,23 +42,13 @@ func TestValueMapDef(t *testing.T) {
|
||||
assert.True(m.Equals(m2))
|
||||
}
|
||||
|
||||
func TestMapValue(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
def := gen.MapOfBoolToStringDef{true: "hi", false: "bye"}
|
||||
m := def.New()
|
||||
val := m
|
||||
m2 := gen.MapOfBoolToStringFromVal(val)
|
||||
assert.True(m.Equals(m2))
|
||||
}
|
||||
|
||||
func TestValueMapValue(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
def := gen.MapOfStringToValueDef{"s": types.NewString("s"), "i": types.Int32(42)}
|
||||
m := def.New()
|
||||
val := m
|
||||
m2 := gen.MapOfStringToValueFromVal(val)
|
||||
var m types.Value
|
||||
m = def.New()
|
||||
m2 := m.(gen.MapOfStringToValue)
|
||||
assert.True(m.Equals(m2))
|
||||
}
|
||||
|
||||
|
||||
@@ -33,19 +33,6 @@ func TestRef(t *testing.T) {
|
||||
assert.False(r.Equals(r3))
|
||||
}
|
||||
|
||||
func TestRefFromValAndNomsValue(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
l := gen.ListOfStringDef{"a", "b", "c"}.New()
|
||||
rv := types.NewRef(l.Ref())
|
||||
r := gen.RefOfListOfStringFromVal(rv)
|
||||
r2 := gen.NewRefOfListOfString(l.Ref())
|
||||
assert.True(r.Equals(r2))
|
||||
|
||||
rv2 := types.NewRef(r.TargetRef())
|
||||
assert.True(rv.Equals(rv2))
|
||||
}
|
||||
|
||||
func TestListOfRef(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
cs := chunks.NewMemoryStore()
|
||||
|
||||
@@ -24,16 +24,6 @@ func TestSetDef(t *testing.T) {
|
||||
assert.True(s.Equals(s2))
|
||||
}
|
||||
|
||||
func TestSetValue(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
def := gen.SetOfBoolDef{true: true}
|
||||
m := def.New()
|
||||
val := m
|
||||
s2 := gen.SetOfBoolFromVal(val)
|
||||
assert.True(m.Equals(s2))
|
||||
}
|
||||
|
||||
func TestSetOfBoolIter(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
{{$typesPackage := .TypesPackage}}
|
||||
|
||||
// A Noms Value that describes {{.Name}}.
|
||||
var __typeRefFor{{.Name}} {{$typesPackage}}TypeRef
|
||||
|
||||
func (m {{.Name}}) TypeRef() {{$typesPackage}}TypeRef {
|
||||
return __typeRefFor{{.Name}}
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeRefFor{{.Name}} = {{toTypesTypeRef .Type .FileID .PackageName}}
|
||||
{{$typesPackage}}RegisterFromValFunction(__typeRefFor{{.Name}}, func(v {{$typesPackage}}Value) {{$typesPackage}}Value {
|
||||
return {{.Name}}FromVal(v)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -76,10 +76,6 @@ func NewBlob(r io.Reader, cs chunks.ChunkStore) (Blob, error) {
|
||||
return compoundBlob{co}, nil
|
||||
}
|
||||
|
||||
func BlobFromVal(v Value) Blob {
|
||||
return v.(Blob)
|
||||
}
|
||||
|
||||
// copyChunk copies from src to dst until a chunk boundary is found.
|
||||
// It returns the number of bytes copied and the earliest error encountered while copying.
|
||||
// copyChunk never returns an io.EOF error, instead it returns the number of bytes read up to the io.EOF.
|
||||
|
||||
@@ -166,15 +166,6 @@ func (l ListOfUInt64) Def() ListOfUInt64Def {
|
||||
return d
|
||||
}
|
||||
|
||||
func ListOfUInt64FromVal(val Value) ListOfUInt64 {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(ListOfUInt64); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return ListOfUInt64{val.(List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUInt64) InternalImplementation() List {
|
||||
return l.l
|
||||
}
|
||||
@@ -203,7 +194,7 @@ func (m ListOfUInt64) TypeRef() TypeRef {
|
||||
func init() {
|
||||
__typeRefForListOfUInt64 = MakeCompoundTypeRef(ListKind, MakePrimitiveTypeRef(UInt64Kind))
|
||||
RegisterFromValFunction(__typeRefForListOfUInt64, func(v Value) Value {
|
||||
return ListOfUInt64FromVal(v)
|
||||
return ListOfUInt64{v.(List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -308,15 +299,6 @@ func (l ListOfRefOfBlob) Def() ListOfRefOfBlobDef {
|
||||
return d
|
||||
}
|
||||
|
||||
func ListOfRefOfBlobFromVal(val Value) ListOfRefOfBlob {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(ListOfRefOfBlob); ok {
|
||||
return val
|
||||
}
|
||||
// TODO: Validate here
|
||||
return ListOfRefOfBlob{val.(List), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfRefOfBlob) InternalImplementation() List {
|
||||
return l.l
|
||||
}
|
||||
@@ -345,7 +327,7 @@ func (m ListOfRefOfBlob) TypeRef() TypeRef {
|
||||
func init() {
|
||||
__typeRefForListOfRefOfBlob = MakeCompoundTypeRef(ListKind, MakeCompoundTypeRef(RefKind, MakePrimitiveTypeRef(BlobKind)))
|
||||
RegisterFromValFunction(__typeRefForListOfRefOfBlob, func(v Value) Value {
|
||||
return ListOfRefOfBlobFromVal(v)
|
||||
return ListOfRefOfBlob{v.(List), &ref.Ref{}}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -450,14 +432,6 @@ func (r RefOfBlob) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfBlobFromVal(val Value) RefOfBlob {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfBlob); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfBlob(val.(Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfBlob.
|
||||
var __typeRefForRefOfBlob TypeRef
|
||||
|
||||
@@ -468,7 +442,7 @@ func (m RefOfBlob) TypeRef() TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfBlob = MakeCompoundTypeRef(RefKind, MakePrimitiveTypeRef(BlobKind))
|
||||
RegisterFromValFunction(__typeRefForRefOfBlob, func(v Value) Value {
|
||||
return RefOfBlobFromVal(v)
|
||||
return NewRefOfBlob(v.(Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,6 @@ func (v {{.NomsType}}) Chunks() []ref.Ref {
|
||||
return nil
|
||||
}
|
||||
|
||||
func {{.NomsType}}FromVal(v Value) {{.NomsType}} {
|
||||
return v.({{.NomsType}})
|
||||
}
|
||||
|
||||
func (v {{.NomsType}}) ToPrimitive() interface{} {
|
||||
return {{.GoType}}(v)
|
||||
}
|
||||
|
||||
@@ -195,7 +195,3 @@ func (l List) TypeRef() TypeRef {
|
||||
func (l List) elemType() TypeRef {
|
||||
return l.t.Desc.(CompoundDesc).ElemTypes[0]
|
||||
}
|
||||
|
||||
func ListFromVal(v Value) List {
|
||||
return v.(List)
|
||||
}
|
||||
|
||||
+2
-2
@@ -197,7 +197,7 @@ func TestListMap(t *testing.T) {
|
||||
for getCur() < expectConcurreny {
|
||||
}
|
||||
|
||||
i := Int64FromVal(v)
|
||||
i := v.(Int64)
|
||||
assert.Equal(uint64(i), index, "%d == %d", i, index)
|
||||
return int64(i * i)
|
||||
}
|
||||
@@ -309,7 +309,7 @@ func TestListIterAllP(t *testing.T) {
|
||||
for getCur() < expectConcurreny {
|
||||
}
|
||||
|
||||
i := Int64FromVal(v)
|
||||
i := v.(Int64)
|
||||
visited[index] = true
|
||||
assert.Equal(uint64(i), index, "%d == %d", i, index)
|
||||
}
|
||||
|
||||
@@ -185,7 +185,3 @@ func indexMapData(m mapData, r ref.Ref) int {
|
||||
return !ref.Less(m[i].key.Ref(), r)
|
||||
})
|
||||
}
|
||||
|
||||
func MapFromVal(v Value) Map {
|
||||
return v.(Map)
|
||||
}
|
||||
|
||||
@@ -40,14 +40,6 @@ func (s SetOfRefOfPackage) Def() SetOfRefOfPackageDef {
|
||||
return def
|
||||
}
|
||||
|
||||
func SetOfRefOfPackageFromVal(val Value) SetOfRefOfPackage {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(SetOfRefOfPackage); ok {
|
||||
return val
|
||||
}
|
||||
return SetOfRefOfPackage{val.(Set), &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (s SetOfRefOfPackage) InternalImplementation() Set {
|
||||
return s.s
|
||||
}
|
||||
@@ -76,7 +68,8 @@ func (m SetOfRefOfPackage) TypeRef() TypeRef {
|
||||
func init() {
|
||||
__typeRefForSetOfRefOfPackage = MakeCompoundTypeRef(SetKind, MakeCompoundTypeRef(RefKind, MakePrimitiveTypeRef(PackageKind)))
|
||||
RegisterFromValFunction(__typeRefForSetOfRefOfPackage, func(v Value) Value {
|
||||
return SetOfRefOfPackageFromVal(v)
|
||||
return SetOfRefOfPackage{v.(Set), &ref.Ref{}}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@@ -185,14 +178,6 @@ func (r RefOfPackage) Chunks() (chunks []ref.Ref) {
|
||||
return
|
||||
}
|
||||
|
||||
func RefOfPackageFromVal(val Value) RefOfPackage {
|
||||
// TODO: Do we still need FromVal?
|
||||
if val, ok := val.(RefOfPackage); ok {
|
||||
return val
|
||||
}
|
||||
return NewRefOfPackage(val.(Ref).TargetRef())
|
||||
}
|
||||
|
||||
// A Noms Value that describes RefOfPackage.
|
||||
var __typeRefForRefOfPackage TypeRef
|
||||
|
||||
@@ -203,7 +188,7 @@ func (m RefOfPackage) TypeRef() TypeRef {
|
||||
func init() {
|
||||
__typeRefForRefOfPackage = MakeCompoundTypeRef(RefKind, MakePrimitiveTypeRef(PackageKind))
|
||||
RegisterFromValFunction(__typeRefForRefOfPackage, func(v Value) Value {
|
||||
return RefOfPackageFromVal(v)
|
||||
return NewRefOfPackage(v.(Ref).TargetRef())
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,6 @@ func (v Bool) Chunks() []ref.Ref {
|
||||
return nil
|
||||
}
|
||||
|
||||
func BoolFromVal(v Value) Bool {
|
||||
return v.(Bool)
|
||||
}
|
||||
|
||||
func (v Bool) ToPrimitive() interface{} {
|
||||
return bool(v)
|
||||
}
|
||||
@@ -49,10 +45,6 @@ func (v Int8) Chunks() []ref.Ref {
|
||||
return nil
|
||||
}
|
||||
|
||||
func Int8FromVal(v Value) Int8 {
|
||||
return v.(Int8)
|
||||
}
|
||||
|
||||
func (v Int8) ToPrimitive() interface{} {
|
||||
return int8(v)
|
||||
}
|
||||
@@ -77,10 +69,6 @@ func (v Int16) Chunks() []ref.Ref {
|
||||
return nil
|
||||
}
|
||||
|
||||
func Int16FromVal(v Value) Int16 {
|
||||
return v.(Int16)
|
||||
}
|
||||
|
||||
func (v Int16) ToPrimitive() interface{} {
|
||||
return int16(v)
|
||||
}
|
||||
@@ -105,10 +93,6 @@ func (v Int32) Chunks() []ref.Ref {
|
||||
return nil
|
||||
}
|
||||
|
||||
func Int32FromVal(v Value) Int32 {
|
||||
return v.(Int32)
|
||||
}
|
||||
|
||||
func (v Int32) ToPrimitive() interface{} {
|
||||
return int32(v)
|
||||
}
|
||||
@@ -133,10 +117,6 @@ func (v Int64) Chunks() []ref.Ref {
|
||||
return nil
|
||||
}
|
||||
|
||||
func Int64FromVal(v Value) Int64 {
|
||||
return v.(Int64)
|
||||
}
|
||||
|
||||
func (v Int64) ToPrimitive() interface{} {
|
||||
return int64(v)
|
||||
}
|
||||
@@ -161,10 +141,6 @@ func (v UInt8) Chunks() []ref.Ref {
|
||||
return nil
|
||||
}
|
||||
|
||||
func UInt8FromVal(v Value) UInt8 {
|
||||
return v.(UInt8)
|
||||
}
|
||||
|
||||
func (v UInt8) ToPrimitive() interface{} {
|
||||
return uint8(v)
|
||||
}
|
||||
@@ -189,10 +165,6 @@ func (v UInt16) Chunks() []ref.Ref {
|
||||
return nil
|
||||
}
|
||||
|
||||
func UInt16FromVal(v Value) UInt16 {
|
||||
return v.(UInt16)
|
||||
}
|
||||
|
||||
func (v UInt16) ToPrimitive() interface{} {
|
||||
return uint16(v)
|
||||
}
|
||||
@@ -217,10 +189,6 @@ func (v UInt32) Chunks() []ref.Ref {
|
||||
return nil
|
||||
}
|
||||
|
||||
func UInt32FromVal(v Value) UInt32 {
|
||||
return v.(UInt32)
|
||||
}
|
||||
|
||||
func (v UInt32) ToPrimitive() interface{} {
|
||||
return uint32(v)
|
||||
}
|
||||
@@ -245,10 +213,6 @@ func (v UInt64) Chunks() []ref.Ref {
|
||||
return nil
|
||||
}
|
||||
|
||||
func UInt64FromVal(v Value) UInt64 {
|
||||
return v.(UInt64)
|
||||
}
|
||||
|
||||
func (v UInt64) ToPrimitive() interface{} {
|
||||
return uint64(v)
|
||||
}
|
||||
@@ -273,10 +237,6 @@ func (v Float32) Chunks() []ref.Ref {
|
||||
return nil
|
||||
}
|
||||
|
||||
func Float32FromVal(v Value) Float32 {
|
||||
return v.(Float32)
|
||||
}
|
||||
|
||||
func (v Float32) ToPrimitive() interface{} {
|
||||
return float32(v)
|
||||
}
|
||||
@@ -301,10 +261,6 @@ func (v Float64) Chunks() []ref.Ref {
|
||||
return nil
|
||||
}
|
||||
|
||||
func Float64FromVal(v Value) Float64 {
|
||||
return v.(Float64)
|
||||
}
|
||||
|
||||
func (v Float64) ToPrimitive() interface{} {
|
||||
return float64(v)
|
||||
}
|
||||
|
||||
@@ -173,7 +173,3 @@ func indexSetData(m setData, r ref.Ref) int {
|
||||
return !ref.Less(m[i].Ref(), r)
|
||||
})
|
||||
}
|
||||
|
||||
func SetFromVal(v Value) Set {
|
||||
return v.(Set)
|
||||
}
|
||||
|
||||
@@ -35,7 +35,3 @@ var typeRefForString = MakePrimitiveTypeRef(StringKind)
|
||||
func (fs String) TypeRef() TypeRef {
|
||||
return typeRefForString
|
||||
}
|
||||
|
||||
func StringFromVal(v Value) String {
|
||||
return v.(String)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user