forked from qt-creator/qt-creator
Revert "Merge remote-tracking branch 'origin/4.15'"
This reverts commit 888ca0dd20
.
Reason for revert: wrong patchset
Change-Id: I1291789938601aaf606c59917ff938e3c24c78dd
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -1366,9 +1366,7 @@ bool Check::visit(Block *ast)
|
||||
&& !cast<WhileStatement *>(p)
|
||||
&& !cast<IfStatement *>(p)
|
||||
&& !cast<SwitchStatement *>(p)
|
||||
&& !isCaseOrDefault(p)
|
||||
&& !cast<WithStatement *>(p)
|
||||
&& hasVarStatement(ast)) {
|
||||
&& !cast<WithStatement *>(p)) {
|
||||
addMessage(WarnBlock, ast->lbraceToken);
|
||||
}
|
||||
if (!ast->statements
|
||||
@@ -1658,33 +1656,6 @@ bool Check::isQtQuick2Ui() const
|
||||
return _doc->language() == Dialect::QmlQtQuick2Ui;
|
||||
}
|
||||
|
||||
bool Check::isCaseOrDefault(Node *n)
|
||||
{
|
||||
if (!cast<StatementList *>(n))
|
||||
return false;
|
||||
if (Node *p = parent(1))
|
||||
return p->kind == Node::Kind_CaseClause || p->kind == Node::Kind_DefaultClause;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Check::hasVarStatement(AST::Block *b) const
|
||||
{
|
||||
QTC_ASSERT(b, return false);
|
||||
StatementList *s = b->statements;
|
||||
while (s) {
|
||||
if (auto var = cast<VariableStatement *>(s->statement)) {
|
||||
VariableDeclarationList *declList = var->declarations;
|
||||
while (declList) {
|
||||
if (declList->declaration && declList->declaration->scope == VariableScope::Var)
|
||||
return true;
|
||||
declList = declList->next;
|
||||
}
|
||||
}
|
||||
s = s->next;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Check::visit(NewExpression *ast)
|
||||
{
|
||||
checkNewExpression(ast->expression);
|
||||
|
Reference in New Issue
Block a user