Drop volatile facts after a yield statement

This commit is contained in:
Nigel Tao committed 2017-12-01 16:24:54 +11:00
1 parent 849db0faa2
commit 906bca4e39
4 files changed
+19 -4

No files matched your search

+10 -2
View File
@@ -232,8 +232,16 @@ loop:
}
// o is a yield statement.
//
// TODO: invalidate this-, in- and out-related facts because the
// suspension can change the state of this and its fields.
// Drop any facts involving in, out or this.
if err := q.facts.update(func(x *a.Expr) (*a.Expr, error) {
if x.Mentions(exprIn) || x.Mentions(exprOut) || x.Mentions(exprThis) {
return nil, nil
}
return x, nil
}); err != nil {
return err
}
// TODO: drop any facts involving ptr-typed local variables?
}
}
return nil