mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 16:47:28 +01:00
Delete old limit- and mark-related code.
This commit is contained in:
1 parent
aa396e7992
commit
cbc8c39375
12 files changed
+10
-167
No files matched your search
@@ -46,7 +46,6 @@ const (
|
||||
cPrefix = "c_" // Coroutine state.
|
||||
fPrefix = "f_" // Struct field.
|
||||
iPrefix = "i_" // Iterate variable.
|
||||
lPrefix = "l_" // Limit length. TODO: delete.
|
||||
tPrefix = "t_" // Temporary local variable.
|
||||
vPrefix = "v_" // Local variable.
|
||||
)
|
||||
|
||||
@@ -404,9 +404,6 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
|
||||
b.writes("private_impl." + fPrefix)
|
||||
b.writes(n.ID1().String(g.tm))
|
||||
return nil
|
||||
|
||||
case t.KeyLimit:
|
||||
panic("TODO: delete t.KeyLimit")
|
||||
}
|
||||
return fmt.Errorf("unrecognized token.Key (0x%X) for writeExprOther", n.ID0().Key())
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ type funk struct {
|
||||
public bool
|
||||
suspendible bool
|
||||
usesScratch bool
|
||||
limitVarName string // TODO: delete.
|
||||
shortReads []string
|
||||
}
|
||||
|
||||
|
||||
@@ -68,15 +68,6 @@ func (g *gen) writeStatement(b *buffer, n *a.Node, depth uint32) error {
|
||||
b.writes(";\n")
|
||||
return nil
|
||||
|
||||
case a.KIO:
|
||||
// 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:
|
||||
// TODO: for writeSuspendibles, make sure that we get order of
|
||||
// sub-expression evaluation correct.
|
||||
@@ -257,15 +248,6 @@ func (g *gen) writeStatement(b *buffer, n *a.Node, depth uint32) error {
|
||||
if err := g.writeSuspendibles(b, v, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
if v.ID0().Key() == t.KeyLimit {
|
||||
g.currFunk.limitVarName = n.Name().String(g.tm)
|
||||
b.printf("%s%s =", lPrefix, g.currFunk.limitVarName)
|
||||
if err := g.writeExpr(
|
||||
b, v.LHS().Expr(), replaceCallSuspendibles, parenthesesMandatory, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
b.writes(";\n")
|
||||
}
|
||||
}
|
||||
switch n.XType().Decorator().Key() {
|
||||
case t.KeyOpenBracket:
|
||||
|
||||
@@ -255,11 +255,10 @@ func (g *gen) visitVars(b *buffer, block []*a.Node, depth uint32, f func(*gen, *
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *gen) writeResumeSuspend1(b *buffer, n *a.Var, prefix string, suspend bool) error {
|
||||
local := fmt.Sprintf("%s%s", prefix, n.Name().String(g.tm))
|
||||
func (g *gen) writeResumeSuspend1(b *buffer, n *a.Var, suspend bool) error {
|
||||
local := fmt.Sprintf("%s%s", vPrefix, n.Name().String(g.tm))
|
||||
|
||||
// TODO: explicitly handle prefix == lPrefix?
|
||||
if typ := n.XType(); prefix == vPrefix && typ.HasPointers() {
|
||||
if typ := n.XType(); typ.HasPointers() {
|
||||
if suspend {
|
||||
return nil
|
||||
}
|
||||
@@ -310,20 +309,12 @@ func (g *gen) writeResumeSuspend1(b *buffer, n *a.Var, prefix string, suspend bo
|
||||
|
||||
func (g *gen) writeResumeSuspend(b *buffer, block []*a.Node, suspend bool) error {
|
||||
return g.visitVars(b, block, 0, func(g *gen, b *buffer, n *a.Var) error {
|
||||
if v := n.Value(); v != nil && v.ID0().Key() == t.KeyLimit {
|
||||
if err := g.writeResumeSuspend1(b, n, lPrefix, suspend); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return g.writeResumeSuspend1(b, n, vPrefix, suspend)
|
||||
return g.writeResumeSuspend1(b, n, suspend)
|
||||
})
|
||||
}
|
||||
|
||||
func (g *gen) writeVars(b *buffer, block []*a.Node, skipPointerTypes bool, skipIterateVariables bool) error {
|
||||
return g.visitVars(b, block, 0, func(g *gen, b *buffer, n *a.Var) error {
|
||||
if v := n.Value(); v != nil && v.ID0().Key() == t.KeyLimit {
|
||||
b.printf("uint64_t %s%v;\n", lPrefix, n.Name().String(g.tm))
|
||||
}
|
||||
if skipPointerTypes && n.XType().HasPointers() {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user