mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 16:52:18 +01:00
Remove the return error "foo" special case.
This commit is contained in:
1 parent
7cefcccc98
commit
4b572702f9
4 files changed
+25
-78
No files matched your search
+1
-18
@@ -158,24 +158,7 @@ func (q *checker) tcheckStatement(n *a.Node) error {
|
||||
|
||||
case a.KReturn:
|
||||
n := n.Return()
|
||||
if nk := n.Keyword(); nk != 0 {
|
||||
// TODO: delete.
|
||||
sk := t.ID(0)
|
||||
if s, ok := q.c.statuses[n.Message()]; ok {
|
||||
sk = s.Status.Keyword()
|
||||
} else {
|
||||
msg := builtin.TrimQuotes(n.Message().String(q.tm))
|
||||
z, ok := builtin.StatusMap[msg]
|
||||
if !ok {
|
||||
return fmt.Errorf("check: no error or status with message %q", msg)
|
||||
}
|
||||
sk = z.Keyword
|
||||
}
|
||||
if nk != sk {
|
||||
return fmt.Errorf("check: return statement says %q but declaration says %q",
|
||||
nk.String(q.tm), sk.String(q.tm))
|
||||
}
|
||||
} else if value := n.Value(); value != nil {
|
||||
if value := n.Value(); value != nil {
|
||||
if err := q.tcheckExpr(value, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user