diff options
Diffstat (limited to 'src/qml/jsruntime/qv4managed_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4managed_p.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h index 28b255bd9a..5c764e7ff0 100644 --- a/src/qml/jsruntime/qv4managed_p.h +++ b/src/qml/jsruntime/qv4managed_p.h @@ -206,6 +206,18 @@ public: bool markBit() const { return d()->isMarked(); } static void destroy(Heap::Base *) {} + + Q_ALWAYS_INLINE Heap::Base *heapObject() const { + return m(); + } + + template<typename T> inline T *cast() { + return static_cast<T *>(this); + } + template<typename T> inline const T *cast() const { + return static_cast<const T *>(this); + } + private: friend class MemoryManager; friend struct Identifiers; @@ -215,14 +227,12 @@ private: template<> inline const Managed *Value::as() const { - if (isManaged()) - return managed(); - return 0; + return managed(); } template<> inline const Object *Value::as() const { - return isManaged() && m() && m()->vtable()->isObject ? objectValue() : 0; + return objectValue(); } } |