mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-26 01:01:35 +01:00
Remove redundant const-value bounds check
This commit is contained in:
1 parent
8ce26e4025
commit
971e173721
1 file changed
-6
@@ -469,12 +469,6 @@ func (q *checker) bcheckAssignment2(lhs *a.Expr, lTyp *a.TypeExpr, op t.ID, rhs
|
|||||||
|
|
||||||
rb := a.Bounds{}
|
rb := a.Bounds{}
|
||||||
if op == t.IDEq {
|
if op == t.IDEq {
|
||||||
if cv := rhs.ConstValue(); cv != nil {
|
|
||||||
if (lb[0] != nil && cv.Cmp(lb[0]) < 0) || (lb[1] != nil && cv.Cmp(lb[1]) > 0) {
|
|
||||||
return fmt.Errorf("check: constant %v is not within bounds %v", cv, lb)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
rb, err = q.bcheckExpr(rhs, 0)
|
rb, err = q.bcheckExpr(rhs, 0)
|
||||||
} else {
|
} else {
|
||||||
rb, err = q.bcheckExprBinaryOp(op.BinaryForm(), lhs, rhs, 0)
|
rb, err = q.bcheckExprBinaryOp(op.BinaryForm(), lhs, rhs, 0)
|
||||||
|
|||||||
Reference in new issue
Block a user