Add a nullptr literal

This commit is contained in:
Nigel Tao committed 2018-07-15 16:41:23 +10:00
1 parent fdf152f8b3
commit 15f2f42b77
8 files changed
+88 -44

No files matched your search

+3 -1
View File
@@ -45,8 +45,10 @@ func (g *gen) writeExpr(b *buffer, n *a.Expr, rp replacementPolicy, depth uint32
}
if cv := n.ConstValue(); cv != nil {
if !n.MType().IsBool() {
if typ := n.MType(); typ.IsNumTypeOrIdeal() {
b.writes(cv.String())
} else if typ.IsNullptr() {
b.writes("NULL")
} else if cv.Cmp(zero) == 0 {
b.writes("false")
} else if cv.Cmp(one) == 0 {