fn def_ana_schema_exp_oper(
        &mut self,
        context_type_params: &[(Symbol, Type)],
        vars: &mut BTreeMap<Symbol, LocalVarEntry>,
        spec: &mut Spec,
        allow_new_vars: bool,
        path_cond: Option<Exp>,
        properties: &PropertyBag,
        exp: &EA::Exp,
    ) {
        let loc = self.parent.to_loc(&exp.loc);
        match &exp.value {
            EA::Exp_::BinopExp(
                lhs,
                Spanned {
                    value: BinOp_::Implies,
                    ..
                },
                rhs,
            ) => {
                let mut et = self.exp_translator_for_schema(&loc, context_type_params, vars);
                let lhs_exp = et.translate_exp(lhs, &BOOL_TYPE);
                et.finalize_types();
                let path_cond = self.extend_path_condition(&loc, path_cond, lhs_exp);
                self.def_ana_schema_exp_oper(
                    context_type_params,
                    vars,
                    spec,
                    allow_new_vars,
                    path_cond,
                    properties,
                    rhs,
                );
            }
            EA::Exp_::BinopExp(
                lhs,
                Spanned {
                    value: BinOp_::And, ..
                },
                rhs,
            ) => {
                self.def_ana_schema_exp_oper(
                    context_type_params,
                    vars,
                    spec,
                    allow_new_vars,
                    path_cond.clone(),
                    properties,
                    lhs,
                );
                self.def_ana_schema_exp_oper(
                    context_type_params,
                    vars,
                    spec,
                    allow_new_vars,
                    path_cond,
                    properties,
                    rhs,
                );
            }
            EA::Exp_::IfElse(c, t, e) => {
                let mut et = self.exp_translator_for_schema(&loc, context_type_params, vars);
                let c_exp = et.translate_exp(c, &BOOL_TYPE);
                et.finalize_types();
                let t_path_cond =
                    self.extend_path_condition(&loc, path_cond.clone(), c_exp.clone());
                self.def_ana_schema_exp_oper(
                    context_type_params,
                    vars,
                    spec,
                    allow_new_vars,
                    t_path_cond,
                    properties,
                    t,
                );
                let node_id = self.new_node_id_with_type_loc(&BOOL_TYPE, &loc);
                let not_c_exp = Exp::Call(node_id, Operation::Not, vec![c_exp]);
                let e_path_cond = self.extend_path_condition(&loc, path_cond, not_c_exp);
                self.def_ana_schema_exp_oper(
                    context_type_params,
                    vars,
                    spec,
                    allow_new_vars,
                    e_path_cond,
                    properties,
                    e,
                );
            }
            EA::Exp_::Name(maccess, type_args_opt) => self.def_ana_schema_exp_leaf(
                context_type_params,
                vars,
                spec,
                allow_new_vars,
                path_cond,
                properties,
                &loc,
                maccess,
                type_args_opt,
                None,
            ),
            EA::Exp_::Pack(maccess, type_args_opt, fields) => self.def_ana_schema_exp_leaf(
                context_type_params,
                vars,
                spec,
                allow_new_vars,
                path_cond,
                properties,
                &loc,
                maccess,
                type_args_opt,
                Some(fields),
            ),
            _ => self
                .parent
                .error(&loc, "expression construct not supported for schemas"),
        }
    }
/// Analyzes operations in schema expressions. This extends the path condition as needed
/// and continues recursively.
Analyzes operations in schema expressions. This extends the path condition as needed
and continues recursively.
Analyzes operations in schema expressions . This extends the path condition as needed and continues recursively .
fn def_ana_schema_exp_oper(
        &mut self,
        context_type_params: &[(Symbol, Type)],
        vars: &mut BTreeMap<Symbol, LocalVarEntry>,
        spec: &mut Spec,
        allow_new_vars: bool,
        path_cond: Option<Exp>,
        properties: &PropertyBag,
        exp: &EA::Exp,
    ) {
        let loc = self.parent.to_loc(&exp.loc);
        match &exp.value {
            EA::Exp_::BinopExp(
                lhs,
                Spanned {
                    value: BinOp_::Implies,
                    ..
                },
                rhs,
            ) => {
                let mut et = self.exp_translator_for_schema(&loc, context_type_params, vars);
                let lhs_exp = et.translate_exp(lhs, &BOOL_TYPE);
                et.finalize_types();
                let path_cond = self.extend_path_condition(&loc, path_cond, lhs_exp);
                self.def_ana_schema_exp_oper(
                    context_type_params,
                    vars,
                    spec,
                    allow_new_vars,
                    path_cond,
                    properties,
                    rhs,
                );
            }
            EA::Exp_::BinopExp(
                lhs,
                Spanned {
                    value: BinOp_::And, ..
                },
                rhs,
            ) => {
                self.def_ana_schema_exp_oper(
                    context_type_params,
                    vars,
                    spec,
                    allow_new_vars,
                    path_cond.clone(),
                    properties,
                    lhs,
                );
                self.def_ana_schema_exp_oper(
                    context_type_params,
                    vars,
                    spec,
                    allow_new_vars,
                    path_cond,
                    properties,
                    rhs,
                );
            }
            EA::Exp_::IfElse(c, t, e) => {
                let mut et = self.exp_translator_for_schema(&loc, context_type_params, vars);
                let c_exp = et.translate_exp(c, &BOOL_TYPE);
                et.finalize_types();
                let t_path_cond =
                    self.extend_path_condition(&loc, path_cond.clone(), c_exp.clone());
                self.def_ana_schema_exp_oper(
                    context_type_params,
                    vars,
                    spec,
                    allow_new_vars,
                    t_path_cond,
                    properties,
                    t,
                );
                let node_id = self.new_node_id_with_type_loc(&BOOL_TYPE, &loc);
                let not_c_exp = Exp::Call(node_id, Operation::Not, vec![c_exp]);
                let e_path_cond = self.extend_path_condition(&loc, path_cond, not_c_exp);
                self.def_ana_schema_exp_oper(
                    context_type_params,
                    vars,
                    spec,
                    allow_new_vars,
                    e_path_cond,
                    properties,
                    e,
                );
            }
            EA::Exp_::Name(maccess, type_args_opt) => self.def_ana_schema_exp_leaf(
                context_type_params,
                vars,
                spec,
                allow_new_vars,
                path_cond,
                properties,
                &loc,
                maccess,
                type_args_opt,
                None,
            ),
            EA::Exp_::Pack(maccess, type_args_opt, fields) => self.def_ana_schema_exp_leaf(
                context_type_params,
                vars,
                spec,
                allow_new_vars,
                path_cond,
                properties,
                &loc,
                maccess,
                type_args_opt,
                Some(fields),
            ),
            _ => self
                .parent
                .error(&loc, "expression construct not supported for schemas"),
        }
    }
fn def_ana_schema_exp_oper ( & mut self , context_type_params : & [ ( Symbol , Type ) ] , vars : & mut BTreeMap < Symbol , LocalVarEntry > , spec : & mut Spec , allow_new_vars : bool , path_cond : Option < Exp > , properties : & PropertyBag , exp : & EA :: Exp , ) { let loc = self . parent . to_loc ( & exp . loc ) ; match & exp . value { EA :: Exp_ :: BinopExp ( lhs , Spanned { value : BinOp_ :: Implies , .. } , rhs , ) => { let mut et = self . exp_translator_for_schema ( & loc , context_type_params , vars ) ; let lhs_exp = et . translate_exp ( lhs , & BOOL_TYPE ) ; et . finalize_types ( ) ; let path_cond = self . extend_path_condition ( & loc , path_cond , lhs_exp ) ; self . def_ana_schema_exp_oper ( context_type_params , vars , spec , allow_new_vars , path_cond , properties , rhs , ) ; } EA :: Exp_ :: BinopExp ( lhs , Spanned { value : BinOp_ :: And , .. } , rhs , ) => { self . def_ana_schema_exp_oper ( context_type_params , vars , spec , allow_new_vars , path_cond . clone ( ) , properties , lhs , ) ; self . def_ana_schema_exp_oper ( context_type_params , vars , spec , allow_new_vars , path_cond , properties , rhs , ) ; } EA :: Exp_ :: IfElse ( c , t , e ) => { let mut et = self . exp_translator_for_schema ( & loc , context_type_params , vars ) ; let c_exp = et . translate_exp ( c , & BOOL_TYPE ) ; et . finalize_types ( ) ; let t_path_cond = self . extend_path_condition ( & loc , path_cond . clone ( ) , c_exp . clone ( ) ) ; self . def_ana_schema_exp_oper ( context_type_params , vars , spec , allow_new_vars , t_path_cond , properties , t , ) ; let node_id = self . new_node_id_with_type_loc ( & BOOL_TYPE , & loc ) ; let not_c_exp = Exp :: Call ( node_id , Operation :: Not , vec ! [ c_exp ] ) ; let e_path_cond = self . extend_path_condition ( & loc , path_cond , not_c_exp ) ; self . def_ana_schema_exp_oper ( context_type_params , vars , spec , allow_new_vars , e_path_cond , properties , e , ) ; } EA :: Exp_ :: Name ( maccess , type_args_opt ) => self . def_ana_schema_exp_leaf ( context_type_params , vars , spec , allow_new_vars , path_cond , properties , & loc , maccess , type_args_opt , None , ) , EA :: Exp_ :: Pack ( maccess , type_args_opt , fields ) => self . def_ana_schema_exp_leaf ( context_type_params , vars , spec , allow_new_vars , path_cond , properties , & loc , maccess , type_args_opt , Some ( fields ) , ) , _ => self . parent . error ( & loc , " " ) , } }
Analyzes operations in schema expressions.
Analyzes operations in schema expressions .
&mut self
context_type_params
&[(Symbol, Type)]
vars
&mut BTreeMap<Symbol, LocalVarEntry>
spec
&mut Spec
allow_new_vars
bool
path_cond
Option<Exp>
properties
&PropertyBag
exp
&EA::Exp
&mut self
context_type_params
&[(Symbol, Type)]
vars
&mut BTreeMap<Symbol, LocalVarEntry>
spec
&mut Spec
allow_new_vars
bool
path_cond
Option<Exp>
properties
&PropertyBag
exp
&EA::Exp