Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a flag to opt in to the old WAT parser #6536

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/tools/wasm-opt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
24 changes: 24 additions & 0 deletions test/lit/deprecated-wat.wast
Original file line number Diff line number Diff line change
@@ -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))
)
4 changes: 4 additions & 0 deletions test/lit/help/wasm-opt.test
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading