diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2009-03-25 11:50:17 +0100 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2009-03-25 11:50:17 +0100 |
commit | 424dd77e18468a0516f1dbce10bcd3c25f979cf5 (patch) | |
tree | 14727ba29f39dfb03e34404264980088498179db /src/shared/cplusplus/CheckDeclaration.cpp | |
parent | 014efbdab0cce09f9c5c4b084cbb801f43d9ef7f (diff) | |
download | qt-creator-424dd77e18468a0516f1dbce10bcd3c25f979cf5.tar.gz |
Added support for Q_SIGNAL and Q_SLOT.
Diffstat (limited to 'src/shared/cplusplus/CheckDeclaration.cpp')
-rw-r--r-- | src/shared/cplusplus/CheckDeclaration.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/shared/cplusplus/CheckDeclaration.cpp b/src/shared/cplusplus/CheckDeclaration.cpp index 06b85f8c5b..c6de2cf4aa 100644 --- a/src/shared/cplusplus/CheckDeclaration.cpp +++ b/src/shared/cplusplus/CheckDeclaration.cpp @@ -154,6 +154,9 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast) } } + const bool isQ_SLOT = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SLOT; + const bool isQ_SIGNAL = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SIGNAL; + List<Declaration *> **decl_it = &ast->symbols; for (DeclaratorListAST *it = ast->declarators; it; it = it->next) { Name *name = 0; @@ -172,6 +175,10 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast) fun->setScope(_scope); fun->setName(name); fun->setMethodKey(semantic()->currentMethodKey()); + if (isQ_SIGNAL) + fun->setMethodKey(Function::SignalMethod); + else if (isQ_SLOT) + fun->setMethodKey(Function::SlotMethod); fun->setVisibility(semantic()->currentVisibility()); } else if (semantic()->currentMethodKey() != Function::NormalMethod) { translationUnit()->warning(ast->firstToken(), @@ -259,6 +266,14 @@ bool CheckDeclaration::visit(FunctionDefinitionAST *ast) fun->setVisibility(semantic()->currentVisibility()); fun->setMethodKey(semantic()->currentMethodKey()); + const bool isQ_SLOT = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SLOT; + const bool isQ_SIGNAL = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SIGNAL; + + if (isQ_SIGNAL) + fun->setMethodKey(Function::SignalMethod); + else if (isQ_SLOT) + fun->setMethodKey(Function::SlotMethod); + checkFunctionArguments(fun); ast->symbol = fun; |