diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2011-10-10 10:55:37 +0200 |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2011-10-12 10:55:55 +0200 |
commit | 7ed717ca62ab080231d019d8b3e378ebd852be5d (patch) | |
tree | cda330220fb2e7f3fc6afdd8e9d2be0aa77cbb05 /src/plugins/qmljseditor | |
parent | 572b3a180b30223aa92678ded7b253051a0a5cb0 (diff) | |
download | qt-creator-7ed717ca62ab080231d019d8b3e378ebd852be5d.tar.gz |
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: Thomas Hartmann <Thomas.Hartmann@nokia.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
Diffstat (limited to 'src/plugins/qmljseditor')
-rw-r--r-- | src/plugins/qmljseditor/qmljscompletionassist.cpp | 6 | ||||
-rw-r--r-- | src/plugins/qmljseditor/qmljsfindreferences.cpp | 4 | ||||
-rw-r--r-- | src/plugins/qmljseditor/qmljshoverhandler.cpp | 2 | ||||
-rw-r--r-- | src/plugins/qmljseditor/qmljssemantichighlighter.cpp | 2 | ||||
-rw-r--r-- | src/plugins/qmljseditor/quicktoolbar.cpp | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp index b5b0dd7577..1f448cca36 100644 --- a/src/plugins/qmljseditor/qmljscompletionassist.cpp +++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp @@ -148,7 +148,7 @@ public: virtual void operator ()(const Value *base, const QString &name, const Value *) { - const CppComponentValue *qmlBase = dynamic_cast<const CppComponentValue *>(base); + const CppComponentValue *qmlBase = value_cast<CppComponentValue>(base); QString itemText = name; QString postfix; @@ -547,7 +547,7 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface } const Value *v = newScopeType->lookupMember(it->name.toString(), context); v = context->lookupReference(v); - newScopeType = value_cast<const ObjectValue *>(v); + newScopeType = value_cast<ObjectValue>(v); } if (!newScopeType) break; @@ -642,7 +642,7 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface const Value *value = getPropertyValue(qmlScopeType, contextFinder.bindingPropertyName(), context); if (const QmlEnumValue *enumValue = - dynamic_cast<const QmlEnumValue *>(value)) { + value_cast<QmlEnumValue>(value)) { const QString &name = context->imports(document.data())->nameForImportedObject(enumValue->owner(), context.data()); foreach (const QString &key, enumValue->keys()) { QString completion; diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index b5d7965e25..557fbca3de 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -525,7 +525,7 @@ protected: if ((!_name.isEmpty()) && _name.at(0).isUpper()) { // a possible type _targetValue = _scopeChain->lookup(_name, &_scope); - if (value_cast<const ObjectValue*>(_targetValue)) + if (value_cast<ObjectValue>(_targetValue)) _typeKind = TypeKind; } } @@ -851,7 +851,7 @@ static void find_helper(QFutureInterface<FindReferences::Usage> &future, FindReferences::Usage searchStarting(replacement, name, 0, 0, 0); if (findTarget.typeKind() == findTarget.TypeKind){ - const ObjectValue *typeValue = value_cast<const ObjectValue*>(findTarget.targetValue()); + const ObjectValue *typeValue = value_cast<ObjectValue>(findTarget.targetValue()); if (!typeValue) return; future.reportResult(searchStarting); diff --git a/src/plugins/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp index bc005757dd..d2c5797c7e 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.cpp +++ b/src/plugins/qmljseditor/qmljshoverhandler.cpp @@ -300,7 +300,7 @@ void HoverHandler::prettyPrintTooltip(const QmlJS::Value *value, } } } else if (const QmlEnumValue *enumValue = - dynamic_cast<const QmlEnumValue *>(value)) { + value_cast<QmlEnumValue>(value)) { setToolTip(enumValue->name()); } diff --git a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp index b22db9abca..8bd0b6fa77 100644 --- a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp +++ b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp @@ -138,7 +138,7 @@ protected: PrototypeIterator it(v, m_scopeChain.context()); while (it.hasNext()) { const ObjectValue *proto = it.next(); - const CppComponentValue *qmlProto = dynamic_cast<const CppComponentValue *>(proto); + const CppComponentValue *qmlProto = value_cast<CppComponentValue>(proto); if (!qmlProto) continue; if (qmlProto->metaObject() == m_statePrototype->metaObject()) diff --git a/src/plugins/qmljseditor/quicktoolbar.cpp b/src/plugins/qmljseditor/quicktoolbar.cpp index c83610d2cc..0ed04a5299 100644 --- a/src/plugins/qmljseditor/quicktoolbar.cpp +++ b/src/plugins/qmljseditor/quicktoolbar.cpp @@ -76,7 +76,7 @@ static inline const ObjectValue * getPropertyChangesTarget(Node *node, const Sco && ! scriptBinding->qualifiedId->next) { Evaluate evaluator(&scopeChain); const Value *targetValue = evaluator(scriptBinding->statement); - if (const ObjectValue *targetObject = value_cast<const ObjectValue *>(targetValue)) { + if (const ObjectValue *targetObject = value_cast<ObjectValue>(targetValue)) { return targetObject; } else { return 0; |