Make mark a method, not a keyword.

This commit is contained in:
Nigel Tao committed 2017-10-26 12:31:27 +11:00
1 parent 36f5ae9bf4
commit 474a0d2ed7
11 files changed
+89 -17

No files matched your search

+1
View File
@@ -724,6 +724,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.KeySlice, 0) ||
isInDst(q.tm, n, t.KeyMark, 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_huffman", 2) ||
+3 -1
View File
@@ -442,6 +442,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.KeySlice, 0) ||
isInDst(q.tm, n, t.KeyMark, 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_huffman", 2) ||
@@ -711,7 +712,8 @@ func isInDst(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool {
methodName != t.KeyCopyFromHistory32 &&
methodName != t.KeyCopyFromSlice32 &&
methodName != t.KeyCopyFromSlice &&
methodName != t.KeySlice
methodName != t.KeySlice &&
methodName != t.KeyMark
// TODO: check that n.Args() is "(x:bar)".
if n.ID0().Key() != t.KeyOpenParen || n.CallSuspendible() != callSuspendible || len(n.Args()) != nArgs {
return false