Generate C code for "a or b or c".

This commit is contained in:
Nigel Tao committed 2017-06-16 14:35:43 +10:00
1 parent 540274b57d
commit ce2720fca1
5 files changed
+65 -3

No files matched your search

+9 -1
View File
@@ -1240,7 +1240,15 @@ func (g *gen) writeExprAs(lhs *a.Expr, rhs *a.TypeExpr, rp replacementPolicy, de
}
func (g *gen) writeExprAssociativeOp(n *a.Expr, rp replacementPolicy, depth uint32) error {
// TODO.
opName := cOpNames[0xFF&n.ID0().Key()]
for i, o := range n.Args() {
if i != 0 {
g.writes(opName)
}
if err := g.writeExpr(o.Expr(), rp, parenthesesMandatory, depth); err != nil {
return err
}
}
return nil
}