Make wuffs_base__status a struct

This commit is contained in:
Nigel Tao committed 2020-01-05 10:48:20 +11:00
1 parent c50f16e58b
commit e6db7f6a40
24 files changed
+677 -499

No files matched your search

+3 -3
View File
@@ -162,7 +162,7 @@ func (g *gen) writeStatementAssign0(b *buffer, op t.ID, lhs *a.Expr, rhs *a.Expr
}
if op != t.IDEqQuestion && rhs.Effect().Coroutine() {
b.writes("if (status) { goto suspend; }\n")
b.writes("if (status.repr) { goto suspend; }\n")
}
}
@@ -464,8 +464,8 @@ func (g *gen) writeStatementRet(b *buffer, n *a.Ret, depth uint32) error {
} else {
g.currFunk.hasGotoOK = true
// TODO: the "goto exit"s can be "goto ok".
b.writes("if (wuffs_base__status__is_error(status)) { goto exit; }" +
"else if (wuffs_base__status__is_suspension(status)) { " +
b.writes("if (wuffs_base__status__is_error(&status)) { goto exit; }" +
"else if (wuffs_base__status__is_suspension(&status)) { " +
"status = wuffs_base__make_status(wuffs_base__error__cannot_return_a_suspension); goto exit; } goto ok;")
}
return nil