mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-22 08:47:28 +01:00
Remove the !? effect, leaving only ! and !??
This commit is contained in:
1 parent
d4be1fdf72
commit
1ea32b3745
7 files changed
+20
-28
No files matched your search
@@ -298,7 +298,7 @@ func (q *checker) bcheckStatement(n *a.Node) error {
|
||||
case a.KRet:
|
||||
n := n.AsRet()
|
||||
lTyp := q.astFunc.Out()
|
||||
if q.astFunc.Effect().Optional() {
|
||||
if q.astFunc.Effect().Coroutine() {
|
||||
lTyp = typeExprStatus
|
||||
} else if lTyp == nil {
|
||||
return fmt.Errorf("TODO: allow returning nothing")
|
||||
|
||||
+1
-1
@@ -433,7 +433,7 @@ func (c *Checker) checkFuncSignature(node *a.Node) error {
|
||||
}
|
||||
setPlaceholderMBoundsMType(n.In().AsNode())
|
||||
if out := n.Out(); out != nil {
|
||||
if n.Effect().Optional() && n.Receiver()[0] != t.IDBase {
|
||||
if n.Effect().Coroutine() && n.Receiver()[0] != t.IDBase {
|
||||
return &Error{
|
||||
Err: fmt.Errorf("func %s has ? effect but non-empty return type", n.QQID().Str(c.tm)),
|
||||
Filename: n.Filename(),
|
||||
|
||||
+2
-2
@@ -170,7 +170,7 @@ func (q *checker) tcheckStatement(n *a.Node) error {
|
||||
case a.KRet:
|
||||
n := n.AsRet()
|
||||
lTyp := q.astFunc.Out()
|
||||
if q.astFunc.Effect().Optional() {
|
||||
if q.astFunc.Effect().Coroutine() {
|
||||
lTyp = typeExprStatus
|
||||
} else if lTyp == nil {
|
||||
return fmt.Errorf("TODO: allow returning nothing")
|
||||
@@ -545,7 +545,7 @@ func (q *checker) tcheckExprCall(n *a.Expr, depth uint32) error {
|
||||
|
||||
oTyp := f.Out()
|
||||
if oTyp == nil {
|
||||
if n.Effect().Optional() {
|
||||
if n.Effect().Coroutine() {
|
||||
n.SetMType(typeExprStatus)
|
||||
} else {
|
||||
n.SetMType(typeExprEmptyStruct)
|
||||
|
||||
Reference in new issue
Block a user