pub fn import(&mut self, symbol: CellRef, cell_id: usize) {
        if let Some((import_from_cell_id, import_from_frame_id, import_ref_type)) = symbol.frame_reference() {
            if import_from_frame_id > 0 {
                // Import from the symbol in the parent frame
                self.import_symbols.push((SafasCell::FrameReference(import_from_cell_id, import_from_frame_id-1, import_ref_type).into(), cell_id));

                // Update any references to this parent cell to point to the imported cell
                for (_symbol, value) in self.symbols.iter_mut() {
                    if let SafasCell::FrameReference(reference_cell, reference_frame, ref_type) = &**value {
                        if *reference_cell == import_from_cell_id && *reference_frame == import_from_frame_id {
                            let replacement_symbol  = SafasCell::FrameReference(cell_id, 0, *ref_type);
                            *value                  = replacement_symbol.into();
                        }
                    }
                }
            } else {
                // Symbol can't be imported
                panic!("Cannot import a symbol that is already in the current frame")
            }
        } else {
            panic!("Import symbols must be a reference to a cell in a parent frame")
        }
    }
///
/// Adds a symbol to be imported from the parent frame of this binding. The symbol should be a frame reference.
/// 
/// Any binding that references this symbol will be updated to point to the cell after this call
///
Adds a symbol to be imported from the parent frame of this binding. The symbol should be a frame reference.
Any binding that references this symbol will be updated to point to the cell after this call
Adds a symbol to be imported from the parent frame of this binding . The symbol should be a frame reference . Any binding that references this symbol will be updated to point to the cell after this call
pub fn import(&mut self, symbol: CellRef, cell_id: usize) {
        if let Some((import_from_cell_id, import_from_frame_id, import_ref_type)) = symbol.frame_reference() {
            if import_from_frame_id > 0 {
                // Import from the symbol in the parent frame
                self.import_symbols.push((SafasCell::FrameReference(import_from_cell_id, import_from_frame_id-1, import_ref_type).into(), cell_id));
                // Update any references to this parent cell to point to the imported cell
                for (_symbol, value) in self.symbols.iter_mut() {
                    if let SafasCell::FrameReference(reference_cell, reference_frame, ref_type) = &**value {
                        if *reference_cell == import_from_cell_id && *reference_frame == import_from_frame_id {
                            let replacement_symbol  = SafasCell::FrameReference(cell_id, 0, *ref_type);
                            *value                  = replacement_symbol.into();
                        }
                    }
                }
            } else {
                // Symbol can't be imported
                panic!("Cannot import a symbol that is already in the current frame")
            }
        } else {
            panic!("Import symbols must be a reference to a cell in a parent frame")
        }
    }
pub fn import ( & mut self , symbol : CellRef , cell_id : usize ) { if let Some ( ( import_from_cell_id , import_from_frame_id , import_ref_type ) ) = symbol . frame_reference ( ) { if import_from_frame_id > 0 { // Import from the symbol in the parent frame self . import_symbols . push ( ( SafasCell :: FrameReference ( import_from_cell_id , import_from_frame_id - 1 , import_ref_type ) . into ( ) , cell_id ) ) ; // Update any references to this parent cell to point to the imported cell for ( _symbol , value ) in self . symbols . iter_mut ( ) { if let SafasCell :: FrameReference ( reference_cell , reference_frame , ref_type ) = & * * value { if * reference_cell == import_from_cell_id && * reference_frame == import_from_frame_id { let replacement_symbol = SafasCell :: FrameReference ( cell_id , 0 , * ref_type ) ; * value = replacement_symbol . into ( ) ; } } } } else { // Symbol can't be imported panic ! ( " " ) } } else { panic ! ( " " ) } }
Adds a symbol to be imported from the parent frame of this binding.
Adds a symbol to be imported from the parent frame of this binding .
&mut self
symbol
CellRef
cell_id
usize
&mut self
symbol
CellRef
cell_id
usize