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

Fix prototype chains being broken on the JS side (#42) #44

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Arshia001
Copy link
Contributor

This change fixes #42.

@Arshia001
Copy link
Contributor Author

@Redfire75369 I'm not sure if the failing lint is caused by the changes in this PR:

error: enum `BufferSource` has a public `len` method, but no `is_empty` method
@@ -12,7 +12,7 @@ pub mod console;
pub mod encoding;
#[cfg(feature = "fetch")]
pub mod fetch;
mod file;
pub mod file;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is causing clippy warning, probably it only applies to externally visible structs.

Copy link
Owner

@Redfire75369 Redfire75369 left a comment

Choose a reason for hiding this comment

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

In general, the use of ClassDefinition::parent_class_info should be moved over to ClassDefinition::parent_proto due to the changes in 8ecaf4c, and in non-proc macro code, the paths for types like Context and Local should be used if needed and inserted directly, instead of using qualified paths like crate::Context or crate::Local.

Comment on lines +32 to +34
pub class: &'static NativeClass,
pub constructor: *mut JSFunction,
pub prototype: *mut JSObject,
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
pub class: &'static NativeClass,
pub constructor: *mut JSFunction,
pub prototype: *mut JSObject,
class: &'static NativeClass,
constructor: *mut JSFunction,
prototype: *mut JSObject,
Comment on lines +40 to +43
fn parent_class_info(_: &Context) -> Option<(&'static NativeClass, Local<*mut JSObject>)> {
None
}

Copy link
Owner

Choose a reason for hiding this comment

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

With the change in 8ecaf4c, ClassDefinition::parent_proto should be used instead, so this can be removed. Other uses/definitions will have to be changed accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll rebase on that commit and fix the code accoredingly.

Comment on lines +81 to +87

#[doc(hidden)]
pub const fn __ion_self_as_parent_class_info(
_cx: &crate::Context,
) -> Option<(&'static NativeClass, crate::Local<*mut JSObject>)> {
None
}
Copy link
Owner

Choose a reason for hiding this comment

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

The function name should probably be something more like __ion_native_parent_proto, to match with ClassDefinition::parent_proto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants