Skip to content

Commit

Permalink
Fix lint and test
Browse files Browse the repository at this point in the history
  • Loading branch information
rgerd committed Jul 23, 2021
1 parent f211f45 commit e69fb2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 6 additions & 3 deletions napi-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2114,11 +2114,14 @@ inline Value Function::Call(napi_value recv, size_t argc, const napi_value* args
return Value(_env, result);
}

inline Value Function::Call(napi_value recv, size_t argc, const Value* args) const {
napi_value stackArgs[6];
inline Value Function::Call(napi_value recv,
size_t argc,
const Value* args) const {
const size_t stackArgsCount = 6;
napi_value stackArgs[stackArgsCount];
std::vector<napi_value> heapArgs;
napi_value* argv;
if (argc <= std::size(stackArgs)) {
if (argc <= stackArgsCount) {
argv = stackArgs;
} else {
heapArgs.resize(argc);
Expand Down
6 changes: 4 additions & 2 deletions test/function.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ Object InitFunction(Env env) {
exports["callWithArgs"] = Function::New(env, CallWithArgs);
exports["callWithVector"] = Function::New(env, CallWithVector);
exports["callWithCStyleArray"] = Function::New(env, CallWithCStyleArray);
exports["callWithCStyleArrayUsingCppWrapper"] = Function::New(env, CallWithCStyleArrayUsingCppWrapper);
exports["callWithCStyleArrayUsingCppWrapper"] =
Function::New(env, CallWithCStyleArrayUsingCppWrapper);
exports["callWithReceiverAndCStyleArray"] =
Function::New(env, CallWithReceiverAndCStyleArray);
exports["callWithReceiverAndCStyleArrayUsingCppWrapper"] =
Expand Down Expand Up @@ -266,7 +267,8 @@ Object InitFunction(Env env) {
exports["callWithArgs"] = Function::New<CallWithArgs>(env);
exports["callWithVector"] = Function::New<CallWithVector>(env);
exports["callWithCStyleArray"] = Function::New<CallWithCStyleArray>(env);
exports["callWithCStyleArrayUsingCppWrapper"] = Function::New<CallWithCStyleArrayUsingCppWrapper>(env);
exports["callWithCStyleArrayUsingCppWrapper"] =
Function::New<CallWithCStyleArrayUsingCppWrapper>(env);
exports["callWithReceiverAndCStyleArray"] =
Function::New<CallWithReceiverAndCStyleArray>(env);
exports["callWithReceiverAndCStyleArrayUsingCppWrapper"] =
Expand Down

0 comments on commit e69fb2c

Please sign in to comment.