diff --git a/src/Language/Wasm/Interpreter.hs b/src/Language/Wasm/Interpreter.hs index ca65b1d..865b4a9 100644 --- a/src/Language/Wasm/Interpreter.hs +++ b/src/Language/Wasm/Interpreter.hs @@ -593,7 +593,7 @@ eval store FunctionInstance { funcType, moduleInstance, code = Function { localT return $ Done ctx { stack = rest, locals = locals ctx // [(fromIntegral i, v)] } step ctx@EvalCtx{ locals = ls, stack = (v:rest) } (TeeLocal i) = return $ Done ctx { - stack = (ls ! fromIntegral i) : rest, + stack = v : rest, locals = locals ctx // [(fromIntegral i, v)] } step ctx (GetGlobal i) = do diff --git a/tests/Test.hs b/tests/Test.hs index febd4af..c60ba01 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 = ["resizing.wast"] + -- let files = ["tee_local.wast"] scriptTestCases <- (`mapM` files) $ \file -> do content <- LBS.readFile $ "tests/samples/" ++ file let Right script = Parser.parseScript <$> Lexer.scanner content