summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@nokia.com>2010-02-08 09:34:51 +0100
committerErik Verbruggen <erik.verbruggen@nokia.com>2010-02-08 09:34:51 +0100
commitb58cb740e5e08f7a11a7b176a97351bf49b0d52a (patch)
treef6a7ffbed6dc2296b96bf229ffd054f5fce07771 /src/shared/cplusplus
parent4a652f6eca84fc641afb922f99581a6a15802a69 (diff)
downloadqt-creator-b58cb740e5e08f7a11a7b176a97351bf49b0d52a.tar.gz
Changed ObjC message arguments to have SimpleName for the name part.
Diffstat (limited to 'src/shared/cplusplus')
-rw-r--r--src/shared/cplusplus/AST.cpp6
-rw-r--r--src/shared/cplusplus/AST.h4
-rw-r--r--src/shared/cplusplus/ASTClone.cpp3
-rw-r--r--src/shared/cplusplus/ASTMatcher.cpp5
-rw-r--r--src/shared/cplusplus/ASTVisit.cpp1
-rw-r--r--src/shared/cplusplus/CheckDeclaration.cpp24
-rw-r--r--src/shared/cplusplus/CheckDeclarator.cpp2
-rw-r--r--src/shared/cplusplus/CheckName.cpp9
-rw-r--r--src/shared/cplusplus/Parser.cpp3
9 files changed, 31 insertions, 26 deletions
diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp
index 348f9cddd7..4504d9eadc 100644
--- a/src/shared/cplusplus/AST.cpp
+++ b/src/shared/cplusplus/AST.cpp
@@ -2250,13 +2250,13 @@ unsigned ObjCMessageArgumentDeclarationAST::firstToken() const
if (type_name)
return type_name->firstToken();
else
- return param_name_token;
+ return param_name->firstToken();
}
unsigned ObjCMessageArgumentDeclarationAST::lastToken() const
{
- if (param_name_token)
- return param_name_token + 1;
+ if (param_name)
+ return param_name->lastToken();
else if (type_name)
return type_name->lastToken();
diff --git a/src/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h
index eef6ec7528..11bcaf0f1c 100644
--- a/src/shared/cplusplus/AST.h
+++ b/src/shared/cplusplus/AST.h
@@ -2996,12 +2996,12 @@ protected:
virtual bool match0(AST *, ASTMatcher *);
};
-class CPLUSPLUS_EXPORT ObjCMessageArgumentDeclarationAST: public NameAST
+class CPLUSPLUS_EXPORT ObjCMessageArgumentDeclarationAST: public AST
{
public:
ObjCTypeNameAST* type_name;
SpecifierListAST *attribute_list;
- unsigned param_name_token;
+ SimpleNameAST *param_name;
public: // annotations
Argument *argument;
diff --git a/src/shared/cplusplus/ASTClone.cpp b/src/shared/cplusplus/ASTClone.cpp
index 183cce037a..805e7837b7 100644
--- a/src/shared/cplusplus/ASTClone.cpp
+++ b/src/shared/cplusplus/ASTClone.cpp
@@ -1466,7 +1466,8 @@ ObjCMessageArgumentDeclarationAST *ObjCMessageArgumentDeclarationAST::clone(Memo
for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list;
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
*ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0);
- ast->param_name_token = param_name_token;
+ if (param_name)
+ ast->param_name = param_name->clone(pool);
return ast;
}
diff --git a/src/shared/cplusplus/ASTMatcher.cpp b/src/shared/cplusplus/ASTMatcher.cpp
index 6992a1d1cc..7f86349551 100644
--- a/src/shared/cplusplus/ASTMatcher.cpp
+++ b/src/shared/cplusplus/ASTMatcher.cpp
@@ -2459,7 +2459,10 @@ bool ASTMatcher::match(ObjCMessageArgumentDeclarationAST *node, ObjCMessageArgum
else if (! AST::match(node->attribute_list, pattern->attribute_list, this))
return false;
- pattern->param_name_token = node->param_name_token;
+ if (! pattern->param_name)
+ pattern->param_name = node->param_name;
+ else if (! AST::match(node->param_name, pattern->param_name, this))
+ return false;
return true;
}
diff --git a/src/shared/cplusplus/ASTVisit.cpp b/src/shared/cplusplus/ASTVisit.cpp
index 22d9bd20de..1b9f50df58 100644
--- a/src/shared/cplusplus/ASTVisit.cpp
+++ b/src/shared/cplusplus/ASTVisit.cpp
@@ -1087,6 +1087,7 @@ void ObjCMessageArgumentDeclarationAST::accept0(ASTVisitor *visitor)
if (visitor->visit(this)) {
accept(type_name, visitor);
accept(attribute_list, visitor);
+ accept(param_name, visitor);
}
visitor->endVisit(this);
}
diff --git a/src/shared/cplusplus/CheckDeclaration.cpp b/src/shared/cplusplus/CheckDeclaration.cpp
index faeac37e10..7ad7662af3 100644
--- a/src/shared/cplusplus/CheckDeclaration.cpp
+++ b/src/shared/cplusplus/CheckDeclaration.cpp
@@ -319,18 +319,14 @@ bool CheckDeclaration::visit(FunctionDefinitionAST *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->invoke_token > 0);
-#endif
+ const bool isQ_INVOKABLE = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_INVOKABLE;
if (isQ_SIGNAL)
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);
checkFunctionArguments(fun);
@@ -672,10 +668,14 @@ bool CheckDeclaration::visit(ObjCClassDeclarationAST *ast)
bool CheckDeclaration::visit(ObjCMethodDeclarationAST *ast)
{
- if (!ast->method_prototype)
+ ObjCMethodPrototypeAST *methodProto = ast->method_prototype;
+ if (!methodProto)
+ return false;
+ ObjCSelectorAST *selector = methodProto->selector;
+ if (!selector)
return false;
- FullySpecifiedType ty = semantic()->check(ast->method_prototype, _scope);
+ FullySpecifiedType ty = semantic()->check(methodProto, _scope);
ObjCMethod *methodTy = ty.type()->asObjCMethodType();
if (!methodTy)
return false;
@@ -688,15 +688,15 @@ bool CheckDeclaration::visit(ObjCMethodDeclarationAST *ast)
symbol = methodTy;
} else {
- Declaration *decl = control()->newDeclaration(ast->firstToken(), methodTy->name());
+ Declaration *decl = control()->newDeclaration(selector->firstToken(), methodTy->name());
decl->setType(methodTy);
symbol = decl;
symbol->setStorage(methodTy->storage());
}
- symbol->setStartOffset(tokenAt(ast->firstToken()).offset);
- symbol->setEndOffset(tokenAt(ast->lastToken()).offset);
- symbol->setVisibility(semantic()->currentVisibility());
+ symbol->setStartOffset(tokenAt(selector->firstToken()).offset);
+ symbol->setEndOffset(tokenAt(selector->lastToken()).offset);
+ symbol->setVisibility(semantic()->currentObjCVisibility());
_scope->enterSymbol(symbol);
diff --git a/src/shared/cplusplus/CheckDeclarator.cpp b/src/shared/cplusplus/CheckDeclarator.cpp
index afee09023b..b168061393 100644
--- a/src/shared/cplusplus/CheckDeclarator.cpp
+++ b/src/shared/cplusplus/CheckDeclarator.cpp
@@ -259,7 +259,7 @@ bool CheckDeclarator::visit(ObjCMethodPrototypeAST *ast)
FullySpecifiedType returnType = semantic()->check(ast->type_name, _scope);
- unsigned location = ast->firstToken();
+ unsigned location = ast->selector->firstToken();
semantic()->check(ast->selector, _scope);
diff --git a/src/shared/cplusplus/CheckName.cpp b/src/shared/cplusplus/CheckName.cpp
index 26fa9c21ee..98b5adea25 100644
--- a/src/shared/cplusplus/CheckName.cpp
+++ b/src/shared/cplusplus/CheckName.cpp
@@ -418,12 +418,11 @@ bool CheckName::visit(ObjCMessageArgumentDeclarationAST *ast)
if (ast->type_name)
type = semantic()->check(ast->type_name, _scope);
- if (ast->param_name_token) {
- const Identifier *id = identifier(ast->param_name_token);
- _name = control()->nameId(id);
- ast->name = _name;
+ if (ast->param_name) {
+ accept(ast->param_name);
- Argument *arg = control()->newArgument(ast->param_name_token, _name);
+ Argument *arg = control()->newArgument(ast->param_name->firstToken(),
+ ast->param_name->name);
ast->argument = arg;
arg->setType(type);
arg->setInitializer(0);
diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp
index 60828aa6fe..86fb18dd2c 100644
--- a/src/shared/cplusplus/Parser.cpp
+++ b/src/shared/cplusplus/Parser.cpp
@@ -5269,7 +5269,8 @@ bool Parser::parseObjCKeywordDeclaration(ObjCSelectorArgumentAST *&argument, Obj
while (parseAttributeSpecifier(*attr))
attr = &(*attr)->next;
- match(T_IDENTIFIER, &node->param_name_token);
+ node->param_name = new (_pool) SimpleNameAST;
+ match(T_IDENTIFIER, &node->param_name->identifier_token);
return true;
}