mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-11 10:04:54 +00:00
Use WeakDom::full_path_of (#1185)
This commit is contained in:
@@ -8,10 +8,8 @@ use rbx_dom_weak::{
|
||||
ustr, Instance, Ustr, WeakDom,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
multimap::MultiMap, syncback::snapshot::inst_path, REF_ID_ATTRIBUTE_NAME,
|
||||
REF_POINTER_ATTRIBUTE_PREFIX,
|
||||
};
|
||||
use crate::syncback::snapshot::inst_path;
|
||||
use crate::{multimap::MultiMap, REF_ID_ATTRIBUTE_NAME, REF_POINTER_ATTRIBUTE_PREFIX};
|
||||
|
||||
pub struct RefLinks {
|
||||
/// A map of referents to each of their Ref properties.
|
||||
|
||||
@@ -222,19 +222,7 @@ pub fn filter_out_property(inst: &Instance, prop_name: &str) -> bool {
|
||||
}
|
||||
|
||||
pub fn inst_path(dom: &WeakDom, referent: Ref) -> String {
|
||||
let mut path = Vec::new();
|
||||
|
||||
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("/")
|
||||
dom.full_path_of(referent, "/")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user