Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rbx-dom #269

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

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.

@@ -75,7 +75,7 @@ impl Instance {

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

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

@@ -41,7 +41,11 @@ where
}

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"));

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