diff --git a/src/tools/wasm-opt.cpp b/src/tools/wasm-opt.cpp index 54a83d15a0f..32f9f1aaddb 100644 --- a/src/tools/wasm-opt.cpp +++ b/src/tools/wasm-opt.cpp @@ -220,6 +220,13 @@ int main(int argc, const char* argv[]) { [&outputSourceMapUrl](Options* o, const std::string& argument) { outputSourceMapUrl = argument; }) + .add( + "--deprecated-wat-parser", + "", + "Use the old, deprecated WAT parser. This option will be removed soon!", + WasmOptOption, + Options::Arguments::Zero, + [](Options*, const std::string&) { useNewWATParser = false; }) .add("--new-wat-parser", "", "Use the experimental new WAT parser", diff --git a/test/lit/deprecated-wat.wast b/test/lit/deprecated-wat.wast new file mode 100644 index 00000000000..401d3244b23 --- /dev/null +++ b/test/lit/deprecated-wat.wast @@ -0,0 +1,24 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. + +;; RUN: wasm-opt --deprecated-wat-parser -all %s -S -o - | filecheck %s + +(module + ;; CHECK: (type $0 (func (param i32))) + + ;; CHECK: (type $1 (func (result i32))) + + ;; CHECK: (import "env" "bad" (func $wrong (type $0) (param i32))) + + ;; CHECK: (func $foo (type $1) (result i32) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + (func $foo (result i32) + ;; Non-standard block result format + (block i32 + (i32.const 0) + ) + ) + + ;; Non-standard import after declared function + (import $wrong "env" "bad" (param i32)) +) diff --git a/test/lit/help/wasm-opt.test b/test/lit/help/wasm-opt.test index 8494691781d..f7ee47c09f6 100644 --- a/test/lit/help/wasm-opt.test +++ b/test/lit/help/wasm-opt.test @@ -72,6 +72,10 @@ ;; CHECK-NEXT: --output-source-map-url,-osu Emit specified string as source ;; CHECK-NEXT: map URL ;; CHECK-NEXT: +;; CHECK-NEXT: --deprecated-wat-parser Use the old, deprecated WAT +;; CHECK-NEXT: parser. This option will be +;; CHECK-NEXT: removed soon! +;; CHECK-NEXT: ;; CHECK-NEXT: --new-wat-parser Use the experimental new WAT ;; CHECK-NEXT: parser ;; CHECK-NEXT: