File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Sources/WasmParser/Stream Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public final class StaticByteStream: ByteStream {
1616
1717 @discardableResult
1818 public func consumeAny( ) throws -> UInt8 {
19- guard bytes. indices . contains ( currentIndex ) else {
19+ guard currentIndex < self . bytes. endIndex else {
2020 throw StreamError< Element> . unexpectedEnd( expected: nil )
2121 }
2222
@@ -27,7 +27,7 @@ public final class StaticByteStream: ByteStream {
2727
2828 @discardableResult
2929 public func consume( _ expected: Set < UInt8 > ) throws -> UInt8 {
30- guard bytes. indices . contains ( currentIndex ) else {
30+ guard currentIndex < self . bytes. endIndex else {
3131 throw StreamError< Element> . unexpectedEnd( expected: Set ( expected) )
3232 }
3333
@@ -44,7 +44,7 @@ public final class StaticByteStream: ByteStream {
4444 guard count > 0 else { return [ ] }
4545 let updatedIndex = currentIndex + count
4646
47- guard bytes . indices . contains ( updatedIndex - 1 ) else {
47+ guard updatedIndex - 1 < bytes . endIndex else {
4848 throw StreamError< Element> . unexpectedEnd( expected: nil )
4949 }
5050
@@ -54,7 +54,7 @@ public final class StaticByteStream: ByteStream {
5454 }
5555
5656 public func peek( ) -> UInt8 ? {
57- guard bytes. indices . contains ( currentIndex ) else {
57+ guard currentIndex < self . bytes. endIndex else {
5858 return nil
5959 }
6060 return bytes [ currentIndex]
You can’t perform that action at this time.
0 commit comments