Add built-in slice functions

This commit is contained in:
Nigel Tao committed 2017-12-16 17:23:49 +11:00
1 parent 333b11dc65
commit 339673ae82
8 files changed
+120 -45

No files matched your search

+4
View File
@@ -617,6 +617,10 @@ func (n *TypeExpr) IsRefined() bool {
return n.id0.Key() != t.KeyOpenBracket && (n.lhs != nil || n.mhs != nil)
}
func (n *TypeExpr) IsSliceType() bool {
return n.id0.Key() == t.KeyColon
}
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?