From f9239c52ee78373d16bcb931a164ecd3ccbe2736 Mon Sep 17 00:00:00 2001 From: Ilya Rezvov Date: Sun, 18 Feb 2018 22:59:02 -0800 Subject: [PATCH] serialize more sections --- src/Language/Wasm/Binary.hs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Language/Wasm/Binary.hs b/src/Language/Wasm/Binary.hs index 7937f11..a30baa2 100644 --- a/src/Language/Wasm/Binary.hs +++ b/src/Language/Wasm/Binary.hs @@ -182,6 +182,18 @@ instance Serialize Import where desc <- get return $ Import sourceModule name desc +instance Serialize Table where + put (Table tableType) = put tableType + get = Table <$> get + +instance Serialize Memory where + put (Memory limit) = put limit + get = Memory <$> get + +-- instance Serialize Global where +-- put (Global globalType expr) = put globalType >> put expr +-- get = Global <$> get <*> get + instance Serialize Module where put mod = do -- magic @@ -197,4 +209,8 @@ instance Serialize Module where putSection TypeSection $ types mod putSection ImportSection $ imports mod + putSection FunctionSection $ map funcType $ functions mod + putSection TableSection $ tables mod + putSection MemorySection $ mems mod + -- putSection GlobalSection $ globals mod get = undefined \ No newline at end of file