aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/jsruntime/qv4engine.cpp2
-rw-r--r--src/qml/jsruntime/qv4managed_p.h4
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp2
-rw-r--r--src/qml/jsruntime/qv4runtime_p.h2
-rw-r--r--src/qml/jsruntime/qv4scopedvalue_p.h2
-rw-r--r--src/qml/jsruntime/qv4value_inl_p.h4
-rw-r--r--src/qml/jsruntime/qv4value_p.h6
7 files changed, 14 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index ec1ea80e47..3e7421a290 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -369,7 +369,7 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
static_cast<URIErrorPrototype *>(uRIErrorPrototype.getPointer())->init(this, uRIErrorCtor.asObject());
static_cast<VariantPrototype *>(variantPrototype.getPointer())->init();
- static_cast<SequencePrototype *>(sequencePrototype.managed())->init();
+ sequencePrototype.cast<SequencePrototype>()->init();
// typed arrays
diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h
index c73ad10230..c69eace865 100644
--- a/src/qml/jsruntime/qv4managed_p.h
+++ b/src/qml/jsruntime/qv4managed_p.h
@@ -326,8 +326,8 @@ public:
void setVTable(const ManagedVTable *vt);
- bool isEqualTo(Managed *other)
- { return internalClass()->vtable->isEqualTo(this, other); }
+ bool isEqualTo(const Managed *other) const
+ { return internalClass()->vtable->isEqualTo(const_cast<Managed *>(this), const_cast<Managed *>(other)); }
static bool isEqualTo(Managed *m, Managed *other);
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 957f8cd42f..54b42c54fb 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -721,7 +721,7 @@ Bool RuntimeHelpers::strictEqual(const ValueRef x, const ValueRef y)
if (x->isNumber())
return y->isNumber() && x->asDouble() == y->asDouble();
if (x->isManaged())
- return y->isManaged() && x->managed()->isEqualTo(y->managed());
+ return y->isManaged() && x->cast<Managed>()->isEqualTo(y->cast<Managed>());
return false;
}
diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h
index 6042420291..52a345f83e 100644
--- a/src/qml/jsruntime/qv4runtime_p.h
+++ b/src/qml/jsruntime/qv4runtime_p.h
@@ -470,7 +470,7 @@ inline Bool Runtime::compareEqual(const ValueRef left, const ValueRef right)
if (!left->isManaged())
return false;
if (left->isString() == right->isString())
- return left->managed()->isEqualTo(right->managed());
+ return left->cast<Managed>()->isEqualTo(right->cast<Managed>());
}
return RuntimeHelpers::equalHelper(left, right);
diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h
index 5cc8495bba..f62dfeac6d 100644
--- a/src/qml/jsruntime/qv4scopedvalue_p.h
+++ b/src/qml/jsruntime/qv4scopedvalue_p.h
@@ -357,7 +357,7 @@ struct Scoped
}
T *operator->() {
- return static_cast<T *>(ptr->managed());
+ return ptr->cast<T>();
}
bool operator!() const {
diff --git a/src/qml/jsruntime/qv4value_inl_p.h b/src/qml/jsruntime/qv4value_inl_p.h
index 045eaccfaf..7a6cdb40d2 100644
--- a/src/qml/jsruntime/qv4value_inl_p.h
+++ b/src/qml/jsruntime/qv4value_inl_p.h
@@ -56,13 +56,13 @@ inline bool Value::isString() const
{
if (!isManaged())
return false;
- return managed() && managed()->internalClass()->vtable->isString;
+ return m && static_cast<Managed::Data *>(m)->internalClass->vtable->isString;
}
inline bool Value::isObject() const
{
if (!isManaged())
return false;
- return managed() && managed()->internalClass()->vtable->isObject;
+ return m && static_cast<Managed::Data *>(m)->internalClass->vtable->isObject;
}
inline bool Value::isPrimitive() const
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index 9c6bd60792..e87a900267 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -329,6 +329,12 @@ struct Q_QML_PRIVATE_EXPORT Value
inline ErrorObject *asErrorObject() const;
template<typename T> inline T *as() const;
+ template<typename T> inline T *cast() {
+ return static_cast<T *>(managed());
+ }
+ template<typename T> inline const T *cast() const {
+ return static_cast<const T *>(managed());
+ }
inline uint asArrayIndex() const;
inline uint asArrayLength(bool *ok) const;