From 12f9df9f393285de8fb4a8cd01478dc4fe3b089d Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Thu, 14 Mar 2019 14:48:08 -0700 Subject: [PATCH] fix: check V8 version directly instead of inferring from NMV (#840) --- nan_converters_43_inl.h | 6 ++++-- nan_implementation_12_inl.h | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/nan_converters_43_inl.h b/nan_converters_43_inl.h index ef483e50..41b72deb 100644 --- a/nan_converters_43_inl.h +++ b/nan_converters_43_inl.h @@ -25,7 +25,8 @@ X(Object) X(Integer) X(Uint32) X(Int32) -#if NODE_MODULE_VERSION <= NODE_11_0_MODULE_VERSION +// V8 <= 7.0 +#if V8_MAJOR_VERSION < 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION == 0) X(Boolean) #else imp::ToFactory::return_t \ @@ -50,7 +51,8 @@ X(double, Number) X(int64_t, Integer) X(uint32_t, Uint32) X(int32_t, Int32) -#if NODE_MODULE_VERSION <= NODE_11_0_MODULE_VERSION +// V8 <= 7.0 +#if V8_MAJOR_VERSION < 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION == 0) X(bool, Boolean) #else imp::ToFactory::return_t \ diff --git a/nan_implementation_12_inl.h b/nan_implementation_12_inl.h index 9af2629e..8756e6ee 100644 --- a/nan_implementation_12_inl.h +++ b/nan_implementation_12_inl.h @@ -345,7 +345,8 @@ Factory::New(ExternalOneByteStringResource * value) { // TODO(bnoordhuis) Use isolate-based version in Node.js v12. Factory::return_t Factory::New(v8::Local value) { -#if NODE_MODULE_VERSION > NODE_11_0_MODULE_VERSION +// V8 > 7.0 +#if V8_MAJOR_VERSION > 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION > 0) return v8::StringObject::New(v8::Isolate::GetCurrent(), value).As(); #else #ifdef _MSC_VER