mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 00:47:28 +01:00
Type and bounds check "x | y | z".
This commit is contained in:
1 parent
eee67e083d
commit
e1be6d9582
6 files changed
+75
-33
No files matched your search
@@ -1118,7 +1118,7 @@ func (g *gen) writeExpr(n *a.Expr, rp replacementPolicy, pp parenthesesPolicy, d
|
||||
return err
|
||||
}
|
||||
case t.FlagsAssociativeOp:
|
||||
if err := g.writeExprAssociativeOp(n, rp, depth); err != nil {
|
||||
if err := g.writeExprAssociativeOp(n, rp, pp, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -704,7 +704,10 @@ func (g *gen) writeExprAs(lhs *a.Expr, rhs *a.TypeExpr, rp replacementPolicy, de
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *gen) writeExprAssociativeOp(n *a.Expr, rp replacementPolicy, depth uint32) error {
|
||||
func (g *gen) writeExprAssociativeOp(n *a.Expr, rp replacementPolicy, pp parenthesesPolicy, depth uint32) error {
|
||||
if pp == parenthesesMandatory {
|
||||
g.writeb('(')
|
||||
}
|
||||
opName := cOpNames[0xFF&n.ID0().Key()]
|
||||
for i, o := range n.Args() {
|
||||
if i != 0 {
|
||||
@@ -714,6 +717,9 @@ func (g *gen) writeExprAssociativeOp(n *a.Expr, rp replacementPolicy, depth uint
|
||||
return err
|
||||
}
|
||||
}
|
||||
if pp == parenthesesMandatory {
|
||||
g.writeb(')')
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user