From 91c1f8a79b615126e406d97384db7606d9602356 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 9 Dec 2018 13:27:13 -0500 Subject: [PATCH] src: use Local version of ToBoolean() This fixes a deprecation warning. PR-URL: https://github.com/nodejs/node/pull/24924 Reviewed-By: Anna Henningsen Reviewed-By: Joyee Cheung Reviewed-By: Franziska Hinkelmann Reviewed-By: James M Snell --- src/js_native_api_v8.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc index 6b8d3f91056823..9e67e2ca24b7c0 100644 --- a/src/js_native_api_v8.cc +++ b/src/js_native_api_v8.cc @@ -11,10 +11,6 @@ #define CHECK_TO_NUMBER(env, context, result, src) \ CHECK_TO_TYPE((env), Number, (context), (result), (src), napi_number_expected) -#define CHECK_TO_BOOL(env, context, result, src) \ - CHECK_TO_TYPE((env), Boolean, (context), (result), (src), \ - napi_boolean_expected) - // n-api defines NAPI_AUTO_LENGHTH as the indicator that a string // is null terminated. For V8 the equivalent is -1. The assert // validates that our cast of NAPI_AUTO_LENGTH results in -1 as @@ -2155,11 +2151,9 @@ napi_status napi_coerce_to_bool(napi_env env, CHECK_ARG(env, value); CHECK_ARG(env, result); - v8::Local context = env->context(); - v8::Local b; - - CHECK_TO_BOOL(env, context, b, value); - + v8::Isolate* isolate = env->isolate; + v8::Local b = + v8impl::V8LocalValueFromJsValue(value)->ToBoolean(isolate); *result = v8impl::JsValueFromV8LocalValue(b); return GET_RETURN_STATUS(env); }