Flattens Memory and Table types and backfills Table encoder (#356)

This flattens Memory and Table types, particularly making it a
compilation error to add multiple of either.

This also backfills binary encoding of Table.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Crypt Keeper
2022-03-10 15:47:49 +08:00
committed by GitHub
parent 074a2cffbf
commit 97c759b9d8
32 changed files with 586 additions and 413 deletions

View File

@@ -58,9 +58,15 @@ func (m *Module) SectionElementCount(sectionID SectionID) uint32 { // element as
case SectionIDFunction:
return uint32(len(m.FunctionSection))
case SectionIDTable:
return uint32(len(m.TableSection))
if m.TableSection != nil {
return 1
}
return 0
case SectionIDMemory:
return uint32(len(m.MemorySection))
if m.MemorySection != nil {
return 1
}
return 0
case SectionIDGlobal:
return uint32(len(m.GlobalSection))
case SectionIDExport: