Commit f8db0ae7 authored by Erik Verbruggen's avatar Erik Verbruggen

Prevent preleminary flushes to prevent order mess-ups.

The semantic highlighter relies on the highlight ranges to be subsequent
and non-overlapping. A method body in a class nested in a method can
result in flushes before the semantic info for the enclosing method is
calculated, resulting in overlapping ranges.

Task-number: QTCREATORBUG-3364
Reviewed-by: Roberto Raggi
parent 79529551
......@@ -343,9 +343,12 @@ bool CheckSymbols::warning(AST *ast, const QString &text)
return false;
}
FunctionDefinitionAST *CheckSymbols::enclosingFunctionDefinition() const
FunctionDefinitionAST *CheckSymbols::enclosingFunctionDefinition(bool skipTopOfStack) const
{
for (int index = _astStack.size() - 1; index != -1; --index) {
int index = _astStack.size() - 1;
if (skipTopOfStack && !_astStack.isEmpty())
--index;
for (; index != -1; --index) {
AST *ast = _astStack.at(index);
if (FunctionDefinitionAST *funDef = ast->asFunctionDefinition())
......@@ -791,7 +794,9 @@ bool CheckSymbols::visit(FunctionDefinitionAST *ast)
addUse(u);
}
flush();
if (!enclosingFunctionDefinition(true))
flush();
return false;
}
......
......@@ -124,7 +124,7 @@ protected:
bool isTemplateClass(Symbol *s) const;
Scope *enclosingScope() const;
FunctionDefinitionAST *enclosingFunctionDefinition() const;
FunctionDefinitionAST *enclosingFunctionDefinition(bool skipTopOfStack = false) const;
TemplateDeclarationAST *enclosingTemplateDeclaration() const;
virtual bool preVisit(AST *);
......
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