Index: src/api.h |
diff --git a/src/api.h b/src/api.h |
index a9563469fd1899cd86e2e70b4eb2b84b8f26f510..b9ffbf56c8b0a7131f1745b4a59427428780e315 100644 |
--- a/src/api.h |
+++ b/src/api.h |
@@ -291,12 +291,21 @@ v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom( |
} |
+class InternalHandleHelper { |
+ public: |
+ template<class From, class To> |
+ static inline Local<To> Convert(v8::internal::Handle<From> obj) { |
+ return Local<To>(reinterpret_cast<To*>(obj.location())); |
+ } |
+}; |
+ |
+ |
// Implementations of ToLocal |
#define MAKE_TO_LOCAL(Name, From, To) \ |
Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \ |
ASSERT(obj.is_null() || !obj->IsTheHole()); \ |
- return Local<To>(reinterpret_cast<To*>(obj.location())); \ |
+ return InternalHandleHelper::Convert<v8::internal::From, v8::To>(obj); \ |
} |
@@ -305,8 +314,8 @@ v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom( |
v8::internal::Handle<v8::internal::JSTypedArray> obj) { \ |
ASSERT(obj.is_null() || !obj->IsTheHole()); \ |
ASSERT(obj->type() == typeConst); \ |
- return Local<v8::TypedArray>( \ |
- reinterpret_cast<v8::TypedArray*>(obj.location())); \ |
+ return InternalHandleHelper:: \ |
+ Convert<v8::internal::JSTypedArray, v8::TypedArray>(obj); \ |
} |