mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
Factor out creating wasmparser::ValidatingParserConfig to its own function.
This commit is contained in:
parent
b2db9238af
commit
acbface4be
@ -137,8 +137,22 @@ impl<
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_validating_parser_config() -> wasmparser::ValidatingParserConfig {
|
||||
wasmparser::ValidatingParserConfig {
|
||||
operator_config: wasmparser::OperatorValidatorConfig {
|
||||
enable_threads: false,
|
||||
enable_reference_types: false,
|
||||
enable_simd: false,
|
||||
enable_bulk_memory: false,
|
||||
enable_multi_value: false,
|
||||
},
|
||||
mutable_global_imports: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn validate(bytes: &[u8]) -> CompileResult<()> {
|
||||
let mut parser = wasmparser::ValidatingParser::new(bytes, None);
|
||||
let mut parser =
|
||||
wasmparser::ValidatingParser::new(bytes, Some(default_validating_parser_config()));
|
||||
loop {
|
||||
let state = parser.read();
|
||||
match *state {
|
||||
|
@ -85,19 +85,8 @@ pub fn read_module<
|
||||
custom_sections: HashMap::new(),
|
||||
}));
|
||||
|
||||
let mut parser = wasmparser::ValidatingParser::new(
|
||||
wasm,
|
||||
Some(wasmparser::ValidatingParserConfig {
|
||||
operator_config: wasmparser::OperatorValidatorConfig {
|
||||
enable_threads: false,
|
||||
enable_reference_types: false,
|
||||
enable_simd: false,
|
||||
enable_bulk_memory: false,
|
||||
enable_multi_value: false,
|
||||
},
|
||||
mutable_global_imports: false,
|
||||
}),
|
||||
);
|
||||
let mut parser =
|
||||
wasmparser::ValidatingParser::new(wasm, Some(default_validating_parser_config()));
|
||||
|
||||
let mut namespace_builder = Some(StringTableBuilder::new());
|
||||
let mut name_builder = Some(StringTableBuilder::new());
|
||||
|
Loading…
Reference in New Issue
Block a user