Don't have suspend state if we don't suspend.

This commit is contained in:
Nigel Tao committed 2017-08-26 17:27:01 +10:00
1 parent a8423cee70
commit 018d8d1893
4 files changed
+18 -127

No files matched your search

+14 -2
View File
@@ -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