mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 08:47:28 +01:00
Ensure that you cannot return a suspension
This commit is contained in:
1 parent
ed9025c8dd
commit
6c83516afa
5 files changed
+65
-13
No files matched your search
@@ -776,6 +776,11 @@ func (p *parser) parseStatement1() (*a.Node, error) {
|
||||
return nil, fmt.Errorf(`parse: %s an impure expression at %s:%d`,
|
||||
x.Str(p.tm), p.filename, p.line())
|
||||
}
|
||||
if (x == t.IDReturn) && (value.Operator() == 0) {
|
||||
if s := p.tm.ByID(value.Ident()); (len(s) > 1) && (s[0] == '"') && (s[1] == '$') {
|
||||
return nil, fmt.Errorf(`parse: cannot return a suspension at %s:%d`, p.filename, p.line())
|
||||
}
|
||||
}
|
||||
return a.NewRet(x, value).AsNode(), nil
|
||||
|
||||
case t.IDWhile:
|
||||
|
||||
Reference in new issue
Block a user