Skip to content

Commit 399bda5

Browse files
Kronopathfacebook-github-bot
authored andcommitted
Fix errors in documentation for Function::callWithThis
Summary: The documentation in two out of the three variants of `Function::callWithThis` incorrectly stated that the `this` value was to be `undefined` instead of set to `jsThis`, which contradicts the point of the `callWithThis` method existing in the first place. This diff fixes that issue. Changelog: [General] [Fixed] - Fix documentation comments for HermesJS's `Function::callWithThis` method to accurately reflect how `this` is handled. Reviewed By: jbower-fb Differential Revision: D19714074 fbshipit-source-id: 123688c1f7e578d6356bec54604fb6e30f06b0b1
1 parent 8dcab66 commit 399bda5

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

ReactCommon/jsi/jsi/jsi.h

+5-7
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ class StringBuffer : public Buffer {
5252
std::string s_;
5353
};
5454

55-
/// PreparedJavaScript is a base class representing JavaScript which is in a form
56-
/// optimized for execution, in a runtime-specific way. Construct one via
55+
/// PreparedJavaScript is a base class representing JavaScript which is in a
56+
/// form optimized for execution, in a runtime-specific way. Construct one via
5757
/// jsi::Runtime::prepareJavaScript().
5858
/// ** This is an experimental API that is subject to change. **
5959
class PreparedJavaScript {
@@ -827,24 +827,22 @@ class Function : public Object {
827827
Value call(Runtime& runtime, Args&&... args) const;
828828

829829
/// Calls the function with \c count \c args and \c jsThis value passed
830-
/// as this value.
830+
/// as the \c this value.
831831
Value callWithThis(
832832
Runtime& Runtime,
833833
const Object& jsThis,
834834
const Value* args,
835835
size_t count) const;
836836

837837
/// Calls the function with a \c std::initializer_list of Value
838-
/// arguments. The \c this value of the JS function will be
839-
/// undefined.
838+
/// arguments and \c jsThis passed as the \c this value.
840839
Value callWithThis(
841840
Runtime& runtime,
842841
const Object& jsThis,
843842
std::initializer_list<Value> args) const;
844843

845844
/// Calls the function with any number of arguments similarly to
846-
/// Object::setProperty(). The \c this value of the JS function
847-
/// will be undefined.
845+
/// Object::setProperty(), and with \c jsThis passed as the \c this value.
848846
template <typename... Args>
849847
Value callWithThis(Runtime& runtime, const Object& jsThis, Args&&... args)
850848
const;

0 commit comments

Comments
 (0)