mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 08:47:56 +01:00
Simplify cgen of empty functions
This commit is contained in:
1 parent
e39f3cbf42
commit
9f6c40246f
2 files changed
+13
-79
No files matched your search
+13
-9
@@ -188,16 +188,20 @@ func (g *gen) writeFuncImpl(b *buffer, n *a.Func) error {
|
||||
return err
|
||||
}
|
||||
b.writes("{\n")
|
||||
b.writex(k.bPrologue)
|
||||
if k.astFunc.Effect().Coroutine() {
|
||||
b.writex(k.bBodyResume)
|
||||
}
|
||||
b.writex(k.bBody)
|
||||
if k.astFunc.Effect().Coroutine() {
|
||||
b.writex(k.bBodySuspend)
|
||||
} else if k.hasGotoOK {
|
||||
b.writes("\ngoto ok;ok:\n") // The goto avoids the "unused label" warning.
|
||||
|
||||
if (len(n.Body()) != 0) || n.Effect().Coroutine() || (n.Out() != nil) {
|
||||
b.writex(k.bPrologue)
|
||||
if n.Effect().Coroutine() {
|
||||
b.writex(k.bBodyResume)
|
||||
}
|
||||
b.writex(k.bBody)
|
||||
if n.Effect().Coroutine() {
|
||||
b.writex(k.bBodySuspend)
|
||||
} else if k.hasGotoOK {
|
||||
b.writes("\ngoto ok;ok:\n") // The goto avoids the "unused label" warning.
|
||||
}
|
||||
}
|
||||
|
||||
b.writex(k.bEpilogue)
|
||||
b.writes("}\n\n")
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user