Add a Layout::next_ebb() method.

This lets us iterate over the blocks in a function without holding a
reference to the layout.
This commit is contained in:
Jakob Stoklund Olesen
2017-02-14 15:52:44 -08:00
parent 2c31041640
commit 2317142c75

View File

@@ -348,6 +348,11 @@ impl Layout {
pub fn entry_block(&self) -> Option<Ebb> {
self.first_ebb
}
/// Get the block following `ebb` in the layout order.
pub fn next_ebb(&self, ebb: Ebb) -> Option<Ebb> {
self.ebbs[ebb].next.expand()
}
}
#[derive(Clone, Debug, Default)]