Add reader1.limitt and writer1.limitt methods.

The "limitt" typo will be renamed to "limit" once we remove the keyword
named "limit".
This commit is contained in:
Nigel Tao committed 2017-10-26 15:06:59 +11:00
1 parent b886e3a1ea
commit a9ba7e85ac
10 files changed
+88 -20

No files matched your search

+1 -1
View File
@@ -721,7 +721,7 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (*big.Int, *big.Int,
isInSrc(q.tm, n, t.KeyReadU16BE, 0) || isInSrc(q.tm, n, t.KeyReadU32BE, 0) ||
isInSrc(q.tm, n, t.KeyReadU32BE, 0) || isInSrc(q.tm, n, t.KeyReadU32LE, 0) ||
isInSrc(q.tm, n, t.KeySkip32, 1) || isInSrc(q.tm, n, t.KeySinceMark, 0) ||
isInSrc(q.tm, n, t.KeyMark, 0) ||
isInSrc(q.tm, n, t.KeyMark, 0) || isInSrc(q.tm, n, t.KeyLimitt, 1) ||
isInDst(q.tm, n, t.KeyCopyFromSlice, 1) || isInDst(q.tm, n, t.KeyCopyFromSlice32, 2) ||
isInDst(q.tm, n, t.KeyCopyFromReader32, 2) || isInDst(q.tm, n, t.KeyCopyFromHistory32, 2) ||
isInDst(q.tm, n, t.KeyWriteU8, 1) || isInDst(q.tm, n, t.KeySinceMark, 0) ||
+5 -3
View File
@@ -439,7 +439,7 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
isInSrc(q.tm, n, t.KeyReadU16BE, 0) || isInSrc(q.tm, n, t.KeyReadU32BE, 0) ||
isInSrc(q.tm, n, t.KeyReadU32BE, 0) || isInSrc(q.tm, n, t.KeyReadU32LE, 0) ||
isInSrc(q.tm, n, t.KeySkip32, 1) || isInSrc(q.tm, n, t.KeySinceMark, 0) ||
isInSrc(q.tm, n, t.KeyMark, 0) ||
isInSrc(q.tm, n, t.KeyMark, 0) || isInSrc(q.tm, n, t.KeyLimitt, 1) ||
isInDst(q.tm, n, t.KeyCopyFromSlice, 1) || isInDst(q.tm, n, t.KeyCopyFromSlice32, 2) ||
isInDst(q.tm, n, t.KeyCopyFromReader32, 2) || isInDst(q.tm, n, t.KeyCopyFromHistory32, 2) ||
isInDst(q.tm, n, t.KeyWriteU8, 1) || isInDst(q.tm, n, t.KeySinceMark, 0) ||
@@ -694,7 +694,8 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
func isInSrc(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool {
callSuspendible := methodName != t.KeySinceMark &&
methodName != t.KeyMark
methodName != t.KeyMark &&
methodName != t.KeyLimitt
if n.ID0().Key() != t.KeyOpenParen || n.CallSuspendible() != callSuspendible || len(n.Args()) != nArgs {
return false
}
@@ -716,7 +717,8 @@ func isInDst(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool {
methodName != t.KeyCopyFromSlice32 &&
methodName != t.KeyCopyFromSlice &&
methodName != t.KeySinceMark &&
methodName != t.KeyMark
methodName != t.KeyMark &&
methodName != t.KeyLimitt
// TODO: check that n.Args() is "(x:bar)".
if n.ID0().Key() != t.KeyOpenParen || n.CallSuspendible() != callSuspendible || len(n.Args()) != nArgs {
return false
+4 -1
View File
@@ -237,7 +237,7 @@ const (
KeyPri = Key(IDPri >> KeyShift)
KeyError = Key(IDError >> KeyShift)
KeySuspension = Key(IDSuspension >> KeyShift)
KeyLimit = Key(IDLimit >> KeyShift)
KeyLimit = Key(IDLimit >> KeyShift) // TODO: delete.
KeyPackageID = Key(IDPackageID >> KeyShift)
KeyConst = Key(IDConst >> KeyShift)
KeyTry = Key(IDTry >> KeyShift)
@@ -301,6 +301,7 @@ const (
KeyAvailable = Key(IDAvailable >> KeyShift)
KeyPrefix = Key(IDPrefix >> KeyShift)
KeySuffix = Key(IDSuffix >> KeyShift)
KeyLimitt = Key(IDLimitt >> KeyShift) // TODO: rename Limitt to Limit.
KeyXUnaryPlus = Key(IDXUnaryPlus >> KeyShift)
KeyXUnaryMinus = Key(IDXUnaryMinus >> KeyShift)
@@ -488,6 +489,7 @@ const (
IDAvailable = ID(0xCA<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
IDPrefix = ID(0xCB<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
IDSuffix = ID(0xCC<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
IDLimitt = ID(0xCD<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
)
// The IDXFoo IDs are not returned by the tokenizer. They are used by the
@@ -693,6 +695,7 @@ var builtInsByKey = [nBuiltInKeys]struct {
KeyAvailable: {"available", IDAvailable},
KeyPrefix: {"prefix", IDPrefix},
KeySuffix: {"suffix", IDSuffix},
KeyLimitt: {"limitt", IDLimitt},
}
var builtInsByName = map[string]ID{}