mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 08:47:28 +01:00
Rename "yield foo" to "yield? foo"
This commit is contained in:
1 parent
045f180a6c
commit
931fdce475
8 files changed
+21
-13
No files matched your search
+8
-2
@@ -642,8 +642,14 @@ func (p *parser) parseStatement1() (*a.Node, error) {
|
||||
|
||||
case t.IDReturn, t.IDYield:
|
||||
p.src = p.src[1:]
|
||||
if x == t.IDYield && !p.funcEffect.Coroutine() {
|
||||
return nil, fmt.Errorf(`parse: yield within non-coroutine at %s:%d`, p.filename, p.line())
|
||||
if x == t.IDYield {
|
||||
if !p.funcEffect.Coroutine() {
|
||||
return nil, fmt.Errorf(`parse: yield within non-coroutine at %s:%d`, p.filename, p.line())
|
||||
}
|
||||
if p.peek1() != t.IDQuestion {
|
||||
return nil, fmt.Errorf(`parse: yield not followed by '?' at %s:%d`, p.filename, p.line())
|
||||
}
|
||||
p.src = p.src[1:]
|
||||
}
|
||||
value, err := p.parseExpr()
|
||||
if err != nil {
|
||||
|
||||
@@ -164,6 +164,8 @@ func Render(w io.Writer, tm *t.Map, src []t.Token, comments []string) (err error
|
||||
return errors.New("render: too many \"}\" tokens")
|
||||
}
|
||||
indent--
|
||||
} else if (tok.ID == t.IDQuestion) && (prevID == t.IDYield) {
|
||||
buf = append(buf, ' ')
|
||||
}
|
||||
|
||||
prevIsTightRight = tok.ID.IsTightRight()
|
||||
|
||||
Reference in new issue
Block a user