summaryrefslogtreecommitdiff
path: root/codegen/lower.zig
diff options
context:
space:
mode:
authorGravatar Tim Culverhouse2024-06-10 13:48:15 -0500
committerGravatar Tim Culverhouse2024-06-10 13:52:53 -0500
commit71f3570ab9259254b70a8a91b389ed698a33a264 (patch)
tree44dd6944e087740d402edc9ae28daa5301e7d45f /codegen/lower.zig
parentbuild: use b.path everywhere (diff)
downloadzg-71f3570ab9259254b70a8a91b389ed698a33a264.tar.gz
zg-71f3570ab9259254b70a8a91b389ed698a33a264.tar.xz
zg-71f3570ab9259254b70a8a91b389ed698a33a264.zip
codepoint: prevent panic when last cp too short
If the last codepoint in a byte slice is incomplete (IE has a length of 3 but there are only 2 bytes remaining), the iterator will panic. Instead of panicking, prefer to return a replacement character. This strategy is similar to that in the block just above which returns a replacement character if the first byte is not valid. In this latter block, we also consume only one byte and allow the iterator to continue. This allows for sections of text which may have a single byte incorrect near the end of the slice.
Diffstat (limited to 'codegen/lower.zig')
0 files changed, 0 insertions, 0 deletions