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

Added Methods for ObjectOpResult #337

Merged
merged 2 commits into from Aug 17, 2023

Conversation

Redfire75369
Copy link
Contributor

@Redfire75369 Redfire75369 commented Jan 8, 2023

mozjs/src/jsimpls.rs Show resolved Hide resolved
mozjs/src/jsimpls.rs Outdated Show resolved Hide resolved
mozjs/src/jsimpls.rs Outdated Show resolved Hide resolved
Comment on lines 396 to 397
assert_ne!(self.code_, JS::ObjectOpResult_SpecialCodes::OkCode as usize);
self.code_ = code as usize;
Copy link
Member

@mrobinson mrobinson Aug 17, 2023

Choose a reason for hiding this comment

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

This does something different than the C++ API which asserts that the argument isn't JS::ObjectOpResult_SpecialCodes::OkCode. Here you are asserting that the existing code isn't that.

From https://searchfox.org/mozilla-central/source/js/public/Class.h#123:

  bool fail(uint32_t msg) {
    MOZ_ASSERT(msg != OkCode);
    code_ = msg;
    return true;
  }

#[allow(non_snake_case)]
pub fn failNoNamedSetter(&mut self) -> bool {
assert!(self.code_ != JS::ObjectOpResult_SpecialCodes::OkCode as usize);
assert_ne!(self.code_, ObjectOpResult_SpecialCodes::OkCode as usize);
Copy link
Member

Choose a reason for hiding this comment

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

There's the same issue here. This function can just be:

    #[deprecated]
    #[allow(non_snake_case)]
    pub fn failNoNamedSetter(&mut self) -> bool {
         self.fail_no_named_setter()
    }

Copy link
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

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

Thank you for the updates.

Mapped ObjectOpResult::failNoNamedSetter to ObjectOpResult::fail_no_named_setter
@mrobinson mrobinson added this pull request to the merge queue Aug 17, 2023
Merged via the queue into servo:master with commit 5f69bbe Aug 17, 2023
1 of 11 checks passed
@sagudev
Copy link
Member

sagudev commented Aug 17, 2023

Is this normal to be merged without https://github.com/servo/mozjs/actions/runs/5890501581 finished and with PR checks failing?

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.

None yet

3 participants