mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 00:47:28 +01:00
Change error "?foo" to status "?foo"
This commit is contained in:
1 parent
203b45e869
commit
eec0fce647
18 files changed
+196
-231
No files matched your search
+3
-6
@@ -277,11 +277,8 @@ func (n *Raw) SetPackage(tm *t.Map, pkg t.ID) error {
|
||||
// No-op.
|
||||
|
||||
case KExpr:
|
||||
switch o.id0 {
|
||||
default:
|
||||
if o.id0 != t.IDStatus {
|
||||
return nil
|
||||
case t.IDError, t.IDStatus, t.IDSuspension:
|
||||
// No-op.
|
||||
}
|
||||
|
||||
case KTypeExpr:
|
||||
@@ -337,8 +334,8 @@ const MaxExprDepth = 255
|
||||
//
|
||||
// For lists, like "$(0, 1, 2)", ID0 is IDDollar.
|
||||
//
|
||||
// For statuses, like `error "foo"` and `suspension bar."baz"`, ID0 is the
|
||||
// keyword, ID1 is the package and ID2 is the message.
|
||||
// For statuses like "?foo" and bar."$baz", ID0 is IDStatus, ID1 is the package
|
||||
// and ID2 is the message.
|
||||
type Expr Node
|
||||
|
||||
func (n *Expr) AsNode() *Node { return (*Node)(n) }
|
||||
|
||||
+2
-9
@@ -78,15 +78,8 @@ func (n *Expr) appendStr(buf []byte, tm *t.Map, parenthesize bool, depth uint32)
|
||||
|
||||
} else {
|
||||
switch n.id0 {
|
||||
case t.IDError, t.IDStatus, t.IDSuspension:
|
||||
switch n.id0 {
|
||||
case t.IDError:
|
||||
buf = append(buf, "error "...)
|
||||
case t.IDStatus:
|
||||
buf = append(buf, "status "...)
|
||||
case t.IDSuspension:
|
||||
buf = append(buf, "suspension "...)
|
||||
}
|
||||
case t.IDStatus:
|
||||
buf = append(buf, "status "...)
|
||||
if n.id1 != 0 {
|
||||
buf = append(buf, tm.ByID(n.id1)...)
|
||||
buf = append(buf, '.')
|
||||
|
||||
Reference in new issue
Block a user