mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 16:47:28 +01:00
Replace wuffs_base__make_status(x).repr with x
This commit is contained in:
1 parent
de1e274ad2
commit
f73fc7721a
2 files changed
+20
-20
No files matched your search
+17
-10
@@ -276,25 +276,32 @@ func (g *gen) writeExprBinaryOp(b *buffer, n *a.Expr, depth uint32) error {
|
||||
}
|
||||
|
||||
b.writeb('(')
|
||||
if err := g.writeExpr(b, n.LHS().AsExpr(), depth); err != nil {
|
||||
if err := g.writeExprRepr(b, n.LHS().AsExpr(), depth); err != nil {
|
||||
return err
|
||||
}
|
||||
if g.hasRepr(n.LHS().AsExpr()) {
|
||||
b.writes(".repr")
|
||||
}
|
||||
b.writes(opName)
|
||||
if err := g.writeExpr(b, n.RHS().AsExpr(), depth); err != nil {
|
||||
if err := g.writeExprRepr(b, n.RHS().AsExpr(), depth); err != nil {
|
||||
return err
|
||||
}
|
||||
if g.hasRepr(n.RHS().AsExpr()) {
|
||||
b.writes(".repr")
|
||||
}
|
||||
b.writeb(')')
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *gen) hasRepr(n *a.Expr) bool {
|
||||
return n.MType().IsStatus()
|
||||
func (g *gen) writeExprRepr(b *buffer, n *a.Expr, depth uint32) error {
|
||||
isStatus := n.MType().IsStatus()
|
||||
if isStatus && (n.Operator() == 0) && n.Ident().IsDQStrLiteral(g.tm) {
|
||||
if z := g.statusMap[n.StatusQID()]; z.cName != "" {
|
||||
b.writes(z.cName)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
if err := g.writeExpr(b, n, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
if isStatus {
|
||||
b.writes(".repr")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *gen) writeExprAs(b *buffer, lhs *a.Expr, rhs *a.TypeExpr, depth uint32) error {
|
||||
|
||||
@@ -13023,10 +13023,7 @@ wuffs_bmp__decoder__decode_frame(wuffs_bmp__decoder* self,
|
||||
}
|
||||
if (wuffs_base__status__is_ok(&v_status)) {
|
||||
goto label__0__break;
|
||||
} else if (v_status.repr !=
|
||||
wuffs_base__make_status(
|
||||
wuffs_bmp__note__internal_note_short_read)
|
||||
.repr) {
|
||||
} else if (v_status.repr != wuffs_bmp__note__internal_note_short_read) {
|
||||
status = v_status;
|
||||
if (wuffs_base__status__is_error(&status)) {
|
||||
goto exit;
|
||||
@@ -21496,13 +21493,9 @@ wuffs_gif__decoder__decode_id_part2(wuffs_gif__decoder* self,
|
||||
}
|
||||
}
|
||||
goto label__outer__break;
|
||||
} else if (v_lzw_status.repr ==
|
||||
wuffs_base__make_status(wuffs_base__suspension__short_read)
|
||||
.repr) {
|
||||
} else if (v_lzw_status.repr == wuffs_base__suspension__short_read) {
|
||||
goto label__outer__continue;
|
||||
} else if (v_lzw_status.repr ==
|
||||
wuffs_base__make_status(wuffs_base__suspension__short_write)
|
||||
.repr) {
|
||||
} else if (v_lzw_status.repr == wuffs_base__suspension__short_write) {
|
||||
goto label__inner__continue;
|
||||
}
|
||||
status = v_lzw_status;
|
||||
|
||||
Reference in new issue
Block a user