NomDL codegen: Fix clobbering

If two files depend on the same file we ended up overwriting the
first written file which is problematic because the "internal" types
would not be written the second time.
This commit is contained in:
Erik Arvidsson
2015-12-01 12:42:28 -05:00
parent 5cce2d68a7
commit ff8924db09
10 changed files with 573 additions and 143 deletions
+1
View File
@@ -128,6 +128,7 @@ func generateDepCode(packageName, outDir string, written map[string]bool, p type
parsed := pkg.Parsed{Package: p, Name: packageName}
if !localPkgs[parsed.Ref()] {
generateAndEmit(tag, filepath.Join(outDir, tag+".go"), written, pDeps, parsed)
localPkgs[parsed.Ref()] = true
}
for depRef, dep := range pDeps {
deps[depRef] = dep
+2
View File
@@ -0,0 +1,2 @@
alias a = import "./clobber_a/a.noms"
alias b = import "./clobber_b/b.noms"
+3
View File
@@ -0,0 +1,3 @@
struct A {
A: List(List(Blob))
}
+1
View File
@@ -0,0 +1 @@
alias a = import "../clobber_a/a.noms"
+15
View File
@@ -0,0 +1,15 @@
package test
import (
"testing"
"github.com/attic-labs/noms/Godeps/_workspace/src/github.com/stretchr/testify/assert"
"github.com/attic-labs/noms/chunks"
"github.com/attic-labs/noms/nomdl/codegen/test/gen"
)
func TestClobber(t *testing.T) {
cs := chunks.NewMemoryStore()
l := gen.NewListOfListOfBlob(cs)
assert.NotNil(t, l)
}
+3
View File
@@ -0,0 +1,3 @@
// This file was generated by nomdl/codegen.
package gen
+402
View File
@@ -0,0 +1,402 @@
// This file was generated by nomdl/codegen.
package gen
import (
"github.com/attic-labs/noms/chunks"
"github.com/attic-labs/noms/ref"
"github.com/attic-labs/noms/types"
)
var __genPackageInFile_sha1_b3ecb0f_CachedRef ref.Ref
// This function builds up a Noms value that describes the type
// package implemented by this file and registers it with the global
// type package definition cache.
func init() {
p := types.NewPackage([]types.Type{
types.MakeStructType("A",
[]types.Field{
types.Field{"A", types.MakeCompoundType(types.ListKind, types.MakeCompoundType(types.ListKind, types.MakePrimitiveType(types.BlobKind))), false},
},
types.Choices{},
),
}, []ref.Ref{})
__genPackageInFile_sha1_b3ecb0f_CachedRef = types.RegisterPackage(&p)
}
// A
type A struct {
_A ListOfListOfBlob
cs chunks.ChunkStore
ref *ref.Ref
}
func NewA(cs chunks.ChunkStore) A {
return A{
_A: NewListOfListOfBlob(cs),
cs: cs,
ref: &ref.Ref{},
}
}
type ADef struct {
A ListOfListOfBlobDef
}
func (def ADef) New(cs chunks.ChunkStore) A {
return A{
_A: def.A.New(cs),
cs: cs,
ref: &ref.Ref{},
}
}
func (s A) Def() (d ADef) {
d.A = s._A.Def()
return
}
var __typeForA types.Type
func (m A) Type() types.Type {
return __typeForA
}
func init() {
__typeForA = types.MakeType(__genPackageInFile_sha1_b3ecb0f_CachedRef, 0)
types.RegisterStruct(__typeForA, builderForA, readerForA)
}
func builderForA(cs chunks.ChunkStore, values []types.Value) types.Value {
i := 0
s := A{ref: &ref.Ref{}, cs: cs}
s._A = values[i].(ListOfListOfBlob)
i++
return s
}
func readerForA(v types.Value) []types.Value {
values := []types.Value{}
s := v.(A)
values = append(values, s._A)
return values
}
func (s A) Equals(other types.Value) bool {
return other != nil && __typeForA.Equals(other.Type()) && s.Ref() == other.Ref()
}
func (s A) Ref() ref.Ref {
return types.EnsureRef(s.ref, s)
}
func (s A) Chunks() (chunks []ref.Ref) {
chunks = append(chunks, __typeForA.Chunks()...)
chunks = append(chunks, s._A.Chunks()...)
return
}
func (s A) ChildValues() (ret []types.Value) {
ret = append(ret, s._A)
return
}
func (s A) A() ListOfListOfBlob {
return s._A
}
func (s A) SetA(val ListOfListOfBlob) A {
s._A = val
s.ref = &ref.Ref{}
return s
}
// ListOfListOfBlob
type ListOfListOfBlob struct {
l types.List
cs chunks.ChunkStore
ref *ref.Ref
}
func NewListOfListOfBlob(cs chunks.ChunkStore) ListOfListOfBlob {
return ListOfListOfBlob{types.NewTypedList(cs, __typeForListOfListOfBlob), cs, &ref.Ref{}}
}
type ListOfListOfBlobDef []ListOfBlobDef
func (def ListOfListOfBlobDef) New(cs chunks.ChunkStore) ListOfListOfBlob {
l := make([]types.Value, len(def))
for i, d := range def {
l[i] = d.New(cs)
}
return ListOfListOfBlob{types.NewTypedList(cs, __typeForListOfListOfBlob, l...), cs, &ref.Ref{}}
}
func (l ListOfListOfBlob) Def() ListOfListOfBlobDef {
d := make([]ListOfBlobDef, l.Len())
for i := uint64(0); i < l.Len(); i++ {
d[i] = l.l.Get(i).(ListOfBlob).Def()
}
return d
}
func (l ListOfListOfBlob) Equals(other types.Value) bool {
return other != nil && __typeForListOfListOfBlob.Equals(other.Type()) && l.Ref() == other.Ref()
}
func (l ListOfListOfBlob) Ref() ref.Ref {
return types.EnsureRef(l.ref, l)
}
func (l ListOfListOfBlob) Chunks() (chunks []ref.Ref) {
chunks = append(chunks, l.Type().Chunks()...)
chunks = append(chunks, l.l.Chunks()...)
return
}
func (l ListOfListOfBlob) ChildValues() []types.Value {
return append([]types.Value{}, l.l.ChildValues()...)
}
// A Noms Value that describes ListOfListOfBlob.
var __typeForListOfListOfBlob types.Type
func (m ListOfListOfBlob) Type() types.Type {
return __typeForListOfListOfBlob
}
func init() {
__typeForListOfListOfBlob = types.MakeCompoundType(types.ListKind, types.MakeCompoundType(types.ListKind, types.MakePrimitiveType(types.BlobKind)))
types.RegisterValue(__typeForListOfListOfBlob, builderForListOfListOfBlob, readerForListOfListOfBlob)
}
func builderForListOfListOfBlob(cs chunks.ChunkStore, v types.Value) types.Value {
return ListOfListOfBlob{v.(types.List), cs, &ref.Ref{}}
}
func readerForListOfListOfBlob(v types.Value) types.Value {
return v.(ListOfListOfBlob).l
}
func (l ListOfListOfBlob) Len() uint64 {
return l.l.Len()
}
func (l ListOfListOfBlob) Empty() bool {
return l.Len() == uint64(0)
}
func (l ListOfListOfBlob) Get(i uint64) ListOfBlob {
return l.l.Get(i).(ListOfBlob)
}
func (l ListOfListOfBlob) Slice(idx uint64, end uint64) ListOfListOfBlob {
return ListOfListOfBlob{l.l.Slice(idx, end), l.cs, &ref.Ref{}}
}
func (l ListOfListOfBlob) Set(i uint64, val ListOfBlob) ListOfListOfBlob {
return ListOfListOfBlob{l.l.Set(i, val), l.cs, &ref.Ref{}}
}
func (l ListOfListOfBlob) Append(v ...ListOfBlob) ListOfListOfBlob {
return ListOfListOfBlob{l.l.Append(l.fromElemSlice(v)...), l.cs, &ref.Ref{}}
}
func (l ListOfListOfBlob) Insert(idx uint64, v ...ListOfBlob) ListOfListOfBlob {
return ListOfListOfBlob{l.l.Insert(idx, l.fromElemSlice(v)...), l.cs, &ref.Ref{}}
}
func (l ListOfListOfBlob) Remove(idx uint64, end uint64) ListOfListOfBlob {
return ListOfListOfBlob{l.l.Remove(idx, end), l.cs, &ref.Ref{}}
}
func (l ListOfListOfBlob) RemoveAt(idx uint64) ListOfListOfBlob {
return ListOfListOfBlob{(l.l.RemoveAt(idx)), l.cs, &ref.Ref{}}
}
func (l ListOfListOfBlob) fromElemSlice(p []ListOfBlob) []types.Value {
r := make([]types.Value, len(p))
for i, v := range p {
r[i] = v
}
return r
}
type ListOfListOfBlobIterCallback func(v ListOfBlob, i uint64) (stop bool)
func (l ListOfListOfBlob) Iter(cb ListOfListOfBlobIterCallback) {
l.l.Iter(func(v types.Value, i uint64) bool {
return cb(v.(ListOfBlob), i)
})
}
type ListOfListOfBlobIterAllCallback func(v ListOfBlob, i uint64)
func (l ListOfListOfBlob) IterAll(cb ListOfListOfBlobIterAllCallback) {
l.l.IterAll(func(v types.Value, i uint64) {
cb(v.(ListOfBlob), i)
})
}
func (l ListOfListOfBlob) IterAllP(concurrency int, cb ListOfListOfBlobIterAllCallback) {
l.l.IterAllP(concurrency, func(v types.Value, i uint64) {
cb(v.(ListOfBlob), i)
})
}
type ListOfListOfBlobFilterCallback func(v ListOfBlob, i uint64) (keep bool)
func (l ListOfListOfBlob) Filter(cb ListOfListOfBlobFilterCallback) ListOfListOfBlob {
out := l.l.Filter(func(v types.Value, i uint64) bool {
return cb(v.(ListOfBlob), i)
})
return ListOfListOfBlob{out, l.cs, &ref.Ref{}}
}
// ListOfBlob
type ListOfBlob struct {
l types.List
cs chunks.ChunkStore
ref *ref.Ref
}
func NewListOfBlob(cs chunks.ChunkStore) ListOfBlob {
return ListOfBlob{types.NewTypedList(cs, __typeForListOfBlob), cs, &ref.Ref{}}
}
type ListOfBlobDef []types.Blob
func (def ListOfBlobDef) New(cs chunks.ChunkStore) ListOfBlob {
l := make([]types.Value, len(def))
for i, d := range def {
l[i] = d
}
return ListOfBlob{types.NewTypedList(cs, __typeForListOfBlob, l...), cs, &ref.Ref{}}
}
func (l ListOfBlob) Def() ListOfBlobDef {
d := make([]types.Blob, l.Len())
for i := uint64(0); i < l.Len(); i++ {
d[i] = l.l.Get(i).(types.Blob)
}
return d
}
func (l ListOfBlob) Equals(other types.Value) bool {
return other != nil && __typeForListOfBlob.Equals(other.Type()) && l.Ref() == other.Ref()
}
func (l ListOfBlob) Ref() ref.Ref {
return types.EnsureRef(l.ref, l)
}
func (l ListOfBlob) Chunks() (chunks []ref.Ref) {
chunks = append(chunks, l.Type().Chunks()...)
chunks = append(chunks, l.l.Chunks()...)
return
}
func (l ListOfBlob) ChildValues() []types.Value {
return append([]types.Value{}, l.l.ChildValues()...)
}
// A Noms Value that describes ListOfBlob.
var __typeForListOfBlob types.Type
func (m ListOfBlob) Type() types.Type {
return __typeForListOfBlob
}
func init() {
__typeForListOfBlob = types.MakeCompoundType(types.ListKind, types.MakePrimitiveType(types.BlobKind))
types.RegisterValue(__typeForListOfBlob, builderForListOfBlob, readerForListOfBlob)
}
func builderForListOfBlob(cs chunks.ChunkStore, v types.Value) types.Value {
return ListOfBlob{v.(types.List), cs, &ref.Ref{}}
}
func readerForListOfBlob(v types.Value) types.Value {
return v.(ListOfBlob).l
}
func (l ListOfBlob) Len() uint64 {
return l.l.Len()
}
func (l ListOfBlob) Empty() bool {
return l.Len() == uint64(0)
}
func (l ListOfBlob) Get(i uint64) types.Blob {
return l.l.Get(i).(types.Blob)
}
func (l ListOfBlob) Slice(idx uint64, end uint64) ListOfBlob {
return ListOfBlob{l.l.Slice(idx, end), l.cs, &ref.Ref{}}
}
func (l ListOfBlob) Set(i uint64, val types.Blob) ListOfBlob {
return ListOfBlob{l.l.Set(i, val), l.cs, &ref.Ref{}}
}
func (l ListOfBlob) Append(v ...types.Blob) ListOfBlob {
return ListOfBlob{l.l.Append(l.fromElemSlice(v)...), l.cs, &ref.Ref{}}
}
func (l ListOfBlob) Insert(idx uint64, v ...types.Blob) ListOfBlob {
return ListOfBlob{l.l.Insert(idx, l.fromElemSlice(v)...), l.cs, &ref.Ref{}}
}
func (l ListOfBlob) Remove(idx uint64, end uint64) ListOfBlob {
return ListOfBlob{l.l.Remove(idx, end), l.cs, &ref.Ref{}}
}
func (l ListOfBlob) RemoveAt(idx uint64) ListOfBlob {
return ListOfBlob{(l.l.RemoveAt(idx)), l.cs, &ref.Ref{}}
}
func (l ListOfBlob) fromElemSlice(p []types.Blob) []types.Value {
r := make([]types.Value, len(p))
for i, v := range p {
r[i] = v
}
return r
}
type ListOfBlobIterCallback func(v types.Blob, i uint64) (stop bool)
func (l ListOfBlob) Iter(cb ListOfBlobIterCallback) {
l.l.Iter(func(v types.Value, i uint64) bool {
return cb(v.(types.Blob), i)
})
}
type ListOfBlobIterAllCallback func(v types.Blob, i uint64)
func (l ListOfBlob) IterAll(cb ListOfBlobIterAllCallback) {
l.l.IterAll(func(v types.Value, i uint64) {
cb(v.(types.Blob), i)
})
}
func (l ListOfBlob) IterAllP(concurrency int, cb ListOfBlobIterAllCallback) {
l.l.IterAllP(concurrency, func(v types.Value, i uint64) {
cb(v.(types.Blob), i)
})
}
type ListOfBlobFilterCallback func(v types.Blob, i uint64) (keep bool)
func (l ListOfBlob) Filter(cb ListOfBlobFilterCallback) ListOfBlob {
out := l.l.Filter(func(v types.Value, i uint64) bool {
return cb(v.(types.Blob), i)
})
return ListOfBlob{out, l.cs, &ref.Ref{}}
}
+3
View File
@@ -0,0 +1,3 @@
// This file was generated by nomdl/codegen.
package gen
@@ -114,146 +114,3 @@ func (s StructWithDupList) SetL(val ListOfUInt8) StructWithDupList {
s.ref = &ref.Ref{}
return s
}
// ListOfUInt8
type ListOfUInt8 struct {
l types.List
cs chunks.ChunkStore
ref *ref.Ref
}
func NewListOfUInt8(cs chunks.ChunkStore) ListOfUInt8 {
return ListOfUInt8{types.NewTypedList(cs, __typeForListOfUInt8), cs, &ref.Ref{}}
}
type ListOfUInt8Def []uint8
func (def ListOfUInt8Def) New(cs chunks.ChunkStore) ListOfUInt8 {
l := make([]types.Value, len(def))
for i, d := range def {
l[i] = types.UInt8(d)
}
return ListOfUInt8{types.NewTypedList(cs, __typeForListOfUInt8, l...), cs, &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) Equals(other types.Value) bool {
return other != nil && __typeForListOfUInt8.Equals(other.Type()) && 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.Type().Chunks()...)
chunks = append(chunks, l.l.Chunks()...)
return
}
func (l ListOfUInt8) ChildValues() []types.Value {
return append([]types.Value{}, l.l.ChildValues()...)
}
// A Noms Value that describes ListOfUInt8.
var __typeForListOfUInt8 types.Type
func (m ListOfUInt8) Type() types.Type {
return __typeForListOfUInt8
}
func init() {
__typeForListOfUInt8 = types.MakeCompoundType(types.ListKind, types.MakePrimitiveType(types.UInt8Kind))
types.RegisterValue(__typeForListOfUInt8, builderForListOfUInt8, readerForListOfUInt8)
}
func builderForListOfUInt8(cs chunks.ChunkStore, v types.Value) types.Value {
return ListOfUInt8{v.(types.List), cs, &ref.Ref{}}
}
func readerForListOfUInt8(v types.Value) types.Value {
return v.(ListOfUInt8).l
}
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), l.cs, &ref.Ref{}}
}
func (l ListOfUInt8) Set(i uint64, val uint8) ListOfUInt8 {
return ListOfUInt8{l.l.Set(i, types.UInt8(val)), l.cs, &ref.Ref{}}
}
func (l ListOfUInt8) Append(v ...uint8) ListOfUInt8 {
return ListOfUInt8{l.l.Append(l.fromElemSlice(v)...), l.cs, &ref.Ref{}}
}
func (l ListOfUInt8) Insert(idx uint64, v ...uint8) ListOfUInt8 {
return ListOfUInt8{l.l.Insert(idx, l.fromElemSlice(v)...), l.cs, &ref.Ref{}}
}
func (l ListOfUInt8) Remove(idx uint64, end uint64) ListOfUInt8 {
return ListOfUInt8{l.l.Remove(idx, end), l.cs, &ref.Ref{}}
}
func (l ListOfUInt8) RemoveAt(idx uint64) ListOfUInt8 {
return ListOfUInt8{(l.l.RemoveAt(idx)), l.cs, &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)
})
}
func (l ListOfUInt8) IterAllP(concurrency int, cb ListOfUInt8IterAllCallback) {
l.l.IterAllP(concurrency, 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 {
out := l.l.Filter(func(v types.Value, i uint64) bool {
return cb(uint8(v.(types.UInt8)), i)
})
return ListOfUInt8{out, l.cs, &ref.Ref{}}
}
@@ -174,3 +174,146 @@ func (s StructWithList) SetI(val int64) StructWithList {
s.ref = &ref.Ref{}
return s
}
// ListOfUInt8
type ListOfUInt8 struct {
l types.List
cs chunks.ChunkStore
ref *ref.Ref
}
func NewListOfUInt8(cs chunks.ChunkStore) ListOfUInt8 {
return ListOfUInt8{types.NewTypedList(cs, __typeForListOfUInt8), cs, &ref.Ref{}}
}
type ListOfUInt8Def []uint8
func (def ListOfUInt8Def) New(cs chunks.ChunkStore) ListOfUInt8 {
l := make([]types.Value, len(def))
for i, d := range def {
l[i] = types.UInt8(d)
}
return ListOfUInt8{types.NewTypedList(cs, __typeForListOfUInt8, l...), cs, &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) Equals(other types.Value) bool {
return other != nil && __typeForListOfUInt8.Equals(other.Type()) && 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.Type().Chunks()...)
chunks = append(chunks, l.l.Chunks()...)
return
}
func (l ListOfUInt8) ChildValues() []types.Value {
return append([]types.Value{}, l.l.ChildValues()...)
}
// A Noms Value that describes ListOfUInt8.
var __typeForListOfUInt8 types.Type
func (m ListOfUInt8) Type() types.Type {
return __typeForListOfUInt8
}
func init() {
__typeForListOfUInt8 = types.MakeCompoundType(types.ListKind, types.MakePrimitiveType(types.UInt8Kind))
types.RegisterValue(__typeForListOfUInt8, builderForListOfUInt8, readerForListOfUInt8)
}
func builderForListOfUInt8(cs chunks.ChunkStore, v types.Value) types.Value {
return ListOfUInt8{v.(types.List), cs, &ref.Ref{}}
}
func readerForListOfUInt8(v types.Value) types.Value {
return v.(ListOfUInt8).l
}
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), l.cs, &ref.Ref{}}
}
func (l ListOfUInt8) Set(i uint64, val uint8) ListOfUInt8 {
return ListOfUInt8{l.l.Set(i, types.UInt8(val)), l.cs, &ref.Ref{}}
}
func (l ListOfUInt8) Append(v ...uint8) ListOfUInt8 {
return ListOfUInt8{l.l.Append(l.fromElemSlice(v)...), l.cs, &ref.Ref{}}
}
func (l ListOfUInt8) Insert(idx uint64, v ...uint8) ListOfUInt8 {
return ListOfUInt8{l.l.Insert(idx, l.fromElemSlice(v)...), l.cs, &ref.Ref{}}
}
func (l ListOfUInt8) Remove(idx uint64, end uint64) ListOfUInt8 {
return ListOfUInt8{l.l.Remove(idx, end), l.cs, &ref.Ref{}}
}
func (l ListOfUInt8) RemoveAt(idx uint64) ListOfUInt8 {
return ListOfUInt8{(l.l.RemoveAt(idx)), l.cs, &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)
})
}
func (l ListOfUInt8) IterAllP(concurrency int, cb ListOfUInt8IterAllCallback) {
l.l.IterAllP(concurrency, 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 {
out := l.l.Filter(func(v types.Value, i uint64) bool {
return cb(uint8(v.(types.UInt8)), i)
})
return ListOfUInt8{out, l.cs, &ref.Ref{}}
}