🐛 bug: patch loader

main
_ 2023-09-30 10:08:13 -05:00
parent 46cf5837bc
commit ae858ebe70
1 changed files with 13 additions and 10 deletions

View File

@ -296,24 +296,27 @@ pub fn parse_block <R: Read> (rdr: &mut R, blocks: &mut Vec <Block>)
// I think this is delta line numbers, e.g. most instructions // I think this is delta line numbers, e.g. most instructions
// have 0, but when you go to a new source line it's 1+. // have 0, but when you go to a new source line it's 1+.
let lineinfo_count = parse_int (rdr).unwrap (); let lineinfo_count = load_size (rdr);
for _ in 0..lineinfo_count { for _ in 0..lineinfo_count {
parse_byte (rdr).unwrap (); parse_byte (rdr).unwrap ();
} }
// Absolute line info, didn't see that in my test files // Absolute line info, didn't see that in my test files
let abslineinfo_count = parse_int (rdr).unwrap (); let abslineinfo_count = load_size (rdr);
assert_eq! (abslineinfo_count, 0); for _ in 0..abslineinfo_count {
load_unsigned (rdr, usize::MAX);
let local_count = parse_int (rdr).unwrap (); load_unsigned (rdr, usize::MAX);
for _ in 0..local_count {
parse_string(rdr).unwrap ();
parse_int (rdr).unwrap ();
parse_int (rdr).unwrap ();
} }
let upvalue_count = parse_int (rdr).unwrap (); let local_count = load_size (rdr);
for _ in 0..local_count {
parse_string(rdr);
load_unsigned (rdr, usize::MAX);
load_unsigned (rdr, usize::MAX);
}
let upvalue_count = load_size (rdr);
for _ in 0..upvalue_count { for _ in 0..upvalue_count {
parse_string (rdr).unwrap (); parse_string (rdr).unwrap ();
} }