fix usage of the debug feature

This commit is contained in:
vms 2020-07-11 22:02:11 +03:00
parent 5dc680c046
commit 9775ca6144
3 changed files with 16 additions and 20 deletions

View File

@ -46,7 +46,7 @@ pub use result::set_result_size;
#[allow(unused_variables)]
pub(crate) fn log<S: AsRef<str>>(msg: S) {
// logs will be printed only if debug feature is enabled
#[cfg(debug)]
#[cfg(feature = "debug")]
unsafe {
let msg = msg.as_ref();
logger::log_utf8_string(msg.as_ptr() as _, msg.len() as _);

View File

@ -210,22 +210,4 @@ impl ParsedType {
ParsedType::Utf8String | ParsedType::ByteVector | ParsedType::Record(_) => true,
}
}
pub fn to_raw_types(&self) -> Vec<WasmType> {
match self {
ParsedType::Boolean
| ParsedType::I8
| ParsedType::I16
| ParsedType::I32
| ParsedType::U8
| ParsedType::U16
| ParsedType::U32 => vec![WasmType::I32],
ParsedType::I64 | ParsedType::U64 => vec![WasmType::I64],
ParsedType::F32 => vec![WasmType::F32],
ParsedType::F64 => vec![WasmType::F64],
ParsedType::Utf8String | ParsedType::ByteVector | ParsedType::Record(_) => {
vec![WasmType::I32, WasmType::I32]
}
}
}
}

View File

@ -24,6 +24,20 @@ pub(crate) trait FnArgGlueCodeGenerator {
impl FnArgGlueCodeGenerator for ParsedType {
fn generate_arguments(&self) -> Vec<WasmType> {
self.to_raw_types()
match self {
ParsedType::Boolean
| ParsedType::I8
| ParsedType::I16
| ParsedType::I32
| ParsedType::U8
| ParsedType::U16
| ParsedType::U32 => vec![WasmType::I32],
ParsedType::I64 | ParsedType::U64 => vec![WasmType::I64],
ParsedType::F32 => vec![WasmType::F32],
ParsedType::F64 => vec![WasmType::F64],
ParsedType::Utf8String | ParsedType::ByteVector | ParsedType::Record(_) => {
vec![WasmType::I32, WasmType::I32]
}
}
}
}