/// Update all index entries rooted at target_path_root to reflect the possibility
/// that an assignment via an unknown index value might change their current value.
Update all index entries rooted at target_path_root to reflect the possibility
that an assignment via an unknown index value might change their current value.
Update all index entries rooted at target_path_root to reflect the possibility that an assignment via an unknown index value might change their current value .
fn weak_updates<F>(
        &mut self,
        target_path_root: &Rc<Path>,
        source_path: &Rc<Path>,
        make_condition: F,
    ) where
        F: Fn(Rc<AbstractValue>) -> Rc<AbstractValue>,
    {
        let old_value_map = self.current_environment.value_map.clone();
        let mut new_value_map = old_value_map.clone();
        for (path, value) in old_value_map
            .iter()
            .filter(|(path, _)| path.is_rooted_by(target_path_root))
        {
            // See if path is of the form target_root_path[index_value].some_or_no_selectors
            let mut subsequent_selectors: Vec<Rc<PathSelector>> = Vec::new();
            if let Some(index_value) = self.extract_index_and_subsequent_selectors(
                path,
                target_path_root,
                &mut subsequent_selectors,
            ) {
                // If the join condition is true, the value at path needs updating.
                let join_condition = make_condition(index_value.clone());
                // Look up value at source_path_with_selectors.
                // source_path_with_selectors is of the form source_path.some_or_no_selectors.
                // This is the value to bind to path if the join condition is true.
                let source_path_with_selectors =
                    Path::add_selectors(source_path, &subsequent_selectors);
                let result_type = value.expression.infer_type();
                let result_rustc_type = result_type.as_rustc_type(self.tcx);
                let additional_value = self
                    .lookup_path_and_refine_result(source_path_with_selectors, result_rustc_type);
                let updated_value =
                    join_condition.conditional_expression(additional_value, value.clone());
                new_value_map.insert_mut(path.clone(), updated_value);
            }
        }
        self.current_environment.value_map = new_value_map;
    }
fn weak_updates < F > ( & mut self , target_path_root : & Rc < Path > , source_path : & Rc < Path > , make_condition : F , ) where F : Fn ( Rc < AbstractValue > ) -> Rc < AbstractValue > , { let old_value_map = self . current_environment . value_map . clone ( ) ; let mut new_value_map = old_value_map . clone ( ) ; for ( path , value ) in old_value_map . iter ( ) . filter ( | ( path , _ ) | path . is_rooted_by ( target_path_root ) ) { // See if path is of the form target_root_path[index_value].some_or_no_selectors let mut subsequent_selectors : Vec < Rc < PathSelector > > = Vec :: new ( ) ; if let Some ( index_value ) = self . extract_index_and_subsequent_selectors ( path , target_path_root , & mut subsequent_selectors , ) { // If the join condition is true, the value at path needs updating. let join_condition = make_condition ( index_value . clone ( ) ) ; // Look up value at source_path_with_selectors. // source_path_with_selectors is of the form source_path.some_or_no_selectors. // This is the value to bind to path if the join condition is true. let source_path_with_selectors = Path :: add_selectors ( source_path , & subsequent_selectors ) ; let result_type = value . expression . infer_type ( ) ; let result_rustc_type = result_type . as_rustc_type ( self . tcx ) ; let additional_value = self . lookup_path_and_refine_result ( source_path_with_selectors , result_rustc_type ) ; let updated_value = join_condition . conditional_expression ( additional_value , value . clone ( ) ) ; new_value_map . insert_mut ( path . clone ( ) , updated_value ) ; } } self . current_environment . value_map = new_value_map ; }
Update all index entries rooted at target_path_root to reflect the possibility
that an assignment via an unknown index value might change their current value.
Update all index entries rooted at target_path_root to reflect the possibility that an assignment via an unknown index value might change their current value .
&mut self
target_path_root
&Rc<Path>
source_path
&Rc<Path>
make_condition
F