pub fn declare(&mut self, span: Span, name: &str, value: Var) -> Result<(), CompileError> {
        let scope = self.last_mut(span)?;

        if let Some((existing_span, _)) = scope.locals.insert(name.into(), (span, value)) {
            return Err(CompileError::new(
                span,
                CompileErrorKind::VariableConflict {
                    name: name.into(),
                    existing_span,
                },
            ));
        }

        Ok(())
    }
/// Declare a variable in the scope.
Declare a variable in the scope.
Declare a variable in the scope .
pub fn declare(&mut self, span: Span, name: &str, value: Var) -> Result<(), CompileError> {
        let scope = self.last_mut(span)?;
        if let Some((existing_span, _)) = scope.locals.insert(name.into(), (span, value)) {
            return Err(CompileError::new(
                span,
                CompileErrorKind::VariableConflict {
                    name: name.into(),
                    existing_span,
                },
            ));
        }
        Ok(())
    }
pub fn declare ( & mut self , span : Span , name : & str , value : Var ) -> Result < ( ) , CompileError > { let scope = self . last_mut ( span ) ? ; if let Some ( ( existing_span , _ ) ) = scope . locals . insert ( name . into ( ) , ( span , value ) ) { return Err ( CompileError :: new ( span , CompileErrorKind :: VariableConflict { name : name . into ( ) , existing_span , } , ) ) ; } Ok ( ( ) ) }
Declare a variable in the scope.
Declare a variable in the scope .
&mut self
span
Span
name
&str
value
Var
&mut self
span
Span
name
&str
value
Var