mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 00:55:11 +01:00
Call SetMBounds when bounds-checking expressions
This commit is contained in:
1 parent
a506657c53
commit
ba3b97ec69
2 files changed
+10
-2
No files matched your search
@@ -62,6 +62,7 @@ var (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
zeroExpr.SetConstValue(zero)
|
zeroExpr.SetConstValue(zero)
|
||||||
|
zeroExpr.SetMBounds(a.Bounds{zero, zero})
|
||||||
zeroExpr.SetMType(typeExprIdeal)
|
zeroExpr.SetMType(typeExprIdeal)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -704,7 +705,9 @@ func (q *checker) bcheckExpr(n *a.Expr, depth uint32) (a.Bounds, error) {
|
|||||||
}
|
}
|
||||||
depth++
|
depth++
|
||||||
|
|
||||||
// TODO: check that n.MBounds() is {nil, nil}? Likewise for tcheck?
|
if b := n.MBounds(); b[0] != nil {
|
||||||
|
return b, nil
|
||||||
|
}
|
||||||
|
|
||||||
nb, err := q.bcheckExpr1(n, depth)
|
nb, err := q.bcheckExpr1(n, depth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -726,7 +729,8 @@ func (q *checker) bcheckExpr(n *a.Expr, depth uint32) (a.Bounds, error) {
|
|||||||
if err := q.optimizeNonSuspendible(n); err != nil {
|
if err := q.optimizeNonSuspendible(n); err != nil {
|
||||||
return a.Bounds{}, err
|
return a.Bounds{}, err
|
||||||
}
|
}
|
||||||
// TODO: call n.SetMBounds.
|
|
||||||
|
n.SetMBounds(nb)
|
||||||
return nb, nil
|
return nb, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -346,6 +346,10 @@ func (q *checker) tcheckExpr(n *a.Expr, depth uint32) error {
|
|||||||
}
|
}
|
||||||
depth++
|
depth++
|
||||||
|
|
||||||
|
if n.MType() != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
switch op := n.Operator(); {
|
switch op := n.Operator(); {
|
||||||
case op.IsXUnaryOp():
|
case op.IsXUnaryOp():
|
||||||
return q.tcheckExprUnaryOp(n, depth)
|
return q.tcheckExprUnaryOp(n, depth)
|
||||||
|
|||||||
Reference in new issue
Block a user