fn define_variable(&mut self, var: VarInfo<'arenas>) -> Result<Variable, ()> {
        let variable = Variable(self.variables.len() as u32);
        let name = StrTendril::from(var.name);

        match self
            .scopes
            .last_mut()
            .expect("empty scope stack, this should never happen")
            .entries
            .entry(name)
        {
            Entry::Occupied(_) => {
                return Err(());
            }
            Entry::Vacant(vacant) => {
                vacant.insert(variable);
                self.variables.push(var);
                Ok(variable)
            }
        }
    }
/// Defines a new local variable in the currently active scope.
///
/// If the scope already defines a variables named `name`, this returns an
/// error.
Defines a new local variable in the currently active scope.
If the scope already defines a variables named `name`, this returns an
error.
Defines a new local variable in the currently active scope . If the scope already defines a variables named ` name ` this returns an error .
fn define_variable(&mut self, var: VarInfo<'arenas>) -> Result<Variable, ()> {
        let variable = Variable(self.variables.len() as u32);
        let name = StrTendril::from(var.name);
        match self
            .scopes
            .last_mut()
            .expect("empty scope stack, this should never happen")
            .entries
            .entry(name)
        {
            Entry::Occupied(_) => {
                return Err(());
            }
            Entry::Vacant(vacant) => {
                vacant.insert(variable);
                self.variables.push(var);
                Ok(variable)
            }
        }
    }
fn define_variable ( & mut self , var : VarInfo < ' arenas > ) -> Result < Variable , ( ) > { let variable = Variable ( self . variables . len ( ) as u32 ) ; let name = StrTendril :: from ( var . name ) ; match self . scopes . last_mut ( ) . expect ( " " ) . entries . entry ( name ) { Entry :: Occupied ( _ ) => { return Err ( ( ) ) ; } Entry :: Vacant ( vacant ) => { vacant . insert ( variable ) ; self . variables . push ( var ) ; Ok ( variable ) } } }
Defines a new local variable in the currently active scope.
Defines a new local variable in the currently active scope .
&mut self
var
VarInfo<'arenas>
&mut self
var
VarInfo<'arenas>