mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-22 08:47:28 +01:00
cgen: allow "var x : nptr array[etc] etc"
This commit is contained in:
1 parent
dfab0d2b3d
commit
8ac22ceab2
7 files changed
+84
-31
No files matched your search
@@ -367,3 +367,18 @@ func proveReasonRequirementForRHSLength(q *checker, op t.ID, lhs *a.Expr, rhs *a
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (q *checker) proveRecvNotEqNullptr(recv *a.Expr) error {
|
||||
for _, x := range q.facts {
|
||||
if x.Operator() != t.IDXBinaryNotEq {
|
||||
continue
|
||||
}
|
||||
xLHS := x.LHS().AsExpr()
|
||||
xRHS := x.RHS().AsExpr()
|
||||
if (xLHS.Eq(exprNullptr) && xRHS.Eq(recv)) ||
|
||||
(xRHS.Eq(exprNullptr) && xLHS.Eq(recv)) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("check: cannot prove %q", recv.Str(q.tm)+" <> nullptr")
|
||||
}
|
||||
Reference in new issue
Block a user