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 -1
View File
@@ -40,7 +40,7 @@ const (
KField
KFile
KFunc
KIO
KIO // TODO: delete.
KIf
KIterate
KJump
+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
+3 -3
View File
@@ -242,7 +242,6 @@ const (
KeyConst = Key(IDConst >> KeyShift)
KeyTry = Key(IDTry >> KeyShift)
KeyIterate = Key(IDIterate >> KeyShift)
KeyMark = Key(IDMark >> KeyShift)
KeyFalse = Key(IDFalse >> KeyShift)
KeyTrue = Key(IDTrue >> KeyShift)
@@ -272,6 +271,7 @@ const (
KeyLowBits = Key(IDLowBits >> KeyShift)
KeyHighBits = Key(IDHighBits >> KeyShift)
KeyMark = Key(IDMark >> KeyShift)
KeyReadU8 = Key(IDReadU8 >> KeyShift)
KeyReadU16BE = Key(IDReadU16BE >> KeyShift)
KeyReadU16LE = Key(IDReadU16LE >> KeyShift)
@@ -429,7 +429,6 @@ const (
IDConst = ID(0x77<<KeyShift | FlagsOther)
IDTry = ID(0x78<<KeyShift | FlagsOther)
IDIterate = ID(0x79<<KeyShift | FlagsOther)
IDMark = ID(0x7A<<KeyShift | FlagsOther)
IDFalse = ID(0x80<<KeyShift | FlagsLiteral | FlagsImplicitSemicolon)
IDTrue = ID(0x81<<KeyShift | FlagsLiteral | FlagsImplicitSemicolon)
@@ -459,6 +458,7 @@ const (
IDLowBits = ID(0xA8<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
IDHighBits = ID(0xA9<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
IDMark = ID(0xB0<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
IDReadU8 = ID(0xB1<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
IDReadU16BE = ID(0xB2<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
IDReadU16LE = ID(0xB3<<KeyShift | FlagsIdent | FlagsImplicitSemicolon)
@@ -632,7 +632,6 @@ var builtInsByKey = [nBuiltInKeys]struct {
KeyConst: {"const", IDConst},
KeyTry: {"try", IDTry},
KeyIterate: {"iterate", IDIterate},
KeyMark: {"mark", IDMark},
KeyFalse: {"false", IDFalse},
KeyTrue: {"true", IDTrue},
@@ -664,6 +663,7 @@ var builtInsByKey = [nBuiltInKeys]struct {
KeyLowBits: {"low_bits", IDLowBits},
KeyHighBits: {"high_bits", IDHighBits},
KeyMark: {"mark", IDMark},
KeyReadU8: {"read_u8", IDReadU8},
KeyReadU16BE: {"read_u16be", IDReadU16BE},
KeyReadU16LE: {"read_u16le", IDReadU16LE},