mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 00:55:11 +01:00
Don't add a bare "true" to the list of facts.
It adds no new actionable information.
This commit is contained in:
1 parent
3f5bb7a02b
commit
6396b47849
1 file changed
+6
-3
@@ -326,8 +326,7 @@ func (q *checker) bcheckWhile(n *a.While) error {
|
|||||||
// We effectively have a "while false { etc }" loop. There's no need to
|
// We effectively have a "while false { etc }" loop. There's no need to
|
||||||
// check the body.
|
// check the body.
|
||||||
} else {
|
} else {
|
||||||
// Assume the pre and inv conditions, and the while condition. Check
|
// Assume the pre and inv conditions...
|
||||||
// the body.
|
|
||||||
q.facts = q.facts[:0]
|
q.facts = q.facts[:0]
|
||||||
for _, o := range n.Asserts() {
|
for _, o := range n.Asserts() {
|
||||||
if o.Assert().Keyword().Key() == t.KeyPost {
|
if o.Assert().Keyword().Key() == t.KeyPost {
|
||||||
@@ -335,7 +334,11 @@ func (q *checker) bcheckWhile(n *a.While) error {
|
|||||||
}
|
}
|
||||||
q.facts.appendFact(o.Assert().Condition())
|
q.facts.appendFact(o.Assert().Condition())
|
||||||
}
|
}
|
||||||
q.facts.appendFact(n.Condition())
|
// ...and the while condition, unless it is the redundant "true".
|
||||||
|
if cv == nil {
|
||||||
|
q.facts.appendFact(n.Condition())
|
||||||
|
}
|
||||||
|
// Check the body.
|
||||||
for _, o := range n.Body() {
|
for _, o := range n.Body() {
|
||||||
if err := q.bcheckStatement(o); err != nil {
|
if err := q.bcheckStatement(o); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in new issue
Block a user