diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-07-11 03:50:50 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-07-11 04:14:03 +0900 |
| commit | 8a083ed74e9f4472441175e187208012927ed357 (patch) | |
| tree | 3686a0f61f3fccc5ded3eda28b92b8bf7765fd2f /examples | |
| parent | 26f49b7e27076e689541b9e13a1b54f60a4ee5c2 (diff) | |
| download | php-waddiwasi-8a083ed74e9f4472441175e187208012927ed357.tar.gz php-waddiwasi-8a083ed74e9f4472441175e187208012927ed357.tar.zst php-waddiwasi-8a083ed74e9f4472441175e187208012927ed357.zip | |
feat: simplify ValType structure
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/php-on-wasm/php-wasm.php | 9 | ||||
| -rw-r--r-- | examples/rubyvm-on-php-on-wasm/php-wasm.php | 9 |
2 files changed, 8 insertions, 10 deletions
diff --git a/examples/php-on-wasm/php-wasm.php b/examples/php-on-wasm/php-wasm.php index f7aca1f..cdec328 100644 --- a/examples/php-on-wasm/php-wasm.php +++ b/examples/php-on-wasm/php-wasm.php @@ -13,7 +13,6 @@ use Nsfisis\Waddiwasi\WebAssembly\Execution\Refs; use Nsfisis\Waddiwasi\WebAssembly\Execution\Runtime; use Nsfisis\Waddiwasi\WebAssembly\Execution\Store; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\FuncType; -use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\NumType; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\ResultType; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\ValType; @@ -176,10 +175,10 @@ function copyStringToWasmMemory(Runtime $runtime, int $dst, string $src): void function makeHostFunc(string $typeDef, callable $fn): Externs\Func { $stringToType = fn (string $s) => match ($s) { - 'i32' => ValType::NumType(NumType::I32), - 'i64' => ValType::NumType(NumType::I64), - 'f32' => ValType::NumType(NumType::F32), - 'f64' => ValType::NumType(NumType::F64), + 'i32' => ValType::I32, + 'i64' => ValType::I64, + 'f32' => ValType::F32, + 'f64' => ValType::F64, default => throw new \RuntimeException('Invalid type: ' . $s), }; preg_match('/^\(([^)]*)\) -> \(([^)]*)\)$/', $typeDef, $matches); diff --git a/examples/rubyvm-on-php-on-wasm/php-wasm.php b/examples/rubyvm-on-php-on-wasm/php-wasm.php index 789e6ac..b9f9cfa 100644 --- a/examples/rubyvm-on-php-on-wasm/php-wasm.php +++ b/examples/rubyvm-on-php-on-wasm/php-wasm.php @@ -13,7 +13,6 @@ use Nsfisis\Waddiwasi\WebAssembly\Execution\Refs; use Nsfisis\Waddiwasi\WebAssembly\Execution\Runtime; use Nsfisis\Waddiwasi\WebAssembly\Execution\Store; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\FuncType; -use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\NumType; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\ResultType; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\ValType; @@ -176,10 +175,10 @@ function copyStringToWasmMemory(Runtime $runtime, int $dst, string $src): void function makeHostFunc(string $typeDef, callable $fn): Externs\Func { $stringToType = fn (string $s) => match ($s) { - 'i32' => ValType::NumType(NumType::I32), - 'i64' => ValType::NumType(NumType::I64), - 'f32' => ValType::NumType(NumType::F32), - 'f64' => ValType::NumType(NumType::F64), + 'i32' => ValType::I32, + 'i64' => ValType::I64, + 'f32' => ValType::F32, + 'f64' => ValType::F64, default => throw new \RuntimeException('Invalid type: ' . $s), }; preg_match('/^\(([^)]*)\) -> \(([^)]*)\)$/', $typeDef, $matches); |
