mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 16:32:11 +01:00
Don't have suspend state if we don't suspend.
This commit is contained in:
1 parent
a8423cee70
commit
018d8d1893
4 files changed
+18
-127
No files matched your search
@@ -558,6 +558,9 @@ func (g *gen) writeStruct(b *buffer, n *a.Struct) error {
|
||||
if o.Receiver() != n.Name() || !o.Suspendible() {
|
||||
continue
|
||||
}
|
||||
if k := g.funks[o.QID()]; k.coroSuspPoint == 0 {
|
||||
continue
|
||||
}
|
||||
// TODO: allow max depth > 1 for recursive coroutines.
|
||||
const maxDepth = 1
|
||||
b.writes("struct {\n")
|
||||
|
||||
@@ -97,9 +97,21 @@ func (g *gen) writeFuncImpl(b *buffer, n *a.Func) error {
|
||||
}
|
||||
b.writes("{\n")
|
||||
b.writex(k.bHeader)
|
||||
b.writex(k.bBodyResume)
|
||||
if k.suspendible {
|
||||
if k.coroSuspPoint > 0 {
|
||||
b.writex(k.bBodyResume)
|
||||
} else {
|
||||
b.writes("{\n")
|
||||
}
|
||||
}
|
||||
b.writex(k.bBody)
|
||||
b.writex(k.bBodySuspend)
|
||||
if k.suspendible {
|
||||
if k.coroSuspPoint > 0 {
|
||||
b.writex(k.bBodySuspend)
|
||||
} else {
|
||||
b.writes("}\n")
|
||||
}
|
||||
}
|
||||
b.writex(k.bFooter)
|
||||
b.writes("}\n\n")
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user