Check for duplicate jump tables before performing any IR mutations.
This isn't fixing an actual bug, but it does make `add_jt` more consistent with the other `add_*` functions.
This commit is contained in:
@@ -233,11 +233,12 @@ impl<'a> Context<'a> {
|
|||||||
|
|
||||||
// Allocate a new jump table.
|
// Allocate a new jump table.
|
||||||
fn add_jt(&mut self, jt: JumpTable, data: JumpTableData, loc: Location) -> ParseResult<()> {
|
fn add_jt(&mut self, jt: JumpTable, data: JumpTableData, loc: Location) -> ParseResult<()> {
|
||||||
|
self.map.def_jt(jt, loc)?;
|
||||||
while self.function.jump_tables.next_key().index() <= jt.index() {
|
while self.function.jump_tables.next_key().index() <= jt.index() {
|
||||||
self.function.create_jump_table(JumpTableData::new());
|
self.function.create_jump_table(JumpTableData::new());
|
||||||
}
|
}
|
||||||
self.function.jump_tables[jt] = data;
|
self.function.jump_tables[jt] = data;
|
||||||
self.map.def_jt(jt, loc)
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve a reference to a jump table.
|
// Resolve a reference to a jump table.
|
||||||
|
|||||||
Reference in New Issue
Block a user