Skip to content

Commit

Permalink
Fix shadowing issues with handle in ObjectWrap
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoopa committed Aug 25, 2015
1 parent bfba85b commit 0a9072d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions nan_object_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class ObjectWrap {


template <class T>
static inline T* Unwrap(v8::Local<v8::Object> handle) {
assert(!handle.IsEmpty());
assert(handle->InternalFieldCount() > 0);
static inline T* Unwrap(v8::Local<v8::Object> object) {
assert(!object.IsEmpty());
assert(object->InternalFieldCount() > 0);
// Cast to ObjectWrap before casting to T. A direct cast from void
// to T won't work right when T has more than one base class.
void* ptr = GetInternalFieldPointer(handle, 0);
void* ptr = GetInternalFieldPointer(object, 0);
ObjectWrap* wrap = static_cast<ObjectWrap*>(ptr);
return static_cast<T*>(wrap);
}
Expand All @@ -50,11 +50,11 @@ class ObjectWrap {


protected:
inline void Wrap(v8::Local<v8::Object> handle) {
inline void Wrap(v8::Local<v8::Object> object) {
assert(persistent().IsEmpty());
assert(handle->InternalFieldCount() > 0);
SetInternalFieldPointer(handle, 0, this);
persistent().Reset(handle);
assert(object->InternalFieldCount() > 0);
SetInternalFieldPointer(object, 0, this);
persistent().Reset(object);
MakeWeak();
}

Expand Down

0 comments on commit 0a9072d

Please sign in to comment.