mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-25 10:26:22 -06:00
Make sure Chunks includes type.Refs and the TypeRef
Chunks shold return the futures for types.Ref values. For typed values that have a TypeRef which has a package ref, also include that.
This commit is contained in:
@@ -76,8 +76,10 @@ func (l ListOfMapOfStringToValue) Ref() ref.Ref {
|
||||
return l.l.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfMapOfStringToValue) Chunks() []types.Future {
|
||||
return l.l.Chunks()
|
||||
func (l ListOfMapOfStringToValue) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, l.TypeRef().Chunks()...)
|
||||
futures = append(futures, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfMapOfStringToValue.
|
||||
@@ -215,8 +217,10 @@ func (m MapOfStringToValue) Ref() ref.Ref {
|
||||
return m.m.Ref()
|
||||
}
|
||||
|
||||
func (m MapOfStringToValue) Chunks() []types.Future {
|
||||
return m.m.Chunks()
|
||||
func (m MapOfStringToValue) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, m.TypeRef().Chunks()...)
|
||||
futures = append(futures, m.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes MapOfStringToValue.
|
||||
@@ -344,8 +348,10 @@ func (m MapOfStringToListOfPitch) Ref() ref.Ref {
|
||||
return m.m.Ref()
|
||||
}
|
||||
|
||||
func (m MapOfStringToListOfPitch) Chunks() []types.Future {
|
||||
return m.m.Chunks()
|
||||
func (m MapOfStringToListOfPitch) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, m.TypeRef().Chunks()...)
|
||||
futures = append(futures, m.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes MapOfStringToListOfPitch.
|
||||
@@ -472,8 +478,10 @@ func (l ListOfPitch) Ref() ref.Ref {
|
||||
return l.l.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfPitch) Chunks() []types.Future {
|
||||
return l.l.Chunks()
|
||||
func (l ListOfPitch) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, l.TypeRef().Chunks()...)
|
||||
futures = append(futures, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfPitch.
|
||||
@@ -630,8 +638,10 @@ func (s Pitch) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s Pitch) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s Pitch) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s Pitch) X() float64 {
|
||||
@@ -699,8 +709,10 @@ func (m MapOfStringToString) Ref() ref.Ref {
|
||||
return m.m.Ref()
|
||||
}
|
||||
|
||||
func (m MapOfStringToString) Chunks() []types.Future {
|
||||
return m.m.Chunks()
|
||||
func (m MapOfStringToString) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, m.TypeRef().Chunks()...)
|
||||
futures = append(futures, m.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes MapOfStringToString.
|
||||
|
||||
@@ -133,8 +133,10 @@ func (s Geoposition) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s Geoposition) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s Geoposition) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s Geoposition) Latitude() float32 {
|
||||
@@ -221,8 +223,10 @@ func (s Georectangle) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s Georectangle) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s Georectangle) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s Georectangle) TopLeft() Geoposition {
|
||||
@@ -309,8 +313,10 @@ func (s Node) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s Node) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s Node) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s Node) Geoposition() Geoposition {
|
||||
@@ -351,7 +357,7 @@ func (r RefOfValue) Equals(other types.Value) bool {
|
||||
}
|
||||
|
||||
func (r RefOfValue) Chunks() []types.Future {
|
||||
return nil
|
||||
return r.TypeRef().Chunks()
|
||||
}
|
||||
|
||||
func (r RefOfValue) NomsValue() types.Value {
|
||||
@@ -469,8 +475,10 @@ func (s QuadTree) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s QuadTree) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s QuadTree) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s QuadTree) Nodes() ListOfNode {
|
||||
@@ -569,8 +577,10 @@ func (l ListOfNode) Ref() ref.Ref {
|
||||
return l.l.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfNode) Chunks() []types.Future {
|
||||
return l.l.Chunks()
|
||||
func (l ListOfNode) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, l.TypeRef().Chunks()...)
|
||||
futures = append(futures, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfNode.
|
||||
@@ -708,8 +718,10 @@ func (m MapOfStringToQuadTree) Ref() ref.Ref {
|
||||
return m.m.Ref()
|
||||
}
|
||||
|
||||
func (m MapOfStringToQuadTree) Chunks() []types.Future {
|
||||
return m.m.Chunks()
|
||||
func (m MapOfStringToQuadTree) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, m.TypeRef().Chunks()...)
|
||||
futures = append(futures, m.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes MapOfStringToQuadTree.
|
||||
@@ -872,8 +884,10 @@ func (s SQuadTree) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s SQuadTree) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s SQuadTree) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s SQuadTree) Nodes() ListOfRefOfValue {
|
||||
@@ -972,8 +986,10 @@ func (l ListOfRefOfValue) Ref() ref.Ref {
|
||||
return l.l.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfRefOfValue) Chunks() []types.Future {
|
||||
return l.l.Chunks()
|
||||
func (l ListOfRefOfValue) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, l.TypeRef().Chunks()...)
|
||||
futures = append(futures, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfRefOfValue.
|
||||
@@ -1111,8 +1127,10 @@ func (m MapOfStringToRefOfSQuadTree) Ref() ref.Ref {
|
||||
return m.m.Ref()
|
||||
}
|
||||
|
||||
func (m MapOfStringToRefOfSQuadTree) Chunks() []types.Future {
|
||||
return m.m.Chunks()
|
||||
func (m MapOfStringToRefOfSQuadTree) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, m.TypeRef().Chunks()...)
|
||||
futures = append(futures, m.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes MapOfStringToRefOfSQuadTree.
|
||||
@@ -1213,7 +1231,7 @@ func (r RefOfSQuadTree) Equals(other types.Value) bool {
|
||||
}
|
||||
|
||||
func (r RefOfSQuadTree) Chunks() []types.Future {
|
||||
return nil
|
||||
return r.TypeRef().Chunks()
|
||||
}
|
||||
|
||||
func (r RefOfSQuadTree) NomsValue() types.Value {
|
||||
|
||||
@@ -92,8 +92,10 @@ func (l ListOfIncident) Ref() ref.Ref {
|
||||
return l.l.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfIncident) Chunks() []types.Future {
|
||||
return l.l.Chunks()
|
||||
func (l ListOfIncident) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, l.TypeRef().Chunks()...)
|
||||
futures = append(futures, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfIncident.
|
||||
@@ -286,8 +288,10 @@ func (s Incident) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s Incident) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s Incident) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s Incident) ID() int64 {
|
||||
@@ -446,8 +450,10 @@ func (s Geoposition) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s Geoposition) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s Geoposition) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s Geoposition) Latitude() float32 {
|
||||
|
||||
@@ -104,8 +104,10 @@ func (l ListOfIncident) Ref() ref.Ref {
|
||||
return l.l.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfIncident) Chunks() []types.Future {
|
||||
return l.l.Chunks()
|
||||
func (l ListOfIncident) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, l.TypeRef().Chunks()...)
|
||||
futures = append(futures, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfIncident.
|
||||
@@ -274,8 +276,10 @@ func (s Incident) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s Incident) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s Incident) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s Incident) Category() string {
|
||||
@@ -386,8 +390,10 @@ func (s Geoposition) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s Geoposition) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s Geoposition) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s Geoposition) Latitude() float32 {
|
||||
@@ -474,8 +480,10 @@ func (s Georectangle) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s Georectangle) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s Georectangle) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s Georectangle) TopLeft() Geoposition {
|
||||
@@ -578,8 +586,10 @@ func (s SQuadTree) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s SQuadTree) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s SQuadTree) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s SQuadTree) Nodes() ListOfIncident {
|
||||
@@ -679,8 +689,10 @@ func (m MapOfStringToSQuadTree) Ref() ref.Ref {
|
||||
return m.m.Ref()
|
||||
}
|
||||
|
||||
func (m MapOfStringToSQuadTree) Chunks() []types.Future {
|
||||
return m.m.Chunks()
|
||||
func (m MapOfStringToSQuadTree) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, m.TypeRef().Chunks()...)
|
||||
futures = append(futures, m.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes MapOfStringToSQuadTree.
|
||||
|
||||
@@ -75,8 +75,10 @@ func (s Commit) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s Commit) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s Commit) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s Commit) Value() types.Value {
|
||||
@@ -124,8 +126,10 @@ func (s SetOfCommit) Ref() ref.Ref {
|
||||
return s.s.Ref()
|
||||
}
|
||||
|
||||
func (s SetOfCommit) Chunks() []types.Future {
|
||||
return s.s.Chunks()
|
||||
func (s SetOfCommit) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.s.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes SetOfCommit.
|
||||
|
||||
@@ -78,8 +78,10 @@ func (s SetOfDataset) Ref() ref.Ref {
|
||||
return s.s.Ref()
|
||||
}
|
||||
|
||||
func (s SetOfDataset) Chunks() []types.Future {
|
||||
return s.s.Chunks()
|
||||
func (s SetOfDataset) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.s.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes SetOfDataset.
|
||||
@@ -240,8 +242,10 @@ func (s Dataset) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s Dataset) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s Dataset) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s Dataset) Id() string {
|
||||
|
||||
@@ -49,8 +49,10 @@ func (l {{.Name}}) Ref() ref.Ref {
|
||||
return l.l.Ref()
|
||||
}
|
||||
|
||||
func (l {{.Name}}) Chunks() []types.Future {
|
||||
return l.l.Chunks()
|
||||
func (l {{.Name}}) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, l.TypeRef().Chunks()...)
|
||||
futures = append(futures, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
{{template "type_ref.tmpl" .}}
|
||||
|
||||
@@ -50,8 +50,10 @@ func (m {{.Name}}) Ref() ref.Ref {
|
||||
return m.m.Ref()
|
||||
}
|
||||
|
||||
func (m {{.Name}}) Chunks() []types.Future {
|
||||
return m.m.Chunks()
|
||||
func (m {{.Name}}) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, m.TypeRef().Chunks()...)
|
||||
futures = append(futures, m.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
{{template "type_ref.tmpl" .}}
|
||||
|
||||
@@ -20,7 +20,7 @@ func (r {{.Name}}) Equals(other types.Value) bool {
|
||||
}
|
||||
|
||||
func (r {{.Name}}) Chunks() []types.Future {
|
||||
return nil
|
||||
return r.TypeRef().Chunks()
|
||||
}
|
||||
|
||||
func (r {{.Name}}) NomsValue() types.Value {
|
||||
|
||||
@@ -50,8 +50,10 @@ func (s {{.Name}}) Ref() ref.Ref {
|
||||
return s.s.Ref()
|
||||
}
|
||||
|
||||
func (s {{.Name}}) Chunks() []types.Future {
|
||||
return s.s.Chunks()
|
||||
func (s {{.Name}}) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.s.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
{{template "type_ref.tmpl" .}}
|
||||
|
||||
@@ -93,8 +93,10 @@ func (s {{.Name}}) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s {{.Name}}) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s {{.Name}}) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
{{$name := .Name}}
|
||||
|
||||
@@ -92,8 +92,10 @@ func (s EnumStruct) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s EnumStruct) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s EnumStruct) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s EnumStruct) Hand() Handedness {
|
||||
|
||||
@@ -107,8 +107,10 @@ func (s S) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s S) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s S) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s S) S() string {
|
||||
|
||||
@@ -97,8 +97,10 @@ func (s D) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s D) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s D) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s D) StructField() sha1_f1a192312c01fb47e8e329471242e475eb7001a4.S {
|
||||
|
||||
@@ -55,8 +55,10 @@ func (l ListOfInt64) Ref() ref.Ref {
|
||||
return l.l.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfInt64) Chunks() []types.Future {
|
||||
return l.l.Chunks()
|
||||
func (l ListOfInt64) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, l.TypeRef().Chunks()...)
|
||||
futures = append(futures, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfInt64.
|
||||
|
||||
@@ -58,3 +58,11 @@ func TestListFilter(t *testing.T) {
|
||||
})
|
||||
assert.Equal(ListOfInt64Def{0, 2, 4, 6, 8}, l2.Def())
|
||||
}
|
||||
|
||||
func TestListChunks(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
l := ListOfInt64Def{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}.New()
|
||||
cs := l.Chunks()
|
||||
assert.Len(cs, 0)
|
||||
}
|
||||
|
||||
@@ -56,8 +56,10 @@ func (m MapOfBoolToString) Ref() ref.Ref {
|
||||
return m.m.Ref()
|
||||
}
|
||||
|
||||
func (m MapOfBoolToString) Chunks() []types.Future {
|
||||
return m.m.Chunks()
|
||||
func (m MapOfBoolToString) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, m.TypeRef().Chunks()...)
|
||||
futures = append(futures, m.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes MapOfBoolToString.
|
||||
@@ -185,8 +187,10 @@ func (m MapOfStringToValue) Ref() ref.Ref {
|
||||
return m.m.Ref()
|
||||
}
|
||||
|
||||
func (m MapOfStringToValue) Chunks() []types.Future {
|
||||
return m.m.Chunks()
|
||||
func (m MapOfStringToValue) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, m.TypeRef().Chunks()...)
|
||||
futures = append(futures, m.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes MapOfStringToValue.
|
||||
|
||||
@@ -50,7 +50,7 @@ func (r RefOfListOfString) Equals(other types.Value) bool {
|
||||
}
|
||||
|
||||
func (r RefOfListOfString) Chunks() []types.Future {
|
||||
return nil
|
||||
return r.TypeRef().Chunks()
|
||||
}
|
||||
|
||||
func (r RefOfListOfString) NomsValue() types.Value {
|
||||
@@ -132,8 +132,10 @@ func (l ListOfString) Ref() ref.Ref {
|
||||
return l.l.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfString) Chunks() []types.Future {
|
||||
return l.l.Chunks()
|
||||
func (l ListOfString) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, l.TypeRef().Chunks()...)
|
||||
futures = append(futures, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfString.
|
||||
@@ -270,8 +272,10 @@ func (l ListOfRefOfFloat32) Ref() ref.Ref {
|
||||
return l.l.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfRefOfFloat32) Chunks() []types.Future {
|
||||
return l.l.Chunks()
|
||||
func (l ListOfRefOfFloat32) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, l.TypeRef().Chunks()...)
|
||||
futures = append(futures, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfRefOfFloat32.
|
||||
@@ -382,7 +386,7 @@ func (r RefOfFloat32) Equals(other types.Value) bool {
|
||||
}
|
||||
|
||||
func (r RefOfFloat32) Chunks() []types.Future {
|
||||
return nil
|
||||
return r.TypeRef().Chunks()
|
||||
}
|
||||
|
||||
func (r RefOfFloat32) NomsValue() types.Value {
|
||||
@@ -480,8 +484,10 @@ func (s StructWithRef) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s StructWithRef) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s StructWithRef) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s StructWithRef) R() RefOfSetOfFloat32 {
|
||||
@@ -514,7 +520,7 @@ func (r RefOfSetOfFloat32) Equals(other types.Value) bool {
|
||||
}
|
||||
|
||||
func (r RefOfSetOfFloat32) Chunks() []types.Future {
|
||||
return nil
|
||||
return r.TypeRef().Chunks()
|
||||
}
|
||||
|
||||
func (r RefOfSetOfFloat32) NomsValue() types.Value {
|
||||
@@ -598,8 +604,10 @@ func (s SetOfFloat32) Ref() ref.Ref {
|
||||
return s.s.Ref()
|
||||
}
|
||||
|
||||
func (s SetOfFloat32) Chunks() []types.Future {
|
||||
return s.s.Chunks()
|
||||
func (s SetOfFloat32) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.s.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes SetOfFloat32.
|
||||
|
||||
@@ -86,3 +86,30 @@ func TestStructWithRef(t *testing.T) {
|
||||
set2 := r2.GetValue(cs)
|
||||
assert.True(set.Equals(set2))
|
||||
}
|
||||
|
||||
func TestListOfRefChunks(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
a := types.Float32(0)
|
||||
ra := a.Ref()
|
||||
|
||||
l := NewListOfRefOfFloat32()
|
||||
r := NewRefOfFloat32(ra)
|
||||
|
||||
assert.Len(l.Chunks(), 0)
|
||||
|
||||
l2 := l.Append(r)
|
||||
assert.Len(l2.Chunks(), 1)
|
||||
}
|
||||
|
||||
func TestStructWithRefChunks(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
set := SetOfFloat32Def{0: true}.New()
|
||||
str := StructWithRefDef{
|
||||
R: set.Ref(),
|
||||
}.New()
|
||||
|
||||
// 1 for the TypeRef and 1 for the ref in the R field.
|
||||
assert.Len(str.Chunks(), 2)
|
||||
}
|
||||
|
||||
@@ -57,8 +57,10 @@ func (s SetOfBool) Ref() ref.Ref {
|
||||
return s.s.Ref()
|
||||
}
|
||||
|
||||
func (s SetOfBool) Chunks() []types.Future {
|
||||
return s.s.Chunks()
|
||||
func (s SetOfBool) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.s.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes SetOfBool.
|
||||
|
||||
@@ -76,8 +76,10 @@ func (l ListOfStruct) Ref() ref.Ref {
|
||||
return l.l.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfStruct) Chunks() []types.Future {
|
||||
return l.l.Chunks()
|
||||
func (l ListOfStruct) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, l.TypeRef().Chunks()...)
|
||||
futures = append(futures, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfStruct.
|
||||
@@ -234,8 +236,10 @@ func (s Struct) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s Struct) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s Struct) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s Struct) S() string {
|
||||
|
||||
@@ -98,8 +98,10 @@ func (s OptionalStruct) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s OptionalStruct) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s OptionalStruct) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s OptionalStruct) S() (v string, ok bool) {
|
||||
|
||||
@@ -156,8 +156,10 @@ func (s StructPrimitives) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s StructPrimitives) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s StructPrimitives) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s StructPrimitives) Uint64() uint64 {
|
||||
|
||||
@@ -91,8 +91,10 @@ func (s Tree) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s Tree) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s Tree) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s Tree) Children() ListOfTree {
|
||||
@@ -151,8 +153,10 @@ func (l ListOfTree) Ref() ref.Ref {
|
||||
return l.l.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfTree) Chunks() []types.Future {
|
||||
return l.l.Chunks()
|
||||
func (l ListOfTree) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, l.TypeRef().Chunks()...)
|
||||
futures = append(futures, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfTree.
|
||||
|
||||
@@ -44,3 +44,12 @@ func TestTypeRef(t *testing.T) {
|
||||
assert.Equal("Struct", typ.Name())
|
||||
assert.Equal(types.TypeRefKind, typ.Kind())
|
||||
}
|
||||
|
||||
func TestStructChunks(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
st := StructDef{"hi", true}.New()
|
||||
cs := st.Chunks()
|
||||
// One chunk for the TypeRef
|
||||
assert.Len(cs, 1)
|
||||
}
|
||||
|
||||
@@ -245,8 +245,10 @@ func (s ImportUser) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s ImportUser) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s ImportUser) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s ImportUser) ImportedStruct() sha1_f9397427926127f67d8f3edb21c92bf642262e9b.D {
|
||||
|
||||
@@ -106,8 +106,10 @@ func (s StructWithList) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s StructWithList) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s StructWithList) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s StructWithList) L() ListOfUInt8 {
|
||||
@@ -190,8 +192,10 @@ func (l ListOfUInt8) Ref() ref.Ref {
|
||||
return l.l.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfUInt8) Chunks() []types.Future {
|
||||
return l.l.Chunks()
|
||||
func (l ListOfUInt8) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, l.TypeRef().Chunks()...)
|
||||
futures = append(futures, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfUInt8.
|
||||
|
||||
@@ -137,8 +137,10 @@ func (s StructWithUnionField) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s StructWithUnionField) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s StructWithUnionField) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s StructWithUnionField) A() float32 {
|
||||
@@ -319,8 +321,10 @@ func (s SetOfUInt8) Ref() ref.Ref {
|
||||
return s.s.Ref()
|
||||
}
|
||||
|
||||
func (s SetOfUInt8) Chunks() []types.Future {
|
||||
return s.s.Chunks()
|
||||
func (s SetOfUInt8) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.s.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
// A Noms Value that describes SetOfUInt8.
|
||||
|
||||
@@ -108,8 +108,10 @@ func (s StructWithUnions) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s StructWithUnions) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s StructWithUnions) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s StructWithUnions) A() __unionOfBOfFloat64AndCOfString {
|
||||
@@ -216,8 +218,10 @@ func (s __unionOfBOfFloat64AndCOfString) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s __unionOfBOfFloat64AndCOfString) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s __unionOfBOfFloat64AndCOfString) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s __unionOfBOfFloat64AndCOfString) B() (val float64, ok bool) {
|
||||
@@ -356,8 +360,10 @@ func (s __unionOfEOfFloat64AndFOfString) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s __unionOfEOfFloat64AndFOfString) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s __unionOfEOfFloat64AndFOfString) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s __unionOfEOfFloat64AndFOfString) E() (val float64, ok bool) {
|
||||
|
||||
@@ -97,8 +97,10 @@ func (s D) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s D) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s D) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s D) StructField() sha1_f1a192312c01fb47e8e329471242e475eb7001a4.S {
|
||||
|
||||
@@ -107,8 +107,10 @@ func (s S) Ref() ref.Ref {
|
||||
return s.m.Ref()
|
||||
}
|
||||
|
||||
func (s S) Chunks() []types.Future {
|
||||
return s.m.Chunks()
|
||||
func (s S) Chunks() (futures []types.Future) {
|
||||
futures = append(futures, s.TypeRef().Chunks()...)
|
||||
futures = append(futures, s.m.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (s S) S() string {
|
||||
|
||||
@@ -27,9 +27,7 @@ func (co compoundObject) Len() uint64 {
|
||||
|
||||
func (co compoundObject) Chunks() (futures []Future) {
|
||||
for _, f := range co.futures {
|
||||
if f, ok := f.(*unresolvedFuture); ok {
|
||||
futures = append(futures, f)
|
||||
}
|
||||
futures = appendChunks(futures, f)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -42,3 +42,18 @@ func futureEqualsValue(f Future, v Value) bool {
|
||||
func futureFromValue(v Value) Future {
|
||||
return resolvedFuture{v}
|
||||
}
|
||||
|
||||
func appendChunks(chunks []Future, f Future) []Future {
|
||||
if uf, ok := f.(*unresolvedFuture); ok {
|
||||
chunks = append(chunks, uf)
|
||||
} else if f != nil {
|
||||
v := f.Val()
|
||||
if v != nil {
|
||||
if r, ok := v.(Ref); ok {
|
||||
chunks = append(chunks, futureFromRef(r.Ref()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return chunks
|
||||
}
|
||||
|
||||
@@ -186,9 +186,7 @@ func (l listLeaf) Equals(other Value) bool {
|
||||
|
||||
func (l listLeaf) Chunks() (futures []Future) {
|
||||
for _, f := range l.list {
|
||||
if f, ok := f.(*unresolvedFuture); ok {
|
||||
futures = append(futures, f)
|
||||
}
|
||||
futures = appendChunks(futures, f)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -357,3 +357,15 @@ func TestListTypeRef(t *testing.T) {
|
||||
l := NewList(Int32(0))
|
||||
assert.True(l.TypeRef().Equals(MakeCompoundTypeRef("", ListKind, MakePrimitiveTypeRef(ValueKind))))
|
||||
}
|
||||
|
||||
func TestListChunks(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
l1 := NewList(Int32(0))
|
||||
c1 := l1.Chunks()
|
||||
assert.Len(c1, 0)
|
||||
|
||||
l2 := NewList(Ref{R: Int32(0).Ref()})
|
||||
c2 := l2.Chunks()
|
||||
assert.Len(c2, 1)
|
||||
}
|
||||
|
||||
@@ -138,14 +138,9 @@ func (m Map) Equals(other Value) (res bool) {
|
||||
}
|
||||
|
||||
func (fm Map) Chunks() (futures []Future) {
|
||||
appendIfUnresolved := func(f Future) {
|
||||
if f, ok := f.(*unresolvedFuture); ok {
|
||||
futures = append(futures, f)
|
||||
}
|
||||
}
|
||||
for _, entry := range fm.m {
|
||||
appendIfUnresolved(entry.key)
|
||||
appendIfUnresolved(entry.value)
|
||||
futures = appendChunks(futures, entry.key)
|
||||
futures = appendChunks(futures, entry.value)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -221,3 +221,19 @@ func TestMapTypeRef(t *testing.T) {
|
||||
m := NewMap()
|
||||
assert.True(m.TypeRef().Equals(MakeCompoundTypeRef("", MapKind, MakePrimitiveTypeRef(ValueKind), MakePrimitiveTypeRef(ValueKind))))
|
||||
}
|
||||
|
||||
func TestMapChunks(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
l1 := NewMap(Int32(0), Int32(1))
|
||||
c1 := l1.Chunks()
|
||||
assert.Len(c1, 0)
|
||||
|
||||
l2 := NewMap(Ref{R: Int32(0).Ref()}, Int32(1))
|
||||
c2 := l2.Chunks()
|
||||
assert.Len(c2, 1)
|
||||
|
||||
l3 := NewMap(Int32(0), Ref{R: Int32(1).Ref()})
|
||||
c3 := l3.Chunks()
|
||||
assert.Len(c3, 1)
|
||||
}
|
||||
|
||||
@@ -133,9 +133,7 @@ func (fs Set) Equals(other Value) bool {
|
||||
|
||||
func (fs Set) Chunks() (futures []Future) {
|
||||
for _, f := range fs.m {
|
||||
if f, ok := f.(*unresolvedFuture); ok {
|
||||
futures = append(futures, f)
|
||||
}
|
||||
futures = appendChunks(futures, f)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -190,3 +190,15 @@ func TestSetTypeRef(t *testing.T) {
|
||||
s := NewSet()
|
||||
assert.True(s.TypeRef().Equals(MakeCompoundTypeRef("", SetKind, MakePrimitiveTypeRef(ValueKind))))
|
||||
}
|
||||
|
||||
func TestSetChunks(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
l1 := NewSet(Int32(0))
|
||||
c1 := l1.Chunks()
|
||||
assert.Len(c1, 0)
|
||||
|
||||
l2 := NewSet(Ref{R: Int32(0).Ref()})
|
||||
c2 := l2.Chunks()
|
||||
assert.Len(c2, 1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user