Use WeakDom::full_path_of (#1185)

This commit is contained in:
krakow10
2026-10-01 22:16:41 -07:00
committed by GitHub
parent 9cc7f45dcd
commit 351194ba93
2 changed files with 3 additions and 17 deletions

View File

@@ -8,10 +8,8 @@ use rbx_dom_weak::{
ustr, Instance, Ustr, WeakDom, ustr, Instance, Ustr, WeakDom,
}; };
use crate::{ use crate::syncback::snapshot::inst_path;
multimap::MultiMap, syncback::snapshot::inst_path, REF_ID_ATTRIBUTE_NAME, use crate::{multimap::MultiMap, REF_ID_ATTRIBUTE_NAME, REF_POINTER_ATTRIBUTE_PREFIX};
REF_POINTER_ATTRIBUTE_PREFIX,
};
pub struct RefLinks { pub struct RefLinks {
/// A map of referents to each of their Ref properties. /// A map of referents to each of their Ref properties.

View File

@@ -222,19 +222,7 @@ pub fn filter_out_property(inst: &Instance, prop_name: &str) -> bool {
} }
pub fn inst_path(dom: &WeakDom, referent: Ref) -> String { pub fn inst_path(dom: &WeakDom, referent: Ref) -> String {
let mut path = Vec::new(); dom.full_path_of(referent, "/")
let mut inst = dom.get_by_ref(referent);
while let Some(instance) = inst {
path.push(instance.name.as_str());
inst = dom.get_by_ref(instance.parent());
}
// This is to avoid the root's name from appearing in the path. Not
// optimal, but should be fine.
path.pop();
path.reverse();
path.join("/")
} }
#[cfg(test)] #[cfg(test)]