mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 00:47:28 +01:00
Re-arrange coro_susp_point's and coro stacks
This commit is contained in:
1 parent
9518af5a95
commit
957182fde7
2 files changed
+41
-21
No files matched your search
@@ -747,6 +747,28 @@ func (g *gen) writeStructPrivateImpl(b *buffer, n *a.Struct) error {
|
||||
}
|
||||
|
||||
if n.Classy() {
|
||||
// TODO: allow max depth > 1 for recursive coroutines.
|
||||
const maxDepth = 1
|
||||
|
||||
b.writeb('\n')
|
||||
for _, file := range g.files {
|
||||
for _, tld := range file.TopLevelDecls() {
|
||||
if tld.Kind() != a.KFunc {
|
||||
continue
|
||||
}
|
||||
o := tld.AsFunc()
|
||||
if o.Receiver() != n.QID() || !o.Effect().Coroutine() {
|
||||
continue
|
||||
}
|
||||
k := g.funks[o.QQID()]
|
||||
if k.coroSuspPoint == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
b.printf("uint32_t %s%s[%d];\n", pPrefix, o.FuncName().Str(g.tm), maxDepth)
|
||||
}
|
||||
}
|
||||
|
||||
b.writeb('\n')
|
||||
for _, file := range g.files {
|
||||
for _, tld := range file.TopLevelDecls() {
|
||||
@@ -762,13 +784,6 @@ func (g *gen) writeStructPrivateImpl(b *buffer, n *a.Struct) error {
|
||||
continue
|
||||
}
|
||||
|
||||
// TODO: allow max depth > 1 for recursive coroutines.
|
||||
const maxDepth = 1
|
||||
|
||||
if k.coroSuspPoint != 0 {
|
||||
b.printf("uint32_t %s%s[%d];\n", pPrefix, o.FuncName().Str(g.tm), maxDepth)
|
||||
}
|
||||
|
||||
oldLenB0 := len(*b)
|
||||
b.writes("struct {\n")
|
||||
oldLenB1 := len(*b)
|
||||
|
||||
Reference in new issue
Block a user