diff --git a/src/vm/obj/mod.rs b/src/vm/obj/mod.rs index fc28b7d..f4787f1 100644 --- a/src/vm/obj/mod.rs +++ b/src/vm/obj/mod.rs @@ -115,7 +115,7 @@ pub struct ObjectParser { impl ObjectParser { pub fn parse(&mut self) -> Result { let header = self.parse_header()?; - let sections = self.parse_sections()?; + let sections = self.parse_sections(header)?; Ok(Object { header, sections }) } @@ -127,8 +127,10 @@ impl ObjectParser { Ok(Header { version, sections }) } - fn parse_sections(&mut self) -> Result>> { - todo!() + fn parse_sections(&mut self, header: Header) -> Result>> { + (0..header.sections) + .map(|_| self.parse_section()) + .collect() } fn parse_section(&mut self) -> Result> {