pub(super) fn traverse_to_place<'me>(
        &'me mut self,
        anchor: &'me Anchor,
        table: &bir::Tables,
        place: bir::Place,
    ) -> eyre::Result<PlaceTraversal<'me>> {
        match place.data(table) {
            bir::PlaceData::LocalVariable(lv) => {
                let lv_data = lv.data(table);
                let permissions = AccumulatedPermissions {
                    traversed: vec![],
                    leased: Leased::No,
                    joint: lv_data.storage_mode.joint(),
                    atomic: lv_data.storage_mode.atomic(),
                };
                Ok(PlaceTraversal {
                    accumulated_permissions: permissions,
                    place: &mut self.machine[*lv],
                })
            }

            bir::PlaceData::Function(f) => {
                Ok(self.temporary_place(anchor, ObjectData::Function(*f)))
            }
            bir::PlaceData::Class(c) => Ok(self.temporary_place(anchor, ObjectData::Class(*c))),
            bir::PlaceData::Intrinsic(i) => {
                Ok(self.temporary_place(anchor, ObjectData::Intrinsic(*i)))
            }
            bir::PlaceData::Dot(owner_place, field_name) => {
                let db = self.db;
                let ObjectTraversal {
                    mut accumulated_permissions,
                    object: owner_object,
                } = self.traverse_to_object(anchor, table, *owner_place)?;
                let (owner_class, field_index, owner_field) =
                    self.object_field(place, owner_object, *field_name)?;

                // Take the field mod einto account
                let field = &owner_class.fields(db)[field_index];
                let field_mode = field.decl(db).mode.unwrap_or(StorageMode::Shared);
                accumulated_permissions.joint |= field_mode.joint();
                accumulated_permissions.atomic |= field_mode.atomic();

                Ok(PlaceTraversal {
                    accumulated_permissions,
                    place: owner_field,
                })
            }
        }
    }
/// Returns a traversal that reaches the location `place`.
/// The result includes the accumulated permissions as well as
/// a `&mut Value` that represents where the place is stored
/// in memory.
///
/// If this returns `Ok`, the place is at least potentially *accessible*,
/// though some of the objects along the way may currently be leased. If the place
/// tries to dereference an expired permission, returns `Err`.
Returns a traversal that reaches the location `place`.
The result includes the accumulated permissions as well as
a `&mut Value` that represents where the place is stored
in memory.

If this returns `Ok`, the place is at least potentially *accessible*,
though some of the objects along the way may currently be leased. If the place
tries to dereference an expired permission, returns `Err`.
Returns a traversal that reaches the location ` place ` . The result includes the accumulated permissions as well as a ` &mut Value ` that represents where the place is stored in memory . If this returns ` Ok ` the place is at least potentially * accessible * though some of the objects along the way may currently be leased . If the place tries to dereference an expired permission returns ` Err ` .
pub(super) fn traverse_to_place<'me>(
        &'me mut self,
        anchor: &'me Anchor,
        table: &bir::Tables,
        place: bir::Place,
    ) -> eyre::Result<PlaceTraversal<'me>> {
        match place.data(table) {
            bir::PlaceData::LocalVariable(lv) => {
                let lv_data = lv.data(table);
                let permissions = AccumulatedPermissions {
                    traversed: vec![],
                    leased: Leased::No,
                    joint: lv_data.storage_mode.joint(),
                    atomic: lv_data.storage_mode.atomic(),
                };
                Ok(PlaceTraversal {
                    accumulated_permissions: permissions,
                    place: &mut self.machine[*lv],
                })
            }
            bir::PlaceData::Function(f) => {
                Ok(self.temporary_place(anchor, ObjectData::Function(*f)))
            }
            bir::PlaceData::Class(c) => Ok(self.temporary_place(anchor, ObjectData::Class(*c))),
            bir::PlaceData::Intrinsic(i) => {
                Ok(self.temporary_place(anchor, ObjectData::Intrinsic(*i)))
            }
            bir::PlaceData::Dot(owner_place, field_name) => {
                let db = self.db;
                let ObjectTraversal {
                    mut accumulated_permissions,
                    object: owner_object,
                } = self.traverse_to_object(anchor, table, *owner_place)?;
                let (owner_class, field_index, owner_field) =
                    self.object_field(place, owner_object, *field_name)?;
                // Take the field mod einto account
                let field = &owner_class.fields(db)[field_index];
                let field_mode = field.decl(db).mode.unwrap_or(StorageMode::Shared);
                accumulated_permissions.joint |= field_mode.joint();
                accumulated_permissions.atomic |= field_mode.atomic();
                Ok(PlaceTraversal {
                    accumulated_permissions,
                    place: owner_field,
                })
            }
        }
    }
pub ( super ) fn traverse_to_place < ' me > ( & ' me mut self , anchor : & ' me Anchor , table : & bir :: Tables , place : bir :: Place , ) -> eyre :: Result < PlaceTraversal < ' me > > { match place . data ( table ) { bir :: PlaceData :: LocalVariable ( lv ) => { let lv_data = lv . data ( table ) ; let permissions = AccumulatedPermissions { traversed : vec ! [ ] , leased : Leased :: No , joint : lv_data . storage_mode . joint ( ) , atomic : lv_data . storage_mode . atomic ( ) , } ; Ok ( PlaceTraversal { accumulated_permissions : permissions , place : & mut self . machine [ * lv ] , } ) } bir :: PlaceData :: Function ( f ) => { Ok ( self . temporary_place ( anchor , ObjectData :: Function ( * f ) ) ) } bir :: PlaceData :: Class ( c ) => Ok ( self . temporary_place ( anchor , ObjectData :: Class ( * c ) ) ) , bir :: PlaceData :: Intrinsic ( i ) => { Ok ( self . temporary_place ( anchor , ObjectData :: Intrinsic ( * i ) ) ) } bir :: PlaceData :: Dot ( owner_place , field_name ) => { let db = self . db ; let ObjectTraversal { mut accumulated_permissions , object : owner_object , } = self . traverse_to_object ( anchor , table , * owner_place ) ? ; let ( owner_class , field_index , owner_field ) = self . object_field ( place , owner_object , * field_name ) ? ; // Take the field mod einto account let field = & owner_class . fields ( db ) [ field_index ] ; let field_mode = field . decl ( db ) . mode . unwrap_or ( StorageMode :: Shared ) ; accumulated_permissions . joint |= field_mode . joint ( ) ; accumulated_permissions . atomic |= field_mode . atomic ( ) ; Ok ( PlaceTraversal { accumulated_permissions , place : owner_field , } ) } } }
Returns a traversal that reaches the location `place`.
Returns a traversal that reaches the location ` place ` .
&'me mut self
anchor
&'me Anchor
table
&bir::Tables
place
bir::Place
&'me mut self
anchor
&'me Anchor
table
&bir::Tables
place
bir::Place