package wasm

import 

// SectionElementCount returns the count of elements in a given section ID
//
// For example...
// * SectionIDType returns the count of FunctionType
// * SectionIDCustom returns the count of CustomSections plus one if NameSection is present
// * SectionIDHostFunction returns the count of HostFunctionSection
// * SectionIDExport returns the count of unique export names
func ( *Module) ( SectionID) uint32 { // element as in vector elements!
	switch  {
	case SectionIDCustom:
		 := uint32(len(.CustomSections))
		if .NameSection != nil {
			++
		}
		return 
	case SectionIDType:
		return uint32(len(.TypeSection))
	case SectionIDImport:
		return uint32(len(.ImportSection))
	case SectionIDFunction:
		return uint32(len(.FunctionSection))
	case SectionIDTable:
		return uint32(len(.TableSection))
	case SectionIDMemory:
		if .MemorySection != nil {
			return 1
		}
		return 0
	case SectionIDGlobal:
		return uint32(len(.GlobalSection))
	case SectionIDExport:
		return uint32(len(.ExportSection))
	case SectionIDStart:
		if .StartSection != nil {
			return 1
		}
		return 0
	case SectionIDElement:
		return uint32(len(.ElementSection))
	case SectionIDCode:
		return uint32(len(.CodeSection))
	case SectionIDData:
		return uint32(len(.DataSection))
	default:
		panic(fmt.Errorf("BUG: unknown section: %d", ))
	}
}