Skip to content
Permalink
Browse files
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
  • Loading branch information
Kronopath authored and facebook-github-bot committed Feb 5, 2020
1 parent 8dcab66 commit 399bda52840161bf7d30c09eca061b4378b8f6e4
Showing 1 changed file with 5 additions and 7 deletions.
@@ -52,8 +52,8 @@ class StringBuffer : public Buffer {
std::string s_;
};

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

/// Calls the function with \c count \c args and \c jsThis value passed
/// as this value.
/// as the \c this value.
Value callWithThis(
Runtime& Runtime,
const Object& jsThis,
const Value* args,
size_t count) const;

/// Calls the function with a \c std::initializer_list of Value
/// arguments. The \c this value of the JS function will be
/// undefined.
/// arguments and \c jsThis passed as the \c this value.
Value callWithThis(
Runtime& runtime,
const Object& jsThis,
std::initializer_list<Value> args) const;

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

0 comments on commit 399bda5

Please sign in to comment.