pub fn assigned_variable(ns: &mut Namespace, exp: &Expression, symtable: &mut Symtable) {
    match &exp {
        Expression::StorageVariable(_, _, contract_no, offset) => {
            ns.contracts[*contract_no].variables[*offset].assigned = true;
        }

        Expression::Variable(_, _, offset) => {
            let var = symtable.vars.get_mut(offset).unwrap();
            (*var).assigned = true;
        }

        Expression::StructMember(_, _, str, _) => {
            assigned_variable(ns, str, symtable);
        }

        Expression::Subscript(_, _, _, array, index) => {
            assigned_variable(ns, array, symtable);
            used_variable(ns, index, symtable);
        }

        Expression::StorageLoad(_, _, expr)
        | Expression::Load(_, _, expr)
        | Expression::Trunc(_, _, expr)
        | Expression::Cast(_, _, expr)
        | Expression::BytesCast(_, _, _, expr) => {
            assigned_variable(ns, expr, symtable);
        }

        _ => {}
    }
}
/// Mark variables as assigned, either in the symbol table (for local variables) or in the
/// Namespace (for storage variables)
Mark variables as assigned, either in the symbol table (for local variables) or in the
Namespace (for storage variables)
Mark variables as assigned either in the symbol table ( for local variables ) or in the Namespace ( for storage variables )
pub fn assigned_variable(ns: &mut Namespace, exp: &Expression, symtable: &mut Symtable) {
    match &exp {
        Expression::StorageVariable(_, _, contract_no, offset) => {
            ns.contracts[*contract_no].variables[*offset].assigned = true;
        }
        Expression::Variable(_, _, offset) => {
            let var = symtable.vars.get_mut(offset).unwrap();
            (*var).assigned = true;
        }
        Expression::StructMember(_, _, str, _) => {
            assigned_variable(ns, str, symtable);
        }
        Expression::Subscript(_, _, _, array, index) => {
            assigned_variable(ns, array, symtable);
            used_variable(ns, index, symtable);
        }
        Expression::StorageLoad(_, _, expr)
        | Expression::Load(_, _, expr)
        | Expression::Trunc(_, _, expr)
        | Expression::Cast(_, _, expr)
        | Expression::BytesCast(_, _, _, expr) => {
            assigned_variable(ns, expr, symtable);
        }
        _ => {}
    }
}
pub fn assigned_variable ( ns : & mut Namespace , exp : & Expression , symtable : & mut Symtable ) { match & exp { Expression :: StorageVariable ( _ , _ , contract_no , offset ) => { ns . contracts [ * contract_no ] . variables [ * offset ] . assigned = true ; } Expression :: Variable ( _ , _ , offset ) => { let var = symtable . vars . get_mut ( offset ) . unwrap ( ) ; ( * var ) . assigned = true ; } Expression :: StructMember ( _ , _ , str , _ ) => { assigned_variable ( ns , str , symtable ) ; } Expression :: Subscript ( _ , _ , _ , array , index ) => { assigned_variable ( ns , array , symtable ) ; used_variable ( ns , index , symtable ) ; } Expression :: StorageLoad ( _ , _ , expr ) | Expression :: Load ( _ , _ , expr ) | Expression :: Trunc ( _ , _ , expr ) | Expression :: Cast ( _ , _ , expr ) | Expression :: BytesCast ( _ , _ , _ , expr ) => { assigned_variable ( ns , expr , symtable ) ; } _ => { } } }
Mark variables as assigned, either in the symbol table (for local variables) or in the
Namespace (for storage variables)
Mark variables as assigned either in the symbol table ( for local variables ) or in the Namespace ( for storage variables )
ns
&mut Namespace
exp
&Expression
symtable
&mut Symtable
ns
&mut Namespace
exp
&Expression
symtable
&mut Symtable