diff --git a/src/Language/Wasm/Parser.y b/src/Language/Wasm/Parser.y index 4b53a04..194f950 100644 --- a/src/Language/Wasm/Parser.y +++ b/src/Language/Wasm/Parser.y @@ -621,7 +621,7 @@ typedef :: { TypeDef } : 'type' opt(ident) functype ')' { TypeDef $2 $3 } functype :: { FuncType } - : '(' 'func' typesign(never, ')') { let (ft, _) = $3 in ft } + : '(' 'func' typesign(')', ')') { let (ft, _) = $3 in ft } memarg1 :: { MemArg } : opt(offset) opt(align) {% parseMemArg 1 $1 $2 } @@ -715,7 +715,7 @@ folded_else :: { [Instruction] } | '(' 'else' mixed_instruction_list(')') ')' { snd $3 } importdesc :: { ImportDesc } - : 'func' opt(ident) typeuse_cont(never, ')') { + : 'func' opt(ident) typeuse_cont(')', ')') { let (ft, _) = $3 in ImportFunc $2 ft } | 'table' opt(ident) tabletype ')' { ImportTable $2 $3 } @@ -747,7 +747,7 @@ export_import_typeuse_locals_body1 :: { Maybe Ident -> ModuleField } | import_typeuse_locals_body1 { $1 } import_typeuse_locals_body1 :: { Maybe Ident -> ModuleField } - : 'import' name name ')' typeuse_cont(never, ')') { + : 'import' name name ')' typeuse_cont(')', ')') { let (ft, _) = $5 in \ident -> MFImport $ Import [] $2 $3 $ ImportFunc ident ft } diff --git a/src/Language/Wasm/Script.hs b/src/Language/Wasm/Script.hs index 6c12fa6..2dfa395 100644 --- a/src/Language/Wasm/Script.hs +++ b/src/Language/Wasm/Script.hs @@ -72,8 +72,8 @@ runScript onAssertFail script = do hostGlobals = do let globI32 = Interpreter.makeConstGlobal $ Interpreter.VI32 666 let globI64 = Interpreter.makeConstGlobal $ Interpreter.VI64 666 - globF32 <- Interpreter.makeMutGlobal $ Interpreter.VF32 666 - globF64 <- Interpreter.makeMutGlobal $ Interpreter.VF64 666 + let globF32 = Interpreter.makeConstGlobal $ Interpreter.VF32 666 + let globF64 = Interpreter.makeConstGlobal $ Interpreter.VF64 666 return ( Interpreter.HostGlobal globI32, Interpreter.HostGlobal globI64, diff --git a/tests/Test.hs b/tests/Test.hs index d848b61..27e0392 100644 --- a/tests/Test.hs +++ b/tests/Test.hs @@ -17,7 +17,7 @@ import qualified Data.List as List main :: IO () main = do files <- filter (List.isSuffixOf ".wast") <$> Directory.listDirectory "tests/spec" - -- let files = ["block.wast", "loop.wast", "if.wast", "stack.wast", "func.wast"] + -- let files = ["imports.wast", "block.wast", "loop.wast", "if.wast", "stack.wast", "func.wast"] scriptTestCases <- (`mapM` files) $ \file -> do test <- LBS.readFile ("tests/spec/" ++ file) return $ testCase file $ do