gengo: emit {map,list}IteratorReject thunks.
The generated package now compiles completely happily.  Neat.
@@ -17,8 +17,7 @@ func TestNuevo(t *testing.T) {
}
return y
}
- f := openOrPanic("_test/neu.go")
- emitFileHeader(f)
+
emitType := func(tg typeGenerator, w io.Writer) {
tg.EmitNodeType(w)
tg.EmitNodeMethodReprKind(w)
@@ -36,5 +35,21 @@ func TestNuevo(t *testing.T) {
tg.EmitNodeMethodAsLink(w)
tg.EmitNodeMethodNodeBuilder(w)
}
+
+ f := openOrPanic("_test/thunks.go")
+ emitFileHeader(f)
+ doTemplate(`
+ type mapIteratorReject struct{ err error }
+ type listIteratorReject struct{ err error }
+
+ func (itr mapIteratorReject) Next() (ipld.Node, ipld.Node, error) { return nil, nil, itr.err }
+ func (itr mapIteratorReject) Done() bool { return false }
+
+ func (itr listIteratorReject) Next() (int, ipld.Node, error) { return -1, nil, itr.err }
+ func (itr listIteratorReject) Done() bool { return false }
+ `, f, nil)
+
+ f = openOrPanic("_test/tStrang.go")
+ emitFileHeader(f)
emitType(generateKindString{"Strang", schema.TypeString{}}, f)
}
