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

Changes to existing files to prep for hermes support #3790

Merged
merged 2 commits into from
Jun 8, 2021

Conversation

RedBeard0531
Copy link
Contributor

Main thing is that some types are not default constructible and have no null
state. Additionally, some types are no longer copyable.

☑️ ToDos

(Removing all TODOs since this is just an internal code change with no user impact on its own)

* [ ] 📝 Changelog entry * [ ] 📝 `Compatibility` label is updated or copied from previous entry * [ ] 🚦 Tests * [ ] 📝 Public documentation PR created or is not necessary * [ ] 💥 `Breaking` label has been applied or is not necessary

If this PR adds or changes public API's:

  • typescript definitions file is updated
  • jsdoc files updated
  • Chrome debug API is updated if API is available on React Native

Main thing is that some types are not default constructible and have no null
state. Additionally, some types are no longer copyable.
@@ -270,8 +276,14 @@ struct Object {
static ValueType get_property(ContextType c, const ObjectType &o, const std::string &s) { return get_property(c, o, StringData(s)); }
static ValueType get_property(ContextType, const ObjectType &, const String<T> &);
static ValueType get_property(ContextType, const ObjectType &, uint32_t);
static void set_property(ContextType, const ObjectType &, const String<T> &, const ValueType &, PropertyAttributes attributes = None);
static void set_property(ContextType, const ObjectType &, uint32_t, const ValueType &);
static void set_property(ContextType ctx, ObjectType&& obj, const String<T>& field, const ValueType& val, PropertyAttributes attributes = None) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Explanation, since it isn't obvious what changed here or why: JSI doesn't support setting properties on const Objects, so I had to remove const here. But you can't pass a temporary to a non-const ref argument, so just doing that prevents things like set_property(ctx, get_global(), ...), which we do in a few places. So I added Object&& overloads, that just directly call the Object& overload.

Copy link
Contributor

@blagoev blagoev left a comment

Choose a reason for hiding this comment

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

👍

@RedBeard0531 RedBeard0531 merged commit 5b0eabf into master Jun 8, 2021
@RedBeard0531 RedBeard0531 deleted the ms/hermes-prep branch June 8, 2021 08:41
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants