mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 08:47:28 +01:00
Make the else-length-1 iterate tail explicit
This commit is contained in:
1 parent
bfff18fd64
commit
b65fdee306
6 files changed
+65
-92
No files matched your search
+3
-17
@@ -299,10 +299,10 @@ func (q *checker) bcheckStatement(n *a.Node) error {
|
||||
// execute-exactly-once block. We should have pre / inv / post
|
||||
// conditions, a la bcheckWhile.
|
||||
|
||||
// Check the body.
|
||||
{
|
||||
variables := n.Variables()
|
||||
for ; n != nil; n = n.ElseIterate() {
|
||||
q.facts = q.facts[:0]
|
||||
for _, o := range n.Variables() {
|
||||
for _, o := range variables {
|
||||
v := o.Var()
|
||||
q.facts = append(q.facts, makeSliceLengthEqEq(v.Name(), v.XType(), n.Length()))
|
||||
}
|
||||
@@ -313,20 +313,6 @@ func (q *checker) bcheckStatement(n *a.Node) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Check the tail.
|
||||
{
|
||||
q.facts = q.facts[:0]
|
||||
for _, o := range n.Variables() {
|
||||
v := o.Var()
|
||||
q.facts = append(q.facts, makeSliceLengthEqEq(v.Name(), v.XType(), t.ID1))
|
||||
}
|
||||
for _, o := range n.Tail() {
|
||||
if err := q.bcheckStatement(o); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
q.facts = q.facts[:0]
|
||||
return nil
|
||||
|
||||
|
||||
Reference in new issue
Block a user