7ZAXEGS7NVSQIZXZKNPNXEDXW44VNZMMRVPZ4LTFCQS4W6HXG4UQC
fn get_offset<S: AsRef<str>>(&self, name: S) -> Option<usize> {
self.labels
.get(&self.symbol_table.borrow_mut().id(name))
.copied()
/// Get the block offset of a specific label
pub fn get_offset<S: AsRef<str>>(&self, label: S) -> Option<usize> {
self.symbol_table
.id(label)
.and_then(|sym| self.labels.get(&sym).copied())
}
/// The symbol table of block labels
pub fn symbols(&self) -> &SymbolTable {
&self.symbol_table
}
/// Breakpoint access
pub fn breakpoints(&self) -> &HashSet<usize> {
&self.breakpoints
}
/// Mutable breakpoint access
pub fn breakpoints_mut(&mut self) -> &mut HashSet<usize> {
&mut self.breakpoints
pub fn id<S: AsRef<str>>(&mut self, source: S) -> SymbolId {
if let Some(pos) = self.1.iter().position(|s| s.as_ref() == source.as_ref()) {
SymbolId(self.0, pos)
} else {
pub fn id<S: AsRef<str>>(&self, source: S) -> Option<SymbolId> {
self.1
.iter()
.position(|s| s.as_ref() == source.as_ref())
.map(|pos| SymbolId(self.0, pos))
}
/// If a valid symbol, get the id, otherwise, create a new id referencing the symbol
pub fn id_mut<S: AsRef<str>>(&mut self, source: S) -> SymbolId {
self.id(source.as_ref()).unwrap_or_else(|| {