summaryrefslogtreecommitdiff
path: root/crates/cli
diff options
context:
space:
mode:
authorHenry <mail@henrygressmann.de>2026-08-29 22:20:03 +0200
committerHenry <mail@henrygressmann.de>2026-08-29 22:20:06 +0200
commitc67ce64bfc88eada4d2b611e30b2dd307a7f7526 (patch)
tree17a14c01d88e16572d9992b6d0aff548fdcbb1fa /crates/cli
parentbb17468c990ba2ef819e5d3349539bb7a4aaedbd (diff)
feat: add nightly tail-call interpreter dispatch
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'crates/cli')
-rw-r--r--crates/cli/src/wast_runner.rs22
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()
}
}