pub(crate) fn try_take_var(
        &mut self,
        name: &str,
        source_id: SourceId,
        span: Span,
    ) -> CompileResult<Option<&Var>> {
        log::trace!("get var: {}", name);

        for scope in self.scopes.iter_mut().rev() {
            if let Some(var) = scope.take(name, span)? {
                log::trace!("found var: {} => {:?}", name, var);
                self.visitor.visit_variable_use(source_id, var.span, span);
                return Ok(Some(var));
            }
        }

        Ok(None)
    }
/// Try to take the local with the given name. Returns `None` if it's
/// missing.
Try to take the local with the given name. Returns `None` if it's
missing.
Try to take the local with the given name . Returns ` None ` if it ' s missing .
pub(crate) fn try_take_var(
        &mut self,
        name: &str,
        source_id: SourceId,
        span: Span,
    ) -> CompileResult<Option<&Var>> {
        log::trace!("get var: {}", name);
        for scope in self.scopes.iter_mut().rev() {
            if let Some(var) = scope.take(name, span)? {
                log::trace!("found var: {} => {:?}", name, var);
                self.visitor.visit_variable_use(source_id, var.span, span);
                return Ok(Some(var));
            }
        }
        Ok(None)
    }
pub ( crate ) fn try_take_var ( & mut self , name : & str , source_id : SourceId , span : Span , ) -> CompileResult < Option < & Var > > { log :: trace ! ( " " name ) ; for scope in self . scopes . iter_mut ( ) . rev ( ) { if let Some ( var ) = scope . take ( name , span ) ? { log :: trace ! ( " " name var ) ; self . visitor . visit_variable_use ( source_id , var . span , span ) ; return Ok ( Some ( var ) ) ; } } Ok ( None ) }
Try to take the local with the given name.
Try to take the local with the given name .
&mut self
name
&str
source_id
SourceId
span
Span
&mut self
name
&str
source_id
SourceId
span
Span