Commit 633c2549 authored by Christian Kamm's avatar Christian Kamm
Browse files

C++: Fix bind of Q_INVOKABLE functions.

Reviewed-by: Roberto Raggi
parent 5f50a6ae
......@@ -1438,6 +1438,8 @@ bool Preprocessor::isQtReservedWord(const QByteArray &macroId) const
return true;
else if (size == 12 && macroId.at(0) == 'Q' && macroId == "Q_INTERFACES")
return true;
else if (size == 11 && macroId.at(0) == 'Q' && macroId == "Q_INVOKABLE")
return true;
else if (size == 6 && macroId.at(0) == 'S' && macroId == "SIGNAL")
return true;
else if (size == 4 && macroId.at(0) == 'S' && macroId == "SLOT")
......
......@@ -1722,10 +1722,25 @@ bool Bind::visit(BracedInitializerAST *ast)
return false;
}
static int methodKeyForInvokableToken(int kind)
{
if (kind == T_Q_SIGNAL)
return Function::SignalMethod;
else if (kind == T_Q_SLOT)
return Function::SlotMethod;
else if (kind == T_Q_INVOKABLE)
return Function::InvokableMethod;
return Function::NormalMethod;
}
// DeclarationAST
bool Bind::visit(SimpleDeclarationAST *ast)
{
int methodKey = _methodKey;
if (ast->qt_invokable_token)
methodKey = methodKeyForInvokableToken(tokenKind(ast->qt_invokable_token));
// unsigned qt_invokable_token = ast->qt_invokable_token;
FullySpecifiedType type;
for (SpecifierListAST *it = ast->decl_specifier_list; it; it = it->next) {
......@@ -1782,7 +1797,7 @@ bool Bind::visit(SimpleDeclarationAST *ast)
decl->setVisibility(_visibility);
if (Function *funTy = decl->type()->asFunctionType()) {
funTy->setMethodKey(_methodKey);
funTy->setMethodKey(methodKey);
if (funTy->isVirtual() && it->value->equal_token)
funTy->setPureVirtual(true);
......@@ -1921,7 +1936,10 @@ bool Bind::visit(ExceptionDeclarationAST *ast)
bool Bind::visit(FunctionDefinitionAST *ast)
{
// unsigned qt_invokable_token = ast->qt_invokable_token;
int methodKey = _methodKey;
if (ast->qt_invokable_token)
methodKey = methodKeyForInvokableToken(tokenKind(ast->qt_invokable_token));
FullySpecifiedType declSpecifiers;
for (SpecifierListAST *it = ast->decl_specifier_list; it; it = it->next) {
declSpecifiers = this->specifier(it->value, declSpecifiers);
......@@ -1937,7 +1955,7 @@ bool Bind::visit(FunctionDefinitionAST *ast)
if (_scope->isClass()) {
fun->setVisibility(_visibility);
fun->setMethodKey(_methodKey);
fun->setMethodKey(methodKey);
}
if (declaratorId && declaratorId->name) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment