Allow scalar constants in type expressions

This commit is contained in:
Nigel Tao committed 2019-02-02 07:53:59 +11:00
1 parent 278200f560
commit 8bbdcc4ce1
7 files changed
+58 -18

No files matched your search

+3
View File
@@ -75,6 +75,9 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, depth uint32) error {
return fmt.Errorf("unrecognized status %s", n.StatusQID().Str(g.tm))
}
} else if c, ok := g.scalarConstsMap[t.QID{0, n.Ident()}]; ok {
b.writes(c.Value().ConstValue().String())
} else {
if n.GlobalIdent() {
b.writes(g.pkgPrefix)