/// Expression is basic entity for state operation and state usage.
/// State correctness verified by expressions call.
Expression is basic entity for state operation and state usage.
State correctness verified by expressions call.
Expression is basic entity for state operation and state usage . State correctness verified by expressions call .
pub fn expression(
        &mut self,
        data: &ast::Expression<'a>,
        body_state: BodyState<'a>,
    ) -> Vec<StateResult> {
        let mut res = match &data.expression_value {
            ast::ExpressionValue::ValueName(value) => {
                // First check value in body state
                if body_state.values.contains_key(&value.name())
                    || self.global.constants.contains_key(&value.name())
                {
                    vec![]
                } else if self.global.imports.contains_key(&value.name()) {
                    todo!("implement import modules analyzer for external constants")
                } else {
                    vec![StateResult::ValueNotFound]
                }
            }
            // do nothing for primitive value
            ast::ExpressionValue::PrimitiveValue(_value) => vec![],
            ast::ExpressionValue::FunctionCall(fn_call) => self.function_call(fn_call, &body_state),
        };
        if let Some(e) = &data.operation {
            let mut res_mut = self.expression(&e.1, body_state);
            res.append(&mut res_mut);
        }
        res
    }
pub fn expression ( & mut self , data : & ast :: Expression < ' a > , body_state : BodyState < ' a > , ) -> Vec < StateResult > { let mut res = match & data . expression_value { ast :: ExpressionValue :: ValueName ( value ) => { // First check value in body state if body_state . values . contains_key ( & value . name ( ) ) || self . global . constants . contains_key ( & value . name ( ) ) { vec ! [ ] } else if self . global . imports . contains_key ( & value . name ( ) ) { todo ! ( " " ) } else { vec ! [ StateResult ValueNotFound ] } } // do nothing for primitive value ast :: ExpressionValue :: PrimitiveValue ( _value ) => vec ! [ ] , ast :: ExpressionValue :: FunctionCall ( fn_call ) => self . function_call ( fn_call , & body_state ) , } ; if let Some ( e ) = & data . operation { let mut res_mut = self . expression ( & e . 1 , body_state ) ; res . append ( & mut res_mut ) ; } res }
Expression is basic entity for state operation and state usage.
Expression is basic entity for state operation and state usage .
&mut self
data
&ast::Expression<'a>
body_state
BodyState<'a>