mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-22 16:47:28 +01:00
Drop volatile facts after a yield statement
This commit is contained in:
1 parent
849db0faa2
commit
906bca4e39
4 files changed
+19
-4
No files matched your search
@@ -58,6 +58,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: a collection of forbidden variable names like and, or, not, as, ref,
|
||||||
|
// deref, false, true, in, out, this, u8, u16, etc?
|
||||||
|
|
||||||
func TrimQuotes(s string) string {
|
func TrimQuotes(s string) string {
|
||||||
if len(s) >= 2 && s[0] == '"' && s[len(s)-1] == '"' {
|
if len(s) >= 2 && s[0] == '"' && s[len(s)-1] == '"' {
|
||||||
return s[1 : len(s)-1]
|
return s[1 : len(s)-1]
|
||||||
|
|||||||
+10
-2
@@ -232,8 +232,16 @@ loop:
|
|||||||
}
|
}
|
||||||
// o is a yield statement.
|
// o is a yield statement.
|
||||||
//
|
//
|
||||||
// TODO: invalidate this-, in- and out-related facts because the
|
// Drop any facts involving in, out or this.
|
||||||
// suspension can change the state of this and its fields.
|
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
|
return nil
|
||||||
|
|||||||
@@ -59,6 +59,12 @@ func (e *Error) Error() string {
|
|||||||
return string(b)
|
return string(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
exprIn = a.NewExpr(a.FlagsTypeChecked, 0, t.IDIn, nil, nil, nil, nil)
|
||||||
|
exprOut = a.NewExpr(a.FlagsTypeChecked, 0, t.IDOut, nil, nil, nil, nil)
|
||||||
|
exprThis = a.NewExpr(a.FlagsTypeChecked, 0, t.IDThis, nil, nil, nil, nil)
|
||||||
|
)
|
||||||
|
|
||||||
// typeExprFoo is an *ast.Node MType (implicit type).
|
// typeExprFoo is an *ast.Node MType (implicit type).
|
||||||
var (
|
var (
|
||||||
typeExprBool = a.NewTypeExpr(0, t.IDBool, nil, nil, nil)
|
typeExprBool = a.NewTypeExpr(0, t.IDBool, nil, nil, nil)
|
||||||
|
|||||||
@@ -213,8 +213,6 @@ pri func flate_decoder.decode_huffman_slow?(dst writer1, src reader1)() {
|
|||||||
}
|
}
|
||||||
// TODO: "closed for writes" instead?
|
// TODO: "closed for writes" instead?
|
||||||
yield suspension "short write"
|
yield suspension "short write"
|
||||||
// TODO: invalidate this-related facts because the
|
|
||||||
// suspension can change the state of this and its fields.
|
|
||||||
}
|
}
|
||||||
// Copy from the start of this.history, if we wrapped around.
|
// Copy from the start of this.history, if we wrapped around.
|
||||||
if hlen > 0 {
|
if hlen > 0 {
|
||||||
|
|||||||
Reference in new issue
Block a user