Move the "mark in.dst" into the flate decode loop.

This commit is contained in:
Nigel Tao committed 2017-10-26 11:20:42 +11:00
1 parent c70fc8fcc6
commit 36f5ae9bf4
4 files changed
+9 -20

No files matched your search

+6 -2
View File
@@ -69,8 +69,12 @@ func (g *gen) writeStatement(b *buffer, n *a.Node, depth uint32) error {
return nil
case a.KIO:
// TODO: the mark needs to apply on every (coroutine) call to the
// function, not just when we execute this particular statement.
// TODO: is a private_impl.mark the right representation? What if the
// function is passed a (ptr writer1) instead of a (writer1)? Do we
// still want to have that mark live outside of the function scope?
//
// TODO: remove this hard-coded hack for "mark in.dst".
b.printf("%sdst.private_impl.mark = %swptr_dst;", aPrefix, bPrefix)
return nil
case a.KIf:
-12
View File
@@ -117,18 +117,6 @@ func (g *gen) writeLoadDerivedVar(b *buffer, name t.ID, typ *a.TypeExpr, header
b.printf("%swptr_%s = %s%s.buf->ptr + %s%s.buf->wi;",
bPrefix, nameStr, aPrefix, nameStr, aPrefix, nameStr)
// TODO: remove this hard-coded hack for "mark in.dst".
//
// TODO: is a private_impl.mark the right representation? What if the
// function is passed a (ptr writer1) instead of a (writer1)? Do we
// still want to have that mark live outside of the function scope?
if header &&
g.currFunk.astFunc.Receiver().String(g.tm) == "flate_decoder" &&
g.currFunk.astFunc.Name().String(g.tm) == "decode" {
b.printf("%s%s.private_impl.mark = %swptr_%s;", aPrefix, nameStr, bPrefix, nameStr)
}
if header {
b.printf("%swstart_%s = %swptr_%s;", bPrefix, nameStr, bPrefix, nameStr)
}