Skip to content

Commit ba34fd5

Browse files
present napi_get_cb_info and napi_*_callback_scope as js-capable
1 parent 18c0766 commit ba34fd5

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

src/js_native_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_instanceof(napi_env env,
289289

290290
// Gets all callback info in a single call. (Ugly, but faster.)
291291
NAPI_EXTERN napi_status NAPI_CDECL napi_get_cb_info(
292-
node_api_nogc_env env, // [in] Node-API environment handle
292+
napi_env env, // [in] Node-API environment handle
293293
napi_callback_info cbinfo, // [in] Opaque callback-info handle
294294
size_t* argc, // [in-out] Specifies the size of the provided argv array
295295
// and receives the actual count of args.

src/js_native_api_v8.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,7 @@ napi_status NAPI_CDECL napi_get_null(napi_env env, napi_value* result) {
19791979

19801980
// Gets all callback info in a single call. (Ugly, but faster.)
19811981
napi_status NAPI_CDECL napi_get_cb_info(
1982-
node_api_nogc_env env, // [in] NAPI environment handle
1982+
napi_env env, // [in] NAPI environment handle
19831983
napi_callback_info cbinfo, // [in] Opaque callback-info handle
19841984
size_t* argc, // [in-out] Specifies the size of the provided argv array
19851985
// and receives the actual count of args.

src/node_api.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ NAPI_NO_RETURN void NAPI_CDECL napi_fatal_error(const char* location,
880880
}
881881

882882
napi_status NAPI_CDECL
883-
napi_open_callback_scope(node_api_nogc_env env,
883+
napi_open_callback_scope(napi_env env,
884884
napi_value /** ignored */,
885885
napi_async_context async_context_handle,
886886
napi_callback_scope* result) {
@@ -897,11 +897,10 @@ napi_open_callback_scope(node_api_nogc_env env,
897897
return napi_clear_last_error(env);
898898
}
899899

900-
napi_status NAPI_CDECL napi_close_callback_scope(node_api_nogc_env nogc_env,
900+
napi_status NAPI_CDECL napi_close_callback_scope(napi_env env,
901901
napi_callback_scope scope) {
902902
// Omit NAPI_PREAMBLE and GET_RETURN_STATUS because V8 calls here cannot throw
903903
// JS exceptions.
904-
napi_env env = const_cast<napi_env>(nogc_env);
905904
CHECK_ENV(env);
906905
CHECK_ARG(env, scope);
907906
if (env->open_callback_scopes == 0) {

src/node_api.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,13 @@ NAPI_EXTERN napi_status NAPI_CDECL napi_remove_env_cleanup_hook(
188188
node_api_nogc_env env, napi_cleanup_hook fun, void* arg);
189189

190190
NAPI_EXTERN napi_status NAPI_CDECL
191-
napi_open_callback_scope(node_api_nogc_env env,
191+
napi_open_callback_scope(napi_env env,
192192
napi_value resource_object,
193193
napi_async_context context,
194194
napi_callback_scope* result);
195195

196196
NAPI_EXTERN napi_status NAPI_CDECL
197-
napi_close_callback_scope(node_api_nogc_env env, napi_callback_scope scope);
197+
napi_close_callback_scope(napi_env env, napi_callback_scope scope);
198198

199199
#endif // NAPI_VERSION >= 3
200200

0 commit comments

Comments
 (0)