From 49f2333d90196d2b5f9df02a3063f1f4cd3df9cc Mon Sep 17 00:00:00 2001 From: King Koopa Date: Fri, 1 May 2015 17:19:11 +0300 Subject: [PATCH] Renamed identifiers with leading underscores --- nan.h | 230 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 101 insertions(+), 129 deletions(-) diff --git a/nan.h b/nan.h index a967416c..22ea5211 100644 --- a/nan.h +++ b/nan.h @@ -324,71 +324,53 @@ namespace Nan { namespace imp { } #endif -#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) -// Node 0.11+ (0.11.12 and below won't compile with these) - -# define _NAN_METHOD_ARGS_TYPE const v8::FunctionCallbackInfo& -# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args -# define _NAN_METHOD_RETURN_TYPE void - -# define _NAN_GETTER_ARGS_TYPE const v8::PropertyCallbackInfo& -# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args -# define _NAN_GETTER_RETURN_TYPE void - -# define _NAN_SETTER_ARGS_TYPE const v8::PropertyCallbackInfo& -# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args -# define _NAN_SETTER_RETURN_TYPE void - -# define _NAN_PROPERTY_GETTER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_PROPERTY_GETTER_ARGS _NAN_PROPERTY_GETTER_ARGS_TYPE args -# define _NAN_PROPERTY_GETTER_RETURN_TYPE void - -# define _NAN_PROPERTY_SETTER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_PROPERTY_SETTER_ARGS _NAN_PROPERTY_SETTER_ARGS_TYPE args -# define _NAN_PROPERTY_SETTER_RETURN_TYPE void - -# define _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_PROPERTY_ENUMERATOR_ARGS _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE args -# define _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE void - -# define _NAN_PROPERTY_DELETER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_PROPERTY_DELETER_ARGS \ - _NAN_PROPERTY_DELETER_ARGS_TYPE args -# define _NAN_PROPERTY_DELETER_RETURN_TYPE void - -# define _NAN_PROPERTY_QUERY_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_PROPERTY_QUERY_ARGS _NAN_PROPERTY_QUERY_ARGS_TYPE args -# define _NAN_PROPERTY_QUERY_RETURN_TYPE void - -# define _NAN_INDEX_GETTER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_INDEX_GETTER_ARGS _NAN_INDEX_GETTER_ARGS_TYPE args -# define _NAN_INDEX_GETTER_RETURN_TYPE void - -# define _NAN_INDEX_SETTER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_INDEX_SETTER_ARGS _NAN_INDEX_SETTER_ARGS_TYPE args -# define _NAN_INDEX_SETTER_RETURN_TYPE void - -# define _NAN_INDEX_ENUMERATOR_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_INDEX_ENUMERATOR_ARGS _NAN_INDEX_ENUMERATOR_ARGS_TYPE args -# define _NAN_INDEX_ENUMERATOR_RETURN_TYPE void - -# define _NAN_INDEX_DELETER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_INDEX_DELETER_ARGS _NAN_INDEX_DELETER_ARGS_TYPE args -# define _NAN_INDEX_DELETER_RETURN_TYPE void - -# define _NAN_INDEX_QUERY_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args -# define _NAN_INDEX_QUERY_RETURN_TYPE void +#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) // Node 0.12 + typedef const v8::FunctionCallbackInfo& NAN_METHOD_ARGS_TYPE; + typedef void NAN_METHOD_RETURN_TYPE; + + typedef const v8::PropertyCallbackInfo& NAN_GETTER_ARGS_TYPE; + typedef void NAN_GETTER_RETURN_TYPE; + + typedef const v8::PropertyCallbackInfo& NAN_SETTER_ARGS_TYPE; + typedef void NAN_SETTER_RETURN_TYPE; + + typedef const v8::PropertyCallbackInfo& + NAN_PROPERTY_GETTER_ARGS_TYPE; + typedef void NAN_PROPERTY_GETTER_RETURN_TYPE; + + typedef const v8::PropertyCallbackInfo& + NAN_PROPERTY_SETTER_ARGS_TYPE; + typedef void NAN_PROPERTY_SETTER_RETURN_TYPE; + + typedef const v8::PropertyCallbackInfo& + NAN_PROPERTY_ENUMERATOR_ARGS_TYPE; + typedef void NAN_PROPERTY_ENUMERATOR_RETURN_TYPE; + + typedef const v8::PropertyCallbackInfo& + NAN_PROPERTY_DELETER_ARGS_TYPE; + typedef void NAN_PROPERTY_DELETER_RETURN_TYPE; + + typedef const v8::PropertyCallbackInfo& + NAN_PROPERTY_QUERY_ARGS_TYPE; + typedef void NAN_PROPERTY_QUERY_RETURN_TYPE; + + typedef const v8::PropertyCallbackInfo& NAN_INDEX_GETTER_ARGS_TYPE; + typedef void NAN_INDEX_GETTER_RETURN_TYPE; + + typedef const v8::PropertyCallbackInfo& NAN_INDEX_SETTER_ARGS_TYPE; + typedef void NAN_INDEX_SETTER_RETURN_TYPE; + + typedef const v8::PropertyCallbackInfo& + NAN_INDEX_ENUMERATOR_ARGS_TYPE; + typedef void NAN_INDEX_ENUMERATOR_RETURN_TYPE; + + typedef const v8::PropertyCallbackInfo& + NAN_INDEX_DELETER_ARGS_TYPE; + typedef void NAN_INDEX_DELETER_RETURN_TYPE; + + typedef const v8::PropertyCallbackInfo& + NAN_INDEX_QUERY_ARGS_TYPE; + typedef void NAN_INDEX_QUERY_RETURN_TYPE; # define NanScope() v8::HandleScope scope(v8::Isolate::GetCurrent()) # define NanEscapableScope() \ @@ -398,7 +380,7 @@ namespace Nan { namespace imp { # define NanLocker() v8::Locker locker(v8::Isolate::GetCurrent()) # define NanUnlocker() v8::Unlocker unlocker(v8::Isolate::GetCurrent()) # define NanReturnValue(value) \ -return args.GetReturnValue().Set(Nan::imp::NanEnsureHandleOrPersistent(value)) + return args.GetReturnValue().Set(Nan::imp::NanEnsureHandleOrPersistent(value)) # define NanReturnUndefined() return # define NanReturnHolder() NanReturnValue(args.Holder()) # define NanReturnThis() NanReturnValue(args.This()) @@ -761,60 +743,45 @@ return args.GetReturnValue().Set(Nan::imp::NanEnsureHandleOrPersistent(value)) int size; }; -#else -// Node 0.8 and 0.10 - -# define _NAN_METHOD_ARGS_TYPE const v8::Arguments& -# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args -# define _NAN_METHOD_RETURN_TYPE v8::Handle +#else // Node 0.8 and 0.10 + typedef const v8::Arguments& NAN_METHOD_ARGS_TYPE; + typedef v8::Handle NAN_METHOD_RETURN_TYPE; -# define _NAN_GETTER_ARGS_TYPE const v8::AccessorInfo & -# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args -# define _NAN_GETTER_RETURN_TYPE v8::Handle + typedef const v8::AccessorInfo & NAN_GETTER_ARGS_TYPE; + typedef v8::Handle NAN_GETTER_RETURN_TYPE; -# define _NAN_SETTER_ARGS_TYPE const v8::AccessorInfo & -# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args -# define _NAN_SETTER_RETURN_TYPE void + typedef const v8::AccessorInfo & NAN_SETTER_ARGS_TYPE; + typedef void NAN_SETTER_RETURN_TYPE; -# define _NAN_PROPERTY_GETTER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_PROPERTY_GETTER_ARGS _NAN_PROPERTY_GETTER_ARGS_TYPE args -# define _NAN_PROPERTY_GETTER_RETURN_TYPE v8::Handle + typedef const v8::AccessorInfo& NAN_PROPERTY_GETTER_ARGS_TYPE; + typedef v8::Handle NAN_PROPERTY_GETTER_RETURN_TYPE; -# define _NAN_PROPERTY_SETTER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_PROPERTY_SETTER_ARGS _NAN_PROPERTY_SETTER_ARGS_TYPE args -# define _NAN_PROPERTY_SETTER_RETURN_TYPE v8::Handle + typedef const v8::AccessorInfo& NAN_PROPERTY_SETTER_ARGS_TYPE; + typedef v8::Handle NAN_PROPERTY_SETTER_RETURN_TYPE; -# define _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_PROPERTY_ENUMERATOR_ARGS _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE args -# define _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE v8::Handle + typedef const v8::AccessorInfo& NAN_PROPERTY_ENUMERATOR_ARGS_TYPE; + typedef v8::Handle NAN_PROPERTY_ENUMERATOR_RETURN_TYPE; -# define _NAN_PROPERTY_DELETER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_PROPERTY_DELETER_ARGS _NAN_PROPERTY_DELETER_ARGS_TYPE args -# define _NAN_PROPERTY_DELETER_RETURN_TYPE v8::Handle + typedef const v8::AccessorInfo& NAN_PROPERTY_DELETER_ARGS_TYPE; + typedef v8::Handle NAN_PROPERTY_DELETER_RETURN_TYPE; -# define _NAN_PROPERTY_QUERY_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_PROPERTY_QUERY_ARGS _NAN_PROPERTY_QUERY_ARGS_TYPE args -# define _NAN_PROPERTY_QUERY_RETURN_TYPE v8::Handle + typedef const v8::AccessorInfo& NAN_PROPERTY_QUERY_ARGS_TYPE; + typedef v8::Handle NAN_PROPERTY_QUERY_RETURN_TYPE; -# define _NAN_INDEX_GETTER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_INDEX_GETTER_ARGS _NAN_INDEX_GETTER_ARGS_TYPE args -# define _NAN_INDEX_GETTER_RETURN_TYPE v8::Handle + typedef const v8::AccessorInfo& NAN_INDEX_GETTER_ARGS_TYPE; + typedef v8::Handle NAN_INDEX_GETTER_RETURN_TYPE; -# define _NAN_INDEX_SETTER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_INDEX_SETTER_ARGS _NAN_INDEX_SETTER_ARGS_TYPE args -# define _NAN_INDEX_SETTER_RETURN_TYPE v8::Handle + typedef const v8::AccessorInfo& NAN_INDEX_SETTER_ARGS_TYPE; + typedef v8::Handle NAN_INDEX_SETTER_RETURN_TYPE; -# define _NAN_INDEX_ENUMERATOR_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_INDEX_ENUMERATOR_ARGS _NAN_INDEX_ENUMERATOR_ARGS_TYPE args -# define _NAN_INDEX_ENUMERATOR_RETURN_TYPE v8::Handle + typedef const v8::AccessorInfo& NAN_INDEX_ENUMERATOR_ARGS_TYPE; + typedef v8::Handle NAN_INDEX_ENUMERATOR_RETURN_TYPE; -# define _NAN_INDEX_DELETER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_INDEX_DELETER_ARGS _NAN_INDEX_DELETER_ARGS_TYPE args -# define _NAN_INDEX_DELETER_RETURN_TYPE v8::Handle + typedef const v8::AccessorInfo& NAN_INDEX_DELETER_ARGS_TYPE; + typedef v8::Handle NAN_INDEX_DELETER_RETURN_TYPE; -# define _NAN_INDEX_QUERY_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args -# define _NAN_INDEX_QUERY_RETURN_TYPE v8::Handle + typedef const v8::AccessorInfo& NAN_INDEX_QUERY_ARGS_TYPE; + typedef v8::Handle NAN_INDEX_QUERY_RETURN_TYPE; # define NanScope() v8::HandleScope scope # define NanEscapableScope() v8::HandleScope scope @@ -1187,50 +1154,55 @@ return args.GetReturnValue().Set(Nan::imp::NanEnsureHandleOrPersistent(value)) typedef void (*NanFreeCallback)(char *data, void *hint); -#define NAN_METHOD(name) _NAN_METHOD_RETURN_TYPE name(_NAN_METHOD_ARGS) +#define NAN_METHOD(name) NAN_METHOD_RETURN_TYPE name(NAN_METHOD_ARGS_TYPE args) #define NAN_GETTER(name) \ - _NAN_GETTER_RETURN_TYPE name( \ + NAN_GETTER_RETURN_TYPE name( \ v8::Local property \ - , _NAN_GETTER_ARGS) + , NAN_GETTER_ARGS_TYPE args) #define NAN_SETTER(name) \ - _NAN_SETTER_RETURN_TYPE name( \ + NAN_SETTER_RETURN_TYPE name( \ v8::Local property \ , v8::Local value \ - , _NAN_SETTER_ARGS) + , NAN_SETTER_ARGS_TYPE args) #define NAN_PROPERTY_GETTER(name) \ - _NAN_PROPERTY_GETTER_RETURN_TYPE name( \ + NAN_PROPERTY_GETTER_RETURN_TYPE name( \ v8::Local property \ - , _NAN_PROPERTY_GETTER_ARGS) + , NAN_PROPERTY_GETTER_ARGS_TYPE args) #define NAN_PROPERTY_SETTER(name) \ - _NAN_PROPERTY_SETTER_RETURN_TYPE name( \ + NAN_PROPERTY_SETTER_RETURN_TYPE name( \ v8::Local property \ , v8::Local value \ - , _NAN_PROPERTY_SETTER_ARGS) + , NAN_PROPERTY_SETTER_ARGS_TYPE args) #define NAN_PROPERTY_ENUMERATOR(name) \ - _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE name(_NAN_PROPERTY_ENUMERATOR_ARGS) + NAN_PROPERTY_ENUMERATOR_RETURN_TYPE name( \ + NAN_PROPERTY_ENUMERATOR_ARGS_TYPE args) #define NAN_PROPERTY_DELETER(name) \ - _NAN_PROPERTY_DELETER_RETURN_TYPE name( \ + NAN_PROPERTY_DELETER_RETURN_TYPE name( \ v8::Local property \ - , _NAN_PROPERTY_DELETER_ARGS) + , NAN_PROPERTY_DELETER_ARGS_TYPE args) #define NAN_PROPERTY_QUERY(name) \ - _NAN_PROPERTY_QUERY_RETURN_TYPE name( \ + NAN_PROPERTY_QUERY_RETURN_TYPE name( \ v8::Local property \ - , _NAN_PROPERTY_QUERY_ARGS) + , NAN_PROPERTY_QUERY_ARGS_TYPE args) # define NAN_INDEX_GETTER(name) \ - _NAN_INDEX_GETTER_RETURN_TYPE name(uint32_t index, _NAN_INDEX_GETTER_ARGS) + NAN_INDEX_GETTER_RETURN_TYPE name( \ + uint32_t index \ + , NAN_INDEX_GETTER_ARGS_TYPE args) #define NAN_INDEX_SETTER(name) \ - _NAN_INDEX_SETTER_RETURN_TYPE name( \ + NAN_INDEX_SETTER_RETURN_TYPE name( \ uint32_t index \ , v8::Local value \ - , _NAN_INDEX_SETTER_ARGS) + , NAN_INDEX_SETTER_ARGS_TYPE args) #define NAN_INDEX_ENUMERATOR(name) \ - _NAN_INDEX_ENUMERATOR_RETURN_TYPE name(_NAN_INDEX_ENUMERATOR_ARGS) + NAN_INDEX_ENUMERATOR_RETURN_TYPE name(NAN_INDEX_ENUMERATOR_ARGS_TYPE args) #define NAN_INDEX_DELETER(name) \ - _NAN_INDEX_DELETER_RETURN_TYPE name( \ + NAN_INDEX_DELETER_RETURN_TYPE name( \ uint32_t index \ - , _NAN_INDEX_DELETER_ARGS) + , NAN_INDEX_DELETER_ARGS_TYPE args) #define NAN_INDEX_QUERY(name) \ - _NAN_INDEX_QUERY_RETURN_TYPE name(uint32_t index, _NAN_INDEX_QUERY_ARGS) + NAN_INDEX_QUERY_RETURN_TYPE name( \ + uint32_t index \ + , NAN_INDEX_QUERY_ARGS_TYPE args) class NanCallback { public: