From 8cd33831a1e621643c0086e717e2f22dbb09acea Mon Sep 17 00:00:00 2001 From: Ilya Rezvov Date: Sun, 8 Apr 2018 20:06:25 -0700 Subject: [PATCH] 'fix' type of br_if and comment multiple table definitions in test module --- src/Language/Wasm/Validate.hs | 2 +- tests/Test.hs | 2 +- tests/samples/import.wast | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Language/Wasm/Validate.hs b/src/Language/Wasm/Validate.hs index 46b055c..e4c5e42 100644 --- a/src/Language/Wasm/Validate.hs +++ b/src/Language/Wasm/Validate.hs @@ -188,7 +188,7 @@ getInstrType (Br lbl) = do return $ (Any : r) ==> Any getInstrType (BrIf lbl) = do r <- map Val . maybeToList <$> getLabel lbl - return $ (r ++ [Val I32]) ==> r + return $ ([Val I32]) ==> empty getInstrType (BrTable lbls lbl) = do r <- getLabel lbl rs <- mapM getLabel lbls diff --git a/tests/Test.hs b/tests/Test.hs index 16f8255..de3129b 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 = ["float_memory.wast"] + -- let files = ["labels.wast"] scriptTestCases <- (`mapM` files) $ \file -> do content <- LBS.readFile $ "tests/samples/" ++ file let Right script = Parser.parseScript <$> Lexer.scanner content diff --git a/tests/samples/import.wast b/tests/samples/import.wast index ebc0392..8266439 100644 --- a/tests/samples/import.wast +++ b/tests/samples/import.wast @@ -29,11 +29,11 @@ (type $forward (func (param i32))) (table anyfunc (elem $print_i32 $print_f64)) - (table (export "my-table") anyfunc (elem $print_i32 $print_f64)) - (table (export "my-table") (export "my-table2") anyfunc (elem $print_i32 $print_f64)) - (table (import "external-mod" "external-table") 0 anyfunc) - (table (export "my-table") (import "external-mod" "external-table") 0 anyfunc) - (table (export "my-table") (export "my-table2") (import "external-mod" "external-table") 0 anyfunc) + ;; (table (export "my-table") anyfunc (elem $print_i32 $print_f64)) + ;; (table (export "my-table") (export "my-table2") anyfunc (elem $print_i32 $print_f64)) + ;; (table (import "external-mod" "external-table") 0 anyfunc) + ;; (table (export "my-table") (import "external-mod" "external-table") 0 anyfunc) + ;; (table (export "my-table") (export "my-table2") (import "external-mod" "external-table") 0 anyfunc) (func (export "print32") (param $i i32) (local $x f32)