Lines
100 %
Functions
Branches
//! What a unit that rebinds a special keeps so a host can tell, after a trap,
//! which value the global holds outside every binding (plan 0014 PERSIST P11).
use super::homes::locked;
use super::table::SymbolTable;
/// Exported i32 `depth` counts the dynamic bindings of a special in force;
/// entering the outermost one stores the special's value in `outer` and its
/// bound flag in `outer_bound`.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Rebind {
pub depth: u32,
pub outer: u32,
pub outer_bound: u32,
}
impl SymbolTable {
/// The rebind globals of the special held in global `global`.
pub(crate) fn rebind_of(&self, global: u32) -> Option<Rebind> {
locked(&self.homes).rebinds.get(&global).copied()
pub(crate) fn note_rebind(&self, global: u32, rebind: Rebind) {
locked(&self.homes).rebinds.insert(global, rebind);