Add a ~+ operator.

This commit is contained in:
Nigel Tao committed 2017-10-19 16:50:05 +11:00
1 parent e7d01e7b2a
commit 6492c52156
8 files changed
+154 -99

No files matched your search

+5
View File
@@ -524,6 +524,11 @@ func (n *TypeExpr) IsRefined() bool {
return t.Key(n.id0>>t.KeyShift) != t.KeyOpenBracket && (n.lhs != nil || n.mhs != nil)
}
func (n *TypeExpr) IsUnsignedInteger() bool {
return n.id0 == 0 && (n.id1.Key() == t.KeyU8 || n.id1.Key() == t.KeyU16 ||
n.id1.Key() == t.KeyU32 || n.id1.Key() == t.KeyU64) // TODO: t.KeyUsize?
}
func (n *TypeExpr) HasPointers() bool {
for ; n != nil; n = n.Inner() {
switch n.id0.Key() {
+1
View File
@@ -158,6 +158,7 @@ var opStrings = [256]string{
t.KeyXBinaryAnd: " and ",
t.KeyXBinaryOr: " or ",
t.KeyXBinaryAs: " as ",
t.KeyXBinaryTildePlus: " ~+ ",
t.KeyXAssociativePlus: " + ",
t.KeyXAssociativeStar: " * ",