remove feature flag on custom sections

This commit is contained in:
Mackenzie Clark
2019-03-12 13:36:11 -07:00
parent 4cee16220b
commit f2488ac410
12 changed files with 6 additions and 23 deletions

View File

@ -8,7 +8,6 @@ pub type LinkResult<T> = std::result::Result<T, Vec<LinkError>>;
pub type RuntimeResult<T> = std::result::Result<T, RuntimeError>;
pub type CallResult<T> = std::result::Result<T, CallError>;
pub type ResolveResult<T> = std::result::Result<T, ResolveError>;
#[cfg(feature = "vfs")]
pub type ParseResult<T> = std::result::Result<T, ParseError>;
/// This is returned when the chosen compiler is unable to
@ -448,13 +447,11 @@ impl Into<GrowError> for MemoryProtectionError {
}
}
#[cfg(feature = "vfs")]
#[derive(Debug)]
pub enum ParseError {
BinaryReadError,
}
#[cfg(feature = "vfs")]
impl From<wasmparser::BinaryReaderError> for ParseError {
fn from(_: wasmparser::BinaryReaderError) -> Self {
ParseError::BinaryReadError

View File

@ -67,14 +67,9 @@ pub fn compile_with(
compiler: &dyn backend::Compiler,
) -> CompileResult<module::Module> {
let token = backend::Token::generate();
compiler.compile(wasm, token).map(|inner| {
#[cfg(feature = "vfs")]
let inner = {
let mut inner = inner;
let inner_info: &mut crate::module::ModuleInfo = &mut inner.info;
inner_info.import_custom_sections(wasm).unwrap();
inner
};
compiler.compile(wasm, token).map(|mut inner| {
let inner_info: &mut crate::module::ModuleInfo = &mut inner.info;
inner_info.import_custom_sections(wasm).unwrap();
module::Module::new(Arc::new(inner))
})
}

View File

@ -57,12 +57,10 @@ pub struct ModuleInfo {
pub namespace_table: StringTable<NamespaceIndex>,
pub name_table: StringTable<NameIndex>,
#[cfg(feature = "vfs")]
pub custom_sections: HashMap<String, Vec<u8>>,
}
impl ModuleInfo {
#[cfg(feature = "vfs")]
pub fn import_custom_sections(&mut self, wasm: &[u8]) -> crate::error::ParseResult<()> {
let mut parser = wasmparser::ModuleReader::new(wasm)?;
while !parser.eof() {

View File

@ -592,7 +592,6 @@ mod vm_ctx_tests {
namespace_table: StringTable::new(),
name_table: StringTable::new(),
#[cfg(feature = "vfs")]
custom_sections: HashMap::new(),
},
}