WIP.
This commit is contained in:
parent
44c2c8dc17
commit
3ca0886fbb
|
@ -3,7 +3,7 @@
|
||||||
use crate::ir::*;
|
use crate::ir::*;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use log::trace;
|
use log::trace;
|
||||||
use wasmparser::{Parser, Payload, TypeDef};
|
use wasmparser::{ImportSectionEntryType, Parser, Payload, TypeDef};
|
||||||
|
|
||||||
pub fn wasm_to_ir(bytes: &[u8]) -> Result<Module> {
|
pub fn wasm_to_ir(bytes: &[u8]) -> Result<Module> {
|
||||||
let mut module = Module::default();
|
let mut module = Module::default();
|
||||||
|
@ -30,6 +30,16 @@ fn handle_payload<'a>(module: &mut Module, payload: Payload<'a>) -> Result<()> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Payload::ImportSection(mut reader) => {
|
||||||
|
for _ in 0..reader.get_count() {
|
||||||
|
match reader.read()?.ty {
|
||||||
|
ImportSectionEntryType::Function(sig_idx) => {
|
||||||
|
module.funcs.push(FuncDecl::Import(sig_idx as SignatureId));
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue