diff --git a/nan_callbacks_12_inl.h b/nan_callbacks_12_inl.h index 806d64c0..1f8bbedd 100644 --- a/nan_callbacks_12_inl.h +++ b/nan_callbacks_12_inl.h @@ -111,7 +111,19 @@ class FunctionCallbackInfo { } #endif inline v8::Local Data() const { return data_; } - inline v8::Local Holder() const { return info_.Holder(); } + NAN_DEPRECATED inline v8::Local Holder() const { +#if defined(V8_MAJOR_VERSION) && \ + (V8_MAJOR_VERSION > 12 || \ + (V8_MAJOR_VERSION == 12 && \ + (defined(V8_MINOR_VERSION) && \ + (V8_MINOR_VERSION > 5 || \ + (V8_MINOR_VERSION == 5 && defined(V8_BUILD_NUMBER) && \ + V8_BUILD_NUMBER >= 214))))) + return info_.This(); +#else + return info_.Holder(); +#endif + } inline bool IsConstructCall() const { return info_.IsConstructCall(); } inline int Length() const { return info_.Length(); } inline v8::Local operator[](int i) const { return info_[i]; } diff --git a/nan_callbacks_pre_12_inl.h b/nan_callbacks_pre_12_inl.h index 409f6125..ca3d2f48 100644 --- a/nan_callbacks_pre_12_inl.h +++ b/nan_callbacks_pre_12_inl.h @@ -140,7 +140,9 @@ class FunctionCallbackInfo { return args_.Callee(); } inline v8::Local Data() const { return data_; } - inline v8::Local Holder() const { return args_.Holder(); } + NAN_DEPRECATED inline v8::Local Holder() const { + return args_.Holder(); + } inline bool IsConstructCall() const { return args_.IsConstructCall(); } inline int Length() const { return args_.Length(); } inline v8::Local operator[](int i) const { return args_[i]; } diff --git a/test/cpp/accessors.cpp b/test/cpp/accessors.cpp index 5848a409..a68b82ca 100644 --- a/test/cpp/accessors.cpp +++ b/test/cpp/accessors.cpp @@ -90,7 +90,7 @@ NAN_METHOD(SetterGetter::New) { NAN_GETTER(SetterGetter::GetProp1) { SetterGetter* settergetter = - ObjectWrap::Unwrap(info.Holder()); + ObjectWrap::Unwrap(info.This()); assert(strlen(settergetter->log) < sizeof (settergetter->log)); strncat( settergetter->log @@ -112,7 +112,7 @@ NAN_GETTER(SetterGetter::GetProp1) { NAN_GETTER(SetterGetter::GetProp2) { SetterGetter* settergetter = - ObjectWrap::Unwrap(info.Holder()); + ObjectWrap::Unwrap(info.This()); assert(strlen(settergetter->log) < sizeof (settergetter->log)); strncat( settergetter->log @@ -134,7 +134,7 @@ NAN_GETTER(SetterGetter::GetProp2) { NAN_SETTER(SetterGetter::SetProp2) { SetterGetter* settergetter = - ObjectWrap::Unwrap(info.Holder()); + ObjectWrap::Unwrap(info.This()); strncpy( settergetter->prop2 , *Utf8String(value) @@ -159,7 +159,7 @@ NAN_SETTER(SetterGetter::SetProp2) { NAN_METHOD(SetterGetter::Log) { SetterGetter* settergetter = - ObjectWrap::Unwrap(info.Holder()); + ObjectWrap::Unwrap(info.This()); info.GetReturnValue().Set(Nan::New(settergetter->log).ToLocalChecked()); } diff --git a/test/cpp/accessors2.cpp b/test/cpp/accessors2.cpp index f5a2b312..59125d33 100644 --- a/test/cpp/accessors2.cpp +++ b/test/cpp/accessors2.cpp @@ -88,7 +88,7 @@ NAN_METHOD(SetterGetter::New) { NAN_GETTER(SetterGetter::GetProp1) { SetterGetter* settergetter = - ObjectWrap::Unwrap(info.Holder()); + ObjectWrap::Unwrap(info.This()); assert(strlen(settergetter->log) < sizeof (settergetter->log)); strncat( settergetter->log @@ -110,7 +110,7 @@ NAN_GETTER(SetterGetter::GetProp1) { NAN_GETTER(SetterGetter::GetProp2) { SetterGetter* settergetter = - ObjectWrap::Unwrap(info.Holder()); + ObjectWrap::Unwrap(info.This()); assert(strlen(settergetter->log) < sizeof (settergetter->log)); strncat( settergetter->log @@ -132,7 +132,7 @@ NAN_GETTER(SetterGetter::GetProp2) { NAN_SETTER(SetterGetter::SetProp2) { SetterGetter* settergetter = - ObjectWrap::Unwrap(info.Holder()); + ObjectWrap::Unwrap(info.This()); strncpy( settergetter->prop2 , *Nan::Utf8String(value) @@ -157,7 +157,7 @@ NAN_SETTER(SetterGetter::SetProp2) { NAN_METHOD(SetterGetter::Log) { SetterGetter* settergetter = - ObjectWrap::Unwrap(info.Holder()); + ObjectWrap::Unwrap(info.This()); info.GetReturnValue().Set(Nan::New(settergetter->log).ToLocalChecked()); } diff --git a/test/cpp/methodswithdata.cpp b/test/cpp/methodswithdata.cpp index 7dd6cbc3..daa91046 100644 --- a/test/cpp/methodswithdata.cpp +++ b/test/cpp/methodswithdata.cpp @@ -74,7 +74,7 @@ NAN_GETTER(SetterGetter::GetProp1) { std::string datavalue = *Nan::Utf8String(info.Data()); assert(datavalue == "prop1-data"); SetterGetter* settergetter = - ObjectWrap::Unwrap(info.Holder()); + ObjectWrap::Unwrap(info.This()); assert(strlen(settergetter->log) < sizeof (settergetter->log)); strncat( settergetter->log @@ -99,7 +99,7 @@ NAN_GETTER(SetterGetter::GetProp2) { assert(datavalue == "prop2-data"); SetterGetter* settergetter = - ObjectWrap::Unwrap(info.Holder()); + ObjectWrap::Unwrap(info.This()); assert(strlen(settergetter->log) < sizeof (settergetter->log)); strncat( settergetter->log @@ -124,7 +124,7 @@ NAN_SETTER(SetterGetter::SetProp2) { assert(datavalue == "prop2-data"); SetterGetter* settergetter = - ObjectWrap::Unwrap(info.Holder()); + ObjectWrap::Unwrap(info.This()); strncpy( settergetter->prop2 , *Utf8String(value) @@ -149,7 +149,7 @@ NAN_SETTER(SetterGetter::SetProp2) { NAN_METHOD(SetterGetter::Log) { SetterGetter* settergetter = - ObjectWrap::Unwrap(info.Holder()); + ObjectWrap::Unwrap(info.This()); info.GetReturnValue().Set(Nan::New(settergetter->log).ToLocalChecked()); } diff --git a/test/cpp/objectwraphandle.cpp b/test/cpp/objectwraphandle.cpp index ac4f79aa..64dd9e7a 100644 --- a/test/cpp/objectwraphandle.cpp +++ b/test/cpp/objectwraphandle.cpp @@ -47,17 +47,17 @@ class MyObject : public ObjectWrap { } static NAN_METHOD(GetHandle) { - MyObject* obj = ObjectWrap::Unwrap(info.Holder()); + MyObject* obj = ObjectWrap::Unwrap(info.This()); info.GetReturnValue().Set(obj->handle()); } static NAN_METHOD(GetHandleConst) { - MyObject const *obj = ObjectWrap::Unwrap(info.Holder()); + MyObject const *obj = ObjectWrap::Unwrap(info.This()); info.GetReturnValue().Set(obj->handle()); } static NAN_METHOD(GetValue) { - MyObject* obj = ObjectWrap::Unwrap(info.Holder()); + MyObject* obj = ObjectWrap::Unwrap(info.This()); info.GetReturnValue().Set(obj->value_); } diff --git a/test/cpp/wrappedobjectfactory.cpp b/test/cpp/wrappedobjectfactory.cpp index 9930a5f1..ec3955e4 100644 --- a/test/cpp/wrappedobjectfactory.cpp +++ b/test/cpp/wrappedobjectfactory.cpp @@ -49,7 +49,7 @@ class InnerObject : public ObjectWrap { } static NAN_METHOD(GetValue) { - InnerObject* obj = ObjectWrap::Unwrap(info.Holder()); + InnerObject* obj = ObjectWrap::Unwrap(info.This()); info.GetReturnValue().Set(obj->value_); } @@ -102,7 +102,7 @@ class MyObject : public ObjectWrap { } static NAN_METHOD(GetValue) { - MyObject* obj = ObjectWrap::Unwrap(info.Holder()); + MyObject* obj = ObjectWrap::Unwrap(info.This()); info.GetReturnValue().Set(obj->value_); }