calculate module instance

This commit is contained in:
Ilya Rezvov
2018-03-07 14:40:19 -08:00
parent a073456a63
commit 1dab371720
3 changed files with 66 additions and 22 deletions
+21 -1
View File
@@ -33,7 +33,11 @@ module Language.Wasm.Structure (
LabelIndex,
LocalIndex,
GlobalIndex,
emptyModule
emptyModule,
isFuncImport,
isTableImport,
isMemImport,
isGlobalImport
) where
import Numeric.Natural (Natural)
@@ -232,6 +236,22 @@ data Import = Import {
desc :: ImportDesc
} deriving (Show, Eq)
isFuncImport :: Import -> Bool
isFuncImport (Import _ _ (ImportFunc _)) = True
isFuncImport _ = False
isTableImport :: Import -> Bool
isTableImport (Import _ _ (ImportTable _)) = True
isTableImport _ = False
isMemImport :: Import -> Bool
isMemImport (Import _ _ (ImportMemory _)) = True
isMemImport _ = False
isGlobalImport :: Import -> Bool
isGlobalImport (Import _ _ (ImportGlobal _)) = True
isGlobalImport _ = False
data Module = Module {
types :: [FuncType],
functions :: [Function],