| 4210 | //////////////////////////////////////////////////////////////////////////////// |
| 4211 | |
| 4212 | inline CallbackInfo::CallbackInfo(napi_env env, napi_callback_info info) |
| 4213 | : _env(env), |
| 4214 | _info(info), |
| 4215 | _this(nullptr), |
| 4216 | _dynamicArgs(nullptr), |
| 4217 | _data(nullptr) { |
| 4218 | _argc = _staticArgCount; |
| 4219 | _argv = _staticArgs; |
| 4220 | napi_status status = |
| 4221 | napi_get_cb_info(env, info, &_argc, _argv, &_this, &_data); |
| 4222 | NAPI_THROW_IF_FAILED_VOID(_env, status); |
| 4223 | |
| 4224 | if (_argc > _staticArgCount) { |
| 4225 | // Use either a fixed-size array (on the stack) or a dynamically-allocated |
| 4226 | // array (on the heap) depending on the number of args. |
| 4227 | _dynamicArgs = new napi_value[_argc]; |
| 4228 | _argv = _dynamicArgs; |
| 4229 | |
| 4230 | status = napi_get_cb_info(env, info, &_argc, _argv, nullptr, nullptr); |
| 4231 | NAPI_THROW_IF_FAILED_VOID(_env, status); |
| 4232 | } |
| 4233 | } |
| 4234 | |
| 4235 | inline CallbackInfo::~CallbackInfo() { |
| 4236 | if (_dynamicArgs != nullptr) { |
nothing calls this directly
no outgoing calls
no test coverage detected