forked from qt-creator/qt-creator
QmlJS checks: Limit warning about unintentional empty blocks.
width: { } should not trigger a warning. We now only warn if { and } are on the same line. Change-Id: I45fa846ff63d0a83de782c412212165845c07e72 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
@@ -935,8 +935,9 @@ bool Check::visit(Block *ast)
|
||||
}
|
||||
if (!ast->statements
|
||||
&& (cast<UiPublicMember *>(p)
|
||||
|| cast<UiScriptBinding *>(p))) {
|
||||
addMessage(WarnUnintentinalEmptyBlock, ast->firstSourceLocation());
|
||||
|| cast<UiScriptBinding *>(p))
|
||||
&& ast->lbraceToken.startLine == ast->rbraceToken.startLine) {
|
||||
addMessage(WarnUnintentinalEmptyBlock, locationFromRange(ast->firstSourceLocation(), ast->lastSourceLocation()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user