From 8a083ed74e9f4472441175e187208012927ed357 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 11 Jul 2024 03:50:50 +0900 Subject: feat: simplify ValType structure --- src/WebAssembly/Structure/Instructions/Instr.php | 6 ++++-- .../Structure/Instructions/Instrs/Reference/RefNull.php | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/WebAssembly/Structure/Instructions') diff --git a/src/WebAssembly/Structure/Instructions/Instr.php b/src/WebAssembly/Structure/Instructions/Instr.php index 18531c6..5f9cf29 100644 --- a/src/WebAssembly/Structure/Instructions/Instr.php +++ b/src/WebAssembly/Structure/Instructions/Instr.php @@ -12,7 +12,6 @@ use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Parametric; use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Reference; use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Table; use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Variable; -use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\RefType; use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\ValType; abstract readonly class Instr @@ -616,7 +615,10 @@ abstract readonly class Instr { return new Reference\RefIsNull(); } - final public static function RefNull(RefType $type): Reference\RefNull + /** + * @param ValType::FuncRef|ValType::ExternRef $type + */ + final public static function RefNull(ValType $type): Reference\RefNull { return new Reference\RefNull($type); } diff --git a/src/WebAssembly/Structure/Instructions/Instrs/Reference/RefNull.php b/src/WebAssembly/Structure/Instructions/Instrs/Reference/RefNull.php index 39d0f8f..ed5afff 100644 --- a/src/WebAssembly/Structure/Instructions/Instrs/Reference/RefNull.php +++ b/src/WebAssembly/Structure/Instructions/Instrs/Reference/RefNull.php @@ -5,12 +5,15 @@ declare(strict_types=1); namespace Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instrs\Reference; use Nsfisis\Waddiwasi\WebAssembly\Structure\Instructions\Instr; -use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\RefType; +use Nsfisis\Waddiwasi\WebAssembly\Structure\Types\ValType; final readonly class RefNull extends Instr { + /** + * @param ValType::FuncRef|ValType::ExternRef $type + */ protected function __construct( - public RefType $type, + public ValType $type, ) { } -- cgit v1.2.3-70-g09d2