Remove unnecessary check for "var b bool = x".

This commit is contained in:
Nigel Tao committed 2017-06-10 10:52:37 +10:00
1 parent 8cd43d2c3c
commit aed3aa9925
2 files changed
+3 -7

No files matched your search

+1 -1
View File
@@ -931,7 +931,7 @@ func (g *gen) writeExpr(n *a.Expr, rp replacementPolicy, pp parenthesesPolicy, d
}
if cv := n.ConstValue(); cv != nil {
if nTyp := n.MType(); nTyp.PackageOrDecorator() != 0 || nTyp.Name().Key() != t.KeyBool {
if !n.MType().IsBool() {
g.writes(cv.String())
} else if cv.Cmp(zero) == 0 {
g.writes("false")