-
Notifications
You must be signed in to change notification settings - Fork 699
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix parsing for typed function reference types
Previously an indexed ref type was parsed as a `Var`, assuming that regular types would be represented as index vars and named ref types would be named vars. Unfortunately, it's also possible for a ref type to be an indexed var that overlaps with a type (e.g., the type "any" which is 0x0 and the index 0). This commit restructures the code so that both a `Type` and `Var` are returned. Closes #1889
- Loading branch information
Showing
3 changed files
with
53 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
;;; TOOL: wat2wasm | ||
;;; ARGS: --enable-function-references | ||
(module | ||
(type $f32-f32-1 (func (param f32) (result f32))) | ||
(type $f32-f32-2 (func (param f32) (result f32))) | ||
|
||
(func $foo (param $f (ref $f32-f32-1)) (result f32) | ||
(call_ref (f32.const 42.0) (local.get $f)) | ||
) | ||
|
||
(func $bar (type $f32-f32-2) | ||
(f32.const 1.0) | ||
) | ||
|
||
(func (export "main") (result f32) | ||
;; $f32-f32-1 and $f32-f32-2 should be equal | ||
(call $foo (ref.func $bar)) | ||
) | ||
|
||
(elem declare funcref (ref.func $bar)) | ||
) | ||
|
||
(;; STDERR ;;; | ||
;;; STDERR ;;) |