Prepare for calculating the zlib checksum.

This commit is contained in:
Nigel Tao committed 2017-10-21 11:55:58 +11:00
1 parent 4d7faac49e
commit 62935c41d7
7 files changed
+89 -42

No files matched your search

+2 -1
View File
@@ -760,7 +760,8 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (*big.Int, *big.Int,
return zero, bitMask(int(aMax.Int64())), nil
}
// TODO: delete this hack that only matches "foo.is_suspension(etc)".
if isThatMethod(q.tm, n, t.KeyIsSuspension, 0) || isThatMethod(q.tm, n, t.KeySuffix, 1) {
if isThatMethod(q.tm, n, t.KeyIsError, 0) || isThatMethod(q.tm, n, t.KeyIsOK, 0) ||
isThatMethod(q.tm, n, t.KeyIsSuspension, 0) || isThatMethod(q.tm, n, t.KeySuffix, 1) {
return nil, nil, nil
}
// TODO: delete this hack that only matches "foo.set_literal_width(etc)".
+9 -2
View File
@@ -480,7 +480,9 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
return nil
}
// TODO: delete this hack that only matches "foo.is_suspension(etc)".
if isThatMethod(q.tm, n, t.KeyIsSuspension, 0) {
if isThatMethod(q.tm, n, t.KeyIsError, 0) ||
isThatMethod(q.tm, n, t.KeyIsOK, 0) ||
isThatMethod(q.tm, n, t.KeyIsSuspension, 0) {
foo := n.LHS().Expr().LHS().Expr()
if err := q.tcheckExpr(foo, depth); err != nil {
return err
@@ -526,7 +528,12 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
return err
}
}
n.SetMType(typeExprPlaceholder) // HACK.
if n.ID0().Key() == t.KeyTry {
// TODO: be more principled about inferring "try etc"'s type.
n.SetMType(typeExprStatus)
} else {
n.SetMType(typeExprPlaceholder) // HACK.
}
return nil
}
// TODO: delete this hack that only matches "foo.length(etc)".