Check struct declarations.

This commit is contained in:
Nigel Tao committed 2017-05-13 15:36:37 +10:00
1 parent e87ff7163b
commit f7095028f0
3 files changed
+73 -17

No files matched your search

+11
View File
@@ -46,6 +46,9 @@ const (
// ID combines a Key and Flags.
type ID uint32
// String returns a string form of x.
func (x ID) String(m *IDMap) string { return m.ByID(x) }
func (x ID) AmbiguousForm() ID { return ambiguousForms[0xFF&(x>>KeyShift)] }
func (x ID) UnaryForm() ID { return unaryForms[0xFF&(x>>KeyShift)] }
func (x ID) BinaryForm() ID { return binaryForms[0xFF&(x>>KeyShift)] }
@@ -75,6 +78,14 @@ func (x ID) IsNumType() bool { return Flags(x)&FlagsNumType != 0 }
// "bar"'s. QID[0] may be 0 for a plain "bar".
type QID [2]ID
// String returns a string form of x.
func (x QID) String(m *IDMap) string {
if x[0] == 0 {
return m.ByID(x[1])
}
return m.ByID(x[0]) + "." + m.ByID(x[1])
}
// Token combines an ID and the line number it was seen.
type Token struct {
ID ID