mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 16:47:28 +01:00
Roll back 'unconditionally resume local vars'
See the previous commit for the rationale.
This commit is contained in:
1 parent
2b6b0acb4f
commit
5a927d6905
5 files changed
+129
-73
No files matched your search
@@ -225,12 +225,18 @@ func (g *gen) writeFuncImplHeader(b *buffer) error {
|
||||
|
||||
func (g *gen) writeFuncImplBodyResume(b *buffer) error {
|
||||
if g.currFunk.suspendible {
|
||||
if err := g.writeResumeSuspend(b, g.currFunk.astFunc.Body(), false, false); err != nil {
|
||||
return err
|
||||
}
|
||||
// TODO: don't hard-code [0], and allow recursive coroutines.
|
||||
b.printf("uint32_t coro_susp_point = self->private_impl.%s%s[0].coro_susp_point;\n",
|
||||
cPrefix, g.currFunk.astFunc.FuncName().Str(g.tm))
|
||||
b.printf("if (coro_susp_point) {\n")
|
||||
if err := g.writeResumeSuspend(b, g.currFunk.astFunc.Body(), false, false); err != nil {
|
||||
return err
|
||||
}
|
||||
b.writes("} else {\n")
|
||||
if err := g.writeResumeSuspend(b, g.currFunk.astFunc.Body(), false, true); err != nil {
|
||||
return err
|
||||
}
|
||||
b.writes("}\n")
|
||||
// Generate a coroutine switch similiar to the technique in
|
||||
// https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
|
||||
//
|
||||
|
||||
@@ -296,7 +296,6 @@ func (g *gen) visitVars(b *buffer, block []*a.Node, depth uint32, f func(*gen, *
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO: initBoolTypedVars is never used.
|
||||
func (g *gen) writeResumeSuspend1(b *buffer, n *a.Var, suspend bool, initBoolTypedVars bool) error {
|
||||
local := fmt.Sprintf("%s%s", vPrefix, n.Name().Str(g.tm))
|
||||
|
||||
|
||||
Reference in new issue
Block a user