Skip to content

Conversation

sasial-dev
Copy link
Contributor

Updates with the breaking changes from the latest commits on master. Still a WIP.

Copy link
Contributor

@kennethloeffler kennethloeffler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall good, we should wait until rbx-dom cuts releases and use those instead of git dependencies before merging this though.

I'm not sure if Filip would agree with breaking changes to various methods and functions, but anywhere where impl AsRef<str> is used for a property or class name, we might prefer impl Into<Ustr> instead.

Some(Self {
dom_ref,
class_name: instance.class.clone(),
class_name: instance.class.to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably worth changing the type of Instance.class_name to Ustr

Comment on lines -340 to +347
pub fn get_property(&self, name: impl AsRef<str>) -> Option<DomValue> {
pub fn get_property(&self, name: &str) -> Option<DomValue> {
INTERNAL_DOM
.lock()
.expect("Failed to lock document")
.get_by_ref(self.dom_ref)
.expect("Failed to find instance in document")
.properties
.get(name.as_ref())
.get(&name.into())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't want to change the type of name param to Ustr, then we can leave this method signature alone, and do &ustr(name.as_ref()) for the property get

.expect("Failed to find instance in document");
if let Some(DomValue::Attributes(attributes)) =
inst.properties.get(PROPERTY_NAME_ATTRIBUTES)
inst.properties.get(&PROPERTY_NAME_ATTRIBUTES.into())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be more readable to do &ustr(PROPERTY_NAME_ATTRIBUTES) here, likewise for the other usages, and for usages of PROPERTY_NAME_TAGS as well

}
}

fn remove_matching_prop(inst: &mut DomInstance, ty: DomType, name: &'static str) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably change the type of the name param to Ustr

if class_is_a(&inst.class, "LuaSourceContainer").unwrap_or(false) {
inst.properties.remove("ScriptGuid");
if class_is_a(inst.class, "LuaSourceContainer").unwrap_or(false) {
inst.properties.remove(&"ScriptGuid".into());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
inst.properties.remove(&"ScriptGuid".into());
inst.properties.remove(&ustr("ScriptGuid"));

@sasial-dev
Copy link
Contributor Author

Superseaded by #304

@sasial-dev sasial-dev closed this Apr 2, 2025
@sasial-dev sasial-dev deleted the rbx-dom-update branch April 2, 2025 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants