forked from qt-creator/qt-creator
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
This commit is contained in:
@@ -343,9 +343,12 @@ bool CheckSymbols::warning(AST *ast, const QString &text)
|
|||||||
return false;
|
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);
|
AST *ast = _astStack.at(index);
|
||||||
|
|
||||||
if (FunctionDefinitionAST *funDef = ast->asFunctionDefinition())
|
if (FunctionDefinitionAST *funDef = ast->asFunctionDefinition())
|
||||||
@@ -791,7 +794,9 @@ bool CheckSymbols::visit(FunctionDefinitionAST *ast)
|
|||||||
addUse(u);
|
addUse(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!enclosingFunctionDefinition(true))
|
||||||
flush();
|
flush();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -124,7 +124,7 @@ protected:
|
|||||||
bool isTemplateClass(Symbol *s) const;
|
bool isTemplateClass(Symbol *s) const;
|
||||||
|
|
||||||
Scope *enclosingScope() const;
|
Scope *enclosingScope() const;
|
||||||
FunctionDefinitionAST *enclosingFunctionDefinition() const;
|
FunctionDefinitionAST *enclosingFunctionDefinition(bool skipTopOfStack = false) const;
|
||||||
TemplateDeclarationAST *enclosingTemplateDeclaration() const;
|
TemplateDeclarationAST *enclosingTemplateDeclaration() const;
|
||||||
|
|
||||||
virtual bool preVisit(AST *);
|
virtual bool preVisit(AST *);
|
||||||
|
Reference in New Issue
Block a user