diff --git a/src/Language/Wasm/Interpreter.hs b/src/Language/Wasm/Interpreter.hs index df15322..79b466d 100644 --- a/src/Language/Wasm/Interpreter.hs +++ b/src/Language/Wasm/Interpreter.hs @@ -572,7 +572,7 @@ eval store FunctionInstance { funcType, moduleInstance, code = Function { localT return $ Done ctx { stack = reverse res ++ (drop (length args) $ stack ctx) } step ctx@EvalCtx{ stack = (VI32 v): rest } (CallIndirect typeIdx) = do let funcType = funcTypes moduleInstance ! fromIntegral typeIdx - let TableInstance { elements } = tableInstances store ! (tableaddrs moduleInstance ! fromIntegral v) + let TableInstance { elements } = tableInstances store ! (tableaddrs moduleInstance ! 0) let funcAddr = elements !? fromIntegral v case funcAddr of Just (Just addr) -> do diff --git a/tests/Test.hs b/tests/Test.hs index 2c8073b..56a49f1 100644 --- a/tests/Test.hs +++ b/tests/Test.hs @@ -34,7 +34,7 @@ compile file = do main :: IO () main = do files <- Directory.listDirectory "tests/samples" - let files = ["linking.wast"] + -- let files = ["linking.wast"] scriptTestCases <- (`mapM` files) $ \file -> do content <- LBS.readFile $ "tests/samples/" ++ file let Right script = Parser.parseScript <$> Lexer.scanner content