diff options
| author | Henry <mail@henrygressmann.de> | 2026-08-29 22:20:03 +0200 |
|---|---|---|
| committer | Henry <mail@henrygressmann.de> | 2026-08-29 22:20:06 +0200 |
| commit | c67ce64bfc88eada4d2b611e30b2dd307a7f7526 (patch) | |
| tree | 17a14c01d88e16572d9992b6d0aff548fdcbb1fa /crates/cli/src/wast_runner.rs | |
| parent | bb17468c990ba2ef819e5d3349539bb7a4aaedbd (diff) | |
feat: add nightly tail-call interpreter dispatch
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'crates/cli/src/wast_runner.rs')
| -rw-r--r-- | crates/cli/src/wast_runner.rs | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/crates/cli/src/wast_runner.rs b/crates/cli/src/wast_runner.rs index 02add87..4ebdc6c 100644 --- a/crates/cli/src/wast_runner.rs +++ b/crates/cli/src/wast_runner.rs @@ -50,10 +50,8 @@ impl ModuleRegistry { } fn definition(&self, id: Option<wast::token::Id<'_>>) -> Option<Module> { - match id { - Some(id) => self.definitions.get(id.name()).cloned(), - None => self.last_definition.clone(), - } + let Some(id) = id else { return self.last_definition.clone() }; + self.definitions.get(id.name()).cloned() } fn update_last_instance(&mut self, instance: ModuleInstance, name: Option<String>) { @@ -71,21 +69,13 @@ impl ModuleRegistry { } fn get_idx(&self, module_id: Option<wast::token::Id<'_>>) -> Option<u32> { - match module_id { - Some(module) => { - self.registered.get(module.name()).or_else(|| self.instances.get(module.name())).map(ModuleInstance::id) - } - None => self.last_instance.as_ref().map(ModuleInstance::id), - } + let Some(module_id) = module_id else { return self.last_instance.as_ref().map(ModuleInstance::id) }; + self.registered.get(module_id.name()).or_else(|| self.instances.get(module_id.name())).map(ModuleInstance::id) } fn get(&self, module_id: Option<wast::token::Id<'_>>) -> Option<ModuleInstance> { - match module_id { - Some(module_id) => { - self.registered.get(module_id.name()).or_else(|| self.instances.get(module_id.name())).cloned() - } - None => self.last_instance.clone(), - } + let Some(module_id) = module_id else { return self.last_instance.clone() }; + self.registered.get(module_id.name()).or_else(|| self.instances.get(module_id.name())).cloned() } } |
