From 39e6c4bfb1f3fb96bba47e3eec8e6451038a3d22 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 21 Feb 2026 23:22:25 +0900 Subject: feat: implement validation phase --- src/WebAssembly/Structure/Types/ValType.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/WebAssembly/Structure') diff --git a/src/WebAssembly/Structure/Types/ValType.php b/src/WebAssembly/Structure/Types/ValType.php index ace4604..02e1113 100644 --- a/src/WebAssembly/Structure/Types/ValType.php +++ b/src/WebAssembly/Structure/Types/ValType.php @@ -13,4 +13,28 @@ enum ValType case V128; case FuncRef; case ExternRef; + + public function isNum(): bool + { + return match ($this) { + ValType::I32 , ValType::I64 , ValType::F32 , ValType::F64 => true, + default => false, + }; + } + + public function isVec(): bool + { + return match ($this) { + ValType::V128 => true, + default => false, + }; + } + + public function isRef(): bool + { + return match ($this) { + ValType::FuncRef , ValType::ExternRef => true, + default => false, + }; + } } -- cgit v1.3-1-g0d28