/// Resolve an expression which defines the array length, e.g. 2**8 in "bool[2**8]"
Resolve an expression which defines the array length, e.g.
Resolve an expression which defines the array length e . g .
fn resolve_array_dimension(
        &mut self,
        file_no: usize,
        contract_no: Option<usize>,
        expr: &pt::Expression,
        diagnostics: &mut Vec<ast::Diagnostic>,
    ) -> Result<ArrayDimension, ()> {
        let symtable = Symtable::new();
        let size_expr = expression(
            &expr,
            file_no,
            contract_no,
            self,
            &symtable,
            true,
            diagnostics,
            Some(&ast::Type::Uint(256)),
        )?;
        match size_expr.ty() {
            ast::Type::Uint(_) | ast::Type::Int(_) => {}
            _ => {
                diagnostics.push(ast::Diagnostic::decl_error(
                    expr.loc(),
                    "expression is not a number".to_string(),
                ));
                return Err(());
            }
        }
        match eval_const_number(&size_expr, contract_no, self) {
            Ok(n) => Ok(Some(n)),
            Err(d) => {
                diagnostics.push(d);
                Err(())
            }
        }
    }
fn resolve_array_dimension ( & mut self , file_no : usize , contract_no : Option < usize > , expr : & pt :: Expression , diagnostics : & mut Vec < ast :: Diagnostic > , ) -> Result < ArrayDimension , ( ) > { let symtable = Symtable :: new ( ) ; let size_expr = expression ( & expr , file_no , contract_no , self , & symtable , true , diagnostics , Some ( & ast :: Type :: Uint ( 256 ) ) , ) ? ; match size_expr . ty ( ) { ast :: Type :: Uint ( _ ) | ast :: Type :: Int ( _ ) => { } _ => { diagnostics . push ( ast :: Diagnostic :: decl_error ( expr . loc ( ) , " " . to_string ( ) , ) ) ; return Err ( ( ) ) ; } } match eval_const_number ( & size_expr , contract_no , self ) { Ok ( n ) => Ok ( Some ( n ) ) , Err ( d ) => { diagnostics . push ( d ) ; Err ( ( ) ) } } }
Resolve an expression which defines the array length, e.g.
Resolve an expression which defines the array length e . g .
&mut self
file_no
usize
contract_no
Option<usize>
expr
&pt::Expression
diagnostics
&mut Vec<ast::Diagnostic>