Skip to content

Commit c821569

Browse files
tniessencodebytere
authored andcommitted
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: #31544 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 6626c4d commit c821569

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

doc/api/n-api.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4994,12 +4994,12 @@ napiVersion: 1
49944994

49954995
```C
49964996
napi_status napi_is_promise(napi_env env,
4997-
napi_value promise,
4997+
napi_value value,
49984998
bool* is_promise);
49994999
```
50005000

50015001
* `[in] env`: The environment that the API is invoked under.
5002-
* `[in] promise`: The promise to examine
5002+
* `[in] value`: The value to examine
50035003
* `[out] is_promise`: Flag indicating whether `promise` is a native promise
50045004
object (that is, a promise object created by the underlying engine).
50055005

src/js_native_api.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ NAPI_EXTERN napi_status napi_reject_deferred(napi_env env,
440440
napi_deferred deferred,
441441
napi_value rejection);
442442
NAPI_EXTERN napi_status napi_is_promise(napi_env env,
443-
napi_value promise,
443+
napi_value value,
444444
bool* is_promise);
445445

446446
// Running a script

src/js_native_api_v8.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -2989,13 +2989,13 @@ napi_status napi_reject_deferred(napi_env env,
29892989
}
29902990

29912991
napi_status napi_is_promise(napi_env env,
2992-
napi_value promise,
2992+
napi_value value,
29932993
bool* is_promise) {
29942994
CHECK_ENV(env);
2995-
CHECK_ARG(env, promise);
2995+
CHECK_ARG(env, value);
29962996
CHECK_ARG(env, is_promise);
29972997

2998-
*is_promise = v8impl::V8LocalValueFromJsValue(promise)->IsPromise();
2998+
*is_promise = v8impl::V8LocalValueFromJsValue(value)->IsPromise();
29992999

30003000
return napi_clear_last_error(env);
30013001
}

0 commit comments

Comments
 (0)