@@ -477,14 +477,18 @@ class JSI_EXPORT Runtime : public ICast {
477477
478478 virtual Value getProperty (const Object&, const PropNameID& name) = 0;
479479 virtual Value getProperty (const Object&, const String& name) = 0;
480+ virtual Value getProperty (const Object&, const Value& name);
480481 virtual bool hasProperty (const Object&, const PropNameID& name) = 0;
481482 virtual bool hasProperty (const Object&, const String& name) = 0;
483+ virtual bool hasProperty (const Object&, const Value& name);
482484 virtual void setPropertyValue (
483485 const Object&,
484486 const PropNameID& name,
485487 const Value& value) = 0;
486488 virtual void
487489 setPropertyValue (const Object&, const String& name, const Value& value) = 0;
490+ virtual void
491+ setPropertyValue (const Object&, const Value& name, const Value& value);
488492
489493 virtual void deleteProperty (const Object&, const PropNameID& name);
490494 virtual void deleteProperty (const Object&, const String& name);
@@ -958,6 +962,12 @@ class JSI_EXPORT Object : public Pointer {
958962 // / undefined value.
959963 Value getProperty (Runtime& runtime, const PropNameID& name) const ;
960964
965+ // / \return the Property of the object with the given JS Value name. If the
966+ // / name isn't a property on the object, returns the undefined value.This
967+ // / attempts to convert the JS Value to convert to a property key. If the
968+ // / conversion fails, this method may throw.
969+ Value getProperty (Runtime& runtime, const Value& name) const ;
970+
961971 // / \return true if and only if the object has a property with the
962972 // / given ascii name.
963973 bool hasProperty (Runtime& runtime, const char * name) const ;
@@ -970,6 +980,11 @@ class JSI_EXPORT Object : public Pointer {
970980 // / given PropNameID name.
971981 bool hasProperty (Runtime& runtime, const PropNameID& name) const ;
972982
983+ // / \return true if and only if the object has a property with the given
984+ // / JS Value name. This attempts to convert the JS Value to convert to a
985+ // / property key. If the conversion fails, this method may throw.
986+ bool hasProperty (Runtime& runtime, const Value& name) const ;
987+
973988 // / Sets the property value from a Value or anything which can be
974989 // / used to make one: nullptr_t, bool, double, int, const char*,
975990 // / String, or Object.
@@ -988,6 +1003,14 @@ class JSI_EXPORT Object : public Pointer {
9881003 template <typename T>
9891004 void setProperty (Runtime& runtime, const PropNameID& name, T&& value) const ;
9901005
1006+ // / Sets the property value from a Value or anything which can be
1007+ // / used to make one: nullptr_t, bool, double, int, const char*,
1008+ // / String, or Object. This takes a JS Value as the property name, and
1009+ // / attempts to convert to a property key. If the conversion fails, this
1010+ // / method may throw.
1011+ template <typename T>
1012+ void setProperty (Runtime& runtime, const Value& name, T&& value) const ;
1013+
9911014 // / Delete the property with the given ascii name. Throws if the deletion
9921015 // / failed.
9931016 void deleteProperty (Runtime& runtime, const char * name) const ;
@@ -1145,6 +1168,11 @@ class JSI_EXPORT Object : public Pointer {
11451168 return runtime.setPropertyValue (*this , name, value);
11461169 }
11471170
1171+ void setPropertyValue (Runtime& runtime, const Value& name, const Value& value)
1172+ const {
1173+ return runtime.setPropertyValue (*this , name, value);
1174+ }
1175+
11481176 friend class Runtime ;
11491177 friend class Value ;
11501178};
0 commit comments