forked from qt-creator/qt-creator
Changed ObjC message arguments to have SimpleName for the name part.
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user