fn propagate_tag_to_tag_fields<F>(&mut self, root_path: Rc<Path>, attach_tag: F)
    where
        F: Fn(Rc<AbstractValue>) -> Rc<AbstractValue>,
    {
        trace!("propagate_tag_to_tag_fields(root_path: {:?})", root_path);
        // Record visited prefixes of paths. We need this information to avoid handling the same prefix for multiple times.
        let mut visited_path_prefixes: HashSet<Rc<Path>> = HashSet::new();

        let old_value_map = self.current_environment.value_map.clone();

        for (path, _) in old_value_map
            .iter()
            .filter(|(p, _)| p.is_rooted_by(&root_path))
        {
            let mut path_prefix = path;

            loop {
                // If path_prefix has been visited, we exit the loop.
                if !visited_path_prefixes.insert(path_prefix.clone()) {
                    break;
                }

                // We get here if path_prefix is rooted by root_path and is not yet visited.
                let path_prefix_rustc_type = self
                    .type_visitor()
                    .get_path_rustc_type(path_prefix, self.current_span);
                if !path_prefix_rustc_type.is_scalar() {
                    let (tag_field_path, tag_field_value) = self
                        .extract_tag_field_of_non_scalar_value_at(
                            path_prefix,
                            path_prefix_rustc_type,
                        );
                    self.current_environment
                        .value_map
                        .insert_mut(tag_field_path.clone(), attach_tag(tag_field_value));
                }

                if let PathEnum::QualifiedPath { qualifier, .. } = &path_prefix.value {
                    // If the qualifier is already root_path, i.e., none of the prefixes can be rooted by root_path,
                    // we exit the loop.
                    if *qualifier == root_path {
                        break;
                    } else {
                        path_prefix = qualifier;
                    }
                } else {
                    // If path_prefix is no longer a qualified path, we exit the loop.
                    break;
                }
            }
        }
    }
/// Attach a tag to all tag field paths that are rooted by root_path.
/// If v is the value at a tag field path, then it is updated to attach_tag(v).
Attach a tag to all tag field paths that are rooted by root_path.
If v is the value at a tag field path, then it is updated to attach_tag(v).
Attach a tag to all tag field paths that are rooted by root_path . If v is the value at a tag field path then it is updated to attach_tag ( v ) .
fn propagate_tag_to_tag_fields<F>(&mut self, root_path: Rc<Path>, attach_tag: F)
    where
        F: Fn(Rc<AbstractValue>) -> Rc<AbstractValue>,
    {
        trace!("propagate_tag_to_tag_fields(root_path: {:?})", root_path);
        // Record visited prefixes of paths. We need this information to avoid handling the same prefix for multiple times.
        let mut visited_path_prefixes: HashSet<Rc<Path>> = HashSet::new();
        let old_value_map = self.current_environment.value_map.clone();
        for (path, _) in old_value_map
            .iter()
            .filter(|(p, _)| p.is_rooted_by(&root_path))
        {
            let mut path_prefix = path;
            loop {
                // If path_prefix has been visited, we exit the loop.
                if !visited_path_prefixes.insert(path_prefix.clone()) {
                    break;
                }
                // We get here if path_prefix is rooted by root_path and is not yet visited.
                let path_prefix_rustc_type = self
                    .type_visitor()
                    .get_path_rustc_type(path_prefix, self.current_span);
                if !path_prefix_rustc_type.is_scalar() {
                    let (tag_field_path, tag_field_value) = self
                        .extract_tag_field_of_non_scalar_value_at(
                            path_prefix,
                            path_prefix_rustc_type,
                        );
                    self.current_environment
                        .value_map
                        .insert_mut(tag_field_path.clone(), attach_tag(tag_field_value));
                }
                if let PathEnum::QualifiedPath { qualifier, .. } = &path_prefix.value {
                    // If the qualifier is already root_path, i.e., none of the prefixes can be rooted by root_path,
                    // we exit the loop.
                    if *qualifier == root_path {
                        break;
                    } else {
                        path_prefix = qualifier;
                    }
                } else {
                    // If path_prefix is no longer a qualified path, we exit the loop.
                    break;
                }
            }
        }
    }
fn propagate_tag_to_tag_fields < F > ( & mut self , root_path : Rc < Path > , attach_tag : F ) where F : Fn ( Rc < AbstractValue > ) -> Rc < AbstractValue > , { trace ! ( " " root_path ) ; // Record visited prefixes of paths. We need this information to avoid handling the same prefix for multiple times. let mut visited_path_prefixes : HashSet < Rc < Path > > = HashSet :: new ( ) ; let old_value_map = self . current_environment . value_map . clone ( ) ; for ( path , _ ) in old_value_map . iter ( ) . filter ( | ( p , _ ) | p . is_rooted_by ( & root_path ) ) { let mut path_prefix = path ; loop { // If path_prefix has been visited, we exit the loop. if ! visited_path_prefixes . insert ( path_prefix . clone ( ) ) { break ; } // We get here if path_prefix is rooted by root_path and is not yet visited. let path_prefix_rustc_type = self . type_visitor ( ) . get_path_rustc_type ( path_prefix , self . current_span ) ; if ! path_prefix_rustc_type . is_scalar ( ) { let ( tag_field_path , tag_field_value ) = self . extract_tag_field_of_non_scalar_value_at ( path_prefix , path_prefix_rustc_type , ) ; self . current_environment . value_map . insert_mut ( tag_field_path . clone ( ) , attach_tag ( tag_field_value ) ) ; } if let PathEnum :: QualifiedPath { qualifier , .. } = & path_prefix . value { // If the qualifier is already root_path, i.e., none of the prefixes can be rooted by root_path, // we exit the loop. if * qualifier == root_path { break ; } else { path_prefix = qualifier ; } } else { // If path_prefix is no longer a qualified path, we exit the loop. break ; } } } }
Attach a tag to all tag field paths that are rooted by root_path.
Attach a tag to all tag field paths that are rooted by root_path .
&mut self
root_path
Rc<Path>
attach_tag
F
&mut self
root_path
Rc<Path>
attach_tag
F