From ba1cf56464f8e5c3c7bcc2dc75f10aad2cd56e6b Mon Sep 17 00:00:00 2001 From: Henry Date: Sat, 2 May 2026 21:14:02 +0200 Subject: chore: add more tests, fix issues with import types, cleanup doom example Signed-off-by: Henry --- crates/parser/src/lib.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'crates/parser/src/lib.rs') diff --git a/crates/parser/src/lib.rs b/crates/parser/src/lib.rs index c4f6ff7..c6ae326 100644 --- a/crates/parser/src/lib.rs +++ b/crates/parser/src/lib.rs @@ -283,7 +283,25 @@ impl Parser { continue; } - if eof || reader.end_reached { + if reader.end_reached { + if !buffer.is_empty() { + return Err(ParseError::Other("trailing bytes after end of module".into())); + } + + if !eof { + let read_bytes = Self::read_more(&mut stream, &mut buffer, 1)?; + eof = read_bytes == 0; + + if !eof { + return Err(ParseError::Other("trailing bytes after end of module".into())); + } + } + + reader.process_pending_functions(&self.options)?; + return reader.into_module(&self.options); + } + + if eof { reader.process_pending_functions(&self.options)?; return reader.into_module(&self.options); } -- cgit v1.3.1