pub (super) fn rebind_imported_bindings(imported_bindings: Arc<HashMap<usize, CellRef>>, bindings: SymbolBindings, frame_depth: u32) -> (SymbolBindings, Option<Arc<HashMap<usize, CellRef>>>) {
    // Rebind all of the imported bindings, importing the frame reference and the syntax if there are any
    let mut bindings                    = bindings;
    let mut rebound_imported_bindings   = (*imported_bindings).clone();
    let mut rebound                     = false;

    for (_cell, binding) in rebound_imported_bindings.iter_mut() {
        // Try to rebind the cell
        let (new_bindings, new_binding) = rebind_cell(binding, bindings, frame_depth);
        bindings                        = new_bindings;

        if let Some(new_binding) = new_binding {
            // Copy to the binding and mark as rebound
            *binding    = new_binding;
            rebound     = true;
        }
    }

    // If no bindings were updated, just keep using the same syntax as before
    if !rebound {
        return (bindings, None);
    }

    // Regenerate the syntax symbols with the new imported bindings
    let rebound_imported_bindings   = Arc::new(rebound_imported_bindings);

    (bindings, Some(rebound_imported_bindings))
}
///
/// Rebinds an imported_bindings hashmap to a new frame at a particular depth
///
Rebinds an imported_bindings hashmap to a new frame at a particular depth
Rebinds an imported_bindings hashmap to a new frame at a particular depth
pub (super) fn rebind_imported_bindings(imported_bindings: Arc<HashMap<usize, CellRef>>, bindings: SymbolBindings, frame_depth: u32) -> (SymbolBindings, Option<Arc<HashMap<usize, CellRef>>>) {
    // Rebind all of the imported bindings, importing the frame reference and the syntax if there are any
    let mut bindings                    = bindings;
    let mut rebound_imported_bindings   = (*imported_bindings).clone();
    let mut rebound                     = false;
    for (_cell, binding) in rebound_imported_bindings.iter_mut() {
        // Try to rebind the cell
        let (new_bindings, new_binding) = rebind_cell(binding, bindings, frame_depth);
        bindings                        = new_bindings;
        if let Some(new_binding) = new_binding {
            // Copy to the binding and mark as rebound
            *binding    = new_binding;
            rebound     = true;
        }
    }
    // If no bindings were updated, just keep using the same syntax as before
    if !rebound {
        return (bindings, None);
    }
    // Regenerate the syntax symbols with the new imported bindings
    let rebound_imported_bindings   = Arc::new(rebound_imported_bindings);
    (bindings, Some(rebound_imported_bindings))
}
pub ( super ) fn rebind_imported_bindings ( imported_bindings : Arc < HashMap < usize , CellRef > > , bindings : SymbolBindings , frame_depth : u32 ) -> ( SymbolBindings , Option < Arc < HashMap < usize , CellRef > > > ) { // Rebind all of the imported bindings, importing the frame reference and the syntax if there are any let mut bindings = bindings ; let mut rebound_imported_bindings = ( * imported_bindings ) . clone ( ) ; let mut rebound = false ; for ( _cell , binding ) in rebound_imported_bindings . iter_mut ( ) { // Try to rebind the cell let ( new_bindings , new_binding ) = rebind_cell ( binding , bindings , frame_depth ) ; bindings = new_bindings ; if let Some ( new_binding ) = new_binding { // Copy to the binding and mark as rebound * binding = new_binding ; rebound = true ; } } // If no bindings were updated, just keep using the same syntax as before if ! rebound { return ( bindings , None ) ; } // Regenerate the syntax symbols with the new imported bindings let rebound_imported_bindings = Arc :: new ( rebound_imported_bindings ) ; ( bindings , Some ( rebound_imported_bindings ) ) }
Rebinds an imported_bindings hashmap to a new frame at a particular depth
Rebinds an imported_bindings hashmap to a new frame at a particular depth
imported_bindings
Arc<HashMap<usize, CellRef>>
bindings
SymbolBindings
frame_depth
u32
imported_bindings
Arc<HashMap<usize, CellRef>>
bindings
SymbolBindings
frame_depth
u32