fn try_replace_labels(&mut self) -> Result<bool, String> {
        let mut did_some = false;

        let names = self.globals.keys().map(|k| k.clone()).collect::<Vec<_>>();
        for name in &names {
            if let ObjectType::Function(f) = &self.globals.get(name).unwrap().dtype {
                let lines = f.body.clone();
                let obj_name = self.globals.get(name).unwrap().name.clone();
                let new_lines = self.replace_labels_in_body(lines, FunctionId::Name(obj_name))?;

                let body = &mut self.globals.get_mut(name).unwrap().dtype.func_mut().unwrap().body;
                did_some = did_some || *body != new_lines;
                *body = new_lines;
            }
        }

        let ids = self.internals.keys().map(|x| *x).collect::<Vec<_>>();
        for id in &ids {
            let lines = self.internals.get(id).unwrap().body.clone();
            let new_lines = self.replace_labels_in_body(lines, FunctionId::Id(*id))?;
            let body = &mut self.internals.get_mut(id).unwrap().body;
            did_some = did_some || *body != new_lines;
            *body = new_lines;
        }

        Ok(did_some)
    }
// return true, if at least one label was replaced
return true, if at least one label was replaced
return true if at least one label was replaced
fn try_replace_labels(&mut self) -> Result<bool, String> {
        let mut did_some = false;
        let names = self.globals.keys().map(|k| k.clone()).collect::<Vec<_>>();
        for name in &names {
            if let ObjectType::Function(f) = &self.globals.get(name).unwrap().dtype {
                let lines = f.body.clone();
                let obj_name = self.globals.get(name).unwrap().name.clone();
                let new_lines = self.replace_labels_in_body(lines, FunctionId::Name(obj_name))?;
                let body = &mut self.globals.get_mut(name).unwrap().dtype.func_mut().unwrap().body;
                did_some = did_some || *body != new_lines;
                *body = new_lines;
            }
        }
        let ids = self.internals.keys().map(|x| *x).collect::<Vec<_>>();
        for id in &ids {
            let lines = self.internals.get(id).unwrap().body.clone();
            let new_lines = self.replace_labels_in_body(lines, FunctionId::Id(*id))?;
            let body = &mut self.internals.get_mut(id).unwrap().body;
            did_some = did_some || *body != new_lines;
            *body = new_lines;
        }
        Ok(did_some)
    }
fn try_replace_labels ( & mut self ) -> Result < bool , String > { let mut did_some = false ; let names = self . globals . keys ( ) . map ( | k | k . clone ( ) ) . collect :: < Vec < _ > > ( ) ; for name in & names { if let ObjectType :: Function ( f ) = & self . globals . get ( name ) . unwrap ( ) . dtype { let lines = f . body . clone ( ) ; let obj_name = self . globals . get ( name ) . unwrap ( ) . name . clone ( ) ; let new_lines = self . replace_labels_in_body ( lines , FunctionId :: Name ( obj_name ) ) ? ; let body = & mut self . globals . get_mut ( name ) . unwrap ( ) . dtype . func_mut ( ) . unwrap ( ) . body ; did_some = did_some || * body != new_lines ; * body = new_lines ; } } let ids = self . internals . keys ( ) . map ( | x | * x ) . collect :: < Vec < _ > > ( ) ; for id in & ids { let lines = self . internals . get ( id ) . unwrap ( ) . body . clone ( ) ; let new_lines = self . replace_labels_in_body ( lines , FunctionId :: Id ( * id ) ) ? ; let body = & mut self . internals . get_mut ( id ) . unwrap ( ) . body ; did_some = did_some || * body != new_lines ; * body = new_lines ; } Ok ( did_some ) }
return true, if at least one label was replaced
return true if at least one label was replaced
&mut self
&mut self