Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable multi-value without feature #4

Open
wants to merge 1 commit into
base: v0.45.0-sign-ext
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/elements/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2378,15 +2378,15 @@ impl fmt::Display for Instruction {
Nop => fmt_op!(f, "nop"),
Block(BlockType::NoResult) => fmt_op!(f, "block"),
Block(BlockType::Value(value_type)) => fmt_op!(f, "block", value_type),
#[cfg(feature = "multi_value")]
// #[cfg(feature = "multi_value")]
Block(BlockType::TypeIndex(idx)) => write!(f, "block type_idx={}", idx),
Loop(BlockType::NoResult) => fmt_op!(f, "loop"),
Loop(BlockType::Value(value_type)) => fmt_op!(f, "loop", value_type),
#[cfg(feature = "multi_value")]
// #[cfg(feature = "multi_value")]
Loop(BlockType::TypeIndex(idx)) => write!(f, "loop type_idx={}", idx),
If(BlockType::NoResult) => fmt_op!(f, "if"),
If(BlockType::Value(value_type)) => fmt_op!(f, "if", value_type),
#[cfg(feature = "multi_value")]
// #[cfg(feature = "multi_value")]
If(BlockType::TypeIndex(idx)) => write!(f, "if type_idx={}", idx),
Else => fmt_op!(f, "else"),
End => fmt_op!(f, "end"),
Expand Down
22 changes: 11 additions & 11 deletions src/elements/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub enum BlockType {
/// Inline value type.
Value(ValueType),
/// Reference to a signature.
#[cfg(feature = "multi_value")]
// #[cfg(feature = "multi_value")]
TypeIndex(u32),
}

Expand All @@ -121,13 +121,13 @@ impl Deserialize for BlockType {
-0x04 => Ok(BlockType::Value(ValueType::F64)),
#[cfg(feature = "simd")]
-0x05 => Ok(BlockType::Value(ValueType::V128)),
#[cfg(feature = "multi_value")]
// #[cfg(feature = "multi_value")]
idx => {
let idx = idx.try_into().map_err(|_| Error::UnknownBlockType(idx))?;
Ok(BlockType::TypeIndex(idx))
},
#[cfg(not(feature = "multi_value"))]
_ => Err(Error::UnknownBlockType(val.into())),
// #[cfg(not(feature = "multi_value"))]
// _ => Err(Error::UnknownBlockType(val.into())),
}
}
}
Expand All @@ -144,7 +144,7 @@ impl Serialize for BlockType {
BlockType::Value(ValueType::F64) => -0x04,
#[cfg(feature = "simd")]
BlockType::Value(ValueType::V128) => -0x05,
#[cfg(feature = "multi_value")]
// #[cfg(feature = "multi_value")]
BlockType::TypeIndex(idx) => idx as i32,
}
.into();
Expand Down Expand Up @@ -207,12 +207,12 @@ impl Deserialize for FunctionType {
let params: Vec<ValueType> = CountedList::deserialize(reader)?.into_inner();
let results: Vec<ValueType> = CountedList::deserialize(reader)?.into_inner();

#[cfg(not(feature = "multi_value"))]
if results.len() > 1 {
return Err(Error::Other(
"Enable the multi_value feature to deserialize more than one function result",
))
}
// #[cfg(not(feature = "multi_value"))]
// if results.len() > 1 {
// return Err(Error::Other(
// "Enable the multi_value feature to deserialize more than one function result",
// ))
// }

Ok(FunctionType { form, params, results })
}
Expand Down