package wasm

import (
	
	
)

// ImportedMemories implements the same method as documented on wazero.CompiledModule.
func ( *Module) () ( []api.MemoryDefinition) {
	for  := range .MemoryDefinitionSection {
		 := &.MemoryDefinitionSection[]
		if .importDesc != nil {
			 = append(, )
		}
	}
	return
}

// ExportedMemories implements the same method as documented on wazero.CompiledModule.
func ( *Module) () map[string]api.MemoryDefinition {
	 := map[string]api.MemoryDefinition{}
	for  := range .MemoryDefinitionSection {
		 := &.MemoryDefinitionSection[]
		for ,  := range .exportNames {
			[] = 
		}
	}
	return 
}

// BuildMemoryDefinitions generates memory metadata that can be parsed from
// the module. This must be called after all validation.
//
// Note: This is exported for wazero.Runtime `CompileModule`.
func ( *Module) () {
	var  string
	if .NameSection != nil {
		 = .NameSection.ModuleName
	}

	 := .ImportMemoryCount
	if .MemorySection != nil {
		++
	}

	if  == 0 {
		return
	}

	.MemoryDefinitionSection = make([]MemoryDefinition, 0, )
	 := Index(0)
	for  := range .ImportSection {
		 := &.ImportSection[]
		if .Type != ExternTypeMemory {
			continue
		}

		.MemoryDefinitionSection = append(.MemoryDefinitionSection, MemoryDefinition{
			importDesc: &[2]string{.Module, .Name},
			index:      ,
			memory:     .DescMem,
		})
		++
	}

	if .MemorySection != nil {
		.MemoryDefinitionSection = append(.MemoryDefinitionSection, MemoryDefinition{
			index:  ,
			memory: .MemorySection,
		})
	}

	for  := range .MemoryDefinitionSection {
		 := &.MemoryDefinitionSection[]
		.moduleName = 
		for  := range .ExportSection {
			 := &.ExportSection[]
			if .Type == ExternTypeMemory && .Index == .index {
				.exportNames = append(.exportNames, .Name)
			}
		}
	}
}

// MemoryDefinition implements api.MemoryDefinition
type MemoryDefinition struct {
	internalapi.WazeroOnlyType
	moduleName  string
	index       Index
	importDesc  *[2]string
	exportNames []string
	memory      *Memory
}

// ModuleName implements the same method as documented on api.MemoryDefinition.
func ( *MemoryDefinition) () string {
	return .moduleName
}

// Index implements the same method as documented on api.MemoryDefinition.
func ( *MemoryDefinition) () uint32 {
	return .index
}

// Import implements the same method as documented on api.MemoryDefinition.
func ( *MemoryDefinition) () (,  string,  bool) {
	if  := .importDesc;  != nil {
		, ,  = [0], [1], true
	}
	return
}

// ExportNames implements the same method as documented on api.MemoryDefinition.
func ( *MemoryDefinition) () []string {
	return .exportNames
}

// Min implements the same method as documented on api.MemoryDefinition.
func ( *MemoryDefinition) () uint32 {
	return .memory.Min
}

// Max implements the same method as documented on api.MemoryDefinition.
func ( *MemoryDefinition) () ( uint32,  bool) {
	 = .memory.Max
	 = .memory.IsMaxEncoded
	return
}