From 1cbe8c3bfaf6bfd0a46b5a25c923405616ee48e7 Mon Sep 17 00:00:00 2001 From: vms Date: Thu, 22 Apr 2021 13:34:36 +0300 Subject: [PATCH] turn Option to Vec for output_type --- crates/wit/src/export_ast_types.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/wit/src/export_ast_types.rs b/crates/wit/src/export_ast_types.rs index db251db..838417b 100644 --- a/crates/wit/src/export_ast_types.rs +++ b/crates/wit/src/export_ast_types.rs @@ -31,7 +31,7 @@ pub struct FnSignature { pub arguments: Vec, // fce supports only one return value now, // waiting for adding multi-value support in Wasmer. - pub output_type: Option, + pub output_type: Vec, } #[derive(Clone, Serialize, Deserialize)] @@ -157,11 +157,15 @@ impl From for FnSignature { fn from(ast_fn_sig: AstFnSignature) -> Self { // TODO: consider to do transmute here in case of optimization issues. let arguments = ast_fn_sig.arguments.into_iter().map(Into::into).collect(); + let output_type = match ast_fn_sig.output_type { + Some(output_type) => vec![output_type], + None => Vec::new(), + }; Self { name: ast_fn_sig.name, arguments, - output_type: ast_fn_sig.output_type, + output_type, } } }