From 8ecbceb5de291e58e39e8400824a317232fd1f2c Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Wed, 26 Feb 2020 12:40:20 -0800 Subject: [PATCH] handle union result types (simplify logic) --- crates/generate/src/funcs.rs | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/crates/generate/src/funcs.rs b/crates/generate/src/funcs.rs index 50344f876e..fc7593d4e2 100644 --- a/crates/generate/src/funcs.rs +++ b/crates/generate/src/funcs.rs @@ -345,22 +345,12 @@ where match &*tref.type_() { witx::Type::Builtin(b) => match b { - witx::BuiltinType::U8 - | witx::BuiltinType::S8 - | witx::BuiltinType::U16 - | witx::BuiltinType::S16 - | witx::BuiltinType::U32 - | witx::BuiltinType::S32 - | witx::BuiltinType::U64 - | witx::BuiltinType::S64 - | witx::BuiltinType::F32 - | witx::BuiltinType::F64 - | witx::BuiltinType::USize - | witx::BuiltinType::Char8 => write_val_to_ptr, - witx::BuiltinType::String => unimplemented!("string types"), + witx::BuiltinType::String => unimplemented!("string result types"), + _ => write_val_to_ptr, }, - witx::Type::Enum(_) | witx::Type::Flags(_) | witx::Type::Int(_) => write_val_to_ptr, - witx::Type::Struct(_) => write_val_to_ptr, - _ => unimplemented!("missing marshalling result for {:?}", &*tref.type_()), + witx::Type::Pointer { .. } | witx::Type::ConstPointer { .. } | witx::Type::Array { .. } => { + unimplemented!("pointer/array result types") + } + _ => write_val_to_ptr, } }