mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
Minor refactor in CodeBuilder
This commit is contained in:
parent
e5a0738681
commit
5f998f3707
1 changed files with 5 additions and 2 deletions
|
@ -378,7 +378,7 @@ impl<'a> CodeBuilder<'a> {
|
|||
}
|
||||
|
||||
/// Serialize all byte vectors in the right order
|
||||
/// Also update relocation offsets relative to the provided base offset in the buffer
|
||||
/// Also update relocation offsets relative to the base offset (code section body start)
|
||||
pub fn serialize_with_relocs<T: SerialBuffer>(
|
||||
&self,
|
||||
buffer: &mut T,
|
||||
|
@ -395,7 +395,10 @@ impl<'a> CodeBuilder<'a> {
|
|||
|
||||
loop {
|
||||
let next_insert = insert_iter.next();
|
||||
let next_pos = next_insert.map(|i| i.at).unwrap_or_else(|| self.code.len());
|
||||
let next_pos = match next_insert {
|
||||
Some(Insertion { at, .. }) => *at,
|
||||
None => self.code.len(),
|
||||
};
|
||||
|
||||
// Relocation offset needs to be an index into the body of the code section, but
|
||||
// at this point it is an index into self.code. Need to adjust for all previous functions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue