Add ~sat+ and ~sat-

This commit is contained in:
Nigel Tao committed 2018-04-26 11:13:19 +10:00
1 parent 6fb1abc739
commit 6d167b7424
7 files changed
+162 -49

No files matched your search

+7 -2
View File
@@ -81,8 +81,13 @@ func (g *gen) writeStatement(b *buffer, n *a.Node, depth uint32) error {
if err := g.writeExpr(b, n.LHS(), replaceCallSuspendibles, parenthesesMandatory, depth); err != nil {
return err
}
// TODO: does KeyAmpHatEq need special consideration?
b.writes(cOpNames[0xFF&n.Operator()])
// TODO: `~sat+=`, `~sat-=` and `&^=` need special consideration.
op := n.Operator()
opName := cOpNames[0xFF&op]
if opName == "" {
return fmt.Errorf("unrecognized operator %q", op.AmbiguousForm().Str(g.tm))
}
b.writes(opName)
if err := g.writeExpr(b, n.RHS(), replaceCallSuspendibles, parenthesesMandatory, depth); err != nil {
return err
}