Skip to content

Commit e58252a

Browse files
committed
Use static casts
1 parent 6c0a9ec commit e58252a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

nan_persistent_12_inl.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ template<typename T, typename M> class Persistent :
4646
, WeakCallbackType type);
4747

4848
private:
49-
inline T *operator*() const { return *PersistentBase<T>::persistent; }
50-
5149
template<typename S, typename M2>
5250
inline void Copy(const Persistent<S, M2> &that) {
5351
TYPE_CHECK(T, S);
@@ -94,8 +92,8 @@ class Global : public v8::Global<T> {
9492
P *parameter
9593
, typename WeakCallbackInfo<P>::Callback callback
9694
, WeakCallbackType type) {
97-
reinterpret_cast<Persistent<T>*>(this)->SetWeak(
98-
parameter, callback, type);
95+
static_cast<Persistent<T>*>(static_cast<v8::PersistentBase<T>*>(this))->
96+
SetWeak(parameter, callback, type);
9997
}
10098
};
10199
#else
@@ -130,7 +128,8 @@ class Global : public v8::UniquePersistent<T> {
130128

131129
#if NODE_MODULE_VERSION == NODE_0_12_MODULE_VERSION
132130
inline void Empty() {
133-
reinterpret_cast<v8::Persistent<T>*>(this)->ClearAndLeak();
131+
static_cast<v8::Persistent<T>*>(static_cast<v8::PersistentBase<T>*>(this))->
132+
ClearAndLeak();
134133
}
135134
#endif
136135

@@ -139,13 +138,14 @@ class Global : public v8::UniquePersistent<T> {
139138
# if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
140139
rvalue.object_->Empty();
141140
# else
142-
reinterpret_cast<v8::Persistent<T>*>(rvalue.object_)->ClearAndLeak();
141+
static_cast<v8::Persistent<T>*>(static_cast<v8::PersistentBase<T>*>(
142+
rvalue.object_))->ClearAndLeak();
143143
# endif
144144
}
145145

146146
template<typename S>
147147
inline Global &operator=(v8::UniquePersistent<S> other) {
148-
return reinterpret_cast<Global>(v8::UniquePersistent<S>::operator=(other));
148+
return static_cast<Global&>(v8::UniquePersistent<S>::operator=(other));
149149
}
150150

151151
inline operator RValue() { return RValue(this); }
@@ -157,8 +157,8 @@ class Global : public v8::UniquePersistent<T> {
157157
P *parameter
158158
, typename WeakCallbackInfo<P>::Callback callback
159159
, WeakCallbackType type) {
160-
reinterpret_cast<Persistent<T>*>(this)->SetWeak(
161-
parameter, callback, type);
160+
static_cast<Persistent<T>*>(static_cast<v8::PersistentBase<T>*>(this))
161+
->SetWeak(parameter, callback, type);
162162
}
163163
};
164164
#endif

0 commit comments

Comments
 (0)