Add a writer1.available method.

This commit is contained in:
Nigel Tao committed 2017-10-07 16:15:17 +11:00
1 parent ac405d485b
commit c3ae0534df
6 files changed
+32 -8

No files matched your search

+1 -1
View File
@@ -739,7 +739,7 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (*big.Int, *big.Int,
return nil, nil, nil
}
// TODO: delete this hack that only matches "foo.length(etc)".
if isThatMethod(q.tm, n, t.KeyLength, 0) {
if isThatMethod(q.tm, n, t.KeyLength, 0) || isThatMethod(q.tm, n, t.KeyAvailable, 0) {
break
}
return nil, nil, fmt.Errorf("check: unrecognized token.Key (0x%X) for bcheckExprOther", n.ID0().Key())
+2 -1
View File
@@ -462,7 +462,8 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
return nil
}
// TODO: delete this hack that only matches "foo.length(etc)".
if isThatMethod(q.tm, n, t.KeyCopyFrom, 1) || isThatMethod(q.tm, n, t.KeyLength, 0) {
if isThatMethod(q.tm, n, t.KeyCopyFrom, 1) || isThatMethod(q.tm, n, t.KeyLength, 0) ||
isThatMethod(q.tm, n, t.KeyAvailable, 0) {
foo := n.LHS().Expr().LHS().Expr()
if err := q.tcheckExpr(foo, depth); err != nil {
return err