Inline jump tables in parsed br_table instructions (#5755)
As jump tables are used by at most one br_table instruction, inline their definition in those instructions instead of requiring them to be declared as function-level metadata.
This commit is contained in:
@@ -81,7 +81,7 @@ impl JumpTableData {
|
||||
|
||||
impl Display for JumpTableData {
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
write!(fmt, "jump_table [")?;
|
||||
write!(fmt, "[")?;
|
||||
match self.table.first() {
|
||||
None => (),
|
||||
Some(first) => write!(fmt, "{}", first)?,
|
||||
@@ -107,7 +107,7 @@ mod tests {
|
||||
assert_eq!(jt.as_slice().get(0), None);
|
||||
assert_eq!(jt.as_slice().get(10), None);
|
||||
|
||||
assert_eq!(jt.to_string(), "jump_table []");
|
||||
assert_eq!(jt.to_string(), "[]");
|
||||
|
||||
let v = jt.as_slice();
|
||||
assert_eq!(v, []);
|
||||
@@ -124,7 +124,7 @@ mod tests {
|
||||
jt.push_entry(e2);
|
||||
jt.push_entry(e1);
|
||||
|
||||
assert_eq!(jt.to_string(), "jump_table [block1, block2, block1]");
|
||||
assert_eq!(jt.to_string(), "[block1, block2, block1]");
|
||||
|
||||
let v = jt.as_slice();
|
||||
assert_eq!(v, [e1, e2, e1]);
|
||||
|
||||
Reference in New Issue
Block a user