mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +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()
|
||||
|
||||
@@ -188,7 +188,7 @@ pub func decoder.decode_io_writer?(dst base.io_writer, src base.io_reader, workb
|
||||
this.history_index = (this.history_index & 0x7FFF) + ((n_copied & 0x7FFF) as base.u32) + already_full
|
||||
}
|
||||
}
|
||||
yield status
|
||||
yield? status
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,9 +275,9 @@ pri func decoder.decode_uncompressed?(dst base.io_writer, src base.io_reader) {
|
||||
}
|
||||
length -= n_copied
|
||||
if args.dst.available() == 0 {
|
||||
yield base."$short write"
|
||||
yield? base."$short write"
|
||||
} else {
|
||||
yield base."$short read"
|
||||
yield? base."$short read"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) {
|
||||
break
|
||||
}
|
||||
}
|
||||
yield base."$short write"
|
||||
yield? base."$short write"
|
||||
}
|
||||
// Copy from the start of this.history, if we wrapped around.
|
||||
if hlen > 0 {
|
||||
@@ -261,7 +261,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) {
|
||||
}
|
||||
hlen -= n_copied
|
||||
hdist ~mod+= n_copied
|
||||
yield base."$short write"
|
||||
yield? base."$short write"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) {
|
||||
break
|
||||
}
|
||||
length -= n_copied
|
||||
yield base."$short write"
|
||||
yield? base."$short write"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -690,7 +690,7 @@ pri func decoder.decode_id_part2?(dst ptr base.pixel_buffer, src base.io_reader,
|
||||
break
|
||||
}
|
||||
while args.src.available() == 0 {
|
||||
yield base."$short read"
|
||||
yield? base."$short read"
|
||||
}
|
||||
|
||||
if this.compressed_ri == this.compressed_wi {
|
||||
|
||||
@@ -120,7 +120,7 @@ pub func decoder.decode_io_writer?(dst base.io_writer, src base.io_reader, workb
|
||||
if status.is_ok() {
|
||||
break
|
||||
}
|
||||
yield status
|
||||
yield? status
|
||||
}
|
||||
checksum_want = args.src.read_u32le?()
|
||||
decoded_length_want = args.src.read_u32le?()
|
||||
|
||||
@@ -114,7 +114,7 @@ pub func decoder.decode_io_writer?(dst base.io_writer, src base.io_reader, workb
|
||||
} else if this.read_from_return_value == 1 {
|
||||
continue
|
||||
} else if this.read_from_return_value == 2 {
|
||||
yield base."$short read"
|
||||
yield? base."$short read"
|
||||
} else if this.read_from_return_value == 3 {
|
||||
return "#bad code"
|
||||
} else {
|
||||
@@ -346,7 +346,7 @@ pri func decoder.write_to?(dst base.io_writer) {
|
||||
return ok
|
||||
}
|
||||
this.output_ri = (this.output_ri ~mod+ ((n & 0xFFFFFFFF) as base.u32)) & 8191
|
||||
yield base."$short write"
|
||||
yield? base."$short write"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ pub func decoder.decode_io_writer?(dst base.io_writer, src base.io_reader, workb
|
||||
if status.is_ok() {
|
||||
break
|
||||
}
|
||||
yield status
|
||||
yield? status
|
||||
}
|
||||
checksum_want = args.src.read_u32be?()
|
||||
if (not this.ignore_checksum) and (checksum_got != checksum_want) {
|
||||
|
||||
Reference in new issue
Block a user