Reorganize some switch cases

This commit is contained in:
Nigel Tao committed 2018-05-03 20:59:44 +10:00
1 parent a106e2a857
commit 9a67d3b701
1 file changed
+25 -25
+25 -25
View File
@@ -277,9 +277,34 @@ func (q *checker) bcheckStatement(n *a.Node) error {
}
return nil
case a.KIOBind:
n := n.IOBind()
if err := q.bcheckBlock(n.Body()); err != nil {
return err
}
// TODO: invalidate any facts regarding the io_bind expressions.
return nil
case a.KIf:
return q.bcheckIf(n.If())
case a.KIterate:
n := n.Iterate()
for _, o := range n.Variables() {
if err := q.bcheckVar(o.Var()); err != nil {
return err
}
}
// TODO: this isn't right, as the body is a loop, not an
// execute-exactly-once block. We should have pre / inv / post
// conditions, a la bcheckWhile.
for _, o := range n.Body() {
if err := q.bcheckStatement(o); err != nil {
return err
}
}
return nil
case a.KJump:
n := n.Jump()
skip := t.IDPost
@@ -303,31 +328,6 @@ func (q *checker) bcheckStatement(n *a.Node) error {
case a.KVar:
return q.bcheckVar(n.Var())
case a.KIOBind:
n := n.IOBind()
if err := q.bcheckBlock(n.Body()); err != nil {
return err
}
// TODO: invalidate any facts regarding the io_bind expressions.
return nil
case a.KIterate:
n := n.Iterate()
for _, o := range n.Variables() {
if err := q.bcheckVar(o.Var()); err != nil {
return err
}
}
// TODO: this isn't right, as the body is a loop, not an
// execute-exactly-once block. We should have pre / inv / post
// conditions, a la bcheckWhile.
for _, o := range n.Body() {
if err := q.bcheckStatement(o); err != nil {
return err
}
}
return nil
case a.KWhile:
return q.bcheckWhile(n.While())