mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 00:55:11 +01:00
Allow explicit returns of built-in status codes.
This commit is contained in:
1 parent
2e883fcc23
commit
010c4db54f
7 files changed
+43
-12
No files matched your search
@@ -122,8 +122,16 @@ func (g *gen) writeStatement(b *buffer, n *a.Node, depth uint32) error {
|
||||
retExpr := (*a.Expr)(nil)
|
||||
if n.Keyword() != 0 {
|
||||
ret = g.statusMap[n.Message()]
|
||||
if ret.name == "" {
|
||||
msg := trimQuotes(n.Message().String(g.tm))
|
||||
suffix := builtInStatusSuffixes[msg]
|
||||
if suffix == "" {
|
||||
return fmt.Errorf("no status code for %q", msg)
|
||||
}
|
||||
ret.name = g.PKGPREFIX + suffix
|
||||
}
|
||||
} else if retExpr = n.Value(); retExpr == nil {
|
||||
ret.name = fmt.Sprintf("%sSTATUS_OK", g.PKGPREFIX)
|
||||
ret.name = g.PKGPREFIX + "STATUS_OK"
|
||||
}
|
||||
if g.currFunk.suspendible {
|
||||
b.writes("status = ")
|
||||
|
||||
Reference in new issue
Block a user