From c44c6f91b89508a71a838406b286d114e461ca18 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 18 Jul 2024 02:39:36 +0900 Subject: refactor: simplify Runtime::instantiate()'s parameters --- src/WebAssembly/Execution/Linker.php | 2 +- src/WebAssembly/Execution/Runtime.php | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/WebAssembly') diff --git a/src/WebAssembly/Execution/Linker.php b/src/WebAssembly/Execution/Linker.php index 3c9c1d0..89aaaba 100644 --- a/src/WebAssembly/Execution/Linker.php +++ b/src/WebAssembly/Execution/Linker.php @@ -14,7 +14,7 @@ final class Linker private array $symbols = []; public function __construct( - private Store $store, + public readonly Store $store, ) { } diff --git a/src/WebAssembly/Execution/Runtime.php b/src/WebAssembly/Execution/Runtime.php index 2604212..1bb440b 100644 --- a/src/WebAssembly/Execution/Runtime.php +++ b/src/WebAssembly/Execution/Runtime.php @@ -39,14 +39,13 @@ final class Runtime implements ExporterInterface ) { } - /** - * @param list $externVals - */ public static function instantiate( - Store $store, Module $module, - array $externVals, + Linker $linker, ): self { + $store = $linker->store; + $externVals = $linker->resolve($module); + $allocator = new Allocator($store); $moduleInstInit = $allocator->allocPreInitModule($module, $externVals); -- cgit v1.2.3-70-g09d2