diff --git a/src/internal/structure/types.gleam b/src/internal/structure/types.gleam index 2c53fd2..9031048 100644 --- a/src/internal/structure/types.gleam +++ b/src/internal/structure/types.gleam @@ -900,7 +900,6 @@ pub type Instruction { Call(func_idx: FuncIDX) CallRef(type_idx: TypeIDX) CallIndirect(table_idx: TableIDX, type_idx: TypeIDX) - // expand(TypeSection[type_idx].subtype[sub_type_index]) -> CompositeType ReturnCall(func_idx: FuncIDX) ReturnCallRef(type_idx: TypeIDX) ReturnCallIndirect(table_idx: TableIDX, type_idx: TypeIDX) diff --git a/src/internal/visitor.gleam b/src/internal/visitor.gleam index 2abf719..33c011f 100644 --- a/src/internal/visitor.gleam +++ b/src/internal/visitor.gleam @@ -1,27 +1,46 @@ +import gleam/list import gleam/option.{type Option, None, Some} import gleam/result.{map, try} import internal/finger_tree.{type FingerTree} import internal/structure/modules.{ - type BinaryModule, type CustomSection, type ExportSection, + type BinaryModule, type CodeSection, type CustomSection, type DataCountSection, + type DataSection, type ElementSection, type ExportSection, type FunctionSection, type GlobalSection, type ImportSection, - type MemorySection, type TableSection, type TypeSection, BinaryModule, - ExportSection, FunctionSection, GlobalSection, ImportSection, MemorySection, + type MemorySection, type StartSection, type TableSection, type TypeSection, + BinaryModule, CodeSection, DataSection, ElementSection, ExportSection, + FunctionSection, GlobalSection, ImportSection, MemorySection, StartSection, TableSection, TypeSection, } import internal/structure/types.{ - type ArrayType, type CompositeType, type DefType, type Export, type Expr, - type FieldType, type FuncType, type Global, type GlobalType, type HeapType, - type Import, type Instruction, type Limits, type MemType, type RecType, - type RefType, type StorageType, type StructType, type SubType, type Table, - type TableType, type TypeIDX, type ValType, AnyRefType, ArrayCompositeType, - ArrayRefType, ArrayType, DefType, DefTypeReference, EqRefType, Expr, + type ArrayType, type BlockType, type Code, type CompositeType, type Data, + type DataIDX, type DefType, type Elem, type ElemIDX, type ElemMode, + type Export, type Expr, type FieldIDX, type FieldType, type FuncIDX, + type FuncType, type Global, type GlobalIDX, type GlobalType, type HeapType, + type Import, type Instruction, type LabelIDX, type Limits, type LocalIDX, + type Locals, type MemIDX, type MemType, type RecType, type RefType, + type StorageType, type StructType, type SubType, type Table, type TableIDX, + type TableType, type TypeIDX, type ValType, ActiveData, ActiveElemMode, + AnyHeapType, AnyRefType, ArrayCompositeType, ArrayCopy, ArrayFill, ArrayGet, + ArrayGetS, ArrayGetU, ArrayHeapType, ArrayInitData, ArrayInitElem, ArrayNew, + ArrayNewData, ArrayNewDefault, ArrayNewElem, ArrayNewFixed, ArrayRefType, + ArraySet, ArrayType, Block, Br, BrIf, BrOnCast, BrOnCastFail, BrOnNonNull, + BrOnNull, BrTable, Call, CallIndirect, CallRef, Code, ConcreteHeapType, + DataDrop, DeclarativeElemMode, DefType, DefTypeReference, ElemDrop, + ElemExpressions, ElemFuncs, EqHeapType, EqRefType, Expr, ExternHeapType, ExternRefType, F32ValType, F64ValType, FieldType, FuncCompositeType, - FuncExport, FuncImport, FuncRefType, FuncType, Global, GlobalExport, - GlobalImport, GlobalType, HeapTypeRefType, I16StorageType, I31RefType, - I32ValType, I64ValType, I8StorageType, Limits, MemExport, MemImport, MemType, - NoExternRefType, NoFuncRefType, NoneRefType, RecType, RecTypeIDX, - RefTypeValType, StructCompositeType, StructRefType, StructType, SubType, Table, - TableExport, TableImport, TableType, TypeIDX, V128ValType, ValTypeStorageType, + FuncExport, FuncHeapType, FuncImport, FuncRefType, FuncType, FuncTypeBlockType, + Global, GlobalExport, GlobalGet, GlobalImport, GlobalSet, GlobalType, + HeapTypeRefType, I16StorageType, I31HeapType, I31RefType, I32ValType, + I64ValType, I8StorageType, If, LabelIDX, Limits, LocalGet, LocalSet, LocalTee, + Locals, Loop, MemExport, MemIDX, MemImport, MemType, MemoryInit, + NoExternHeapType, NoExternRefType, NoFuncHeapType, NoFuncRefType, NoneHeapType, + NoneRefType, PassiveData, PassiveElemMode, RecType, RecTypeIDX, RefCast, + RefCastNullable, RefFunc, RefNull, RefTest, RefTestNullable, RefTypeValType, + ReturnCall, ReturnCallIndirect, ReturnCallRef, SelectT, StructCompositeType, + StructGet, StructGetS, StructGetU, StructHeapType, StructRefType, StructSet, + StructType, SubType, Table, TableCopy, TableExport, TableFill, TableGet, + TableGrow, TableImport, TableInit, TableSet, TableSize, TableType, TypeIDX, + V128ValType, ValTypeBlockType, ValTypeStorageType, VoidBlockType, } pub type VisitorCallback(ctx, element) = @@ -41,6 +60,16 @@ pub type BinaryModuleVisitor(ctx) { on_exit_table_section: Option(VisitorCallback(ctx, Option(TableSection))), on_enter_memory_section: Option(VisitorCallback(ctx, Option(MemorySection))), on_exit_memory_section: Option(VisitorCallback(ctx, Option(MemorySection))), + on_enter_start_section: Option(VisitorCallback(ctx, Option(StartSection))), + on_exit_start_section: Option(VisitorCallback(ctx, Option(StartSection))), + on_enter_element_segment: Option(VisitorCallback(ctx, Elem)), + on_exit_element_segment: Option(VisitorCallback(ctx, Elem)), + on_enter_element_section: Option( + VisitorCallback(ctx, Option(ElementSection)), + ), + on_exit_element_section: Option( + VisitorCallback(ctx, Option(ElementSection)), + ), on_enter_import: Option(VisitorCallback(ctx, Import)), on_exit_import: Option(VisitorCallback(ctx, Import)), on_enter_func_import: Option(VisitorCallback(ctx, Import)), @@ -143,6 +172,20 @@ pub type BinaryModuleVisitor(ctx) { on_exit_function_section: Option( VisitorCallback(ctx, Option(FunctionSection)), ), + on_enter_code_section: Option(VisitorCallback(ctx, Option(CodeSection))), + on_exit_code_section: Option(VisitorCallback(ctx, Option(CodeSection))), + on_enter_func_idx: Option(VisitorCallback(ctx, FuncIDX)), + on_exit_func_idx: Option(VisitorCallback(ctx, FuncIDX)), + on_enter_table_idx: Option(VisitorCallback(ctx, TableIDX)), + on_exit_table_idx: Option(VisitorCallback(ctx, TableIDX)), + on_enter_mem_idx: Option(VisitorCallback(ctx, MemIDX)), + on_exit_mem_idx: Option(VisitorCallback(ctx, MemIDX)), + on_enter_global_idx: Option(VisitorCallback(ctx, GlobalIDX)), + on_exit_global_idx: Option(VisitorCallback(ctx, GlobalIDX)), + on_enter_elem_expressions: Option(VisitorCallback(ctx, Elem)), + on_exit_elem_expressions: Option(VisitorCallback(ctx, Elem)), + on_enter_elem_funcs: Option(VisitorCallback(ctx, Elem)), + on_exit_elem_funcs: Option(VisitorCallback(ctx, Elem)), on_enter_global_section: Option(VisitorCallback(ctx, Option(GlobalSection))), on_exit_global_section: Option(VisitorCallback(ctx, Option(GlobalSection))), on_enter_export_section: Option(VisitorCallback(ctx, Option(ExportSection))), @@ -163,6 +206,184 @@ pub type BinaryModuleVisitor(ctx) { on_exit_expr: Option(VisitorCallback(ctx, Expr)), on_enter_instruction: Option(VisitorCallback(ctx, Instruction)), on_exit_instruction: Option(VisitorCallback(ctx, Instruction)), + on_enter_element_mode: Option(VisitorCallback(ctx, ElemMode)), + on_exit_element_mode: Option(VisitorCallback(ctx, ElemMode)), + on_enter_declarative_elem_mode: Option(VisitorCallback(ctx, ElemMode)), + on_exit_declarative_elem_mode: Option(VisitorCallback(ctx, ElemMode)), + on_enter_passive_elem_mode: Option(VisitorCallback(ctx, ElemMode)), + on_exit_passive_elem_mode: Option(VisitorCallback(ctx, ElemMode)), + on_enter_active_elem_mode: Option(VisitorCallback(ctx, ElemMode)), + on_exit_active_elem_mode: Option(VisitorCallback(ctx, ElemMode)), + on_enter_code: Option(VisitorCallback(ctx, Code)), + on_exit_code: Option(VisitorCallback(ctx, Code)), + on_enter_locals: Option(VisitorCallback(ctx, Locals)), + on_exit_locals: Option(VisitorCallback(ctx, Locals)), + on_enter_data_section: Option(VisitorCallback(ctx, Option(DataSection))), + on_exit_data_section: Option(VisitorCallback(ctx, Option(DataSection))), + on_enter_active_data: Option(VisitorCallback(ctx, Data)), + on_exit_active_data: Option(VisitorCallback(ctx, Data)), + on_enter_passive_data: Option(VisitorCallback(ctx, Data)), + on_exit_passive_data: Option(VisitorCallback(ctx, Data)), + on_enter_data: Option(VisitorCallback(ctx, Data)), + on_exit_data: Option(VisitorCallback(ctx, Data)), + on_enter_data_count_section: Option( + VisitorCallback(ctx, Option(DataCountSection)), + ), + on_exit_data_count_section: Option( + VisitorCallback(ctx, Option(DataCountSection)), + ), + on_enter_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_exit_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_enter_func_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_exit_func_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_enter_no_func_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_exit_no_func_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_enter_extern_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_exit_extern_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_enter_no_extern_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_exit_no_extern_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_enter_any_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_exit_any_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_enter_eq_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_exit_eq_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_enter_i31_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_exit_i31_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_enter_struct_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_exit_struct_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_enter_array_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_exit_array_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_enter_none_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_exit_none_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_enter_concrete_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_exit_concrete_heap_type: Option(VisitorCallback(ctx, HeapType)), + on_enter_ref_null: Option(VisitorCallback(ctx, Instruction)), + on_exit_ref_null: Option(VisitorCallback(ctx, Instruction)), + on_enter_ref_func: Option(VisitorCallback(ctx, Instruction)), + on_exit_ref_func: Option(VisitorCallback(ctx, Instruction)), + on_enter_ref_test: Option(VisitorCallback(ctx, Instruction)), + on_exit_ref_test: Option(VisitorCallback(ctx, Instruction)), + on_enter_ref_test_nullable: Option(VisitorCallback(ctx, Instruction)), + on_exit_ref_test_nullable: Option(VisitorCallback(ctx, Instruction)), + on_enter_ref_cast: Option(VisitorCallback(ctx, Instruction)), + on_exit_ref_cast: Option(VisitorCallback(ctx, Instruction)), + on_enter_ref_cast_nullable: Option(VisitorCallback(ctx, Instruction)), + on_exit_ref_cast_nullable: Option(VisitorCallback(ctx, Instruction)), + on_enter_struct_get: Option(VisitorCallback(ctx, Instruction)), + on_exit_struct_get: Option(VisitorCallback(ctx, Instruction)), + on_enter_struct_get_s: Option(VisitorCallback(ctx, Instruction)), + on_exit_struct_get_s: Option(VisitorCallback(ctx, Instruction)), + on_enter_struct_get_u: Option(VisitorCallback(ctx, Instruction)), + on_exit_struct_get_u: Option(VisitorCallback(ctx, Instruction)), + on_enter_struct_set: Option(VisitorCallback(ctx, Instruction)), + on_exit_struct_set: Option(VisitorCallback(ctx, Instruction)), + on_enter_array_new: Option(VisitorCallback(ctx, Instruction)), + on_exit_array_new: Option(VisitorCallback(ctx, Instruction)), + on_enter_array_new_default: Option(VisitorCallback(ctx, Instruction)), + on_exit_array_new_default: Option(VisitorCallback(ctx, Instruction)), + on_enter_array_new_data: Option(VisitorCallback(ctx, Instruction)), + on_exit_array_new_data: Option(VisitorCallback(ctx, Instruction)), + on_enter_array_new_elem: Option(VisitorCallback(ctx, Instruction)), + on_exit_array_new_elem: Option(VisitorCallback(ctx, Instruction)), + on_enter_array_new_fixed: Option(VisitorCallback(ctx, Instruction)), + on_exit_array_new_fixed: Option(VisitorCallback(ctx, Instruction)), + on_enter_array_get: Option(VisitorCallback(ctx, Instruction)), + on_exit_array_get: Option(VisitorCallback(ctx, Instruction)), + on_enter_array_get_s: Option(VisitorCallback(ctx, Instruction)), + on_exit_array_get_s: Option(VisitorCallback(ctx, Instruction)), + on_enter_array_get_u: Option(VisitorCallback(ctx, Instruction)), + on_exit_array_get_u: Option(VisitorCallback(ctx, Instruction)), + on_enter_array_set: Option(VisitorCallback(ctx, Instruction)), + on_exit_array_set: Option(VisitorCallback(ctx, Instruction)), + on_enter_array_fill: Option(VisitorCallback(ctx, Instruction)), + on_exit_array_fill: Option(VisitorCallback(ctx, Instruction)), + on_enter_array_copy: Option(VisitorCallback(ctx, Instruction)), + on_exit_array_copy: Option(VisitorCallback(ctx, Instruction)), + on_enter_array_init_data: Option(VisitorCallback(ctx, Instruction)), + on_exit_array_init_data: Option(VisitorCallback(ctx, Instruction)), + on_enter_array_init_elem: Option(VisitorCallback(ctx, Instruction)), + on_exit_array_init_elem: Option(VisitorCallback(ctx, Instruction)), + on_enter_select_t: Option(VisitorCallback(ctx, Instruction)), + on_exit_select_t: Option(VisitorCallback(ctx, Instruction)), + on_enter_local_get: Option(VisitorCallback(ctx, Instruction)), + on_exit_local_get: Option(VisitorCallback(ctx, Instruction)), + on_enter_local_set: Option(VisitorCallback(ctx, Instruction)), + on_exit_local_set: Option(VisitorCallback(ctx, Instruction)), + on_enter_local_tee: Option(VisitorCallback(ctx, Instruction)), + on_exit_local_tee: Option(VisitorCallback(ctx, Instruction)), + on_enter_global_get: Option(VisitorCallback(ctx, Instruction)), + on_exit_global_get: Option(VisitorCallback(ctx, Instruction)), + on_enter_global_set: Option(VisitorCallback(ctx, Instruction)), + on_exit_global_set: Option(VisitorCallback(ctx, Instruction)), + on_enter_table_get: Option(VisitorCallback(ctx, Instruction)), + on_exit_table_get: Option(VisitorCallback(ctx, Instruction)), + on_enter_table_set: Option(VisitorCallback(ctx, Instruction)), + on_exit_table_set: Option(VisitorCallback(ctx, Instruction)), + on_enter_table_size: Option(VisitorCallback(ctx, Instruction)), + on_exit_table_size: Option(VisitorCallback(ctx, Instruction)), + on_enter_table_grow: Option(VisitorCallback(ctx, Instruction)), + on_exit_table_grow: Option(VisitorCallback(ctx, Instruction)), + on_enter_table_fill: Option(VisitorCallback(ctx, Instruction)), + on_exit_table_fill: Option(VisitorCallback(ctx, Instruction)), + on_enter_table_copy: Option(VisitorCallback(ctx, Instruction)), + on_exit_table_copy: Option(VisitorCallback(ctx, Instruction)), + on_enter_table_init: Option(VisitorCallback(ctx, Instruction)), + on_exit_table_init: Option(VisitorCallback(ctx, Instruction)), + on_enter_elem_drop: Option(VisitorCallback(ctx, Instruction)), + on_exit_elem_drop: Option(VisitorCallback(ctx, Instruction)), + on_enter_memory_init: Option(VisitorCallback(ctx, Instruction)), + on_exit_memory_init: Option(VisitorCallback(ctx, Instruction)), + on_enter_data_drop: Option(VisitorCallback(ctx, Instruction)), + on_exit_data_drop: Option(VisitorCallback(ctx, Instruction)), + on_enter_block: Option(VisitorCallback(ctx, Instruction)), + on_exit_block: Option(VisitorCallback(ctx, Instruction)), + on_enter_loop: Option(VisitorCallback(ctx, Instruction)), + on_exit_loop: Option(VisitorCallback(ctx, Instruction)), + on_enter_if: Option(VisitorCallback(ctx, Instruction)), + on_exit_if: Option(VisitorCallback(ctx, Instruction)), + on_enter_br: Option(VisitorCallback(ctx, Instruction)), + on_exit_br: Option(VisitorCallback(ctx, Instruction)), + on_enter_br_if: Option(VisitorCallback(ctx, Instruction)), + on_exit_br_if: Option(VisitorCallback(ctx, Instruction)), + on_enter_br_table: Option(VisitorCallback(ctx, Instruction)), + on_exit_br_table: Option(VisitorCallback(ctx, Instruction)), + on_enter_br_on_null: Option(VisitorCallback(ctx, Instruction)), + on_exit_br_on_null: Option(VisitorCallback(ctx, Instruction)), + on_enter_br_on_non_null: Option(VisitorCallback(ctx, Instruction)), + on_exit_br_on_non_null: Option(VisitorCallback(ctx, Instruction)), + on_enter_br_on_cast: Option(VisitorCallback(ctx, Instruction)), + on_exit_br_on_cast: Option(VisitorCallback(ctx, Instruction)), + on_enter_br_on_cast_fail: Option(VisitorCallback(ctx, Instruction)), + on_exit_br_on_cast_fail: Option(VisitorCallback(ctx, Instruction)), + on_enter_call: Option(VisitorCallback(ctx, Instruction)), + on_exit_call: Option(VisitorCallback(ctx, Instruction)), + on_enter_call_ref: Option(VisitorCallback(ctx, Instruction)), + on_exit_call_ref: Option(VisitorCallback(ctx, Instruction)), + on_enter_call_indirect: Option(VisitorCallback(ctx, Instruction)), + on_exit_call_indirect: Option(VisitorCallback(ctx, Instruction)), + on_enter_return_call: Option(VisitorCallback(ctx, Instruction)), + on_exit_return_call: Option(VisitorCallback(ctx, Instruction)), + on_enter_return_call_ref: Option(VisitorCallback(ctx, Instruction)), + on_exit_return_call_ref: Option(VisitorCallback(ctx, Instruction)), + on_enter_return_call_indirect: Option(VisitorCallback(ctx, Instruction)), + on_exit_return_call_indirect: Option(VisitorCallback(ctx, Instruction)), + on_enter_label_idx: Option(VisitorCallback(ctx, LabelIDX)), + on_exit_label_idx: Option(VisitorCallback(ctx, LabelIDX)), + on_enter_block_type: Option(VisitorCallback(ctx, BlockType)), + on_exit_block_type: Option(VisitorCallback(ctx, BlockType)), + on_enter_void_block_type: Option(VisitorCallback(ctx, BlockType)), + on_exit_void_block_type: Option(VisitorCallback(ctx, BlockType)), + on_enter_val_type_block_type: Option(VisitorCallback(ctx, BlockType)), + on_exit_val_type_block_type: Option(VisitorCallback(ctx, BlockType)), + on_enter_func_type_block_type: Option(VisitorCallback(ctx, BlockType)), + on_exit_func_type_block_type: Option(VisitorCallback(ctx, BlockType)), + on_enter_field_idx: Option(VisitorCallback(ctx, FieldIDX)), + on_exit_field_idx: Option(VisitorCallback(ctx, FieldIDX)), + on_enter_data_idx: Option(VisitorCallback(ctx, DataIDX)), + on_exit_data_idx: Option(VisitorCallback(ctx, DataIDX)), + on_enter_elem_idx: Option(VisitorCallback(ctx, ElemIDX)), + on_exit_elem_idx: Option(VisitorCallback(ctx, ElemIDX)), + on_enter_local_idx: Option(VisitorCallback(ctx, LocalIDX)), + on_exit_local_idx: Option(VisitorCallback(ctx, LocalIDX)), ) } @@ -197,7 +418,7 @@ pub fn do_visit_module( module.custom_1, visitor, )) - use #(ctx, imports) <- result.try(do_visit_imports( + use #(ctx, imports) <- result.try(do_visit_import_section( ctx, module.imports, visitor, @@ -207,7 +428,7 @@ pub fn do_visit_module( module.custom_2, visitor, )) - use #(ctx, functions) <- result.try(do_visit_functions( + use #(ctx, functions) <- result.try(do_visit_function_section( ctx, module.functions, visitor, @@ -217,13 +438,17 @@ pub fn do_visit_module( module.custom_3, visitor, )) - use #(ctx, tables) <- result.try(do_visit_tables(ctx, module.tables, visitor)) + use #(ctx, tables) <- result.try(do_visit_table_section( + ctx, + module.tables, + visitor, + )) use #(ctx, custom_4) <- result.try(do_visit_custom_sections( ctx, module.custom_4, visitor, )) - use #(ctx, memories) <- result.try(do_visit_memories( + use #(ctx, memories) <- result.try(do_visit_memory_section( ctx, module.memories, visitor, @@ -233,7 +458,7 @@ pub fn do_visit_module( module.custom_5, visitor, )) - use #(ctx, globals) <- result.try(do_visit_globals( + use #(ctx, globals) <- result.try(do_visit_global_section( ctx, module.globals, visitor, @@ -243,7 +468,7 @@ pub fn do_visit_module( module.custom_6, visitor, )) - use #(ctx, exports) <- result.try(do_visit_exports( + use #(ctx, exports) <- result.try(do_visit_export_section( ctx, module.exports, visitor, @@ -253,13 +478,17 @@ pub fn do_visit_module( module.custom_7, visitor, )) - use #(ctx, start) <- result.try(do_visit_start(ctx, module.start, visitor)) + use #(ctx, start) <- result.try(do_visit_start_section( + ctx, + module.start, + visitor, + )) use #(ctx, custom_8) <- result.try(do_visit_custom_sections( ctx, module.custom_8, visitor, )) - use #(ctx, elements) <- result.try(do_visit_elements( + use #(ctx, elements) <- result.try(do_visit_element_section( ctx, module.elements, visitor, @@ -269,19 +498,27 @@ pub fn do_visit_module( module.custom_9, visitor, )) - use #(ctx, code) <- result.try(do_visit_code(ctx, module.code, visitor)) + use #(ctx, code) <- result.try(do_visit_code_section( + ctx, + module.code, + visitor, + )) use #(ctx, custom_10) <- result.try(do_visit_custom_sections( ctx, module.custom_10, visitor, )) - use #(ctx, data) <- result.try(do_visit_data(ctx, module.data, visitor)) + use #(ctx, data) <- result.try(do_visit_data_section( + ctx, + module.data, + visitor, + )) use #(ctx, custom_11) <- result.try(do_visit_custom_sections( ctx, module.custom_11, visitor, )) - use #(ctx, data_count) <- result.try(do_visit_data_count( + use #(ctx, data_count) <- result.try(do_visit_data_count_section( ctx, module.data_count, visitor, @@ -827,7 +1064,7 @@ pub fn do_visit_custom_section( ) } -pub fn do_visit_imports( +pub fn do_visit_import_section( ctx, import_section: Option(ImportSection), visitor: BinaryModuleVisitor(ctx), @@ -920,7 +1157,7 @@ pub fn do_visit_import(ctx, import_: Import, visitor: BinaryModuleVisitor(ctx)) } } -pub fn do_visit_functions( +pub fn do_visit_function_section( ctx, section: Option(FunctionSection), visitor: BinaryModuleVisitor(ctx), @@ -945,7 +1182,7 @@ pub fn do_visit_functions( } } -pub fn do_visit_tables( +pub fn do_visit_table_section( ctx, table_section: Option(TableSection), visitor: BinaryModuleVisitor(ctx), @@ -971,7 +1208,7 @@ pub fn do_visit_tables( } } -pub fn do_visit_memories( +pub fn do_visit_memory_section( ctx, memories: Option(MemorySection), visitor: BinaryModuleVisitor(ctx), @@ -996,7 +1233,7 @@ pub fn do_visit_memories( } } -pub fn do_visit_globals( +pub fn do_visit_global_section( ctx, globals: Option(GlobalSection), visitor: BinaryModuleVisitor(ctx), @@ -1022,8 +1259,12 @@ pub fn do_visit_globals( } pub fn do_visit_global(ctx, global: Global, visitor: BinaryModuleVisitor(ctx)) { - use #(ctx, Global(global_type, init)) <- - enter(ctx, global, visitor.on_enter_global, visitor.on_exit_global, _) + use #(ctx, Global(global_type, init)) <- enter( + ctx, + global, + visitor.on_enter_global, + visitor.on_exit_global, + ) use #(ctx, global_type) <- try(do_visit_global_type(ctx, global_type, visitor)) use #(ctx, init) <- map(do_visit_expr(ctx, init, visitor)) @@ -1031,7 +1272,7 @@ pub fn do_visit_global(ctx, global: Global, visitor: BinaryModuleVisitor(ctx)) { #(ctx, Global(global_type, init)) } -pub fn do_visit_exports( +pub fn do_visit_export_section( ctx, exports: Option(ExportSection), visitor: BinaryModuleVisitor(ctx), @@ -1121,44 +1362,302 @@ pub fn do_visit_export(ctx, export: Export, visitor: BinaryModuleVisitor(ctx)) { } } -pub fn do_visit_start( +pub fn do_visit_start_section( + ctx, + start_section: Option(StartSection), + visitor: BinaryModuleVisitor(ctx), +) -> Result(#(ctx, Option(StartSection)), String) { + use #(ctx, start_section) <- enter( + ctx, + start_section, + visitor.on_enter_start_section, + visitor.on_exit_start_section, + ) + + case start_section { + Some(StartSection(func_idx)) -> { + use #(ctx, func_idx) <- map(do_visit_func_idx(ctx, func_idx, visitor)) + #(ctx, Some(StartSection(func_idx))) + } + _ -> Ok(#(ctx, start_section)) + } +} + +pub fn do_visit_element_section( + ctx, + elements: Option(ElementSection), + visitor: BinaryModuleVisitor(ctx), +) -> Result(#(ctx, Option(ElementSection)), String) { + use #(ctx, elements) <- enter( + ctx, + elements, + visitor.on_enter_element_section, + visitor.on_exit_element_section, + ) + + case elements { + Some(ElementSection(elements)) -> { + use #(ctx, elements) <- map(do_visit_element_list( + ctx, + elements, + visitor, + do_visit_element_segment, + )) + #(ctx, Some(ElementSection(elements))) + } + _ -> Ok(#(ctx, elements)) + } +} + +pub fn do_visit_element_segment( + ctx, + element_segment: Elem, + visitor: BinaryModuleVisitor(ctx), +) -> Result(#(ctx, Elem), String) { + use #(ctx, element_segment) <- enter( + ctx, + element_segment, + visitor.on_enter_element_segment, + visitor.on_exit_element_segment, + ) + + use #(ctx, element_segment) <- + case element_segment { + ElemFuncs(_, _, _) -> enter( + ctx, + element_segment, + visitor.on_enter_elem_funcs, + visitor.on_exit_elem_funcs, + _, + ) + ElemExpressions(_, _, _) -> enter( + ctx, + element_segment, + visitor.on_enter_elem_expressions, + visitor.on_exit_elem_expressions, + _, + ) + } + + case element_segment { + ElemExpressions(ref_type, exprs, mode) -> { + use #(ctx, ref_type) <- try(do_visit_ref_type(ctx, ref_type, visitor)) + use #(ctx, exprs) <- try(do_visit_element_list( + ctx, + exprs, + visitor, + do_visit_expr, + )) + use #(ctx, mode) <- map(do_visit_element_mode(ctx, mode, visitor)) + + #(ctx, ElemExpressions(ref_type, exprs, mode)) + } + ElemFuncs(ref_type, func_idxs, mode) -> { + use #(ctx, ref_type) <- try(do_visit_ref_type(ctx, ref_type, visitor)) + use #(ctx, func_idxs) <- try(do_visit_element_list( + ctx, + func_idxs, + visitor, + do_visit_func_idx, + )) + use #(ctx, mode) <- map(do_visit_element_mode(ctx, mode, visitor)) + + #(ctx, ElemFuncs(ref_type, func_idxs, mode)) + } + } +} + +pub fn do_visit_element_mode( ctx, - start: section, + mode: ElemMode, visitor: BinaryModuleVisitor(ctx), -) -> Result(#(ctx, section), String) { - todo +) -> Result(#(ctx, ElemMode), String) { + use #(ctx, mode) <- enter( + ctx, + mode, + visitor.on_enter_element_mode, + visitor.on_exit_element_mode, + ) + + case mode { + DeclarativeElemMode -> enter( + ctx, + mode, + visitor.on_enter_declarative_elem_mode, + visitor.on_exit_declarative_elem_mode, + _, + ) + PassiveElemMode -> enter( + ctx, + mode, + visitor.on_enter_passive_elem_mode, + visitor.on_exit_passive_elem_mode, + _, + ) + ActiveElemMode(_, _) -> enter( + ctx, + mode, + visitor.on_enter_active_elem_mode, + visitor.on_exit_active_elem_mode, + _, + ) + } + + case mode { + ActiveElemMode(table_idx, offset) -> { + use #(ctx, table_idx) <- try(do_visit_table_idx(ctx, table_idx, visitor)) + use #(ctx, offset) <- map(do_visit_expr(ctx, offset, visitor)) + #(ctx, ActiveElemMode(table_idx, offset)) + } + _ -> Ok(#(ctx, mode)) + } } -pub fn do_visit_elements( +pub fn do_visit_code_section( ctx, - elements: section, + code: Option(CodeSection), visitor: BinaryModuleVisitor(ctx), -) -> Result(#(ctx, section), String) { - todo +) -> Result(#(ctx, Option(CodeSection)), String) { + use #(ctx, code) <- enter( + ctx, + code, + visitor.on_enter_code_section, + visitor.on_exit_code_section, + ) + + case code { + Some(CodeSection(code)) -> { + use #(ctx, codes) <- map(do_visit_element_list( + ctx, + code, + visitor, + do_visit_code, + )) + #(ctx, Some(CodeSection(codes))) + } + _ -> Ok(#(ctx, code)) + } } pub fn do_visit_code( ctx, - code: section, + code: Code, + visitor: BinaryModuleVisitor(ctx), +) -> Result(#(ctx, Code), String) { + use #(ctx, Code(locals, body)) <- enter( + ctx, + code, + visitor.on_enter_code, + visitor.on_exit_code, + ) + + use #(ctx, locals) <- try(do_visit_element_list( + ctx, + locals, + visitor, + do_visit_locals, + )) + + use #(ctx, body) <- map(do_visit_expr(ctx, body, visitor)) + + #(ctx, Code(locals, body)) +} + +pub fn do_visit_locals( + ctx, + locals: Locals, visitor: BinaryModuleVisitor(ctx), -) -> Result(#(ctx, section), String) { - todo +) -> Result(#(ctx, Locals), String) { + use #(ctx, Locals(count, val_type)) <- enter( + ctx, + locals, + visitor.on_enter_locals, + visitor.on_exit_locals, + ) + + use #(ctx, val_type) <- map(do_visit_val_type(ctx, val_type, visitor)) + + #(ctx, Locals(count, val_type)) +} + +pub fn do_visit_data_section( + ctx, + data_section: Option(DataSection), + visitor: BinaryModuleVisitor(ctx), +) -> Result(#(ctx, Option(DataSection)), String) { + use #(ctx, data_section) <- enter( + ctx, + data_section, + visitor.on_enter_data_section, + visitor.on_exit_data_section, + ) + + case data_section { + Some(DataSection(data_segments)) -> { + use #(ctx, data_segments) <- map(do_visit_element_list( + ctx, + data_segments, + visitor, + do_visit_data, + )) + #(ctx, Some(DataSection(data_segments))) + } + _ -> Ok(#(ctx, data_section)) + } } pub fn do_visit_data( ctx, - data: section, + data: Data, visitor: BinaryModuleVisitor(ctx), -) -> Result(#(ctx, section), String) { - todo +) -> Result(#(ctx, Data), String) { + use #(ctx, data) <- enter( + ctx, + data, + visitor.on_enter_data, + visitor.on_exit_data, + ) + + use #(ctx, data) <- + case data { + ActiveData(_, _, _) -> enter( + ctx, + data, + visitor.on_enter_active_data, + visitor.on_exit_active_data, + _, + ) + PassiveData(_) -> enter( + ctx, + data, + visitor.on_enter_passive_data, + visitor.on_exit_passive_data, + _, + ) + } + + case data { + ActiveData(mem_idx, offset, init) -> { + use #(ctx, mem_idx) <- try(do_visit_mem_idx(ctx, mem_idx, visitor)) + use #(ctx, offset) <- map(do_visit_expr(ctx, offset, visitor)) + #(ctx, ActiveData(mem_idx, offset, init)) + } + PassiveData(_) -> Ok(#(ctx, data)) + } } -pub fn do_visit_data_count( +pub fn do_visit_data_count_section( ctx, - data_count: section, + data_count_section: Option(DataCountSection), visitor: BinaryModuleVisitor(ctx), -) -> Result(#(ctx, section), String) { - todo +) -> Result(#(ctx, Option(DataCountSection)), String) { + enter( + ctx, + data_count_section, + visitor.on_enter_data_count_section, + visitor.on_exit_data_count_section, + Ok, + ) } pub fn do_visit_heap_type( @@ -1166,7 +1665,102 @@ pub fn do_visit_heap_type( heap_type: HeapType, visitor: BinaryModuleVisitor(ctx), ) -> Result(#(ctx, HeapType), String) { - todo + use #(ctx, heap_type) <- enter( + ctx, + heap_type, + visitor.on_enter_heap_type, + visitor.on_exit_heap_type, + ) + + use #(ctx, heap_type) <- + case heap_type { + FuncHeapType -> enter( + ctx, + heap_type, + visitor.on_enter_func_heap_type, + visitor.on_exit_func_heap_type, + _, + ) + NoFuncHeapType -> enter( + ctx, + heap_type, + visitor.on_enter_no_func_heap_type, + visitor.on_exit_no_func_heap_type, + _, + ) + ExternHeapType -> enter( + ctx, + heap_type, + visitor.on_enter_extern_heap_type, + visitor.on_exit_extern_heap_type, + _, + ) + NoExternHeapType -> enter( + ctx, + heap_type, + visitor.on_enter_no_extern_heap_type, + visitor.on_exit_no_extern_heap_type, + _, + ) + AnyHeapType -> enter( + ctx, + heap_type, + visitor.on_enter_any_heap_type, + visitor.on_exit_any_heap_type, + _, + ) + EqHeapType -> enter( + ctx, + heap_type, + visitor.on_enter_eq_heap_type, + visitor.on_exit_eq_heap_type, + _, + ) + I31HeapType -> enter( + ctx, + heap_type, + visitor.on_enter_i31_heap_type, + visitor.on_exit_i31_heap_type, + _, + ) + StructHeapType -> enter( + ctx, + heap_type, + visitor.on_enter_struct_heap_type, + visitor.on_exit_struct_heap_type, + _, + ) + ArrayHeapType -> enter( + ctx, + heap_type, + visitor.on_enter_array_heap_type, + visitor.on_exit_array_heap_type, + _, + ) + NoneHeapType -> enter( + ctx, + heap_type, + visitor.on_enter_none_heap_type, + visitor.on_exit_none_heap_type, + _, + ) + ConcreteHeapType(_) -> enter( + ctx, + heap_type, + visitor.on_enter_concrete_heap_type, + visitor.on_exit_concrete_heap_type, + _, + ) + _ -> fn(_) { Ok(#(ctx, heap_type)) } + } + + case heap_type { + ConcreteHeapType(idx) -> { + use #(ctx, idx) <- map(do_visit_type_idx(ctx, idx, visitor)) + #(ctx, ConcreteHeapType(idx)) + } + _ -> Ok(#(ctx, heap_type)) + } } pub fn do_visit_field_type( @@ -1174,16 +1768,14 @@ pub fn do_visit_field_type( field_type: FieldType, visitor: BinaryModuleVisitor(ctx), ) -> Result(#(ctx, FieldType), String) { - use #(ctx, FieldType(st, mut)) <- try(do_visit( + use #(ctx, FieldType(storage_type, mut)) <- enter( ctx, field_type, visitor.on_enter_field_type, - )) - - use #(ctx, st) <- try(do_visit_storage_type(ctx, st, visitor)) - - let field_type = FieldType(st, mut) - do_visit(ctx, field_type, visitor.on_exit_field_type) + visitor.on_exit_field_type, + ) + use #(ctx, st) <- map(do_visit_storage_type(ctx, storage_type, visitor)) + #(ctx, FieldType(st, mut)) } pub fn do_visit_storage_type( @@ -1191,39 +1783,45 @@ pub fn do_visit_storage_type( storage_type: StorageType, visitor: BinaryModuleVisitor(ctx), ) -> Result(#(ctx, StorageType), String) { - use #(ctx, storage_type) <- try(do_visit( + use #(ctx, storage_type) <- enter( ctx, storage_type, visitor.on_enter_storage_type, - )) + visitor.on_exit_storage_type, + ) - use #(ctx, storage_type) <- try(case storage_type { - I8StorageType -> - do_visit(ctx, storage_type, visitor.on_enter_i8_storage_type) - I16StorageType -> - do_visit(ctx, storage_type, visitor.on_enter_i16_storage_type) - ValTypeStorageType(_) -> - do_visit(ctx, storage_type, visitor.on_enter_val_type_storage_type) - }) + use #(ctx, storage_type) <- + case storage_type { + I8StorageType -> enter( + ctx, + storage_type, + visitor.on_enter_i8_storage_type, + visitor.on_exit_i8_storage_type, + _, + ) + I16StorageType -> enter( + ctx, + storage_type, + visitor.on_enter_i16_storage_type, + visitor.on_exit_i16_storage_type, + _, + ) + ValTypeStorageType(_) -> enter( + ctx, + storage_type, + visitor.on_enter_val_type_storage_type, + visitor.on_exit_val_type_storage_type, + _, + ) + } - use #(ctx, storage_type) <- try(case storage_type { + case storage_type { ValTypeStorageType(vt) -> { use #(ctx, vt) <- map(do_visit_val_type(ctx, vt, visitor)) #(ctx, ValTypeStorageType(vt)) } a -> Ok(#(ctx, a)) - }) - - use #(ctx, storage_type) <- try(case storage_type { - I8StorageType -> - do_visit(ctx, storage_type, visitor.on_exit_i8_storage_type) - I16StorageType -> - do_visit(ctx, storage_type, visitor.on_exit_i16_storage_type) - ValTypeStorageType(_) -> - do_visit(ctx, storage_type, visitor.on_exit_val_type_storage_type) - }) - - do_visit(ctx, storage_type, visitor.on_exit_storage_type) + } } pub fn do_visit_table_type( @@ -1231,17 +1829,18 @@ pub fn do_visit_table_type( table_type: TableType, visitor: BinaryModuleVisitor(ctx), ) { - use #(ctx, TableType(rt, limits)) <- try(do_visit( + use #(ctx, TableType(rt, limits)) <- enter( ctx, table_type, visitor.on_enter_table_type, - )) + visitor.on_exit_table_type, + ) use #(ctx, rt) <- try(do_visit_ref_type(ctx, rt, visitor)) - use #(ctx, limits) <- try(do_visit_limits(ctx, limits, visitor)) + use #(ctx, limits) <- map(do_visit_limits(ctx, limits, visitor)) let table_type = TableType(rt, limits) - do_visit(ctx, table_type, visitor.on_exit_table_type) + #(ctx, table_type) } pub fn do_visit_limits( @@ -1249,8 +1848,7 @@ pub fn do_visit_limits( limits: Limits, visitor: BinaryModuleVisitor(ctx), ) -> Result(#(ctx, Limits), String) { - use #(ctx, limits) <- try(do_visit(ctx, limits, visitor.on_enter_limits)) - do_visit(ctx, limits, visitor.on_exit_limits) + enter(ctx, limits, visitor.on_enter_limits, visitor.on_exit_limits, Ok) } pub fn do_visit_mem_type( @@ -1258,14 +1856,15 @@ pub fn do_visit_mem_type( mem_type: MemType, visitor: BinaryModuleVisitor(ctx), ) -> Result(#(ctx, MemType), String) { - use #(ctx, MemType(limits)) <- try(do_visit( + use #(ctx, MemType(limits)) <- enter( ctx, mem_type, visitor.on_enter_mem_type, - )) - use #(ctx, limits) <- try(do_visit_limits(ctx, limits, visitor)) - let mem_type = MemType(limits) - do_visit(ctx, mem_type, visitor.on_exit_mem_type) + visitor.on_exit_mem_type, + ) + use #(ctx, limits) <- map(do_visit_limits(ctx, limits, visitor)) + + #(ctx, MemType(limits)) } pub fn do_visit_global_type( @@ -1289,15 +1888,16 @@ pub fn do_visit_table( table: Table, visitor: BinaryModuleVisitor(ctx), ) -> Result(#(ctx, Table), String) { - use #(ctx, Table(table_type, init_expr)) <- try(do_visit( + use #(ctx, Table(table_type, init_expr)) <- enter( ctx, table, visitor.on_enter_table, - )) + visitor.on_exit_table, + ) use #(ctx, table_type) <- try(do_visit_table_type(ctx, table_type, visitor)) - use #(ctx, init_expr) <- try(case init_expr { + use #(ctx, init_expr) <- map(case init_expr { Some(init_expr) -> { use #(ctx, init_expr) <- map(do_visit_expr(ctx, init_expr, visitor)) #(ctx, Some(init_expr)) @@ -1306,10 +1906,14 @@ pub fn do_visit_table( }) let table = Table(table_type, init_expr) - do_visit(ctx, table, visitor.on_exit_table) + #(ctx, table) } -pub fn do_visit_expr(ctx, expr: Expr, visitor: BinaryModuleVisitor(ctx)) { +pub fn do_visit_expr( + ctx, + expr: Expr, + visitor: BinaryModuleVisitor(ctx), +) -> Result(#(ctx, Expr), String) { use #(ctx, Expr(body)) <- enter( ctx, expr, @@ -1323,6 +1927,7 @@ pub fn do_visit_expr(ctx, expr: Expr, visitor: BinaryModuleVisitor(ctx)) { visitor, do_visit_instruction, )) + #(ctx, Expr(body)) } @@ -1338,17 +1943,849 @@ pub fn do_visit_instruction( visitor.on_exit_instruction, ) - todo -} - -fn enter( - ctx, - element, - on_enter: Option(VisitorCallback(ctx, element)), - on_exit: Option(VisitorCallback(ctx, element)), - body: fn(#(ctx, element)) -> Result(#(ctx, element), String), -) { - use #(ctx, element) <- try(do_visit(ctx, element, on_enter)) - use #(ctx, element) <- try(body(#(ctx, element))) - do_visit(ctx, element, on_exit) + use #(ctx, instruction) <- + case instruction { + RefNull(_) -> enter( + ctx, + instruction, + visitor.on_enter_ref_null, + visitor.on_exit_ref_null, + _, + ) + RefFunc(_) -> enter( + ctx, + instruction, + visitor.on_enter_ref_func, + visitor.on_exit_ref_func, + _, + ) + RefTest(_) -> enter( + ctx, + instruction, + visitor.on_enter_ref_test, + visitor.on_exit_ref_test, + _, + ) + RefTestNullable(_) -> enter( + ctx, + instruction, + visitor.on_enter_ref_test_nullable, + visitor.on_exit_ref_test_nullable, + _, + ) + RefCast(_) -> enter( + ctx, + instruction, + visitor.on_enter_ref_cast, + visitor.on_exit_ref_cast, + _, + ) + RefCastNullable(_) -> enter( + ctx, + instruction, + visitor.on_enter_ref_cast_nullable, + visitor.on_exit_ref_cast_nullable, + _, + ) + StructGet(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_struct_get, + visitor.on_exit_struct_get, + _, + ) + StructGetS(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_struct_get_s, + visitor.on_exit_struct_get_s, + _, + ) + StructGetU(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_struct_get_u, + visitor.on_exit_struct_get_u, + _, + ) + StructSet(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_struct_set, + visitor.on_exit_struct_set, + _, + ) + ArrayNew(_) -> enter( + ctx, + instruction, + visitor.on_enter_array_new, + visitor.on_exit_array_new, + _, + ) + ArrayNewDefault(_) -> enter( + ctx, + instruction, + visitor.on_enter_array_new_default, + visitor.on_exit_array_new_default, + _, + ) + ArrayNewData(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_array_new_data, + visitor.on_exit_array_new_data, + _, + ) + ArrayNewElem(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_array_new_elem, + visitor.on_exit_array_new_elem, + _, + ) + ArrayNewFixed(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_array_new_fixed, + visitor.on_exit_array_new_fixed, + _, + ) + ArrayGet(_) -> enter( + ctx, + instruction, + visitor.on_enter_array_get, + visitor.on_exit_array_get, + _, + ) + ArrayGetS(_) -> enter( + ctx, + instruction, + visitor.on_enter_array_get_s, + visitor.on_exit_array_get_s, + _, + ) + ArrayGetU(_) -> enter( + ctx, + instruction, + visitor.on_enter_array_get_u, + visitor.on_exit_array_get_u, + _, + ) + ArraySet(_) -> enter( + ctx, + instruction, + visitor.on_enter_array_set, + visitor.on_exit_array_set, + _, + ) + ArrayFill(_) -> enter( + ctx, + instruction, + visitor.on_enter_array_fill, + visitor.on_exit_array_fill, + _, + ) + ArrayCopy(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_array_copy, + visitor.on_exit_array_copy, + _, + ) + ArrayInitData(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_array_init_data, + visitor.on_exit_array_init_data, + _, + ) + ArrayInitElem(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_array_init_elem, + visitor.on_exit_array_init_elem, + _, + ) + SelectT(_) -> enter( + ctx, + instruction, + visitor.on_enter_select_t, + visitor.on_exit_select_t, + _, + ) + LocalGet(_) -> enter( + ctx, + instruction, + visitor.on_enter_local_get, + visitor.on_exit_local_get, + _, + ) + LocalSet(_) -> enter( + ctx, + instruction, + visitor.on_enter_local_set, + visitor.on_exit_local_set, + _, + ) + LocalTee(_) -> enter( + ctx, + instruction, + visitor.on_enter_local_tee, + visitor.on_exit_local_tee, + _, + ) + GlobalGet(_) -> enter( + ctx, + instruction, + visitor.on_enter_global_get, + visitor.on_exit_global_get, + _, + ) + GlobalSet(_) -> enter( + ctx, + instruction, + visitor.on_enter_global_set, + visitor.on_exit_global_set, + _, + ) + TableGet(_) -> enter( + ctx, + instruction, + visitor.on_enter_table_get, + visitor.on_exit_table_get, + _, + ) + TableSet(_) -> enter( + ctx, + instruction, + visitor.on_enter_table_set, + visitor.on_exit_table_set, + _, + ) + TableSize(_) -> enter( + ctx, + instruction, + visitor.on_enter_table_size, + visitor.on_exit_table_size, + _, + ) + TableGrow(_) -> enter( + ctx, + instruction, + visitor.on_enter_table_grow, + visitor.on_exit_table_grow, + _, + ) + TableFill(_) -> enter( + ctx, + instruction, + visitor.on_enter_table_fill, + visitor.on_exit_table_fill, + _, + ) + TableCopy(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_table_copy, + visitor.on_exit_table_copy, + _, + ) + TableInit(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_table_init, + visitor.on_exit_table_init, + _, + ) + ElemDrop(_) -> enter( + ctx, + instruction, + visitor.on_enter_elem_drop, + visitor.on_exit_elem_drop, + _, + ) + MemoryInit(_) -> enter( + ctx, + instruction, + visitor.on_enter_memory_init, + visitor.on_exit_memory_init, + _, + ) + DataDrop(_) -> enter( + ctx, + instruction, + visitor.on_enter_data_drop, + visitor.on_exit_data_drop, + _, + ) + Block(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_block, + visitor.on_exit_block, + _, + ) + Loop(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_loop, + visitor.on_exit_loop, + _, + ) + If(_, _, _) -> enter( + ctx, + instruction, + visitor.on_enter_if, + visitor.on_exit_if, + _, + ) + Br(_) -> enter( + ctx, + instruction, + visitor.on_enter_br, + visitor.on_exit_br, + _, + ) + BrIf(_) -> enter( + ctx, + instruction, + visitor.on_enter_br_if, + visitor.on_exit_br_if, + _, + ) + BrTable(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_br_table, + visitor.on_exit_br_table, + _, + ) + BrOnNull(_) -> enter( + ctx, + instruction, + visitor.on_enter_br_on_null, + visitor.on_exit_br_on_null, + _, + ) + BrOnNonNull(_) -> enter( + ctx, + instruction, + visitor.on_enter_br_on_non_null, + visitor.on_exit_br_on_non_null, + _, + ) + BrOnCast(_, _, _) -> enter( + ctx, + instruction, + visitor.on_enter_br_on_cast, + visitor.on_exit_br_on_cast, + _, + ) + BrOnCastFail(_, _, _) -> enter( + ctx, + instruction, + visitor.on_enter_br_on_cast_fail, + visitor.on_exit_br_on_cast_fail, + _, + ) + Call(_) -> enter( + ctx, + instruction, + visitor.on_enter_call, + visitor.on_exit_call, + _, + ) + CallRef(_) -> enter( + ctx, + instruction, + visitor.on_enter_call_ref, + visitor.on_exit_call_ref, + _, + ) + CallIndirect(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_call_indirect, + visitor.on_exit_call_indirect, + _, + ) + ReturnCall(_) -> enter( + ctx, + instruction, + visitor.on_enter_return_call, + visitor.on_exit_return_call, + _, + ) + ReturnCallRef(_) -> enter( + ctx, + instruction, + visitor.on_enter_return_call_ref, + visitor.on_exit_return_call_ref, + _, + ) + ReturnCallIndirect(_, _) -> enter( + ctx, + instruction, + visitor.on_enter_return_call_indirect, + visitor.on_exit_return_call_indirect, + _, + ) + _ -> fn(_) { Ok(#(ctx, instruction)) } + } + + case instruction { + RefNull(heap_type) -> { + use #(ctx, heap_type) <- map(do_visit_heap_type(ctx, heap_type, visitor)) + #(ctx, RefNull(heap_type)) + } + RefFunc(func_idx) -> { + use #(ctx, func_idx) <- map(do_visit_func_idx(ctx, func_idx, visitor)) + #(ctx, RefFunc(func_idx)) + } + RefTest(heap_type) -> { + use #(ctx, heap_type) <- map(do_visit_heap_type(ctx, heap_type, visitor)) + #(ctx, RefTest(heap_type)) + } + RefTestNullable(heap_type) -> { + use #(ctx, heap_type) <- map(do_visit_heap_type(ctx, heap_type, visitor)) + #(ctx, RefTestNullable(heap_type)) + } + RefCast(heap_type) -> { + use #(ctx, heap_type) <- map(do_visit_heap_type(ctx, heap_type, visitor)) + #(ctx, RefCast(heap_type)) + } + RefCastNullable(heap_type) -> { + use #(ctx, heap_type) <- map(do_visit_heap_type(ctx, heap_type, visitor)) + #(ctx, RefCastNullable(heap_type)) + } + StructGet(type_idx, field_idx) -> { + use #(ctx, type_idx) <- try(do_visit_type_idx(ctx, type_idx, visitor)) + use #(ctx, field_idx) <- map(do_visit_field_idx(ctx, field_idx, visitor)) + #(ctx, StructGet(type_idx, field_idx)) + } + StructGetS(type_idx, field_idx) -> { + use #(ctx, type_idx) <- try(do_visit_type_idx(ctx, type_idx, visitor)) + use #(ctx, field_idx) <- map(do_visit_field_idx(ctx, field_idx, visitor)) + #(ctx, StructGetS(type_idx, field_idx)) + } + StructGetU(type_idx, field_idx) -> { + use #(ctx, type_idx) <- try(do_visit_type_idx(ctx, type_idx, visitor)) + use #(ctx, field_idx) <- map(do_visit_field_idx(ctx, field_idx, visitor)) + #(ctx, StructGetU(type_idx, field_idx)) + } + StructSet(type_idx, field_idx) -> { + use #(ctx, type_idx) <- try(do_visit_type_idx(ctx, type_idx, visitor)) + use #(ctx, field_idx) <- map(do_visit_field_idx(ctx, field_idx, visitor)) + #(ctx, StructSet(type_idx, field_idx)) + } + ArrayNew(type_idx) -> { + use #(ctx, type_idx) <- map(do_visit_type_idx(ctx, type_idx, visitor)) + #(ctx, ArrayNew(type_idx)) + } + ArrayNewDefault(type_idx) -> { + use #(ctx, type_idx) <- map(do_visit_type_idx(ctx, type_idx, visitor)) + #(ctx, ArrayNewDefault(type_idx)) + } + ArrayNewData(type_idx, data_idx) -> { + use #(ctx, type_idx) <- try(do_visit_type_idx(ctx, type_idx, visitor)) + use #(ctx, data_idx) <- map(do_visit_data_idx(ctx, data_idx, visitor)) + #(ctx, ArrayNewData(type_idx, data_idx)) + } + ArrayNewElem(type_idx, elem_idx) -> { + use #(ctx, type_idx) <- try(do_visit_type_idx(ctx, type_idx, visitor)) + use #(ctx, elem_idx) <- map(do_visit_elem_idx(ctx, elem_idx, visitor)) + #(ctx, ArrayNewElem(type_idx, elem_idx)) + } + ArrayNewFixed(type_idx, size) -> { + use #(ctx, type_idx) <- map(do_visit_type_idx(ctx, type_idx, visitor)) + #(ctx, ArrayNewFixed(type_idx, size)) + } + ArrayGet(type_idx) -> { + use #(ctx, type_idx) <- map(do_visit_type_idx(ctx, type_idx, visitor)) + #(ctx, ArrayGet(type_idx)) + } + ArrayGetS(type_idx) -> { + use #(ctx, type_idx) <- map(do_visit_type_idx(ctx, type_idx, visitor)) + #(ctx, ArrayGetS(type_idx)) + } + ArrayGetU(type_idx) -> { + use #(ctx, type_idx) <- map(do_visit_type_idx(ctx, type_idx, visitor)) + #(ctx, ArrayGetU(type_idx)) + } + ArraySet(type_idx) -> { + use #(ctx, type_idx) <- map(do_visit_type_idx(ctx, type_idx, visitor)) + #(ctx, ArraySet(type_idx)) + } + ArrayFill(type_idx) -> { + use #(ctx, type_idx) <- map(do_visit_type_idx(ctx, type_idx, visitor)) + #(ctx, ArrayFill(type_idx)) + } + ArrayCopy(type_idx1, type_idx2) -> { + use #(ctx, type_idx1) <- try(do_visit_type_idx(ctx, type_idx1, visitor)) + use #(ctx, type_idx2) <- map(do_visit_type_idx(ctx, type_idx2, visitor)) + #(ctx, ArrayCopy(type_idx1, type_idx2)) + } + ArrayInitData(type_idx, data_idx) -> { + use #(ctx, type_idx) <- try(do_visit_type_idx(ctx, type_idx, visitor)) + use #(ctx, data_idx) <- map(do_visit_data_idx(ctx, data_idx, visitor)) + #(ctx, ArrayInitData(type_idx, data_idx)) + } + ArrayInitElem(type_idx, elem_idx) -> { + use #(ctx, type_idx) <- try(do_visit_type_idx(ctx, type_idx, visitor)) + use #(ctx, elem_idx) <- map(do_visit_elem_idx(ctx, elem_idx, visitor)) + #(ctx, ArrayInitElem(type_idx, elem_idx)) + } + SelectT(val_types) -> { + use #(ctx, val_types) <- map(do_visit_element_list( + ctx, + val_types, + visitor, + do_visit_val_type, + )) + #(ctx, SelectT(val_types)) + } + LocalGet(local_idx) -> { + use #(ctx, local_idx) <- map(do_visit_local_idx(ctx, local_idx, visitor)) + #(ctx, LocalGet(local_idx)) + } + LocalSet(local_idx) -> { + use #(ctx, local_idx) <- map(do_visit_local_idx(ctx, local_idx, visitor)) + #(ctx, LocalSet(local_idx)) + } + LocalTee(local_idx) -> { + use #(ctx, local_idx) <- map(do_visit_local_idx(ctx, local_idx, visitor)) + #(ctx, LocalTee(local_idx)) + } + GlobalGet(global_idx) -> { + use #(ctx, global_idx) <- map(do_visit_global_idx( + ctx, + global_idx, + visitor, + )) + #(ctx, GlobalGet(global_idx)) + } + GlobalSet(global_idx) -> { + use #(ctx, global_idx) <- map(do_visit_global_idx( + ctx, + global_idx, + visitor, + )) + #(ctx, GlobalSet(global_idx)) + } + TableGet(table_idx) -> { + use #(ctx, table_idx) <- map(do_visit_table_idx(ctx, table_idx, visitor)) + #(ctx, TableGet(table_idx)) + } + TableSet(table_idx) -> { + use #(ctx, table_idx) <- map(do_visit_table_idx(ctx, table_idx, visitor)) + #(ctx, TableSet(table_idx)) + } + TableSize(table_idx) -> { + use #(ctx, table_idx) <- map(do_visit_table_idx(ctx, table_idx, visitor)) + #(ctx, TableSize(table_idx)) + } + TableGrow(table_idx) -> { + use #(ctx, table_idx) <- map(do_visit_table_idx(ctx, table_idx, visitor)) + #(ctx, TableGrow(table_idx)) + } + TableFill(table_idx) -> { + use #(ctx, table_idx) <- map(do_visit_table_idx(ctx, table_idx, visitor)) + #(ctx, TableFill(table_idx)) + } + TableCopy(dest_idx, src_idx) -> { + use #(ctx, dest_idx) <- try(do_visit_table_idx(ctx, dest_idx, visitor)) + use #(ctx, src_idx) <- map(do_visit_table_idx(ctx, src_idx, visitor)) + #(ctx, TableCopy(dest_idx, src_idx)) + } + TableInit(elem_idx, table_idx) -> { + use #(ctx, elem_idx) <- try(do_visit_elem_idx(ctx, elem_idx, visitor)) + use #(ctx, table_idx) <- map(do_visit_table_idx(ctx, table_idx, visitor)) + #(ctx, TableInit(elem_idx, table_idx)) + } + ElemDrop(elem_idx) -> { + use #(ctx, elem_idx) <- map(do_visit_elem_idx(ctx, elem_idx, visitor)) + #(ctx, ElemDrop(elem_idx)) + } + MemoryInit(data_idx) -> { + use #(ctx, data_idx) <- map(do_visit_data_idx(ctx, data_idx, visitor)) + #(ctx, DataDrop(data_idx)) + } + DataDrop(data_idx) -> { + use #(ctx, data_idx) <- map(do_visit_data_idx(ctx, data_idx, visitor)) + #(ctx, DataDrop(data_idx)) + } + Block(block_type, body) -> { + use #(ctx, block_type) <- try(do_visit_block_type( + ctx, + block_type, + visitor, + )) + use #(ctx, body) <- map(do_visit_expr(ctx, body, visitor)) + #(ctx, Block(block_type, body)) + } + Loop(block_type, body) -> { + use #(ctx, block_type) <- try(do_visit_block_type( + ctx, + block_type, + visitor, + )) + use #(ctx, body) <- map(do_visit_expr(ctx, body, visitor)) + #(ctx, Loop(block_type, body)) + } + If(block_type, if_instructions, else_instructions) -> { + use #(ctx, block_type) <- try(do_visit_block_type( + ctx, + block_type, + visitor, + )) + use #(ctx, if_instructions) <- try(do_visit_element_list( + ctx, + if_instructions, + visitor, + do_visit_instruction, + )) + use #(ctx, else_instructions) <- map(case else_instructions { + Some(else_instructions) -> { + use #(ctx, else_instructions) <- map(do_visit_element_list( + ctx, + else_instructions, + visitor, + do_visit_instruction, + )) + #(ctx, Some(else_instructions)) + } + None -> Ok(#(ctx, None)) + }) + #(ctx, If(block_type, if_instructions, else_instructions)) + } + Br(label_idx) -> { + use #(ctx, label_idx) <- map(do_visit_label_idx(ctx, label_idx, visitor)) + #(ctx, Br(label_idx)) + } + BrIf(label_idx) -> { + use #(ctx, label_idx) <- map(do_visit_label_idx(ctx, label_idx, visitor)) + #(ctx, BrIf(label_idx)) + } + BrTable(label_idxs, default_label_idx) -> { + use #(ctx, label_idxs) <- try(do_visit_element_list( + ctx, + label_idxs, + visitor, + do_visit_label_idx, + )) + use #(ctx, default_label_idx) <- map(do_visit_label_idx( + ctx, + default_label_idx, + visitor, + )) + #(ctx, BrTable(label_idxs, default_label_idx)) + } + BrOnNull(label_idx) -> { + use #(ctx, label_idx) <- map(do_visit_label_idx(ctx, label_idx, visitor)) + #(ctx, BrOnNull(label_idx)) + } + BrOnNonNull(label_idx) -> { + use #(ctx, label_idx) <- map(do_visit_label_idx(ctx, label_idx, visitor)) + #(ctx, BrOnNonNull(label_idx)) + } + BrOnCast(label_idx, ref_type1, ref_type2) -> { + use #(ctx, label_idx) <- try(do_visit_label_idx(ctx, label_idx, visitor)) + use #(ctx, ref_type1) <- try(do_visit_ref_type(ctx, ref_type1, visitor)) + use #(ctx, ref_type2) <- map(do_visit_ref_type(ctx, ref_type2, visitor)) + #(ctx, BrOnCast(label_idx, ref_type1, ref_type2)) + } + BrOnCastFail(label_idx, ref_type1, ref_type2) -> { + use #(ctx, label_idx) <- try(do_visit_label_idx(ctx, label_idx, visitor)) + use #(ctx, ref_type1) <- try(do_visit_ref_type(ctx, ref_type1, visitor)) + use #(ctx, ref_type2) <- map(do_visit_ref_type(ctx, ref_type2, visitor)) + #(ctx, BrOnCastFail(label_idx, ref_type1, ref_type2)) + } + Call(func_idx) -> { + use #(ctx, func_idx) <- map(do_visit_func_idx(ctx, func_idx, visitor)) + #(ctx, Call(func_idx)) + } + CallRef(type_idx) -> { + use #(ctx, type_idx) <- map(do_visit_type_idx(ctx, type_idx, visitor)) + #(ctx, CallRef(type_idx)) + } + CallIndirect(table_idx, type_idx) -> { + use #(ctx, table_idx) <- try(do_visit_table_idx(ctx, table_idx, visitor)) + use #(ctx, type_idx) <- map(do_visit_type_idx(ctx, type_idx, visitor)) + #(ctx, CallIndirect(table_idx, type_idx)) + } + ReturnCall(func_idx) -> { + use #(ctx, func_idx) <- map(do_visit_func_idx(ctx, func_idx, visitor)) + #(ctx, ReturnCall(func_idx)) + } + ReturnCallRef(type_idx) -> { + use #(ctx, type_idx) <- map(do_visit_type_idx(ctx, type_idx, visitor)) + #(ctx, ReturnCallRef(type_idx)) + } + ReturnCallIndirect(table_idx, type_idx) -> { + use #(ctx, table_idx) <- try(do_visit_table_idx(ctx, table_idx, visitor)) + use #(ctx, type_idx) <- map(do_visit_type_idx(ctx, type_idx, visitor)) + #(ctx, ReturnCallIndirect(table_idx, type_idx)) + } + _ -> Ok(#(ctx, instruction)) + } +} + +pub fn do_visit_func_idx( + ctx, + func_idx: FuncIDX, + visitor: BinaryModuleVisitor(ctx), +) { + enter(ctx, func_idx, visitor.on_enter_func_idx, visitor.on_exit_func_idx, Ok) +} + +pub fn do_visit_table_idx( + ctx, + table_idx: TableIDX, + visitor: BinaryModuleVisitor(ctx), +) { + enter( + ctx, + table_idx, + visitor.on_enter_table_idx, + visitor.on_exit_table_idx, + Ok, + ) +} + +pub fn do_visit_mem_idx(ctx, mem_idx: MemIDX, visitor: BinaryModuleVisitor(ctx)) { + enter(ctx, mem_idx, visitor.on_enter_mem_idx, visitor.on_exit_mem_idx, Ok) +} + +pub fn do_visit_global_idx( + ctx, + global_idx: GlobalIDX, + visitor: BinaryModuleVisitor(ctx), +) { + enter( + ctx, + global_idx, + visitor.on_enter_global_idx, + visitor.on_exit_global_idx, + Ok, + ) +} + +fn enter( + ctx, + element, + on_enter: Option(VisitorCallback(ctx, element)), + on_exit: Option(VisitorCallback(ctx, element)), + body: fn(#(ctx, element)) -> Result(#(ctx, element), String), +) { + use #(ctx, element) <- try(do_visit(ctx, element, on_enter)) + use #(ctx, element) <- try(body(#(ctx, element))) + do_visit(ctx, element, on_exit) +} + +pub fn do_visit_label_idx( + ctx, + label_idx: LabelIDX, + visitor: BinaryModuleVisitor(ctx), +) { + enter( + ctx, + label_idx, + visitor.on_enter_label_idx, + visitor.on_exit_label_idx, + Ok, + ) +} + +pub fn do_visit_field_idx( + ctx, + field_idx: FieldIDX, + visitor: BinaryModuleVisitor(ctx), +) { + enter( + ctx, + field_idx, + visitor.on_enter_field_idx, + visitor.on_exit_field_idx, + Ok, + ) +} + +pub fn do_visit_data_idx( + ctx, + data_idx: DataIDX, + visitor: BinaryModuleVisitor(ctx), +) { + enter(ctx, data_idx, visitor.on_enter_data_idx, visitor.on_exit_data_idx, Ok) +} + +pub fn do_visit_elem_idx( + ctx, + elem_idx: ElemIDX, + visitor: BinaryModuleVisitor(ctx), +) { + enter(ctx, elem_idx, visitor.on_enter_elem_idx, visitor.on_exit_elem_idx, Ok) +} + +pub fn do_visit_local_idx( + ctx, + local_idx: LocalIDX, + visitor: BinaryModuleVisitor(ctx), +) { + enter( + ctx, + local_idx, + visitor.on_enter_local_idx, + visitor.on_exit_local_idx, + Ok, + ) +} + +pub fn do_visit_block_type( + ctx, + block_type: BlockType, + visitor: BinaryModuleVisitor(ctx), +) { + use #(ctx, block_type) <- enter( + ctx, + block_type, + visitor.on_enter_block_type, + visitor.on_exit_block_type, + ) + + use #(ctx, block_type) <- + case block_type { + VoidBlockType -> enter( + ctx, + block_type, + visitor.on_enter_void_block_type, + visitor.on_exit_void_block_type, + _, + ) + ValTypeBlockType(_) -> enter( + ctx, + block_type, + visitor.on_enter_val_type_block_type, + visitor.on_exit_val_type_block_type, + _, + ) + FuncTypeBlockType(_) -> enter( + ctx, + block_type, + visitor.on_enter_func_type_block_type, + visitor.on_exit_func_type_block_type, + _, + ) + } + + case block_type { + ValTypeBlockType(val_type) -> { + use #(ctx, val_type) <- map(do_visit_val_type(ctx, val_type, visitor)) + #(ctx, ValTypeBlockType(val_type)) + } + FuncTypeBlockType(type_idx) -> { + use #(ctx, type_idx) <- map(do_visit_type_idx(ctx, type_idx, visitor)) + #(ctx, FuncTypeBlockType(type_idx)) + } + _ -> Ok(#(ctx, block_type)) + } } diff --git a/src/visitor.gleam b/src/visitor.gleam new file mode 100644 index 0000000..f429ec8 --- /dev/null +++ b/src/visitor.gleam @@ -0,0 +1,3228 @@ +import gleam/option.{type Option, Some} +import internal/finger_tree +import internal/structure/modules.{ + type BinaryModule, type CodeSection, type CustomSection, type DataCountSection, + type DataSection, type ElementSection, type ExportSection, + type FunctionSection, type GlobalSection, type ImportSection, + type MemorySection, type StartSection, type TableSection, type TypeSection, +} +import internal/structure/types.{ + type ArrayType, type BlockType, type Code, type CompositeType, type Data, + type DataIDX, type DefType, type Elem, type ElemIDX, type ElemMode, + type Export, type Expr, type FieldIDX, type FieldType, type FuncIDX, + type FuncType, type Global, type GlobalIDX, type GlobalType, type HeapType, + type Import, type Instruction, type LabelIDX, type Limits, type LocalIDX, + type Locals, type MemIDX, type MemType, type RecType, type RefType, + type StorageType, type StructType, type SubType, type Table, type TableIDX, + type TableType, type TypeIDX, type ValType, +} +import internal/visitor.{ + type BinaryModuleVisitor, type VisitorCallback, BinaryModuleVisitor, + do_visit_array_type, do_visit_block_type, do_visit_code, do_visit_code_section, + do_visit_composite_type, do_visit_custom_section, do_visit_custom_sections, + do_visit_data, do_visit_data_count_section, do_visit_data_idx, + do_visit_data_section, do_visit_def_type, do_visit_elem_idx, + do_visit_element_mode, do_visit_element_section, do_visit_element_segment, + do_visit_export, do_visit_export_section, do_visit_expr, do_visit_field_idx, + do_visit_field_type, do_visit_func_idx, do_visit_func_type, + do_visit_function_section, do_visit_global, do_visit_global_idx, + do_visit_global_section, do_visit_global_type, do_visit_heap_type, + do_visit_import, do_visit_import_section, do_visit_instruction, + do_visit_label_idx, do_visit_limits, do_visit_local_idx, do_visit_locals, + do_visit_mem_idx, do_visit_mem_type, do_visit_memory_section, do_visit_module, + do_visit_rec_type, do_visit_ref_type, do_visit_start_section, + do_visit_storage_type, do_visit_struct_type, do_visit_sub_type, do_visit_table, + do_visit_table_idx, do_visit_table_section, do_visit_table_type, + do_visit_type_idx, do_visit_type_section, do_visit_val_type, +} + +pub fn on_enter_module( + visitor: BinaryModuleVisitor(ctx), + on_enter_module: VisitorCallback(ctx, BinaryModule), +) { + BinaryModuleVisitor(..visitor, on_enter_module: Some(on_enter_module)) +} + +pub fn on_exit_module( + visitor: BinaryModuleVisitor(ctx), + on_exit_module: VisitorCallback(ctx, BinaryModule), +) { + BinaryModuleVisitor(..visitor, on_exit_module: Some(on_exit_module)) +} + +pub fn on_enter_custom_section( + visitor: BinaryModuleVisitor(ctx), + on_enter_custom_section: VisitorCallback(ctx, Option(CustomSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_custom_section: Some(on_enter_custom_section), + ) +} + +pub fn on_exit_custom_section( + visitor: BinaryModuleVisitor(ctx), + on_exit_custom_section: VisitorCallback(ctx, Option(CustomSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_custom_section: Some(on_exit_custom_section), + ) +} + +pub fn on_enter_type_section( + visitor: BinaryModuleVisitor(ctx), + on_enter_type_section: VisitorCallback(ctx, Option(TypeSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_type_section: Some(on_enter_type_section), + ) +} + +pub fn on_exit_type_section( + visitor: BinaryModuleVisitor(ctx), + on_exit_type_section: VisitorCallback(ctx, Option(TypeSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_type_section: Some(on_exit_type_section), + ) +} + +pub fn on_enter_import_section( + visitor: BinaryModuleVisitor(ctx), + on_enter_import_section: VisitorCallback(ctx, Option(ImportSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_import_section: Some(on_enter_import_section), + ) +} + +pub fn on_exit_import_section( + visitor: BinaryModuleVisitor(ctx), + on_exit_import_section: VisitorCallback(ctx, Option(ImportSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_import_section: Some(on_exit_import_section), + ) +} + +pub fn on_enter_table_section( + visitor: BinaryModuleVisitor(ctx), + on_enter_table_section: VisitorCallback(ctx, Option(TableSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_table_section: Some(on_enter_table_section), + ) +} + +pub fn on_exit_table_section( + visitor: BinaryModuleVisitor(ctx), + on_exit_table_section: VisitorCallback(ctx, Option(TableSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_table_section: Some(on_exit_table_section), + ) +} + +pub fn on_enter_memory_section( + visitor: BinaryModuleVisitor(ctx), + on_enter_memory_section: VisitorCallback(ctx, Option(MemorySection)), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_memory_section: Some(on_enter_memory_section), + ) +} + +pub fn on_exit_memory_section( + visitor: BinaryModuleVisitor(ctx), + on_exit_memory_section: VisitorCallback(ctx, Option(MemorySection)), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_memory_section: Some(on_exit_memory_section), + ) +} + +pub fn on_enter_start_section( + visitor: BinaryModuleVisitor(ctx), + on_enter_start_section: VisitorCallback(ctx, Option(StartSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_start_section: Some(on_enter_start_section), + ) +} + +pub fn on_exit_start_section( + visitor: BinaryModuleVisitor(ctx), + on_exit_start_section: VisitorCallback(ctx, Option(StartSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_start_section: Some(on_exit_start_section), + ) +} + +pub fn on_enter_element_segment( + visitor: BinaryModuleVisitor(ctx), + on_enter_element_segment: VisitorCallback(ctx, Elem), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_element_segment: Some(on_enter_element_segment), + ) +} + +pub fn on_exit_element_segment( + visitor: BinaryModuleVisitor(ctx), + on_exit_element_segment: VisitorCallback(ctx, Elem), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_element_segment: Some(on_exit_element_segment), + ) +} + +pub fn on_enter_element_section( + visitor: BinaryModuleVisitor(ctx), + on_enter_element_section: VisitorCallback(ctx, Option(ElementSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_element_section: Some(on_enter_element_section), + ) +} + +pub fn on_exit_element_section( + visitor: BinaryModuleVisitor(ctx), + on_exit_element_section: VisitorCallback(ctx, Option(ElementSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_element_section: Some(on_exit_element_section), + ) +} + +pub fn on_enter_import( + visitor: BinaryModuleVisitor(ctx), + on_enter_import: VisitorCallback(ctx, Import), +) { + BinaryModuleVisitor(..visitor, on_enter_import: Some(on_enter_import)) +} + +pub fn on_exit_import( + visitor: BinaryModuleVisitor(ctx), + on_exit_import: VisitorCallback(ctx, Import), +) { + BinaryModuleVisitor(..visitor, on_exit_import: Some(on_exit_import)) +} + +pub fn on_enter_func_import( + visitor: BinaryModuleVisitor(ctx), + on_enter_func_import: VisitorCallback(ctx, Import), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_func_import: Some(on_enter_func_import), + ) +} + +pub fn on_exit_func_import( + visitor: BinaryModuleVisitor(ctx), + on_exit_func_import: VisitorCallback(ctx, Import), +) { + BinaryModuleVisitor(..visitor, on_exit_func_import: Some(on_exit_func_import)) +} + +pub fn on_enter_table_import( + visitor: BinaryModuleVisitor(ctx), + on_enter_table_import: VisitorCallback(ctx, Import), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_table_import: Some(on_enter_table_import), + ) +} + +pub fn on_exit_table_import( + visitor: BinaryModuleVisitor(ctx), + on_exit_table_import: VisitorCallback(ctx, Import), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_table_import: Some(on_exit_table_import), + ) +} + +pub fn on_enter_mem_import( + visitor: BinaryModuleVisitor(ctx), + on_enter_mem_import: VisitorCallback(ctx, Import), +) { + BinaryModuleVisitor(..visitor, on_enter_mem_import: Some(on_enter_mem_import)) +} + +pub fn on_exit_mem_import( + visitor: BinaryModuleVisitor(ctx), + on_exit_mem_import: VisitorCallback(ctx, Import), +) { + BinaryModuleVisitor(..visitor, on_exit_mem_import: Some(on_exit_mem_import)) +} + +pub fn on_enter_global_import( + visitor: BinaryModuleVisitor(ctx), + on_enter_global_import: VisitorCallback(ctx, Import), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_global_import: Some(on_enter_global_import), + ) +} + +pub fn on_exit_global_import( + visitor: BinaryModuleVisitor(ctx), + on_exit_global_import: VisitorCallback(ctx, Import), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_global_import: Some(on_exit_global_import), + ) +} + +pub fn on_enter_table_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_table_type: VisitorCallback(ctx, TableType), +) { + BinaryModuleVisitor(..visitor, on_enter_table_type: Some(on_enter_table_type)) +} + +pub fn on_exit_table_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_table_type: VisitorCallback(ctx, TableType), +) { + BinaryModuleVisitor(..visitor, on_exit_table_type: Some(on_exit_table_type)) +} + +pub fn on_enter_table( + visitor: BinaryModuleVisitor(ctx), + on_enter_table: VisitorCallback(ctx, Table), +) { + BinaryModuleVisitor(..visitor, on_enter_table: Some(on_enter_table)) +} + +pub fn on_exit_table( + visitor: BinaryModuleVisitor(ctx), + on_exit_table: VisitorCallback(ctx, Table), +) { + BinaryModuleVisitor(..visitor, on_exit_table: Some(on_exit_table)) +} + +pub fn on_enter_global( + visitor: BinaryModuleVisitor(ctx), + on_enter_global: VisitorCallback(ctx, Global), +) { + BinaryModuleVisitor(..visitor, on_enter_global: Some(on_enter_global)) +} + +pub fn on_exit_global( + visitor: BinaryModuleVisitor(ctx), + on_exit_global: VisitorCallback(ctx, Global), +) { + BinaryModuleVisitor(..visitor, on_exit_global: Some(on_exit_global)) +} + +pub fn on_enter_global_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_global_type: VisitorCallback(ctx, GlobalType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_global_type: Some(on_enter_global_type), + ) +} + +pub fn on_exit_global_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_global_type: VisitorCallback(ctx, GlobalType), +) { + BinaryModuleVisitor(..visitor, on_exit_global_type: Some(on_exit_global_type)) +} + +pub fn on_enter_mem_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_mem_type: VisitorCallback(ctx, MemType), +) { + BinaryModuleVisitor(..visitor, on_enter_mem_type: Some(on_enter_mem_type)) +} + +pub fn on_exit_mem_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_mem_type: VisitorCallback(ctx, MemType), +) { + BinaryModuleVisitor(..visitor, on_exit_mem_type: Some(on_exit_mem_type)) +} + +pub fn on_enter_def_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_def_type: VisitorCallback(ctx, DefType), +) { + BinaryModuleVisitor(..visitor, on_enter_def_type: Some(on_enter_def_type)) +} + +pub fn on_exit_def_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_def_type: VisitorCallback(ctx, DefType), +) { + BinaryModuleVisitor(..visitor, on_exit_def_type: Some(on_exit_def_type)) +} + +pub fn on_enter_rec_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_rec_type: VisitorCallback(ctx, RecType), +) { + BinaryModuleVisitor(..visitor, on_enter_rec_type: Some(on_enter_rec_type)) +} + +pub fn on_exit_rec_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_rec_type: VisitorCallback(ctx, RecType), +) { + BinaryModuleVisitor(..visitor, on_exit_rec_type: Some(on_exit_rec_type)) +} + +pub fn on_enter_sub_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_sub_type: VisitorCallback(ctx, SubType), +) { + BinaryModuleVisitor(..visitor, on_enter_sub_type: Some(on_enter_sub_type)) +} + +pub fn on_exit_sub_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_sub_type: VisitorCallback(ctx, SubType), +) { + BinaryModuleVisitor(..visitor, on_exit_sub_type: Some(on_exit_sub_type)) +} + +pub fn on_enter_type_idx( + visitor: BinaryModuleVisitor(ctx), + on_enter_type_idx: VisitorCallback(ctx, TypeIDX), +) { + BinaryModuleVisitor(..visitor, on_enter_type_idx: Some(on_enter_type_idx)) +} + +pub fn on_exit_type_idx( + visitor: BinaryModuleVisitor(ctx), + on_exit_type_idx: VisitorCallback(ctx, TypeIDX), +) { + BinaryModuleVisitor(..visitor, on_exit_type_idx: Some(on_exit_type_idx)) +} + +pub fn on_enter_rec_type_idx( + visitor: BinaryModuleVisitor(ctx), + on_enter_rec_type_idx: VisitorCallback(ctx, TypeIDX), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_rec_type_idx: Some(on_enter_rec_type_idx), + ) +} + +pub fn on_exit_rec_type_idx( + visitor: BinaryModuleVisitor(ctx), + on_exit_rec_type_idx: VisitorCallback(ctx, TypeIDX), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_rec_type_idx: Some(on_exit_rec_type_idx), + ) +} + +pub fn on_enter_def_type_reference( + visitor: BinaryModuleVisitor(ctx), + on_enter_def_type_reference: VisitorCallback(ctx, TypeIDX), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_def_type_reference: Some(on_enter_def_type_reference), + ) +} + +pub fn on_exit_def_type_reference( + visitor: BinaryModuleVisitor(ctx), + on_exit_def_type_reference: VisitorCallback(ctx, TypeIDX), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_def_type_reference: Some(on_exit_def_type_reference), + ) +} + +pub fn on_enter_comp_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_comp_type: VisitorCallback(ctx, CompositeType), +) { + BinaryModuleVisitor(..visitor, on_enter_comp_type: Some(on_enter_comp_type)) +} + +pub fn on_exit_comp_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_comp_type: VisitorCallback(ctx, CompositeType), +) { + BinaryModuleVisitor(..visitor, on_exit_comp_type: Some(on_exit_comp_type)) +} + +pub fn on_enter_composite_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_composite_type: VisitorCallback(ctx, CompositeType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_composite_type: Some(on_enter_composite_type), + ) +} + +pub fn on_exit_composite_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_composite_type: VisitorCallback(ctx, CompositeType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_composite_type: Some(on_exit_composite_type), + ) +} + +pub fn on_enter_func_composite_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_func_composite_type: VisitorCallback(ctx, CompositeType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_func_composite_type: Some(on_enter_func_composite_type), + ) +} + +pub fn on_exit_func_composite_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_func_composite_type: VisitorCallback(ctx, CompositeType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_func_composite_type: Some(on_exit_func_composite_type), + ) +} + +pub fn on_enter_struct_composite_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_struct_composite_type: VisitorCallback(ctx, CompositeType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_struct_composite_type: Some(on_enter_struct_composite_type), + ) +} + +pub fn on_exit_struct_composite_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_struct_composite_type: VisitorCallback(ctx, CompositeType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_struct_composite_type: Some(on_exit_struct_composite_type), + ) +} + +pub fn on_enter_array_composite_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_composite_type: VisitorCallback(ctx, CompositeType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_array_composite_type: Some(on_enter_array_composite_type), + ) +} + +pub fn on_exit_array_composite_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_composite_type: VisitorCallback(ctx, CompositeType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_array_composite_type: Some(on_exit_array_composite_type), + ) +} + +pub fn on_enter_func_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_func_type: VisitorCallback(ctx, FuncType), +) { + BinaryModuleVisitor(..visitor, on_enter_func_type: Some(on_enter_func_type)) +} + +pub fn on_enter_val_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_val_type: VisitorCallback(ctx, ValType), +) { + BinaryModuleVisitor(..visitor, on_enter_val_type: Some(on_enter_val_type)) +} + +pub fn on_exit_val_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_val_type: VisitorCallback(ctx, ValType), +) { + BinaryModuleVisitor(..visitor, on_exit_val_type: Some(on_exit_val_type)) +} + +pub fn on_exit_func_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_func_type: VisitorCallback(ctx, FuncType), +) { + BinaryModuleVisitor(..visitor, on_exit_func_type: Some(on_exit_func_type)) +} + +pub fn on_enter_v128_val_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_v128_val_type: VisitorCallback(ctx, ValType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_v128_val_type: Some(on_enter_v128_val_type), + ) +} + +pub fn on_exit_v128_val_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_v128_val_type: VisitorCallback(ctx, ValType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_v128_val_type: Some(on_exit_v128_val_type), + ) +} + +pub fn on_enter_i32_val_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_i32_val_type: VisitorCallback(ctx, ValType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_i32_val_type: Some(on_enter_i32_val_type), + ) +} + +pub fn on_exit_i32_val_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_i32_val_type: VisitorCallback(ctx, ValType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_i32_val_type: Some(on_exit_i32_val_type), + ) +} + +pub fn on_enter_i64_val_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_i64_val_type: VisitorCallback(ctx, ValType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_i64_val_type: Some(on_enter_i64_val_type), + ) +} + +pub fn on_exit_i64_val_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_i64_val_type: VisitorCallback(ctx, ValType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_i64_val_type: Some(on_exit_i64_val_type), + ) +} + +pub fn on_enter_f32_val_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_f32_val_type: VisitorCallback(ctx, ValType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_f32_val_type: Some(on_enter_f32_val_type), + ) +} + +pub fn on_exit_f32_val_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_f32_val_type: VisitorCallback(ctx, ValType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_f32_val_type: Some(on_exit_f32_val_type), + ) +} + +pub fn on_enter_f64_val_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_f64_val_type: VisitorCallback(ctx, ValType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_f64_val_type: Some(on_enter_f64_val_type), + ) +} + +pub fn on_exit_f64_val_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_f64_val_type: VisitorCallback(ctx, ValType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_f64_val_type: Some(on_exit_f64_val_type), + ) +} + +pub fn on_enter_ref_type_val_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_ref_type_val_type: VisitorCallback(ctx, ValType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_ref_type_val_type: Some(on_enter_ref_type_val_type), + ) +} + +pub fn on_exit_ref_type_val_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_ref_type_val_type: VisitorCallback(ctx, ValType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_ref_type_val_type: Some(on_exit_ref_type_val_type), + ) +} + +pub fn on_enter_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor(..visitor, on_enter_ref_type: Some(on_enter_ref_type)) +} + +pub fn on_exit_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor(..visitor, on_exit_ref_type: Some(on_exit_ref_type)) +} + +pub fn on_enter_heap_type_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_heap_type_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_heap_type_ref_type: Some(on_enter_heap_type_ref_type), + ) +} + +pub fn on_exit_heap_type_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_heap_type_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_heap_type_ref_type: Some(on_exit_heap_type_ref_type), + ) +} + +pub fn on_enter_any_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_any_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_any_ref_type: Some(on_enter_any_ref_type), + ) +} + +pub fn on_exit_any_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_any_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_any_ref_type: Some(on_exit_any_ref_type), + ) +} + +pub fn on_enter_eq_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_eq_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_eq_ref_type: Some(on_enter_eq_ref_type), + ) +} + +pub fn on_exit_eq_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_eq_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor(..visitor, on_exit_eq_ref_type: Some(on_exit_eq_ref_type)) +} + +pub fn on_enter_i31_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_i31_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_i31_ref_type: Some(on_enter_i31_ref_type), + ) +} + +pub fn on_exit_i31_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_i31_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_i31_ref_type: Some(on_exit_i31_ref_type), + ) +} + +pub fn on_enter_struct_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_struct_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_struct_ref_type: Some(on_enter_struct_ref_type), + ) +} + +pub fn on_exit_struct_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_struct_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_struct_ref_type: Some(on_exit_struct_ref_type), + ) +} + +pub fn on_enter_array_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_array_ref_type: Some(on_enter_array_ref_type), + ) +} + +pub fn on_exit_array_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_array_ref_type: Some(on_exit_array_ref_type), + ) +} + +pub fn on_enter_func_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_func_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_func_ref_type: Some(on_enter_func_ref_type), + ) +} + +pub fn on_exit_func_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_func_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_func_ref_type: Some(on_exit_func_ref_type), + ) +} + +pub fn on_enter_extern_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_extern_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_extern_ref_type: Some(on_enter_extern_ref_type), + ) +} + +pub fn on_exit_extern_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_extern_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_extern_ref_type: Some(on_exit_extern_ref_type), + ) +} + +pub fn on_enter_none_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_none_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_none_ref_type: Some(on_enter_none_ref_type), + ) +} + +pub fn on_exit_none_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_none_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_none_ref_type: Some(on_exit_none_ref_type), + ) +} + +pub fn on_enter_no_func_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_no_func_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_no_func_ref_type: Some(on_enter_no_func_ref_type), + ) +} + +pub fn on_exit_no_func_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_no_func_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_no_func_ref_type: Some(on_exit_no_func_ref_type), + ) +} + +pub fn on_enter_no_extern_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_no_extern_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_no_extern_ref_type: Some(on_enter_no_extern_ref_type), + ) +} + +pub fn on_exit_no_extern_ref_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_no_extern_ref_type: VisitorCallback(ctx, RefType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_no_extern_ref_type: Some(on_exit_no_extern_ref_type), + ) +} + +pub fn on_enter_struct_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_struct_type: VisitorCallback(ctx, StructType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_struct_type: Some(on_enter_struct_type), + ) +} + +pub fn on_exit_struct_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_struct_type: VisitorCallback(ctx, StructType), +) { + BinaryModuleVisitor(..visitor, on_exit_struct_type: Some(on_exit_struct_type)) +} + +pub fn on_enter_field_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_field_type: VisitorCallback(ctx, FieldType), +) { + BinaryModuleVisitor(..visitor, on_enter_field_type: Some(on_enter_field_type)) +} + +pub fn on_exit_field_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_field_type: VisitorCallback(ctx, FieldType), +) { + BinaryModuleVisitor(..visitor, on_exit_field_type: Some(on_exit_field_type)) +} + +pub fn on_enter_storage_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_storage_type: VisitorCallback(ctx, StorageType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_storage_type: Some(on_enter_storage_type), + ) +} + +pub fn on_enter_i8_storage_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_i8_storage_type: VisitorCallback(ctx, StorageType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_i8_storage_type: Some(on_enter_i8_storage_type), + ) +} + +pub fn on_enter_i16_storage_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_i16_storage_type: VisitorCallback(ctx, StorageType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_i16_storage_type: Some(on_enter_i16_storage_type), + ) +} + +pub fn on_enter_val_type_storage_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_val_type_storage_type: VisitorCallback(ctx, StorageType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_val_type_storage_type: Some(on_enter_val_type_storage_type), + ) +} + +pub fn on_exit_i8_storage_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_i8_storage_type: VisitorCallback(ctx, StorageType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_i8_storage_type: Some(on_exit_i8_storage_type), + ) +} + +pub fn on_exit_i16_storage_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_i16_storage_type: VisitorCallback(ctx, StorageType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_i16_storage_type: Some(on_exit_i16_storage_type), + ) +} + +pub fn on_exit_val_type_storage_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_val_type_storage_type: VisitorCallback(ctx, StorageType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_val_type_storage_type: Some(on_exit_val_type_storage_type), + ) +} + +pub fn on_exit_storage_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_storage_type: VisitorCallback(ctx, StorageType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_storage_type: Some(on_exit_storage_type), + ) +} + +pub fn on_enter_array_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_type: VisitorCallback(ctx, ArrayType), +) { + BinaryModuleVisitor(..visitor, on_enter_array_type: Some(on_enter_array_type)) +} + +pub fn on_exit_array_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_type: VisitorCallback(ctx, ArrayType), +) { + BinaryModuleVisitor(..visitor, on_exit_array_type: Some(on_exit_array_type)) +} + +pub fn on_enter_function_section( + visitor: BinaryModuleVisitor(ctx), + on_enter_function_section: VisitorCallback(ctx, Option(FunctionSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_function_section: Some(on_enter_function_section), + ) +} + +pub fn on_exit_function_section( + visitor: BinaryModuleVisitor(ctx), + on_exit_function_section: VisitorCallback(ctx, Option(FunctionSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_function_section: Some(on_exit_function_section), + ) +} + +pub fn on_enter_code_section( + visitor: BinaryModuleVisitor(ctx), + on_enter_code_section: VisitorCallback(ctx, Option(CodeSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_code_section: Some(on_enter_code_section), + ) +} + +pub fn on_exit_code_section( + visitor: BinaryModuleVisitor(ctx), + on_exit_code_section: VisitorCallback(ctx, Option(CodeSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_code_section: Some(on_exit_code_section), + ) +} + +pub fn on_enter_func_idx( + visitor: BinaryModuleVisitor(ctx), + on_enter_func_idx: VisitorCallback(ctx, FuncIDX), +) { + BinaryModuleVisitor(..visitor, on_enter_func_idx: Some(on_enter_func_idx)) +} + +pub fn on_exit_func_idx( + visitor: BinaryModuleVisitor(ctx), + on_exit_func_idx: VisitorCallback(ctx, FuncIDX), +) { + BinaryModuleVisitor(..visitor, on_exit_func_idx: Some(on_exit_func_idx)) +} + +pub fn on_enter_table_idx( + visitor: BinaryModuleVisitor(ctx), + on_enter_table_idx: VisitorCallback(ctx, TableIDX), +) { + BinaryModuleVisitor(..visitor, on_enter_table_idx: Some(on_enter_table_idx)) +} + +pub fn on_exit_table_idx( + visitor: BinaryModuleVisitor(ctx), + on_exit_table_idx: VisitorCallback(ctx, TableIDX), +) { + BinaryModuleVisitor(..visitor, on_exit_table_idx: Some(on_exit_table_idx)) +} + +pub fn on_enter_mem_idx( + visitor: BinaryModuleVisitor(ctx), + on_enter_mem_idx: VisitorCallback(ctx, MemIDX), +) { + BinaryModuleVisitor(..visitor, on_enter_mem_idx: Some(on_enter_mem_idx)) +} + +pub fn on_exit_mem_idx( + visitor: BinaryModuleVisitor(ctx), + on_exit_mem_idx: VisitorCallback(ctx, MemIDX), +) { + BinaryModuleVisitor(..visitor, on_exit_mem_idx: Some(on_exit_mem_idx)) +} + +pub fn on_enter_global_idx( + visitor: BinaryModuleVisitor(ctx), + on_enter_global_idx: VisitorCallback(ctx, GlobalIDX), +) { + BinaryModuleVisitor(..visitor, on_enter_global_idx: Some(on_enter_global_idx)) +} + +pub fn on_exit_global_idx( + visitor: BinaryModuleVisitor(ctx), + on_exit_global_idx: VisitorCallback(ctx, GlobalIDX), +) { + BinaryModuleVisitor(..visitor, on_exit_global_idx: Some(on_exit_global_idx)) +} + +pub fn on_enter_elem_expressions( + visitor: BinaryModuleVisitor(ctx), + on_enter_elem_expressions: VisitorCallback(ctx, Elem), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_elem_expressions: Some(on_enter_elem_expressions), + ) +} + +pub fn on_exit_elem_expressions( + visitor: BinaryModuleVisitor(ctx), + on_exit_elem_expressions: VisitorCallback(ctx, Elem), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_elem_expressions: Some(on_exit_elem_expressions), + ) +} + +pub fn on_enter_elem_funcs( + visitor: BinaryModuleVisitor(ctx), + on_enter_elem_funcs: VisitorCallback(ctx, Elem), +) { + BinaryModuleVisitor(..visitor, on_enter_elem_funcs: Some(on_enter_elem_funcs)) +} + +pub fn on_exit_elem_funcs( + visitor: BinaryModuleVisitor(ctx), + on_exit_elem_funcs: VisitorCallback(ctx, Elem), +) { + BinaryModuleVisitor(..visitor, on_exit_elem_funcs: Some(on_exit_elem_funcs)) +} + +pub fn on_enter_global_section( + visitor: BinaryModuleVisitor(ctx), + on_enter_global_section: VisitorCallback(ctx, Option(GlobalSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_global_section: Some(on_enter_global_section), + ) +} + +pub fn on_exit_global_section( + visitor: BinaryModuleVisitor(ctx), + on_exit_global_section: VisitorCallback(ctx, Option(GlobalSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_global_section: Some(on_exit_global_section), + ) +} + +pub fn on_enter_export_section( + visitor: BinaryModuleVisitor(ctx), + on_enter_export_section: VisitorCallback(ctx, Option(ExportSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_export_section: Some(on_enter_export_section), + ) +} + +pub fn on_exit_export_section( + visitor: BinaryModuleVisitor(ctx), + on_exit_export_section: VisitorCallback(ctx, Option(ExportSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_export_section: Some(on_exit_export_section), + ) +} + +pub fn on_enter_export( + visitor: BinaryModuleVisitor(ctx), + on_enter_export: VisitorCallback(ctx, Export), +) { + BinaryModuleVisitor(..visitor, on_enter_export: Some(on_enter_export)) +} + +pub fn on_exit_export( + visitor: BinaryModuleVisitor(ctx), + on_exit_export: VisitorCallback(ctx, Export), +) { + BinaryModuleVisitor(..visitor, on_exit_export: Some(on_exit_export)) +} + +pub fn on_enter_func_export( + visitor: BinaryModuleVisitor(ctx), + on_enter_func_export: VisitorCallback(ctx, Export), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_func_export: Some(on_enter_func_export), + ) +} + +pub fn on_exit_func_export( + visitor: BinaryModuleVisitor(ctx), + on_exit_func_export: VisitorCallback(ctx, Export), +) { + BinaryModuleVisitor(..visitor, on_exit_func_export: Some(on_exit_func_export)) +} + +pub fn on_enter_table_export( + visitor: BinaryModuleVisitor(ctx), + on_enter_table_export: VisitorCallback(ctx, Export), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_table_export: Some(on_enter_table_export), + ) +} + +pub fn on_exit_table_export( + visitor: BinaryModuleVisitor(ctx), + on_exit_table_export: VisitorCallback(ctx, Export), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_table_export: Some(on_exit_table_export), + ) +} + +pub fn on_enter_mem_export( + visitor: BinaryModuleVisitor(ctx), + on_enter_mem_export: VisitorCallback(ctx, Export), +) { + BinaryModuleVisitor(..visitor, on_enter_mem_export: Some(on_enter_mem_export)) +} + +pub fn on_exit_mem_export( + visitor: BinaryModuleVisitor(ctx), + on_exit_mem_export: VisitorCallback(ctx, Export), +) { + BinaryModuleVisitor(..visitor, on_exit_mem_export: Some(on_exit_mem_export)) +} + +pub fn on_enter_global_export( + visitor: BinaryModuleVisitor(ctx), + on_enter_global_export: VisitorCallback(ctx, Export), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_global_export: Some(on_enter_global_export), + ) +} + +pub fn on_exit_global_export( + visitor: BinaryModuleVisitor(ctx), + on_exit_global_export: VisitorCallback(ctx, Export), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_global_export: Some(on_exit_global_export), + ) +} + +pub fn on_enter_limits( + visitor: BinaryModuleVisitor(ctx), + on_enter_limits: VisitorCallback(ctx, Limits), +) { + BinaryModuleVisitor(..visitor, on_enter_limits: Some(on_enter_limits)) +} + +pub fn on_exit_limits( + visitor: BinaryModuleVisitor(ctx), + on_exit_limits: VisitorCallback(ctx, Limits), +) { + BinaryModuleVisitor(..visitor, on_exit_limits: Some(on_exit_limits)) +} + +pub fn on_enter_expr( + visitor: BinaryModuleVisitor(ctx), + on_enter_expr: VisitorCallback(ctx, Expr), +) { + BinaryModuleVisitor(..visitor, on_enter_expr: Some(on_enter_expr)) +} + +pub fn on_exit_expr( + visitor: BinaryModuleVisitor(ctx), + on_exit_expr: VisitorCallback(ctx, Expr), +) { + BinaryModuleVisitor(..visitor, on_exit_expr: Some(on_exit_expr)) +} + +pub fn on_enter_instruction( + visitor: BinaryModuleVisitor(ctx), + on_enter_instruction: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_instruction: Some(on_enter_instruction), + ) +} + +pub fn on_exit_instruction( + visitor: BinaryModuleVisitor(ctx), + on_exit_instruction: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_instruction: Some(on_exit_instruction)) +} + +pub fn on_enter_element_mode( + visitor: BinaryModuleVisitor(ctx), + on_enter_element_mode: VisitorCallback(ctx, ElemMode), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_element_mode: Some(on_enter_element_mode), + ) +} + +pub fn on_exit_element_mode( + visitor: BinaryModuleVisitor(ctx), + on_exit_element_mode: VisitorCallback(ctx, ElemMode), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_element_mode: Some(on_exit_element_mode), + ) +} + +pub fn on_enter_declarative_elem_mode( + visitor: BinaryModuleVisitor(ctx), + on_enter_declarative_elem_mode: VisitorCallback(ctx, ElemMode), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_declarative_elem_mode: Some(on_enter_declarative_elem_mode), + ) +} + +pub fn on_exit_declarative_elem_mode( + visitor: BinaryModuleVisitor(ctx), + on_exit_declarative_elem_mode: VisitorCallback(ctx, ElemMode), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_declarative_elem_mode: Some(on_exit_declarative_elem_mode), + ) +} + +pub fn on_enter_passive_elem_mode( + visitor: BinaryModuleVisitor(ctx), + on_enter_passive_elem_mode: VisitorCallback(ctx, ElemMode), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_passive_elem_mode: Some(on_enter_passive_elem_mode), + ) +} + +pub fn on_exit_passive_elem_mode( + visitor: BinaryModuleVisitor(ctx), + on_exit_passive_elem_mode: VisitorCallback(ctx, ElemMode), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_passive_elem_mode: Some(on_exit_passive_elem_mode), + ) +} + +pub fn on_enter_active_elem_mode( + visitor: BinaryModuleVisitor(ctx), + on_enter_active_elem_mode: VisitorCallback(ctx, ElemMode), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_active_elem_mode: Some(on_enter_active_elem_mode), + ) +} + +pub fn on_exit_active_elem_mode( + visitor: BinaryModuleVisitor(ctx), + on_exit_active_elem_mode: VisitorCallback(ctx, ElemMode), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_active_elem_mode: Some(on_exit_active_elem_mode), + ) +} + +pub fn on_enter_code( + visitor: BinaryModuleVisitor(ctx), + on_enter_code: VisitorCallback(ctx, Code), +) { + BinaryModuleVisitor(..visitor, on_enter_code: Some(on_enter_code)) +} + +pub fn on_exit_code( + visitor: BinaryModuleVisitor(ctx), + on_exit_code: VisitorCallback(ctx, Code), +) { + BinaryModuleVisitor(..visitor, on_exit_code: Some(on_exit_code)) +} + +pub fn on_enter_locals( + visitor: BinaryModuleVisitor(ctx), + on_enter_locals: VisitorCallback(ctx, Locals), +) { + BinaryModuleVisitor(..visitor, on_enter_locals: Some(on_enter_locals)) +} + +pub fn on_exit_locals( + visitor: BinaryModuleVisitor(ctx), + on_exit_locals: VisitorCallback(ctx, Locals), +) { + BinaryModuleVisitor(..visitor, on_exit_locals: Some(on_exit_locals)) +} + +pub fn on_enter_data_section( + visitor: BinaryModuleVisitor(ctx), + on_enter_data_section: VisitorCallback(ctx, Option(DataSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_data_section: Some(on_enter_data_section), + ) +} + +pub fn on_exit_data_section( + visitor: BinaryModuleVisitor(ctx), + on_exit_data_section: VisitorCallback(ctx, Option(DataSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_data_section: Some(on_exit_data_section), + ) +} + +pub fn on_enter_active_data( + visitor: BinaryModuleVisitor(ctx), + on_enter_active_data: VisitorCallback(ctx, Data), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_active_data: Some(on_enter_active_data), + ) +} + +pub fn on_exit_active_data( + visitor: BinaryModuleVisitor(ctx), + on_exit_active_data: VisitorCallback(ctx, Data), +) { + BinaryModuleVisitor(..visitor, on_exit_active_data: Some(on_exit_active_data)) +} + +pub fn on_enter_passive_data( + visitor: BinaryModuleVisitor(ctx), + on_enter_passive_data: VisitorCallback(ctx, Data), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_passive_data: Some(on_enter_passive_data), + ) +} + +pub fn on_exit_passive_data( + visitor: BinaryModuleVisitor(ctx), + on_exit_passive_data: VisitorCallback(ctx, Data), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_passive_data: Some(on_exit_passive_data), + ) +} + +pub fn on_enter_data( + visitor: BinaryModuleVisitor(ctx), + on_enter_data: VisitorCallback(ctx, Data), +) { + BinaryModuleVisitor(..visitor, on_enter_data: Some(on_enter_data)) +} + +pub fn on_exit_data( + visitor: BinaryModuleVisitor(ctx), + on_exit_data: VisitorCallback(ctx, Data), +) { + BinaryModuleVisitor(..visitor, on_exit_data: Some(on_exit_data)) +} + +pub fn on_enter_data_count_section( + visitor: BinaryModuleVisitor(ctx), + on_enter_data_count_section: VisitorCallback(ctx, Option(DataCountSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_data_count_section: Some(on_enter_data_count_section), + ) +} + +pub fn on_exit_data_count_section( + visitor: BinaryModuleVisitor(ctx), + on_exit_data_count_section: VisitorCallback(ctx, Option(DataCountSection)), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_data_count_section: Some(on_exit_data_count_section), + ) +} + +pub fn on_enter_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor(..visitor, on_enter_heap_type: Some(on_enter_heap_type)) +} + +pub fn on_exit_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor(..visitor, on_exit_heap_type: Some(on_exit_heap_type)) +} + +pub fn on_enter_func_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_func_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_func_heap_type: Some(on_enter_func_heap_type), + ) +} + +pub fn on_exit_func_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_func_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_func_heap_type: Some(on_exit_func_heap_type), + ) +} + +pub fn on_enter_no_func_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_no_func_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_no_func_heap_type: Some(on_enter_no_func_heap_type), + ) +} + +pub fn on_exit_no_func_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_no_func_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_no_func_heap_type: Some(on_exit_no_func_heap_type), + ) +} + +pub fn on_enter_extern_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_extern_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_extern_heap_type: Some(on_enter_extern_heap_type), + ) +} + +pub fn on_exit_extern_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_extern_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_extern_heap_type: Some(on_exit_extern_heap_type), + ) +} + +pub fn on_enter_no_extern_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_no_extern_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_no_extern_heap_type: Some(on_enter_no_extern_heap_type), + ) +} + +pub fn on_exit_no_extern_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_no_extern_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_no_extern_heap_type: Some(on_exit_no_extern_heap_type), + ) +} + +pub fn on_enter_any_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_any_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_any_heap_type: Some(on_enter_any_heap_type), + ) +} + +pub fn on_exit_any_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_any_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_any_heap_type: Some(on_exit_any_heap_type), + ) +} + +pub fn on_enter_eq_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_eq_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_eq_heap_type: Some(on_enter_eq_heap_type), + ) +} + +pub fn on_exit_eq_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_eq_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_eq_heap_type: Some(on_exit_eq_heap_type), + ) +} + +pub fn on_enter_i31_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_i31_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_i31_heap_type: Some(on_enter_i31_heap_type), + ) +} + +pub fn on_exit_i31_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_i31_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_i31_heap_type: Some(on_exit_i31_heap_type), + ) +} + +pub fn on_enter_struct_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_struct_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_struct_heap_type: Some(on_enter_struct_heap_type), + ) +} + +pub fn on_exit_struct_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_struct_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_struct_heap_type: Some(on_exit_struct_heap_type), + ) +} + +pub fn on_enter_array_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_array_heap_type: Some(on_enter_array_heap_type), + ) +} + +pub fn on_exit_array_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_array_heap_type: Some(on_exit_array_heap_type), + ) +} + +pub fn on_enter_none_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_none_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_none_heap_type: Some(on_enter_none_heap_type), + ) +} + +pub fn on_exit_none_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_none_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_none_heap_type: Some(on_exit_none_heap_type), + ) +} + +pub fn on_enter_concrete_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_concrete_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_concrete_heap_type: Some(on_enter_concrete_heap_type), + ) +} + +pub fn on_exit_concrete_heap_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_concrete_heap_type: VisitorCallback(ctx, HeapType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_concrete_heap_type: Some(on_exit_concrete_heap_type), + ) +} + +pub fn on_enter_ref_null( + visitor: BinaryModuleVisitor(ctx), + on_enter_ref_null: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_ref_null: Some(on_enter_ref_null)) +} + +pub fn on_exit_ref_null( + visitor: BinaryModuleVisitor(ctx), + on_exit_ref_null: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_ref_null: Some(on_exit_ref_null)) +} + +pub fn on_enter_ref_func( + visitor: BinaryModuleVisitor(ctx), + on_enter_ref_func: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_ref_func: Some(on_enter_ref_func)) +} + +pub fn on_exit_ref_func( + visitor: BinaryModuleVisitor(ctx), + on_exit_ref_func: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_ref_func: Some(on_exit_ref_func)) +} + +pub fn on_enter_ref_test( + visitor: BinaryModuleVisitor(ctx), + on_enter_ref_test: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_ref_test: Some(on_enter_ref_test)) +} + +pub fn on_exit_ref_test( + visitor: BinaryModuleVisitor(ctx), + on_exit_ref_test: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_ref_test: Some(on_exit_ref_test)) +} + +pub fn on_enter_ref_test_nullable( + visitor: BinaryModuleVisitor(ctx), + on_enter_ref_test_nullable: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_ref_test_nullable: Some(on_enter_ref_test_nullable), + ) +} + +pub fn on_exit_ref_test_nullable( + visitor: BinaryModuleVisitor(ctx), + on_exit_ref_test_nullable: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_ref_test_nullable: Some(on_exit_ref_test_nullable), + ) +} + +pub fn on_enter_ref_cast( + visitor: BinaryModuleVisitor(ctx), + on_enter_ref_cast: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_ref_cast: Some(on_enter_ref_cast)) +} + +pub fn on_exit_ref_cast( + visitor: BinaryModuleVisitor(ctx), + on_exit_ref_cast: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_ref_cast: Some(on_exit_ref_cast)) +} + +pub fn on_enter_ref_cast_nullable( + visitor: BinaryModuleVisitor(ctx), + on_enter_ref_cast_nullable: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_ref_cast_nullable: Some(on_enter_ref_cast_nullable), + ) +} + +pub fn on_exit_ref_cast_nullable( + visitor: BinaryModuleVisitor(ctx), + on_exit_ref_cast_nullable: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_ref_cast_nullable: Some(on_exit_ref_cast_nullable), + ) +} + +pub fn on_enter_struct_get( + visitor: BinaryModuleVisitor(ctx), + on_enter_struct_get: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_struct_get: Some(on_enter_struct_get)) +} + +pub fn on_exit_struct_get( + visitor: BinaryModuleVisitor(ctx), + on_exit_struct_get: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_struct_get: Some(on_exit_struct_get)) +} + +pub fn on_enter_struct_get_s( + visitor: BinaryModuleVisitor(ctx), + on_enter_struct_get_s: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_struct_get_s: Some(on_enter_struct_get_s), + ) +} + +pub fn on_exit_struct_get_s( + visitor: BinaryModuleVisitor(ctx), + on_exit_struct_get_s: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_struct_get_s: Some(on_exit_struct_get_s), + ) +} + +pub fn on_enter_struct_get_u( + visitor: BinaryModuleVisitor(ctx), + on_enter_struct_get_u: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_struct_get_u: Some(on_enter_struct_get_u), + ) +} + +pub fn on_exit_struct_get_u( + visitor: BinaryModuleVisitor(ctx), + on_exit_struct_get_u: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_struct_get_u: Some(on_exit_struct_get_u), + ) +} + +pub fn on_enter_struct_set( + visitor: BinaryModuleVisitor(ctx), + on_enter_struct_set: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_struct_set: Some(on_enter_struct_set)) +} + +pub fn on_exit_struct_set( + visitor: BinaryModuleVisitor(ctx), + on_exit_struct_set: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_struct_set: Some(on_exit_struct_set)) +} + +pub fn on_enter_array_new( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_new: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_array_new: Some(on_enter_array_new)) +} + +pub fn on_exit_array_new( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_new: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_array_new: Some(on_exit_array_new)) +} + +pub fn on_enter_array_new_default( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_new_default: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_array_new_default: Some(on_enter_array_new_default), + ) +} + +pub fn on_exit_array_new_default( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_new_default: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_array_new_default: Some(on_exit_array_new_default), + ) +} + +pub fn on_enter_array_new_data( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_new_data: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_array_new_data: Some(on_enter_array_new_data), + ) +} + +pub fn on_exit_array_new_data( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_new_data: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_array_new_data: Some(on_exit_array_new_data), + ) +} + +pub fn on_enter_array_new_elem( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_new_elem: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_array_new_elem: Some(on_enter_array_new_elem), + ) +} + +pub fn on_exit_array_new_elem( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_new_elem: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_array_new_elem: Some(on_exit_array_new_elem), + ) +} + +pub fn on_enter_array_new_fixed( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_new_fixed: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_array_new_fixed: Some(on_enter_array_new_fixed), + ) +} + +pub fn on_exit_array_new_fixed( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_new_fixed: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_array_new_fixed: Some(on_exit_array_new_fixed), + ) +} + +pub fn on_enter_array_get( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_get: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_array_get: Some(on_enter_array_get)) +} + +pub fn on_exit_array_get( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_get: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_array_get: Some(on_exit_array_get)) +} + +pub fn on_enter_array_get_s( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_get_s: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_array_get_s: Some(on_enter_array_get_s), + ) +} + +pub fn on_exit_array_get_s( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_get_s: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_array_get_s: Some(on_exit_array_get_s)) +} + +pub fn on_enter_array_get_u( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_get_u: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_array_get_u: Some(on_enter_array_get_u), + ) +} + +pub fn on_exit_array_get_u( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_get_u: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_array_get_u: Some(on_exit_array_get_u)) +} + +pub fn on_enter_array_set( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_set: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_array_set: Some(on_enter_array_set)) +} + +pub fn on_exit_array_set( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_set: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_array_set: Some(on_exit_array_set)) +} + +pub fn on_enter_array_fill( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_fill: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_array_fill: Some(on_enter_array_fill)) +} + +pub fn on_exit_array_fill( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_fill: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_array_fill: Some(on_exit_array_fill)) +} + +pub fn on_enter_array_copy( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_copy: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_array_copy: Some(on_enter_array_copy)) +} + +pub fn on_exit_array_copy( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_copy: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_array_copy: Some(on_exit_array_copy)) +} + +pub fn on_enter_array_init_data( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_init_data: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_array_init_data: Some(on_enter_array_init_data), + ) +} + +pub fn on_exit_array_init_data( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_init_data: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_array_init_data: Some(on_exit_array_init_data), + ) +} + +pub fn on_enter_array_init_elem( + visitor: BinaryModuleVisitor(ctx), + on_enter_array_init_elem: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_array_init_elem: Some(on_enter_array_init_elem), + ) +} + +pub fn on_exit_array_init_elem( + visitor: BinaryModuleVisitor(ctx), + on_exit_array_init_elem: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_array_init_elem: Some(on_exit_array_init_elem), + ) +} + +pub fn on_enter_select_t( + visitor: BinaryModuleVisitor(ctx), + on_enter_select_t: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_select_t: Some(on_enter_select_t)) +} + +pub fn on_exit_select_t( + visitor: BinaryModuleVisitor(ctx), + on_exit_select_t: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_select_t: Some(on_exit_select_t)) +} + +pub fn on_enter_local_get( + visitor: BinaryModuleVisitor(ctx), + on_enter_local_get: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_local_get: Some(on_enter_local_get)) +} + +pub fn on_exit_local_get( + visitor: BinaryModuleVisitor(ctx), + on_exit_local_get: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_local_get: Some(on_exit_local_get)) +} + +pub fn on_enter_local_set( + visitor: BinaryModuleVisitor(ctx), + on_enter_local_set: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_local_set: Some(on_enter_local_set)) +} + +pub fn on_exit_local_set( + visitor: BinaryModuleVisitor(ctx), + on_exit_local_set: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_local_set: Some(on_exit_local_set)) +} + +pub fn on_enter_local_tee( + visitor: BinaryModuleVisitor(ctx), + on_enter_local_tee: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_local_tee: Some(on_enter_local_tee)) +} + +pub fn on_exit_local_tee( + visitor: BinaryModuleVisitor(ctx), + on_exit_local_tee: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_local_tee: Some(on_exit_local_tee)) +} + +pub fn on_enter_global_get( + visitor: BinaryModuleVisitor(ctx), + on_enter_global_get: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_global_get: Some(on_enter_global_get)) +} + +pub fn on_exit_global_get( + visitor: BinaryModuleVisitor(ctx), + on_exit_global_get: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_global_get: Some(on_exit_global_get)) +} + +pub fn on_enter_global_set( + visitor: BinaryModuleVisitor(ctx), + on_enter_global_set: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_global_set: Some(on_enter_global_set)) +} + +pub fn on_exit_global_set( + visitor: BinaryModuleVisitor(ctx), + on_exit_global_set: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_global_set: Some(on_exit_global_set)) +} + +pub fn on_enter_table_get( + visitor: BinaryModuleVisitor(ctx), + on_enter_table_get: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_table_get: Some(on_enter_table_get)) +} + +pub fn on_exit_table_get( + visitor: BinaryModuleVisitor(ctx), + on_exit_table_get: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_table_get: Some(on_exit_table_get)) +} + +pub fn on_enter_table_set( + visitor: BinaryModuleVisitor(ctx), + on_enter_table_set: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_table_set: Some(on_enter_table_set)) +} + +pub fn on_exit_table_set( + visitor: BinaryModuleVisitor(ctx), + on_exit_table_set: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_table_set: Some(on_exit_table_set)) +} + +pub fn on_enter_table_size( + visitor: BinaryModuleVisitor(ctx), + on_enter_table_size: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_table_size: Some(on_enter_table_size)) +} + +pub fn on_exit_table_size( + visitor: BinaryModuleVisitor(ctx), + on_exit_table_size: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_table_size: Some(on_exit_table_size)) +} + +pub fn on_enter_table_grow( + visitor: BinaryModuleVisitor(ctx), + on_enter_table_grow: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_table_grow: Some(on_enter_table_grow)) +} + +pub fn on_exit_table_grow( + visitor: BinaryModuleVisitor(ctx), + on_exit_table_grow: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_table_grow: Some(on_exit_table_grow)) +} + +pub fn on_enter_table_fill( + visitor: BinaryModuleVisitor(ctx), + on_enter_table_fill: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_table_fill: Some(on_enter_table_fill)) +} + +pub fn on_exit_table_fill( + visitor: BinaryModuleVisitor(ctx), + on_exit_table_fill: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_table_fill: Some(on_exit_table_fill)) +} + +pub fn on_enter_table_copy( + visitor: BinaryModuleVisitor(ctx), + on_enter_table_copy: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_table_copy: Some(on_enter_table_copy)) +} + +pub fn on_exit_table_copy( + visitor: BinaryModuleVisitor(ctx), + on_exit_table_copy: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_table_copy: Some(on_exit_table_copy)) +} + +pub fn on_enter_table_init( + visitor: BinaryModuleVisitor(ctx), + on_enter_table_init: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_table_init: Some(on_enter_table_init)) +} + +pub fn on_exit_table_init( + visitor: BinaryModuleVisitor(ctx), + on_exit_table_init: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_table_init: Some(on_exit_table_init)) +} + +pub fn on_enter_elem_drop( + visitor: BinaryModuleVisitor(ctx), + on_enter_elem_drop: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_elem_drop: Some(on_enter_elem_drop)) +} + +pub fn on_exit_elem_drop( + visitor: BinaryModuleVisitor(ctx), + on_exit_elem_drop: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_elem_drop: Some(on_exit_elem_drop)) +} + +pub fn on_enter_memory_init( + visitor: BinaryModuleVisitor(ctx), + on_enter_memory_init: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_memory_init: Some(on_enter_memory_init), + ) +} + +pub fn on_exit_memory_init( + visitor: BinaryModuleVisitor(ctx), + on_exit_memory_init: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_memory_init: Some(on_exit_memory_init)) +} + +pub fn on_enter_data_drop( + visitor: BinaryModuleVisitor(ctx), + on_enter_data_drop: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_data_drop: Some(on_enter_data_drop)) +} + +pub fn on_exit_data_drop( + visitor: BinaryModuleVisitor(ctx), + on_exit_data_drop: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_data_drop: Some(on_exit_data_drop)) +} + +pub fn on_enter_block( + visitor: BinaryModuleVisitor(ctx), + on_enter_block: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_block: Some(on_enter_block)) +} + +pub fn on_exit_block( + visitor: BinaryModuleVisitor(ctx), + on_exit_block: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_block: Some(on_exit_block)) +} + +pub fn on_enter_loop( + visitor: BinaryModuleVisitor(ctx), + on_enter_loop: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_loop: Some(on_enter_loop)) +} + +pub fn on_exit_loop( + visitor: BinaryModuleVisitor(ctx), + on_exit_loop: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_loop: Some(on_exit_loop)) +} + +pub fn on_enter_if( + visitor: BinaryModuleVisitor(ctx), + on_enter_if: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_if: Some(on_enter_if)) +} + +pub fn on_exit_if( + visitor: BinaryModuleVisitor(ctx), + on_exit_if: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_if: Some(on_exit_if)) +} + +pub fn on_enter_br( + visitor: BinaryModuleVisitor(ctx), + on_enter_br: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_br: Some(on_enter_br)) +} + +pub fn on_exit_br( + visitor: BinaryModuleVisitor(ctx), + on_exit_br: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_br: Some(on_exit_br)) +} + +pub fn on_enter_br_if( + visitor: BinaryModuleVisitor(ctx), + on_enter_br_if: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_br_if: Some(on_enter_br_if)) +} + +pub fn on_exit_br_if( + visitor: BinaryModuleVisitor(ctx), + on_exit_br_if: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_br_if: Some(on_exit_br_if)) +} + +pub fn on_enter_br_table( + visitor: BinaryModuleVisitor(ctx), + on_enter_br_table: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_br_table: Some(on_enter_br_table)) +} + +pub fn on_exit_br_table( + visitor: BinaryModuleVisitor(ctx), + on_exit_br_table: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_br_table: Some(on_exit_br_table)) +} + +pub fn on_enter_br_on_null( + visitor: BinaryModuleVisitor(ctx), + on_enter_br_on_null: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_br_on_null: Some(on_enter_br_on_null)) +} + +pub fn on_exit_br_on_null( + visitor: BinaryModuleVisitor(ctx), + on_exit_br_on_null: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_br_on_null: Some(on_exit_br_on_null)) +} + +pub fn on_enter_br_on_non_null( + visitor: BinaryModuleVisitor(ctx), + on_enter_br_on_non_null: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_br_on_non_null: Some(on_enter_br_on_non_null), + ) +} + +pub fn on_exit_br_on_non_null( + visitor: BinaryModuleVisitor(ctx), + on_exit_br_on_non_null: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_br_on_non_null: Some(on_exit_br_on_non_null), + ) +} + +pub fn on_enter_br_on_cast( + visitor: BinaryModuleVisitor(ctx), + on_enter_br_on_cast: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_br_on_cast: Some(on_enter_br_on_cast)) +} + +pub fn on_exit_br_on_cast( + visitor: BinaryModuleVisitor(ctx), + on_exit_br_on_cast: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_br_on_cast: Some(on_exit_br_on_cast)) +} + +pub fn on_enter_br_on_cast_fail( + visitor: BinaryModuleVisitor(ctx), + on_enter_br_on_cast_fail: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_br_on_cast_fail: Some(on_enter_br_on_cast_fail), + ) +} + +pub fn on_exit_br_on_cast_fail( + visitor: BinaryModuleVisitor(ctx), + on_exit_br_on_cast_fail: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_br_on_cast_fail: Some(on_exit_br_on_cast_fail), + ) +} + +pub fn on_enter_call( + visitor: BinaryModuleVisitor(ctx), + on_enter_call: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_call: Some(on_enter_call)) +} + +pub fn on_exit_call( + visitor: BinaryModuleVisitor(ctx), + on_exit_call: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_call: Some(on_exit_call)) +} + +pub fn on_enter_call_ref( + visitor: BinaryModuleVisitor(ctx), + on_enter_call_ref: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_enter_call_ref: Some(on_enter_call_ref)) +} + +pub fn on_exit_call_ref( + visitor: BinaryModuleVisitor(ctx), + on_exit_call_ref: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_call_ref: Some(on_exit_call_ref)) +} + +pub fn on_enter_call_indirect( + visitor: BinaryModuleVisitor(ctx), + on_enter_call_indirect: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_call_indirect: Some(on_enter_call_indirect), + ) +} + +pub fn on_exit_call_indirect( + visitor: BinaryModuleVisitor(ctx), + on_exit_call_indirect: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_call_indirect: Some(on_exit_call_indirect), + ) +} + +pub fn on_enter_return_call( + visitor: BinaryModuleVisitor(ctx), + on_enter_return_call: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_return_call: Some(on_enter_return_call), + ) +} + +pub fn on_exit_return_call( + visitor: BinaryModuleVisitor(ctx), + on_exit_return_call: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor(..visitor, on_exit_return_call: Some(on_exit_return_call)) +} + +pub fn on_enter_return_call_ref( + visitor: BinaryModuleVisitor(ctx), + on_enter_return_call_ref: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_return_call_ref: Some(on_enter_return_call_ref), + ) +} + +pub fn on_exit_return_call_ref( + visitor: BinaryModuleVisitor(ctx), + on_exit_return_call_ref: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_return_call_ref: Some(on_exit_return_call_ref), + ) +} + +pub fn on_enter_return_call_indirect( + visitor: BinaryModuleVisitor(ctx), + on_enter_return_call_indirect: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_return_call_indirect: Some(on_enter_return_call_indirect), + ) +} + +pub fn on_exit_return_call_indirect( + visitor: BinaryModuleVisitor(ctx), + on_exit_return_call_indirect: VisitorCallback(ctx, Instruction), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_return_call_indirect: Some(on_exit_return_call_indirect), + ) +} + +pub fn on_enter_label_idx( + visitor: BinaryModuleVisitor(ctx), + on_enter_label_idx: VisitorCallback(ctx, LabelIDX), +) { + BinaryModuleVisitor(..visitor, on_enter_label_idx: Some(on_enter_label_idx)) +} + +pub fn on_exit_label_idx( + visitor: BinaryModuleVisitor(ctx), + on_exit_label_idx: VisitorCallback(ctx, LabelIDX), +) { + BinaryModuleVisitor(..visitor, on_exit_label_idx: Some(on_exit_label_idx)) +} + +pub fn on_enter_block_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_block_type: VisitorCallback(ctx, BlockType), +) { + BinaryModuleVisitor(..visitor, on_enter_block_type: Some(on_enter_block_type)) +} + +pub fn on_exit_block_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_block_type: VisitorCallback(ctx, BlockType), +) { + BinaryModuleVisitor(..visitor, on_exit_block_type: Some(on_exit_block_type)) +} + +pub fn on_enter_void_block_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_void_block_type: VisitorCallback(ctx, BlockType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_void_block_type: Some(on_enter_void_block_type), + ) +} + +pub fn on_exit_void_block_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_void_block_type: VisitorCallback(ctx, BlockType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_void_block_type: Some(on_exit_void_block_type), + ) +} + +pub fn on_enter_val_type_block_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_val_type_block_type: VisitorCallback(ctx, BlockType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_val_type_block_type: Some(on_enter_val_type_block_type), + ) +} + +pub fn on_exit_val_type_block_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_val_type_block_type: VisitorCallback(ctx, BlockType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_val_type_block_type: Some(on_exit_val_type_block_type), + ) +} + +pub fn on_enter_func_type_block_type( + visitor: BinaryModuleVisitor(ctx), + on_enter_func_type_block_type: VisitorCallback(ctx, BlockType), +) { + BinaryModuleVisitor( + ..visitor, + on_enter_func_type_block_type: Some(on_enter_func_type_block_type), + ) +} + +pub fn on_exit_func_type_block_type( + visitor: BinaryModuleVisitor(ctx), + on_exit_func_type_block_type: VisitorCallback(ctx, BlockType), +) { + BinaryModuleVisitor( + ..visitor, + on_exit_func_type_block_type: Some(on_exit_func_type_block_type), + ) +} + +pub fn on_enter_field_idx( + visitor: BinaryModuleVisitor(ctx), + on_enter_field_idx: VisitorCallback(ctx, FieldIDX), +) { + BinaryModuleVisitor(..visitor, on_enter_field_idx: Some(on_enter_field_idx)) +} + +pub fn on_exit_field_idx( + visitor: BinaryModuleVisitor(ctx), + on_exit_field_idx: VisitorCallback(ctx, FieldIDX), +) { + BinaryModuleVisitor(..visitor, on_exit_field_idx: Some(on_exit_field_idx)) +} + +pub fn on_enter_data_idx( + visitor: BinaryModuleVisitor(ctx), + on_enter_data_idx: VisitorCallback(ctx, DataIDX), +) { + BinaryModuleVisitor(..visitor, on_enter_data_idx: Some(on_enter_data_idx)) +} + +pub fn on_exit_data_idx( + visitor: BinaryModuleVisitor(ctx), + on_exit_data_idx: VisitorCallback(ctx, DataIDX), +) { + BinaryModuleVisitor(..visitor, on_exit_data_idx: Some(on_exit_data_idx)) +} + +pub fn on_enter_elem_idx( + visitor: BinaryModuleVisitor(ctx), + on_enter_elem_idx: VisitorCallback(ctx, ElemIDX), +) { + BinaryModuleVisitor(..visitor, on_enter_elem_idx: Some(on_enter_elem_idx)) +} + +pub fn on_exit_elem_idx( + visitor: BinaryModuleVisitor(ctx), + on_exit_elem_idx: VisitorCallback(ctx, ElemIDX), +) { + BinaryModuleVisitor(..visitor, on_exit_elem_idx: Some(on_exit_elem_idx)) +} + +pub fn on_enter_local_idx( + visitor: BinaryModuleVisitor(ctx), + on_enter_local_idx: VisitorCallback(ctx, LocalIDX), +) { + BinaryModuleVisitor(..visitor, on_enter_local_idx: Some(on_enter_local_idx)) +} + +pub fn on_exit_local_idx( + visitor: BinaryModuleVisitor(ctx), + on_exit_local_idx: VisitorCallback(ctx, LocalIDX), +) { + BinaryModuleVisitor(..visitor, on_exit_local_idx: Some(on_exit_local_idx)) +} + +pub fn visit_module( + visitor: BinaryModuleVisitor(ctx), + ctx, + module: BinaryModule, +) -> Result(#(ctx, BinaryModule), String) { + do_visit_module(ctx, module, visitor) +} + +pub fn visit_type_section( + visitor: BinaryModuleVisitor(ctx), + ctx, + type_section: TypeSection, +) -> Result(#(ctx, Option(TypeSection)), String) { + do_visit_type_section(ctx, Some(type_section), visitor) +} + +pub fn visit_rec_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + rec_type: RecType, +) -> Result(#(ctx, RecType), String) { + do_visit_rec_type(ctx, rec_type, visitor) +} + +pub fn visit_sub_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + sub_type: SubType, +) -> Result(#(ctx, SubType), String) { + do_visit_sub_type(ctx, sub_type, visitor) +} + +pub fn visit_type_idx( + visitor: BinaryModuleVisitor(ctx), + ctx, + type_idx: TypeIDX, +) -> Result(#(ctx, TypeIDX), String) { + do_visit_type_idx(ctx, type_idx, visitor) +} + +pub fn visit_composite_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + composite_type: CompositeType, +) -> Result(#(ctx, CompositeType), String) { + do_visit_composite_type(ctx, composite_type, visitor) +} + +pub fn visit_def_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + def_type: DefType, +) -> Result(#(ctx, DefType), String) { + do_visit_def_type(ctx, def_type, visitor) +} + +pub fn visit_func_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + func_type: FuncType, +) -> Result(#(ctx, FuncType), String) { + do_visit_func_type(ctx, func_type, visitor) +} + +pub fn visit_val_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + val_type: ValType, +) -> Result(#(ctx, ValType), String) { + do_visit_val_type(ctx, val_type, visitor) +} + +pub fn visit_ref_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + ref_type: RefType, +) -> Result(#(ctx, RefType), String) { + do_visit_ref_type(ctx, ref_type, visitor) +} + +pub fn visit_struct_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + struct_type: StructType, +) -> Result(#(ctx, StructType), String) { + do_visit_struct_type(ctx, struct_type, visitor) +} + +pub fn visit_array_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + array_type: ArrayType, +) -> Result(#(ctx, ArrayType), String) { + do_visit_array_type(ctx, array_type, visitor) +} + +pub fn visit_custom_section( + visitor: BinaryModuleVisitor(ctx), + ctx, + custom_section: CustomSection, +) -> Result(#(ctx, Option(CustomSection)), String) { + do_visit_custom_section(ctx, custom_section, visitor) +} + +pub fn visit_import_section( + visitor: BinaryModuleVisitor(ctx), + ctx, + imports: ImportSection, +) -> Result(#(ctx, Option(ImportSection)), String) { + do_visit_import_section(ctx, Some(imports), visitor) +} + +pub fn visit_import( + visitor: BinaryModuleVisitor(ctx), + ctx, + import_: Import, +) -> Result(#(ctx, Import), String) { + do_visit_import(ctx, import_, visitor) +} + +pub fn visit_function_section( + visitor: BinaryModuleVisitor(ctx), + ctx, + functions: FunctionSection, +) -> Result(#(ctx, Option(FunctionSection)), String) { + do_visit_function_section(ctx, Some(functions), visitor) +} + +pub fn visit_table_section( + visitor: BinaryModuleVisitor(ctx), + ctx, + tables: TableSection, +) -> Result(#(ctx, Option(TableSection)), String) { + do_visit_table_section(ctx, Some(tables), visitor) +} + +pub fn visit_memory_section( + visitor: BinaryModuleVisitor(ctx), + ctx, + memories: MemorySection, +) -> Result(#(ctx, Option(MemorySection)), String) { + do_visit_memory_section(ctx, Some(memories), visitor) +} + +pub fn visit_global_section( + visitor: BinaryModuleVisitor(ctx), + ctx, + globals: GlobalSection, +) -> Result(#(ctx, Option(GlobalSection)), String) { + do_visit_global_section(ctx, Some(globals), visitor) +} + +pub fn visit_global( + visitor: BinaryModuleVisitor(ctx), + ctx, + global: Global, +) -> Result(#(ctx, Global), String) { + do_visit_global(ctx, global, visitor) +} + +pub fn visit_export_section( + visitor: BinaryModuleVisitor(ctx), + ctx, + exports: ExportSection, +) -> Result(#(ctx, Option(ExportSection)), String) { + do_visit_export_section(ctx, Some(exports), visitor) +} + +pub fn visit_export( + visitor: BinaryModuleVisitor(ctx), + ctx, + export: Export, +) -> Result(#(ctx, Export), String) { + do_visit_export(ctx, export, visitor) +} + +pub fn visit_start_section( + visitor: BinaryModuleVisitor(ctx), + ctx, + start: StartSection, +) -> Result(#(ctx, Option(StartSection)), String) { + do_visit_start_section(ctx, Some(start), visitor) +} + +pub fn visit_element_section( + visitor: BinaryModuleVisitor(ctx), + ctx, + element_section: ElementSection, +) -> Result(#(ctx, Option(ElementSection)), String) { + do_visit_element_section(ctx, Some(element_section), visitor) +} + +pub fn visit_element_segment( + visitor: BinaryModuleVisitor(ctx), + ctx, + element_segment: Elem, +) -> Result(#(ctx, Elem), String) { + do_visit_element_segment(ctx, element_segment, visitor) +} + +pub fn visit_element_mode( + visitor: BinaryModuleVisitor(ctx), + ctx, + element_mode: ElemMode, +) -> Result(#(ctx, ElemMode), String) { + do_visit_element_mode(ctx, element_mode, visitor) +} + +pub fn visit_code_section( + visitor: BinaryModuleVisitor(ctx), + ctx, + code_section: CodeSection, +) -> Result(#(ctx, Option(CodeSection)), String) { + do_visit_code_section(ctx, Some(code_section), visitor) +} + +pub fn visit_code( + visitor: BinaryModuleVisitor(ctx), + ctx, + code: Code, +) -> Result(#(ctx, Code), String) { + do_visit_code(ctx, code, visitor) +} + +pub fn visit_locals( + visitor: BinaryModuleVisitor(ctx), + ctx, + locals: Locals, +) -> Result(#(ctx, Locals), String) { + do_visit_locals(ctx, locals, visitor) +} + +pub fn visit_data_section( + visitor: BinaryModuleVisitor(ctx), + ctx, + data_section: DataSection, +) -> Result(#(ctx, Option(DataSection)), String) { + do_visit_data_section(ctx, Some(data_section), visitor) +} + +pub fn visit_data( + visitor: BinaryModuleVisitor(ctx), + ctx, + data: Data, +) -> Result(#(ctx, Data), String) { + do_visit_data(ctx, data, visitor) +} + +pub fn visit_data_count_section( + visitor: BinaryModuleVisitor(ctx), + ctx, + data_count: DataCountSection, +) -> Result(#(ctx, Option(DataCountSection)), String) { + do_visit_data_count_section(ctx, Some(data_count), visitor) +} + +pub fn visit_heap_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + heap_type: HeapType, +) -> Result(#(ctx, HeapType), String) { + do_visit_heap_type(ctx, heap_type, visitor) +} + +pub fn visit_field_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + field_type: FieldType, +) -> Result(#(ctx, FieldType), String) { + do_visit_field_type(ctx, field_type, visitor) +} + +pub fn visit_storage_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + storage_type: StorageType, +) -> Result(#(ctx, StorageType), String) { + do_visit_storage_type(ctx, storage_type, visitor) +} + +pub fn visit_table_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + table_type: TableType, +) -> Result(#(ctx, TableType), String) { + do_visit_table_type(ctx, table_type, visitor) +} + +pub fn visit_limits( + visitor: BinaryModuleVisitor(ctx), + ctx, + limits: Limits, +) -> Result(#(ctx, Limits), String) { + do_visit_limits(ctx, limits, visitor) +} + +pub fn visit_mem_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + mem_type: MemType, +) -> Result(#(ctx, MemType), String) { + do_visit_mem_type(ctx, mem_type, visitor) +} + +pub fn visit_global_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + global_type: GlobalType, +) -> Result(#(ctx, GlobalType), String) { + do_visit_global_type(ctx, global_type, visitor) +} + +pub fn visit_table( + visitor: BinaryModuleVisitor(ctx), + ctx, + table: Table, +) -> Result(#(ctx, Table), String) { + do_visit_table(ctx, table, visitor) +} + +pub fn visit_expr( + visitor: BinaryModuleVisitor(ctx), + ctx, + expr: Expr, +) -> Result(#(ctx, Expr), String) { + do_visit_expr(ctx, expr, visitor) +} + +pub fn visit_instruction( + visitor: BinaryModuleVisitor(ctx), + ctx, + instruction: Instruction, +) -> Result(#(ctx, Instruction), String) { + do_visit_instruction(ctx, instruction, visitor) +} + +pub fn visit_func_idx( + visitor: BinaryModuleVisitor(ctx), + ctx, + func_idx: FuncIDX, +) -> Result(#(ctx, FuncIDX), String) { + do_visit_func_idx(ctx, func_idx, visitor) +} + +pub fn visit_table_idx( + visitor: BinaryModuleVisitor(ctx), + ctx, + table_idx: TableIDX, +) -> Result(#(ctx, TableIDX), String) { + do_visit_table_idx(ctx, table_idx, visitor) +} + +pub fn visit_mem_idx( + visitor: BinaryModuleVisitor(ctx), + ctx, + mem_idx: MemIDX, +) -> Result(#(ctx, MemIDX), String) { + do_visit_mem_idx(ctx, mem_idx, visitor) +} + +pub fn visit_global_idx( + visitor: BinaryModuleVisitor(ctx), + ctx, + global_idx: GlobalIDX, +) -> Result(#(ctx, GlobalIDX), String) { + do_visit_global_idx(ctx, global_idx, visitor) +} + +pub fn visit_label_idx( + visitor: BinaryModuleVisitor(ctx), + ctx, + label_idx: LabelIDX, +) -> Result(#(ctx, LabelIDX), String) { + do_visit_label_idx(ctx, label_idx, visitor) +} + +pub fn visit_field_idx( + visitor: BinaryModuleVisitor(ctx), + ctx, + field_idx: FieldIDX, +) -> Result(#(ctx, FieldIDX), String) { + do_visit_field_idx(ctx, field_idx, visitor) +} + +pub fn visit_data_idx( + visitor: BinaryModuleVisitor(ctx), + ctx, + data_idx: DataIDX, +) -> Result(#(ctx, DataIDX), String) { + do_visit_data_idx(ctx, data_idx, visitor) +} + +pub fn visit_elem_idx( + visitor: BinaryModuleVisitor(ctx), + ctx, + elem_idx: ElemIDX, +) -> Result(#(ctx, ElemIDX), String) { + do_visit_elem_idx(ctx, elem_idx, visitor) +} + +pub fn visit_local_idx( + visitor: BinaryModuleVisitor(ctx), + ctx, + local_idx: LocalIDX, +) -> Result(#(ctx, LocalIDX), String) { + do_visit_local_idx(ctx, local_idx, visitor) +} + +pub fn visit_block_type( + visitor: BinaryModuleVisitor(ctx), + ctx, + block_type: BlockType, +) -> Result(#(ctx, BlockType), String) { + do_visit_block_type(ctx, block_type, visitor) +}