QmlJS: Convert more dynamic_casts to value_casts.

And introduce a good error message for the case when someone
forgets the specialization of the value_cast template.

Change-Id: Iec55a839e8f5eef5872b1dab8601f66e0e0c88de
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
Christian Kamm
2011-10-12 11:37:58 +02:00
parent 0e8657107c
commit 9abf0e6a9a
3 changed files with 28 additions and 3 deletions

View File

@@ -84,11 +84,11 @@ void ScopeBuilder::push(AST::Node *node)
break;
}
// signals defined in QML
if (const ASTSignal *astsig = dynamic_cast<const ASTSignal *>(value)) {
if (const ASTSignal *astsig = value_cast<ASTSignal>(value)) {
_scopeChain->appendJsScope(astsig->bodyScope());
}
// signals defined in C++
else if (const CppComponentValue *qmlObject = dynamic_cast<const CppComponentValue *>(owner)) {
else if (const CppComponentValue *qmlObject = value_cast<CppComponentValue>(owner)) {
if (const ObjectValue *scope = qmlObject->signalScope(name)) {
_scopeChain->appendJsScope(scope);
}