@@ -606,23 +606,27 @@ extension Parser: BinaryInstructionDecoder {
606606 return 0
607607 }
608608
609- @inlinable package func visitUnknown ( _ opcode: [ UInt8 ] ) throws {
609+ @inlinable func throwUnknown ( _ opcode: [ UInt8 ] ) throws -> Never {
610610 throw makeError ( . illegalOpcode( opcode) )
611611 }
612612
613- @inlinable package mutating func visitBlock( ) throws -> BlockType { try parseResultType ( ) }
614- @inlinable package mutating func visitLoop( ) throws -> BlockType { try parseResultType ( ) }
615- @inlinable package mutating func visitIf( ) throws -> BlockType { try parseResultType ( ) }
616- @inlinable package mutating func visitBr( ) throws -> UInt32 { try parseUnsigned ( ) }
617- @inlinable package mutating func visitBrIf( ) throws -> UInt32 { try parseUnsigned ( ) }
618- @inlinable package mutating func visitBrTable( ) throws -> BrTable {
613+ @inlinable func visitUnknown( _ opcode: [ UInt8 ] ) throws -> Bool {
614+ try throwUnknown ( opcode)
615+ }
616+
617+ @inlinable mutating func visitBlock( ) throws -> BlockType { try parseResultType ( ) }
618+ @inlinable mutating func visitLoop( ) throws -> BlockType { try parseResultType ( ) }
619+ @inlinable mutating func visitIf( ) throws -> BlockType { try parseResultType ( ) }
620+ @inlinable mutating func visitBr( ) throws -> UInt32 { try parseUnsigned ( ) }
621+ @inlinable mutating func visitBrIf( ) throws -> UInt32 { try parseUnsigned ( ) }
622+ @inlinable mutating func visitBrTable( ) throws -> BrTable {
619623 let labelIndices : [ UInt32 ] = try parseVector { try parseUnsigned ( ) }
620624 let labelIndex : UInt32 = try parseUnsigned ( )
621625 return BrTable ( labelIndices: labelIndices, defaultIndex: labelIndex)
622626 }
623- @inlinable package mutating func visitCall( ) throws -> UInt32 { try parseUnsigned ( ) }
627+ @inlinable mutating func visitCall( ) throws -> UInt32 { try parseUnsigned ( ) }
624628
625- @inlinable package mutating func visitCallIndirect( ) throws -> ( typeIndex: UInt32 , tableIndex: UInt32 ) {
629+ @inlinable mutating func visitCallIndirect( ) throws -> ( typeIndex: UInt32 , tableIndex: UInt32 ) {
626630 let typeIndex : TypeIndex = try parseUnsigned ( )
627631 if try ! features. contains ( . referenceTypes) && stream. peek ( ) != 0 {
628632 // Check that reserved byte is zero when reference-types is disabled
@@ -632,118 +636,119 @@ extension Parser: BinaryInstructionDecoder {
632636 return ( typeIndex, tableIndex)
633637 }
634638
635- @inlinable package mutating func visitReturnCall( ) throws -> UInt32 {
639+ @inlinable mutating func visitReturnCall( ) throws -> UInt32 {
636640 try parseUnsigned ( )
637641 }
638642
639- @inlinable package mutating func visitReturnCallIndirect( ) throws -> ( typeIndex: UInt32 , tableIndex: UInt32 ) {
643+ @inlinable mutating func visitReturnCallIndirect( ) throws -> ( typeIndex: UInt32 , tableIndex: UInt32 ) {
640644 let typeIndex : TypeIndex = try parseUnsigned ( )
641645 let tableIndex : TableIndex = try parseUnsigned ( )
642646 return ( typeIndex, tableIndex)
643647 }
644648
645- @inlinable package mutating func visitTypedSelect( ) throws -> WasmTypes . ValueType {
649+ @inlinable mutating func visitTypedSelect( ) throws -> WasmTypes . ValueType {
646650 let results = try parseVector { try parseValueType ( ) }
647651 guard results. count == 1 else {
648652 throw makeError ( . invalidResultArity( expected: 1 , actual: results. count) )
649653 }
650654 return results [ 0 ]
651655 }
652656
653- @inlinable package mutating func visitLocalGet( ) throws -> UInt32 { try parseUnsigned ( ) }
654- @inlinable package mutating func visitLocalSet( ) throws -> UInt32 { try parseUnsigned ( ) }
655- @inlinable package mutating func visitLocalTee( ) throws -> UInt32 { try parseUnsigned ( ) }
656- @inlinable package mutating func visitGlobalGet( ) throws -> UInt32 { try parseUnsigned ( ) }
657- @inlinable package mutating func visitGlobalSet( ) throws -> UInt32 { try parseUnsigned ( ) }
658- @inlinable package mutating func visitLoad( _: Instruction . Load ) throws -> MemArg { try parseMemarg ( ) }
659- @inlinable package mutating func visitStore( _: Instruction . Store ) throws -> MemArg { try parseMemarg ( ) }
660- @inlinable package mutating func visitMemorySize( ) throws -> UInt32 {
657+ @inlinable mutating func visitLocalGet( ) throws -> UInt32 { try parseUnsigned ( ) }
658+ @inlinable mutating func visitLocalSet( ) throws -> UInt32 { try parseUnsigned ( ) }
659+ @inlinable mutating func visitLocalTee( ) throws -> UInt32 { try parseUnsigned ( ) }
660+ @inlinable mutating func visitGlobalGet( ) throws -> UInt32 { try parseUnsigned ( ) }
661+ @inlinable mutating func visitGlobalSet( ) throws -> UInt32 { try parseUnsigned ( ) }
662+ @inlinable mutating func visitLoad( _: Instruction . Load ) throws -> MemArg { try parseMemarg ( ) }
663+ @inlinable mutating func visitStore( _: Instruction . Store ) throws -> MemArg { try parseMemarg ( ) }
664+ @inlinable mutating func visitMemorySize( ) throws -> UInt32 {
661665 try parseMemoryIndex ( )
662666 }
663- @inlinable package mutating func visitMemoryGrow( ) throws -> UInt32 {
667+ @inlinable mutating func visitMemoryGrow( ) throws -> UInt32 {
664668 try parseMemoryIndex ( )
665669 }
666- @inlinable package mutating func visitI32Const( ) throws -> Int32 {
670+ @inlinable mutating func visitI32Const( ) throws -> Int32 {
667671 let n : UInt32 = try parseInteger ( )
668672 return Int32 ( bitPattern: n)
669673 }
670- @inlinable package mutating func visitI64Const( ) throws -> Int64 {
674+ @inlinable mutating func visitI64Const( ) throws -> Int64 {
671675 let n : UInt64 = try parseInteger ( )
672676 return Int64 ( bitPattern: n)
673677 }
674- @inlinable package mutating func visitF32Const( ) throws -> IEEE754 . Float32 {
678+ @inlinable mutating func visitF32Const( ) throws -> IEEE754 . Float32 {
675679 let n = try parseFloat ( )
676680 return IEEE754 . Float32 ( bitPattern: n)
677681 }
678- @inlinable package mutating func visitF64Const( ) throws -> IEEE754 . Float64 {
682+ @inlinable mutating func visitF64Const( ) throws -> IEEE754 . Float64 {
679683 let n = try parseDouble ( )
680684 return IEEE754 . Float64 ( bitPattern: n)
681685 }
682- @inlinable package mutating func visitRefNull( ) throws -> WasmTypes . ReferenceType {
686+ @inlinable mutating func visitRefNull( ) throws -> WasmTypes . ReferenceType {
683687 let type = try parseValueType ( )
684688 guard case let . ref( refType) = type else {
685689 throw makeError ( . expectedRefType( actual: type) )
686690 }
687691 return refType
688692 }
689693
690- @inlinable package mutating func visitRefFunc( ) throws -> UInt32 { try parseUnsigned ( ) }
691- @inlinable package mutating func visitMemoryInit( ) throws -> UInt32 {
694+ @inlinable mutating func visitRefFunc( ) throws -> UInt32 { try parseUnsigned ( ) }
695+ @inlinable mutating func visitMemoryInit( ) throws -> UInt32 {
692696 let dataIndex : DataIndex = try parseUnsigned ( )
693697 _ = try parseMemoryIndex ( )
694698 return dataIndex
695699 }
696700
697- @inlinable package mutating func visitDataDrop( ) throws -> UInt32 {
701+ @inlinable mutating func visitDataDrop( ) throws -> UInt32 {
698702 try parseUnsigned ( )
699703 }
700704
701- @inlinable package mutating func visitMemoryCopy( ) throws -> ( dstMem: UInt32 , srcMem: UInt32 ) {
705+ @inlinable mutating func visitMemoryCopy( ) throws -> ( dstMem: UInt32 , srcMem: UInt32 ) {
702706 _ = try parseMemoryIndex ( )
703707 _ = try parseMemoryIndex ( )
704708 return ( 0 , 0 )
705709 }
706710
707- @inlinable package mutating func visitMemoryFill( ) throws -> UInt32 {
711+ @inlinable mutating func visitMemoryFill( ) throws -> UInt32 {
708712 let zero = try stream. consumeAny ( )
709713 guard zero == 0x00 else {
710714 throw makeError ( . zeroExpected( actual: zero) )
711715 }
712716 return 0
713717 }
714718
715- @inlinable package mutating func visitTableInit( ) throws -> ( elemIndex: UInt32 , table: UInt32 ) {
719+ @inlinable mutating func visitTableInit( ) throws -> ( elemIndex: UInt32 , table: UInt32 ) {
716720 let elementIndex : ElementIndex = try parseUnsigned ( )
717721 let tableIndex : TableIndex = try parseUnsigned ( )
718722 return ( elementIndex, tableIndex)
719723 }
720- @inlinable package mutating func visitElemDrop( ) throws -> UInt32 {
724+ @inlinable mutating func visitElemDrop( ) throws -> UInt32 {
721725 try parseUnsigned ( )
722726 }
723- @inlinable package mutating func visitTableCopy( ) throws -> ( dstTable: UInt32 , srcTable: UInt32 ) {
727+ @inlinable mutating func visitTableCopy( ) throws -> ( dstTable: UInt32 , srcTable: UInt32 ) {
724728 let destination : TableIndex = try parseUnsigned ( )
725729 let source : TableIndex = try parseUnsigned ( )
726730 return ( destination, source)
727731 }
728- @inlinable package mutating func visitTableFill( ) throws -> UInt32 {
732+ @inlinable mutating func visitTableFill( ) throws -> UInt32 {
729733 try parseUnsigned ( )
730734 }
731- @inlinable package mutating func visitTableGet( ) throws -> UInt32 {
735+ @inlinable mutating func visitTableGet( ) throws -> UInt32 {
732736 try parseUnsigned ( )
733737 }
734- @inlinable package mutating func visitTableSet( ) throws -> UInt32 {
738+ @inlinable mutating func visitTableSet( ) throws -> UInt32 {
735739 try parseUnsigned ( )
736740 }
737- @inlinable package mutating func visitTableGrow( ) throws -> UInt32 {
741+ @inlinable mutating func visitTableGrow( ) throws -> UInt32 {
738742 try parseUnsigned ( )
739743 }
740- @inlinable package mutating func visitTableSize( ) throws -> UInt32 {
744+ @inlinable mutating func visitTableSize( ) throws -> UInt32 {
741745 try parseUnsigned ( )
742746 }
743747 @inlinable package func claimNextByte( ) throws -> UInt8 {
744748 return try stream. consumeAny ( )
745749 }
746750
751+ /// Returns: `true` if the parsed instruction is the block end instruction.
747752 @inline ( __always)
748753 @inlinable
749754 mutating func parseInstruction< V: InstructionVisitor > ( visitor v: inout V ) throws -> Bool {
0 commit comments