diff options
author | Jérôme Vouillon <jerome.vouillon@gmail.com> | 2023-08-22 18:47:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-22 09:47:37 -0700 |
commit | 1d95fdc7805ef2f29b8b8b0cce8f7c8cc385edd0 (patch) | |
tree | 8476853499d83954cb6d6deb9d687dc45614a4b5 /test/lit/if-then-else.wast | |
parent | afca5f51a46750927ac9263297d24b224915e558 (diff) | |
download | binaryen-1d95fdc7805ef2f29b8b8b0cce8f7c8cc385edd0.tar.gz binaryen-1d95fdc7805ef2f29b8b8b0cce8f7c8cc385edd0.tar.bz2 binaryen-1d95fdc7805ef2f29b8b8b0cce8f7c8cc385edd0.zip |
Make the legacy parser follow more closely the standard GC text format (#5889)
* Allow empty `then` and `else` clauses
* Allow standard syntax for `ref.test` and `ref.cast`
Fixes #5795
* Allow size immediate in `array.new_fixed`
Fixes #5769
Diffstat (limited to 'test/lit/if-then-else.wast')
-rw-r--r-- | test/lit/if-then-else.wast | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/lit/if-then-else.wast b/test/lit/if-then-else.wast new file mode 100644 index 000000000..9d457bef1 --- /dev/null +++ b/test/lit/if-then-else.wast @@ -0,0 +1,48 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-opt %s -S -o - | filecheck %s + +;; Check that an empty then or else clause is allowed. +(module + ;; CHECK: (func $test (param $0 i32) (result i32) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (return + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (return + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (return + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $test (param i32) (result i32) + (if + (local.get $0) + (then) + (else + (return (i32.const 0)) + ) + ) + (if + (local.get $0) + (then + (return + (i32.const 1) + ) + ) + (else) + ) + (return + (i32.const 2) + ) + ) +) |