make serializer work correct

This commit is contained in:
Ilya Rezvov
2018-02-19 14:30:06 -08:00
parent 809d5bbf38
commit 8dc40aa699
5 changed files with 54 additions and 4 deletions
+10 -3
View File
@@ -1,7 +1,8 @@
{-# LANGUAGE NamedFieldPuns #-}
module Language.Wasm.Binary (
dumpModule,
dumpModuleLazy
) where
import Language.Wasm.Structure
@@ -542,7 +543,7 @@ instance Serialize Module where
putSection TypeSection $ putVec $ types mod
putSection ImportSection $ putVec $ imports mod
putSection FunctionSection $ putVec $ map funcType $ functions mod
putSection FunctionSection $ putVec $ map (Index . funcType) $ functions mod
putSection TableSection $ putVec $ tables mod
putSection MemorySection $ putVec $ mems mod
putSection GlobalSection $ putVec $ globals mod
@@ -554,4 +555,10 @@ instance Serialize Module where
putSection CodeSection $ putVec $ functions mod
putSection DataSection $ putVec $ datas mod
get = undefined
get = undefined
dumpModule :: Module -> BS.ByteString
dumpModule = encode
dumpModuleLazy :: Module -> LBS.ByteString
dumpModuleLazy = encodeLazy