Add a writer1.is_marked method.

This commit is contained in:
Nigel Tao committed 2017-11-09 10:38:24 +11:00
1 parent 545f043d94
commit e2ce9f1b1d
7 files changed
+38 -5

No files matched your search

+1 -1
View File
@@ -750,7 +750,7 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (*big.Int, *big.Int,
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) ||
isInDst(q.tm, n, t.KeyMark, 0) ||
isInDst(q.tm, n, t.KeyMark, 0) || isInDst(q.tm, n, t.KeyIsMarked, 0) ||
isThisMethod(q.tm, n, "decode_header", 1) || isThisMethod(q.tm, n, "decode_lsd", 1) ||
isThisMethod(q.tm, n, "decode_extension", 1) || isThisMethod(q.tm, n, "decode_id", 2) ||
isThisMethod(q.tm, n, "decode_uncompressed", 2) || isThisMethod(q.tm, n, "decode_blocks", 2) ||
+4 -1
View File
@@ -415,7 +415,7 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
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) ||
isInDst(q.tm, n, t.KeyMark, 0) ||
isInDst(q.tm, n, t.KeyMark, 0) || isInDst(q.tm, n, t.KeyIsMarked, 0) ||
isThisMethod(q.tm, n, "decode_header", 1) || isThisMethod(q.tm, n, "decode_lsd", 1) ||
isThisMethod(q.tm, n, "decode_extension", 1) || isThisMethod(q.tm, n, "decode_id", 2) ||
isThisMethod(q.tm, n, "decode_uncompressed", 2) || isThisMethod(q.tm, n, "decode_blocks", 2) ||
@@ -446,6 +446,8 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
} else if isInDst(q.tm, n, t.KeyCopyFromSlice32, 2) || isInDst(q.tm, n, t.KeyCopyFromReader32, 2) ||
isInDst(q.tm, n, t.KeyCopyFromHistory32, 2) {
n.SetMType(typeExprU32) // HACK.
} else if isInDst(q.tm, n, t.KeyIsMarked, 0) {
n.SetMType(typeExprBool) // HACK.
} else {
n.SetMType(typeExprPlaceholder) // HACK.
}
@@ -684,6 +686,7 @@ 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.KeyIsMarked &&
methodName != t.KeyMark &&
methodName != t.KeyLimit
// TODO: check that n.Args() is "(x:bar)".
+3
View File
@@ -303,6 +303,7 @@ const (
KeyLowBits = Key(IDLowBits >> KeyShift)
KeyHighBits = Key(IDHighBits >> KeyShift)
KeyUnreadU8 = Key(IDUnreadU8 >> KeyShift)
KeyIsMarked = Key(IDIsMarked >> KeyShift)
KeyXUnaryPlus = Key(IDXUnaryPlus >> KeyShift)
KeyXUnaryMinus = Key(IDXUnaryMinus >> KeyShift)
@@ -490,6 +491,7 @@ const (
IDLowBits = ID(0xAE<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
IDHighBits = ID(0xAF<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
IDUnreadU8 = ID(0xB0<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
IDIsMarked = ID(0xB1<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
)
// The IDXFoo IDs are not returned by the tokenizer. They are used by the
@@ -695,6 +697,7 @@ var builtInsByKey = [nBuiltInKeys]struct {
KeyLowBits: {"low_bits", IDLowBits},
KeyHighBits: {"high_bits", IDHighBits},
KeyUnreadU8: {"unread_u8", IDUnreadU8},
KeyIsMarked: {"is_marked", IDIsMarked},
}
var builtInsByName = map[string]ID{}