Skip to content

Commit

Permalink
fix: 修复代码lint报错
Browse files Browse the repository at this point in the history
  • Loading branch information
YufJi committed Nov 29, 2024
1 parent d9bb9bc commit d0aea67
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions crates/mako/src/plugins/wasm_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,27 @@ impl Plugin for WasmRuntimePlugin {
File::open(&file.path)?.read_to_end(&mut buffer)?;
// Parse wasm file to get imports
let mut wasm_import_object_map: HashMap<&str, Vec<String>> = HashMap::new();
for payload in Parser::new(0).parse_all(&buffer) {
Parser::new(0).parse_all(&buffer).for_each(|payload| {
if let Ok(Payload::ImportSection(imports)) = payload {
for import in imports {
if let Ok(Import {
module,
name,
ty: _,
}) = import
imports.into_iter_with_offsets().for_each(|import| {
if let Ok((
_,
Import {
module,
name,
ty: _,
},
)) = import
{
if let Some(import_object) = wasm_import_object_map.get_mut(module) {
import_object.push(name.to_string());
} else {
wasm_import_object_map.insert(module, vec![name.to_string()]);
}
}
}
});
}
}
});

let mut module_import_code = String::new();
let mut wasm_import_object_code = String::new();
Expand Down

0 comments on commit d0aea67

Please sign in to comment.