Check a while loop's pre and inv conditions.

This commit is contained in:
Nigel Tao committed 2017-06-01 17:11:01 +10:00
1 parent bcf6a7ee1d
commit 3f5bb7a02b
5 files changed
+115 -29

No files matched your search

+18
View File
@@ -53,6 +53,24 @@ func (n *Expr) Eq(o *Expr) bool {
return true
}
func (n *Expr) Mentions(o *Expr) bool {
if n == nil {
return false
}
if n.Eq(o) ||
n.lhs.Expr().Mentions(o) ||
n.mhs.Expr().Mentions(o) ||
(n.id0.Key() != t.KeyXBinaryAs && n.rhs.Expr().Mentions(o)) {
return true
}
for _, x := range n.list0 {
if x.Expr().Mentions(o) {
return true
}
}
return false
}
// Eq returns whether n and o are equal.
func (n *TypeExpr) Eq(o *TypeExpr) bool {
return n.eq(o, false)