Commit 7ed717ca authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS: Add more value_casts.

And switch all existing dynamic_casts to value_casts.

Change-Id: I93b89358e4802080f40b332074c64f4e91a2bc4c
Reviewed-on: http://codereview.qt-project.org/6311


Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@nokia.com>
parent 572b3a18
......@@ -81,7 +81,7 @@ public:
virtual void visit(const NumberValue *value)
{
if (const QmlEnumValue *enumValue = dynamic_cast<const QmlEnumValue *>(value)) {
if (const QmlEnumValue *enumValue = value_cast<QmlEnumValue>(value)) {
if (StringLiteral *stringLiteral = cast<StringLiteral *>(_ast)) {
const QString valueName = stringLiteral->value.toString();
......@@ -643,7 +643,7 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId,
const ObjectValue *lastPrototype = prototypes.last();
if (iter.error() == PrototypeIterator::ReferenceResolutionError) {
if (const QmlPrototypeReference *ref =
dynamic_cast<const QmlPrototypeReference *>(lastPrototype->prototype())) {
value_cast<QmlPrototypeReference>(lastPrototype->prototype())) {
addMessage(ErrCouldNotResolvePrototypeOf, typeErrorLocation,
toString(ref->qmlTypeName()), lastPrototype->className());
} else {
......@@ -778,7 +778,7 @@ bool Check::visit(IdentifierExpression *)
// _lastValue = evaluator.reference(ast);
// if (!_lastValue)
// addMessage(ErrUnknownIdentifier, ast->identifierToken);
// if (const Reference *ref = value_cast<const Reference *>(_lastValue)) {
// if (const Reference *ref = value_cast<Reference>(_lastValue)) {
// _lastValue = _context->lookupReference(ref);
// if (!_lastValue)
// error(ast->identifierToken, tr("could not resolve"));
......@@ -1293,7 +1293,7 @@ const Value *Check::checkScopeObjectMember(const UiQualifiedId *id)
// member lookup
const UiQualifiedId *idPart = id;
while (idPart->next) {
const ObjectValue *objectValue = value_cast<const ObjectValue *>(value);
const ObjectValue *objectValue = value_cast<ObjectValue>(value);
if (! objectValue) {
addMessage(ErrDoesNotHaveMembers, idPart->identifierToken, propertyName);
return 0;
......
......@@ -134,11 +134,11 @@ QString Context::defaultPropertyName(const ObjectValue *object) const
PrototypeIterator iter(object, this);
while (iter.hasNext()) {
const ObjectValue *o = iter.next();
if (const ASTObjectValue *astObjValue = dynamic_cast<const ASTObjectValue *>(o)) {
if (const ASTObjectValue *astObjValue = value_cast<ASTObjectValue>(o)) {
QString defaultProperty = astObjValue->defaultPropertyName();
if (!defaultProperty.isEmpty())
return defaultProperty;
} else if (const CppComponentValue *qmlValue = dynamic_cast<const CppComponentValue *>(o)) {
} else if (const CppComponentValue *qmlValue = value_cast<CppComponentValue>(o)) {
return qmlValue->defaultPropertyName();
}
}
......@@ -151,7 +151,7 @@ ReferenceContext::ReferenceContext(const ContextPtr &context)
const Value *ReferenceContext::lookupReference(const Value *value)
{
const Reference *reference = value_cast<const Reference *>(value);
const Reference *reference = value_cast<Reference>(value);
if (!reference)
return value;
......
......@@ -62,7 +62,7 @@ const Value *Evaluate::value(AST::Node *ast)
{
const Value *result = reference(ast);
if (const Reference *ref = value_cast<const Reference *>(result)) {
if (const Reference *ref = value_cast<Reference>(result)) {
if (_referenceContext)
result = _referenceContext->lookupReference(ref);
else
......@@ -176,7 +176,7 @@ bool Evaluate::visit(AST::UiQualifiedId *ast)
_result = value;
} else {
const ObjectValue *base = value_cast<const ObjectValue *>(value);
const ObjectValue *base = value_cast<ObjectValue>(value);
for (AST::UiQualifiedId *it = ast->next; base && it; it = it->next) {
const QString &name = it->name.toString();
......@@ -187,7 +187,7 @@ bool Evaluate::visit(AST::UiQualifiedId *ast)
if (! it->next)
_result = value;
else
base = value_cast<const ObjectValue *>(value);
base = value_cast<ObjectValue>(value);
}
}
......@@ -328,7 +328,7 @@ bool Evaluate::visit(AST::FieldMemberExpression *ast)
bool Evaluate::visit(AST::NewMemberExpression *ast)
{
if (const FunctionValue *ctor = value_cast<const FunctionValue *>(value(ast->base))) {
if (const FunctionValue *ctor = value_cast<FunctionValue>(value(ast->base))) {
_result = ctor->construct();
}
return false;
......@@ -336,7 +336,7 @@ bool Evaluate::visit(AST::NewMemberExpression *ast)
bool Evaluate::visit(AST::NewExpression *ast)
{
if (const FunctionValue *ctor = value_cast<const FunctionValue *>(value(ast->expression))) {
if (const FunctionValue *ctor = value_cast<FunctionValue>(value(ast->expression))) {
_result = ctor->construct();
}
return false;
......
......@@ -193,6 +193,11 @@ static QString generatedSlotName(const QString &base)
return slotName;
}
const CppComponentValue *CppComponentValue::asCppComponentValue() const
{
return this;
}
void CppComponentValue::processMembers(MemberProcessor *processor) const
{
// process the meta enums
......@@ -337,7 +342,7 @@ const Value *CppComponentValue::valueForCppName(const QString &typeName) const
const CppComponentValue *CppComponentValue::prototype() const
{
Q_ASSERT(!_prototype || dynamic_cast<const CppComponentValue *>(_prototype));
Q_ASSERT(!_prototype || value_cast<CppComponentValue>(_prototype));
return static_cast<const CppComponentValue *>(_prototype);
}
......@@ -522,6 +527,11 @@ QmlEnumValue::~QmlEnumValue()
{
}
const QmlEnumValue *QmlEnumValue::asQmlEnumValue() const
{
return this;
}
QString QmlEnumValue::name() const
{
return _owner->metaObject()->enumerator(_enumIndex).name();
......@@ -669,6 +679,31 @@ const AnchorLineValue *Value::asAnchorLineValue() const
return 0;
}
const CppComponentValue *Value::asCppComponentValue() const
{
return 0;
}
const ASTObjectValue *Value::asAstObjectValue() const
{
return 0;
}
const QmlEnumValue *Value::asQmlEnumValue() const
{
return 0;
}
const QmlPrototypeReference *Value::asQmlPrototypeReference() const
{
return 0;
}
const ASTPropertyReference *Value::asAstPropertyReference() const
{
return 0;
}
////////////////////////////////////////////////////////////////////////////////
// Values
////////////////////////////////////////////////////////////////////////////////
......@@ -853,10 +888,10 @@ const Value *ObjectValue::prototype() const
const ObjectValue *ObjectValue::prototype(const Context *context) const
{
const ObjectValue *prototypeObject = value_cast<const ObjectValue *>(_prototype);
const ObjectValue *prototypeObject = value_cast<ObjectValue>(_prototype);
if (! prototypeObject) {
if (const Reference *prototypeReference = value_cast<const Reference *>(_prototype)) {
prototypeObject = value_cast<const ObjectValue *>(context->lookupReference(prototypeReference));
if (const Reference *prototypeReference = value_cast<Reference>(_prototype)) {
prototypeObject = value_cast<ObjectValue>(context->lookupReference(prototypeReference));
}
}
return prototypeObject;
......@@ -981,9 +1016,9 @@ bool PrototypeIterator::hasNext()
if (!proto)
return false;
m_next = value_cast<const ObjectValue *>(proto);
m_next = value_cast<ObjectValue>(proto);
if (! m_next)
m_next = value_cast<const ObjectValue *>(m_context->lookupReference(proto));
m_next = value_cast<ObjectValue>(m_context->lookupReference(proto));
if (!m_next) {
m_error = ReferenceResolutionError;
return false;
......@@ -1480,15 +1515,15 @@ void ConvertToNumber::visit(const StringValue *)
void ConvertToNumber::visit(const ObjectValue *object)
{
if (const FunctionValue *valueOfMember = value_cast<const FunctionValue *>(object->lookupMember("valueOf", ContextPtr()))) {
_result = value_cast<const NumberValue *>(valueOfMember->call(object)); // ### invoke convert-to-number?
if (const FunctionValue *valueOfMember = value_cast<FunctionValue>(object->lookupMember("valueOf", ContextPtr()))) {
_result = value_cast<NumberValue>(valueOfMember->call(object)); // ### invoke convert-to-number?
}
}
void ConvertToNumber::visit(const FunctionValue *object)
{
if (const FunctionValue *valueOfMember = value_cast<const FunctionValue *>(object->lookupMember("valueOf", ContextPtr()))) {
_result = value_cast<const NumberValue *>(valueOfMember->call(object)); // ### invoke convert-to-number?
if (const FunctionValue *valueOfMember = value_cast<FunctionValue>(object->lookupMember("valueOf", ContextPtr()))) {
_result = value_cast<NumberValue>(valueOfMember->call(object)); // ### invoke convert-to-number?
}
}
......@@ -1541,15 +1576,15 @@ void ConvertToString::visit(const StringValue *value)
void ConvertToString::visit(const ObjectValue *object)
{
if (const FunctionValue *toStringMember = value_cast<const FunctionValue *>(object->lookupMember("toString", ContextPtr()))) {
_result = value_cast<const StringValue *>(toStringMember->call(object)); // ### invoke convert-to-string?
if (const FunctionValue *toStringMember = value_cast<FunctionValue>(object->lookupMember("toString", ContextPtr()))) {
_result = value_cast<StringValue>(toStringMember->call(object)); // ### invoke convert-to-string?
}
}
void ConvertToString::visit(const FunctionValue *object)
{
if (const FunctionValue *toStringMember = value_cast<const FunctionValue *>(object->lookupMember("toString", ContextPtr()))) {
_result = value_cast<const StringValue *>(toStringMember->call(object)); // ### invoke convert-to-string?
if (const FunctionValue *toStringMember = value_cast<FunctionValue>(object->lookupMember("toString", ContextPtr()))) {
_result = value_cast<StringValue>(toStringMember->call(object)); // ### invoke convert-to-string?
}
}
......@@ -1705,6 +1740,11 @@ ASTObjectValue::~ASTObjectValue()
{
}
const ASTObjectValue *ASTObjectValue::asAstObjectValue() const
{
return this;
}
bool ASTObjectValue::getSourceLocation(QString *fileName, int *line, int *column) const
{
*fileName = _doc->fileName();
......@@ -1856,6 +1896,11 @@ QmlPrototypeReference::~QmlPrototypeReference()
{
}
const QmlPrototypeReference *QmlPrototypeReference::asQmlPrototypeReference() const
{
return this;
}
UiQualifiedId *QmlPrototypeReference::qmlTypeName() const
{
return _qmlTypeName;
......@@ -1878,6 +1923,11 @@ ASTPropertyReference::~ASTPropertyReference()
{
}
const ASTPropertyReference *ASTPropertyReference::asAstPropertyReference() const
{
return this;
}
bool ASTPropertyReference::getSourceLocation(QString *fileName, int *line, int *column) const
{
*fileName = _doc->fileName();
......
......@@ -75,6 +75,11 @@ class JSImportScope;
class Context;
typedef QSharedPointer<const Context> ContextPtr;
class ReferenceContext;
class CppComponentValue;
class ASTObjectValue;
class QmlEnumValue;
class QmlPrototypeReference;
class ASTPropertyReference;
typedef QList<const Value *> ValueList;
......@@ -124,13 +129,18 @@ public:
virtual const Reference *asReference() const;
virtual const ColorValue *asColorValue() const;
virtual const AnchorLineValue *asAnchorLineValue() const;
virtual const CppComponentValue *asCppComponentValue() const;
virtual const ASTObjectValue *asAstObjectValue() const;
virtual const QmlEnumValue *asQmlEnumValue() const;
virtual const QmlPrototypeReference *asQmlPrototypeReference() const;
virtual const ASTPropertyReference *asAstPropertyReference() const;
virtual void accept(ValueVisitor *) const = 0;
virtual bool getSourceLocation(QString *fileName, int *line, int *column) const;
};
template <typename _RetTy> _RetTy value_cast(const Value *v);
template <typename _RetTy> const _RetTy *value_cast(const Value *v);
template <> Q_INLINE_TEMPLATE const NullValue *value_cast(const Value *v)
{
......@@ -210,6 +220,36 @@ template <> Q_INLINE_TEMPLATE const AnchorLineValue *value_cast(const Value *v)
else return 0;
}
template <> Q_INLINE_TEMPLATE const CppComponentValue *value_cast(const Value *v)
{
if (v) return v->asCppComponentValue();
else return 0;
}
template <> Q_INLINE_TEMPLATE const ASTObjectValue *value_cast(const Value *v)
{
if (v) return v->asAstObjectValue();
else return 0;
}
template <> Q_INLINE_TEMPLATE const QmlEnumValue *value_cast(const Value *v)
{
if (v) return v->asQmlEnumValue();
else return 0;
}
template <> Q_INLINE_TEMPLATE const QmlPrototypeReference *value_cast(const Value *v)
{
if (v) return v->asQmlPrototypeReference();
else return 0;
}
template <> Q_INLINE_TEMPLATE const ASTPropertyReference *value_cast(const Value *v)
{
if (v) return v->asAstPropertyReference();
else return 0;
}
////////////////////////////////////////////////////////////////////////////////
// Value nodes
////////////////////////////////////////////////////////////////////////////////
......@@ -394,14 +434,14 @@ private:
Error m_error;
};
class CppComponentValue;
class QMLJS_EXPORT QmlEnumValue: public NumberValue
{
public:
QmlEnumValue(const CppComponentValue *owner, int index);
virtual ~QmlEnumValue();
virtual const QmlEnumValue *asQmlEnumValue() const;
QString name() const;
QStringList keys() const;
const CppComponentValue *owner() const;
......@@ -423,6 +463,8 @@ public:
ValueOwner *valueOwner);
virtual ~CppComponentValue();
virtual const CppComponentValue *asCppComponentValue() const;
virtual void processMembers(MemberProcessor *processor) const;
const Value *valueForCppName(const QString &typeName) const;
......@@ -701,6 +743,8 @@ public:
QmlPrototypeReference(AST::UiQualifiedId *qmlTypeName, const Document *doc, ValueOwner *valueOwner);
virtual ~QmlPrototypeReference();
virtual const QmlPrototypeReference *asQmlPrototypeReference() const;
AST::UiQualifiedId *qmlTypeName() const;
private:
......@@ -755,6 +799,8 @@ public:
ASTPropertyReference(AST::UiPublicMember *ast, const Document *doc, ValueOwner *valueOwner);
virtual ~ASTPropertyReference();
virtual const ASTPropertyReference *asAstPropertyReference() const;
AST::UiPublicMember *ast() const { return _ast; }
QString onChangedSlotName() const { return _onChangedSlotName; }
......@@ -804,6 +850,8 @@ public:
ValueOwner *valueOwner);
virtual ~ASTObjectValue();
virtual const ASTObjectValue *asAstObjectValue() const;
bool getSourceLocation(QString *fileName, int *line, int *column) const;
virtual void processMembers(MemberProcessor *processor) const;
......
......@@ -185,7 +185,7 @@ void ScopeBuilder::setQmlScopeObject(Node *node)
iter.next();
while (iter.hasNext()) {
const ObjectValue *prototype = iter.next();
if (const CppComponentValue *qmlMetaObject = dynamic_cast<const CppComponentValue *>(prototype)) {
if (const CppComponentValue *qmlMetaObject = value_cast<CppComponentValue>(prototype)) {
if ((qmlMetaObject->className() == QLatin1String("ListElement")
|| qmlMetaObject->className() == QLatin1String("Connections")
) && (qmlMetaObject->moduleName() == QLatin1String("Qt")
......@@ -211,7 +211,7 @@ void ScopeBuilder::setQmlScopeObject(Node *node)
Evaluate evaluator(_scopeChain);
const Value *targetValue = evaluator(scriptBinding->statement);
if (const ObjectValue *target = value_cast<const ObjectValue *>(targetValue)) {
if (const ObjectValue *target = value_cast<ObjectValue>(targetValue)) {
qmlScopeObjects.prepend(target);
} else {
qmlScopeObjects.clear();
......@@ -259,7 +259,7 @@ const ObjectValue *ScopeBuilder::isPropertyChangesObject(const ContextPtr &conte
PrototypeIterator iter(object, context);
while (iter.hasNext()) {
const ObjectValue *prototype = iter.next();
if (const CppComponentValue *qmlMetaObject = dynamic_cast<const CppComponentValue *>(prototype)) {
if (const CppComponentValue *qmlMetaObject = value_cast<CppComponentValue>(prototype)) {
if (qmlMetaObject->className() == QLatin1String("PropertyChanges")
&& (qmlMetaObject->moduleName() == QLatin1String("Qt")
|| qmlMetaObject->moduleName() == QLatin1String("QtQuick")))
......
......@@ -96,14 +96,14 @@ class PropertyMemberProcessor : public MemberProcessor
public:
virtual bool processProperty(const QString &name, const Value *value)
{
const ASTPropertyReference *ref = dynamic_cast<const ASTPropertyReference*>(value);
const ASTPropertyReference *ref = value_cast<ASTPropertyReference>(value);
if (ref) {
QString type = "unknown";
if (!ref->ast()->memberType.isEmpty())
type = ref->ast()->memberType.toString();
m_properties.append(qMakePair(name, type));
} else {
if (const CppComponentValue * ov = dynamic_cast<const CppComponentValue *>(value)) {
if (const CppComponentValue * ov = value_cast<CppComponentValue>(value)) {
QString qualifiedTypeName = ov->moduleName().isEmpty() ? ov->className() : ov->moduleName() + '.' + ov->className();
m_properties.append(qMakePair(name, qualifiedTypeName));
} else {
......@@ -140,7 +140,7 @@ const CppComponentValue *findQmlPrototype(const ObjectValue *ov, const ContextPt
if (!ov)
return 0;
const CppComponentValue * qmlValue = dynamic_cast<const CppComponentValue *>(ov);
const CppComponentValue * qmlValue = value_cast<CppComponentValue>(ov);
if (qmlValue)
return qmlValue;
......@@ -154,7 +154,7 @@ QStringList prototypes(const ObjectValue *ov, const ContextPtr &context, bool ve
return list;
ov = ov->prototype(context);
while (ov) {
const CppComponentValue * qmlValue = dynamic_cast<const CppComponentValue *>(ov);
const CppComponentValue * qmlValue = value_cast<CppComponentValue>(ov);
if (qmlValue) {
if (versions) {
list << qmlValue->moduleName() + '.' + qmlValue->className() +
......@@ -192,7 +192,7 @@ QList<PropertyInfo> getQmlTypes(const CppComponentValue *ov, const ContextPtr &c
QString name = property.first;
if (!ov->isWritable(name) && ov->isPointer(name)) {
//dot property
const CppComponentValue * qmlValue = dynamic_cast<const CppComponentValue *>(ov->lookupMember(name, context));
const CppComponentValue * qmlValue = value_cast<CppComponentValue>(ov->lookupMember(name, context));
if (qmlValue) {
QList<PropertyInfo> dotProperties = getQmlTypes(qmlValue, context);
foreach (const PropertyInfo &propertyInfo, dotProperties) {
......@@ -204,7 +204,7 @@ QList<PropertyInfo> getQmlTypes(const CppComponentValue *ov, const ContextPtr &c
}
}
if (isValueType(ov->propertyType(name))) {
const ObjectValue *dotObjectValue = dynamic_cast<const ObjectValue *>(ov->lookupMember(name, context));
const ObjectValue *dotObjectValue = value_cast<ObjectValue>(ov->lookupMember(name, context));
if (dotObjectValue) {
QList<PropertyInfo> dotProperties = getObjectTypes(dotObjectValue, context);
foreach (const PropertyInfo &propertyInfo, dotProperties) {
......@@ -224,7 +224,7 @@ QList<PropertyInfo> getQmlTypes(const CppComponentValue *ov, const ContextPtr &c
if (!local) {
const ObjectValue* prototype = ov->prototype(context);
const CppComponentValue * qmlObjectValue = dynamic_cast<const CppComponentValue *>(prototype);
const CppComponentValue * qmlObjectValue = value_cast<CppComponentValue>(prototype);
if (qmlObjectValue) {
list << getQmlTypes(qmlObjectValue, context);
......@@ -240,7 +240,7 @@ QList<PropertyInfo> getTypes(const ObjectValue *ov, const ContextPtr &context, b
{
QList<PropertyInfo> list;
const CppComponentValue * qmlObjectValue = dynamic_cast<const CppComponentValue *>(ov);
const CppComponentValue * qmlObjectValue = value_cast<CppComponentValue>(ov);
if (qmlObjectValue) {
list << getQmlTypes(qmlObjectValue, context, local);
......@@ -264,7 +264,7 @@ QList<PropertyInfo> getObjectTypes(const ObjectValue *ov, const ContextPtr &cont
if (!local) {
const ObjectValue* prototype = ov->prototype(context);
const CppComponentValue * qmlObjectValue = dynamic_cast<const CppComponentValue *>(prototype);
const CppComponentValue * qmlObjectValue = value_cast<CppComponentValue>(prototype);
if (qmlObjectValue) {
list << getQmlTypes(qmlObjectValue, context);
......@@ -434,7 +434,7 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, QString type, int maj, in
} else {
const ObjectValue *objectValue = getObjectValue();
if (objectValue) {
const CppComponentValue *qmlValue = dynamic_cast<const CppComponentValue *>(objectValue);
const CppComponentValue *qmlValue = value_cast<CppComponentValue>(objectValue);
if (qmlValue) {
m_majorVersion = qmlValue->componentVersion().majorVersion();
m_minorVersion = qmlValue->componentVersion().minorVersion();
......@@ -476,7 +476,7 @@ const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() cons
if (import.info.path() != module)
continue;
const Value *lookupResult = import.object->lookupMember(type, context());
if ((value = dynamic_cast<const CppComponentValue *>(lookupResult)))
if ((value = value_cast<CppComponentValue>(lookupResult)))
return value;
}
......@@ -759,7 +759,7 @@ QString NodeMetaInfoPrivate::packageName() const
QString NodeMetaInfoPrivate::componentSource() const
{
if (isComponent()) {
const ASTObjectValue * astObjectValue = dynamic_cast<const ASTObjectValue *>(getObjectValue());
const ASTObjectValue * astObjectValue = value_cast<ASTObjectValue>(getObjectValue());
if (astObjectValue)
return astObjectValue->document()->source().mid(astObjectValue->typeName()->identifierToken.begin(),
astObjectValue->initializer()->rbraceToken.end());
......@@ -770,7 +770,7 @@ QString NodeMetaInfoPrivate::componentSource() const
QString NodeMetaInfoPrivate::componentFileName() const
{
if (isComponent()) {
const ASTObjectValue * astObjectValue = dynamic_cast<const ASTObjectValue *>(getObjectValue());
const ASTObjectValue * astObjectValue = value_cast<ASTObjectValue>(getObjectValue());
if (astObjectValue) {
QString fileName;
int line;
......@@ -831,7 +831,7 @@ void NodeMetaInfoPrivate::setupPrototypes()
description.className = ov->className();
description.minorVersion = -1;
description.majorVersion = -1;
if (const CppComponentValue * qmlValue = dynamic_cast<const CppComponentValue *>(ov)) {
if (const CppComponentValue * qmlValue = value_cast<CppComponentValue>(ov)) {
description.minorVersion = qmlValue->componentVersion().minorVersion();
description.majorVersion = qmlValue->componentVersion().majorVersion();
if (!qmlValue->moduleName().isEmpty())
......
......@@ -344,7 +344,7 @@ public:
const ObjectValue *value = m_context->lookupType(m_doc.data(), astTypeNode);
defaultPropertyName = m_context->defaultPropertyName(value);
const CppComponentValue * qmlValue = dynamic_cast<const CppComponentValue *>(value);
const CppComponentValue * qmlValue = value_cast<CppComponentValue>(value);
if (qmlValue) {
typeName = fixUpPackeNameForQt(qmlValue->moduleName()) + QLatin1String(".") + qmlValue->className();
......@@ -452,7 +452,7 @@ public:
if (prefix.isEmpty())
idPart = idPart->next;
for (; idPart; idPart = idPart->next) {
objectValue = value_cast<const ObjectValue *>(value);
objectValue = value_cast<ObjectValue>(value);
if (! objectValue) {
// if (idPart->name)
// qDebug() << idPart->name->asString() << "has no property named"
......@@ -500,7 +500,7 @@ public:
const ObjectValue *proto = iter.next();
if (proto->lookupMember(name, m_context) == m_context->valueOwner()->arrayPrototype())
return true;
if (const CppComponentValue *qmlIter = dynamic_cast<const CppComponentValue *>(proto)) {
if (const CppComponentValue *qmlIter = value_cast<CppComponentValue>(proto)) {
if (qmlIter->isListProperty(name))
return true;
}
......@@ -525,7 +525,7 @@ public:
if (containingObject)
containingObject->lookupMember(name, m_context, &containingObject);
if (const CppComponentValue * qmlObject = dynamic_cast<const CppComponentValue *>(containingObject)) {
if (const CppComponentValue * qmlObject = value_cast<CppComponentValue>(containingObject)) {
const QString typeName = qmlObject->propertyType(name);
if (qmlObject->getEnum(typeName).isValid()) {
return QVariant(cleanedValue);
......@@ -569,7 +569,7 @@ public:
if (containingObject)
containingObject->lookupMember(name, m_context, &containingObject);
const CppComponentValue * lhsCppComponent = dynamic_cast<const CppComponentValue *>(containingObject);
const CppComponentValue * lhsCppComponent = value_cast<CppComponentValue>(containingObject);
if (!lhsCppComponent)
return QVariant();
const QString lhsPropertyTypeName = lhsCppComponent->propertyType(name);
......@@ -593,7 +593,7 @@ public:
if (rhsValueObject)
rhsValueObject->lookupMember(rhsValueName, m_context, &rhsValueObject);
const CppComponentValue *rhsCppComponentValue = dynamic_cast<const CppComponentValue *>(rhsValueObject);
const CppComponentValue *rhsCppComponentValue = value_cast<CppComponentValue>(rhsValueObject);
if (!rhsCppComponentValue)
return QVariant();
......