fn resolve_base_contract(
        &self,
        contract_no: usize,
        id: &pt::Identifier,
    ) -> Option<&ast::Symbol> {
        for base in self.contracts[contract_no].bases.iter() {
            // find file this contract was defined in
            let file_no = self.contracts[base.contract_no].loc.0;

            if let Some(sym) =
                self.symbols
                    .get(&(file_no, Some(base.contract_no), id.name.to_owned()))
            {
                if let ast::Symbol::Variable(_, var_contract_no, var_no) = sym {
                    if *var_contract_no != Some(base.contract_no) {
                        return None;
                    }

                    let var = &self.contracts[base.contract_no].variables[*var_no];

                    if let pt::Visibility::Private(_) = var.visibility {
                        return None;
                    }
                }

                return Some(sym);
            } else {
                let res = self.resolve_base_contract(base.contract_no, id);

                if res.is_some() {
                    return res;
                }
            }
        }

        None
    }
/// Does a parent contract have a variable defined with this name (recursive)
Does a parent contract have a variable defined with this name (recursive)
Does a parent contract have a variable defined with this name ( recursive )
fn resolve_base_contract(
        &self,
        contract_no: usize,
        id: &pt::Identifier,
    ) -> Option<&ast::Symbol> {
        for base in self.contracts[contract_no].bases.iter() {
            // find file this contract was defined in
            let file_no = self.contracts[base.contract_no].loc.0;
            if let Some(sym) =
                self.symbols
                    .get(&(file_no, Some(base.contract_no), id.name.to_owned()))
            {
                if let ast::Symbol::Variable(_, var_contract_no, var_no) = sym {
                    if *var_contract_no != Some(base.contract_no) {
                        return None;
                    }
                    let var = &self.contracts[base.contract_no].variables[*var_no];
                    if let pt::Visibility::Private(_) = var.visibility {
                        return None;
                    }
                }
                return Some(sym);
            } else {
                let res = self.resolve_base_contract(base.contract_no, id);
                if res.is_some() {
                    return res;
                }
            }
        }
        None
    }
fn resolve_base_contract ( & self , contract_no : usize , id : & pt :: Identifier , ) -> Option < & ast :: Symbol > { for base in self . contracts [ contract_no ] . bases . iter ( ) { // find file this contract was defined in let file_no = self . contracts [ base . contract_no ] . loc . 0 ; if let Some ( sym ) = self . symbols . get ( & ( file_no , Some ( base . contract_no ) , id . name . to_owned ( ) ) ) { if let ast :: Symbol :: Variable ( _ , var_contract_no , var_no ) = sym { if * var_contract_no != Some ( base . contract_no ) { return None ; } let var = & self . contracts [ base . contract_no ] . variables [ * var_no ] ; if let pt :: Visibility :: Private ( _ ) = var . visibility { return None ; } } return Some ( sym ) ; } else { let res = self . resolve_base_contract ( base . contract_no , id ) ; if res . is_some ( ) { return res ; } } } None }
Does a parent contract have a variable defined with this name (recursive)
Does a parent contract have a variable defined with this name ( recursive )
&self
contract_no
usize
id
&pt::Identifier
&self
contract_no
usize
id
&pt::Identifier