Save derived vars (I/O pointers) even on error.

This commit is contained in:
Nigel Tao committed 2017-07-16 15:01:23 +10:00
1 parent 7b3628d78f
commit fc2a295354
3 files changed
+22 -20

No files matched your search

+4 -2
View File
@@ -161,6 +161,7 @@ func (g *gen) writeFuncImpl(n *a.Func) error {
g.writes("goto suspend;\n") // Avoid the "unused label" warning.
g.writes("suspend:\n")
g.printf("self->private_impl.%s%s[0].coro_susp_point = coro_susp_point;\n",
cPrefix, n.Name().String(g.tm))
if err := g.writeResumeSuspend(n.Body(), true); err != nil {
@@ -168,6 +169,9 @@ func (g *gen) writeFuncImpl(n *a.Func) error {
}
g.writes("\n")
g.writes("goto exit;\n") // Avoid the "unused label" warning.
g.writes("exit:")
for _, o := range n.In().Fields() {
o := o.Field()
if err := g.writeSaveDerivedVar(o.Name(), o.XType()); err != nil {
@@ -176,8 +180,6 @@ func (g *gen) writeFuncImpl(n *a.Func) error {
}
g.writes("\n")
g.writes("goto exit;\n") // Avoid the "unused label" warning.
g.writes("exit:")
if g.perFunc.public {
g.writes("self->private_impl.status = status;\n")
}