summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/CheckDeclaration.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@nokia.com>2010-02-06 14:32:25 +0100
committerErik Verbruggen <erik.verbruggen@nokia.com>2010-02-07 10:49:03 +0100
commit21488e8898b1aaf5d33b3a33b488e2e280219f06 (patch)
tree03f2bb0c876eaddd1112995f3c3907a2d2bf4f90 /src/shared/cplusplus/CheckDeclaration.cpp
parentac6aba5ec34e2b2f7f83105e9a986e629e00ad14 (diff)
downloadqt-creator-21488e8898b1aaf5d33b3a33b488e2e280219f06.tar.gz
Added semantic checks for Q_ENUMS.
Diffstat (limited to 'src/shared/cplusplus/CheckDeclaration.cpp')
-rw-r--r--src/shared/cplusplus/CheckDeclaration.cpp68
1 files changed, 41 insertions, 27 deletions
diff --git a/src/shared/cplusplus/CheckDeclaration.cpp b/src/shared/cplusplus/CheckDeclaration.cpp
index 7a6e07ce97..b5c402e314 100644
--- a/src/shared/cplusplus/CheckDeclaration.cpp
+++ b/src/shared/cplusplus/CheckDeclaration.cpp
@@ -170,9 +170,7 @@ 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;
-#ifdef ICHECK_BUILD
const bool isQ_INVOKABLE = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_INVOKABLE;
-#endif
List<Declaration *> **decl_it = &ast->symbols;
for (DeclaratorListAST *it = ast->declarator_list; it; it = it->next) {
@@ -199,10 +197,8 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
fun->setMethodKey(Function::SignalMethod);
else if (isQ_SLOT)
fun->setMethodKey(Function::SlotMethod);
-#ifdef ICHECK_BUILD
else if (isQ_INVOKABLE)
- fun->setInvokable(true);
-#endif
+ fun->setMethodKey(Function::InvokableMethod);
fun->setVisibility(semantic()->currentVisibility());
} else if (semantic()->currentMethodKey() != Function::NormalMethod) {
translationUnit()->warning(ast->firstToken(),
@@ -266,28 +262,6 @@ bool CheckDeclaration::visit(AccessDeclarationAST *ast)
return false;
}
-#ifdef ICHECK_BUILD
-bool CheckDeclaration::visit(QPropertyDeclarationAST *)
-{
- return false;
-}
-
-bool CheckDeclaration::visit(QEnumDeclarationAST *)
-{
- return false;
-}
-
-bool CheckDeclaration::visit(QFlagsDeclarationAST *)
-{
- return false;
-}
-
-bool CheckDeclaration::visit(QDeclareFlagsDeclarationAST *)
-{
- return false;
-}
-#endif
-
bool CheckDeclaration::visit(AsmDefinitionAST *)
{
return false;
@@ -827,3 +801,43 @@ bool CheckDeclaration::visit(ObjCPropertyDeclarationAST *ast)
return false;
}
+
+bool CheckDeclaration::visit(QtDeclareFlagsDeclarationAST *ast)
+{
+ if (ast->flags_name)
+ semantic()->check(ast->flags_name, _scope);
+ if (ast->enum_name)
+ semantic()->check(ast->enum_name, _scope);
+ return false;
+}
+
+bool CheckDeclaration::visit(QtEnumDeclarationAST *ast)
+{
+ for (NameListAST *iter = ast->enumerator_list; iter; iter = iter->next)
+ semantic()->check(iter->value, _scope);
+ return false;
+}
+
+bool CheckDeclaration::visit(QtFlagsDeclarationAST *ast)
+{
+ for (NameListAST *iter = ast->flag_enums_list; iter; iter = iter->next)
+ semantic()->check(iter->value, _scope);
+ return false;
+}
+
+bool CheckDeclaration::visit(QtPropertyDeclarationAST *ast)
+{
+ if (ast->type_id)
+ semantic()->check(ast->type_id, _scope);
+ if (ast->property_name)
+ semantic()->check(ast->property_name, _scope);
+ if (ast->read_function)
+ semantic()->check(ast->read_function, _scope);
+ if (ast->write_function)
+ semantic()->check(ast->write_function, _scope);
+ if (ast->reset_function)
+ semantic()->check(ast->reset_function, _scope);
+ if (ast->notify_function)
+ semantic()->check(ast->notify_function, _scope);
+ return false;
+}