From a17131400360562f06fc4d1c217ee60f7c5928aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Mon, 27 Jan 2020 23:12:26 -0400 Subject: [PATCH] n-api: rename 'promise' parameter to 'value' This change makes it clear that the value doesn't need to be a Promise, and makes the signature consistent with other napi_is_* functions. PR-URL: https://github.com/nodejs/node/pull/31544 Reviewed-By: Chengzhong Wu Reviewed-By: Anna Henningsen Reviewed-By: David Carlier Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Rich Trott --- doc/api/n-api.md | 4 ++-- src/js_native_api.h | 2 +- src/js_native_api_v8.cc | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 9c784ba2a382c1..9ccfeb9cb74f9c 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -4994,12 +4994,12 @@ napiVersion: 1 ```C napi_status napi_is_promise(napi_env env, - napi_value promise, + napi_value value, bool* is_promise); ``` * `[in] env`: The environment that the API is invoked under. -* `[in] promise`: The promise to examine +* `[in] value`: The value to examine * `[out] is_promise`: Flag indicating whether `promise` is a native promise object (that is, a promise object created by the underlying engine). diff --git a/src/js_native_api.h b/src/js_native_api.h index f749232e07c749..cb69fde5d1990e 100644 --- a/src/js_native_api.h +++ b/src/js_native_api.h @@ -440,7 +440,7 @@ NAPI_EXTERN napi_status napi_reject_deferred(napi_env env, napi_deferred deferred, napi_value rejection); NAPI_EXTERN napi_status napi_is_promise(napi_env env, - napi_value promise, + napi_value value, bool* is_promise); // Running a script diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc index 6a528e3827bbd9..24d9bc86556c10 100644 --- a/src/js_native_api_v8.cc +++ b/src/js_native_api_v8.cc @@ -2999,13 +2999,13 @@ napi_status napi_reject_deferred(napi_env env, } napi_status napi_is_promise(napi_env env, - napi_value promise, + napi_value value, bool* is_promise) { CHECK_ENV(env); - CHECK_ARG(env, promise); + CHECK_ARG(env, value); CHECK_ARG(env, is_promise); - *is_promise = v8impl::V8LocalValueFromJsValue(promise)->IsPromise(); + *is_promise = v8impl::V8LocalValueFromJsValue(value)->IsPromise(); return napi_clear_last_error(env); }