Skip to content

Commit a171314

Browse files
tniessenTrott
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 <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent dd4c62e commit a171314

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

doc/api/n-api.md

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2999,13 +2999,13 @@ napi_status napi_reject_deferred(napi_env env,
29992999
}
30003000

30013001
napi_status napi_is_promise(napi_env env,
3002-
napi_value promise,
3002+
napi_value value,
30033003
bool* is_promise) {
30043004
CHECK_ENV(env);
3005-
CHECK_ARG(env, promise);
3005+
CHECK_ARG(env, value);
30063006
CHECK_ARG(env, is_promise);
30073007

3008-
*is_promise = v8impl::V8LocalValueFromJsValue(promise)->IsPromise();
3008+
*is_promise = v8impl::V8LocalValueFromJsValue(value)->IsPromise();
30093009

30103010
return napi_clear_last_error(env);
30113011
}

0 commit comments

Comments
 (0)