fix imports

This commit is contained in:
Ilya Rezvov
2021-04-04 17:11:07 -07:00
parent d4a72089ba
commit afb5cb4f05
3 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -621,7 +621,7 @@ typedef :: { TypeDef }
: 'type' opt(ident) functype ')' { TypeDef $2 $3 } : 'type' opt(ident) functype ')' { TypeDef $2 $3 }
functype :: { FuncType } functype :: { FuncType }
: '(' 'func' typesign(never, ')') { let (ft, _) = $3 in ft } : '(' 'func' typesign(')', ')') { let (ft, _) = $3 in ft }
memarg1 :: { MemArg } memarg1 :: { MemArg }
: opt(offset) opt(align) {% parseMemArg 1 $1 $2 } : opt(offset) opt(align) {% parseMemArg 1 $1 $2 }
@@ -715,7 +715,7 @@ folded_else :: { [Instruction] }
| '(' 'else' mixed_instruction_list(')') ')' { snd $3 } | '(' 'else' mixed_instruction_list(')') ')' { snd $3 }
importdesc :: { ImportDesc } importdesc :: { ImportDesc }
: 'func' opt(ident) typeuse_cont(never, ')') { : 'func' opt(ident) typeuse_cont(')', ')') {
let (ft, _) = $3 in ImportFunc $2 ft let (ft, _) = $3 in ImportFunc $2 ft
} }
| 'table' opt(ident) tabletype ')' { ImportTable $2 $3 } | '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 { $1 }
import_typeuse_locals_body1 :: { Maybe Ident -> ModuleField } import_typeuse_locals_body1 :: { Maybe Ident -> ModuleField }
: 'import' name name ')' typeuse_cont(never, ')') { : 'import' name name ')' typeuse_cont(')', ')') {
let (ft, _) = $5 in let (ft, _) = $5 in
\ident -> MFImport $ Import [] $2 $3 $ ImportFunc ident ft \ident -> MFImport $ Import [] $2 $3 $ ImportFunc ident ft
} }
+2 -2
View File
@@ -72,8 +72,8 @@ runScript onAssertFail script = do
hostGlobals = do hostGlobals = do
let globI32 = Interpreter.makeConstGlobal $ Interpreter.VI32 666 let globI32 = Interpreter.makeConstGlobal $ Interpreter.VI32 666
let globI64 = Interpreter.makeConstGlobal $ Interpreter.VI64 666 let globI64 = Interpreter.makeConstGlobal $ Interpreter.VI64 666
globF32 <- Interpreter.makeMutGlobal $ Interpreter.VF32 666 let globF32 = Interpreter.makeConstGlobal $ Interpreter.VF32 666
globF64 <- Interpreter.makeMutGlobal $ Interpreter.VF64 666 let globF64 = Interpreter.makeConstGlobal $ Interpreter.VF64 666
return ( return (
Interpreter.HostGlobal globI32, Interpreter.HostGlobal globI32,
Interpreter.HostGlobal globI64, Interpreter.HostGlobal globI64,
+1 -1
View File
@@ -17,7 +17,7 @@ import qualified Data.List as List
main :: IO () main :: IO ()
main = do main = do
files <- filter (List.isSuffixOf ".wast") <$> Directory.listDirectory "tests/spec" 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 scriptTestCases <- (`mapM` files) $ \file -> do
test <- LBS.readFile ("tests/spec/" ++ file) test <- LBS.readFile ("tests/spec/" ++ file)
return $ testCase file $ do return $ testCase file $ do