From 81dc6e7062ed86945a6253c6edaffe62ddabc631 Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Wed, 1 May 2024 17:35:52 +0200 Subject: feat: switch back to upstream wasmparser Signed-off-by: Henry Gressmann --- crates/parser/src/visit.rs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'crates/parser/src/visit.rs') diff --git a/crates/parser/src/visit.rs b/crates/parser/src/visit.rs index c5743b8..80dc789 100644 --- a/crates/parser/src/visit.rs +++ b/crates/parser/src/visit.rs @@ -117,12 +117,26 @@ impl FunctionBuilder { } } +macro_rules! impl_visit_operator { + ($(@$proposal:ident $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident)*) => { + $(impl_visit_operator!(@@$proposal $op $({ $($arg: $argty),* })? => $visit);)* + }; + + (@@mvp $($rest:tt)* ) => {}; + (@@reference_types $($rest:tt)* ) => {}; + (@@sign_extension $($rest:tt)* ) => {}; + (@@saturating_float_to_int $($rest:tt)* ) => {}; + (@@bulk_memory $($rest:tt)* ) => {}; + (@@$proposal:ident $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident) => { + fn $visit(&mut self $($(,$arg: $argty)*)?) -> Result<()>{ + self.unsupported(stringify!($visit)) + } + }; +} + impl<'a> wasmparser::VisitOperator<'a> for FunctionBuilder { type Output = Result<()>; - - fn visit_default(&mut self, op: &str) -> Self::Output { - self.unsupported(op) - } + wasmparser::for_each_operator!(impl_visit_operator); define_primitive_operands! { visit_br, Instruction::Br, u32, -- cgit v1.3.1