aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/WebAssembly/Structure
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-07-29 18:23:59 +0900
committernsfisis <nsfisis@gmail.com>2025-10-18 19:47:13 +0900
commita0ec6fc11cbb68d5912e850b9f73b94f4560d510 (patch)
tree070ab472bb1bd3c5bb739b2b19052d1083fe9acd /src/WebAssembly/Structure
parent2656a7d724c2738bd8fa8d3a876a1228642bf54e (diff)
downloadphp-waddiwasi-validation.tar.gz
php-waddiwasi-validation.tar.zst
php-waddiwasi-validation.zip
Diffstat (limited to 'src/WebAssembly/Structure')
-rw-r--r--src/WebAssembly/Structure/Types/ValType.php24
1 files changed, 24 insertions, 0 deletions
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,
+ };
+ }
}