diff options
author | Alon Zakai <azakai@google.com> | 2020-11-18 09:52:08 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-18 09:52:08 -0800 |
commit | 3b5a67596be228d44471ecf66c934162c7b87882 (patch) | |
tree | 3dcb0f102d78bf8adae256abdd8f4d1ea68a86f2 /src/wasm/wasm-validator.cpp | |
parent | 091a50c764362511c4c338cb781ea278611613b0 (diff) | |
download | binaryen-3b5a67596be228d44471ecf66c934162c7b87882.tar.gz binaryen-3b5a67596be228d44471ecf66c934162c7b87882.tar.bz2 binaryen-3b5a67596be228d44471ecf66c934162c7b87882.zip |
[Types] Handle function types fully in more places (#3381)
Call isFunction to check for a general function type instead of just
a funcref, in places where we care about both, and some other minor
miscellaneous typing fixes in preparation for typed function references
(this will be tested fully at that time).
Change is mostly whitespace.
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 38dfa8092..809ca5a6a 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2030,6 +2030,10 @@ void FunctionValidator::visitRefFunc(RefFunc* curr) { } auto* func = getModule()->getFunctionOrNull(curr->func); shouldBeTrue(!!func, curr, "function argument of ref.func must exist"); + shouldBeTrue(curr->type.isFunction(), + curr, + "ref.func must have a function reference type"); + // TODO: check for non-nullability } void FunctionValidator::visitRefEq(RefEq* curr) { @@ -2311,7 +2315,7 @@ void FunctionValidator::visitFunction(Function* curr) { shouldBeTrue(var.isConcrete(), curr, "vars must be concretely typed"); } shouldBeTrue(features <= getModule()->features, - curr, + curr->name, "all used types should be allowed"); if (curr->profile == IRProfile::Poppy) { shouldBeTrue( |