forked from qt-creator/qt-creator
QmlJS: Don't warn about expression statements in script bindings.
Reviewed-by: Roberto Raggi
This commit is contained in:
@@ -629,8 +629,7 @@ bool Check::visit(ExpressionStatement *ast)
|
||||
|| cast<PreDecrementExpression *>(ast->expression)
|
||||
|| cast<PreIncrementExpression *>(ast->expression)
|
||||
|| cast<PostIncrementExpression *>(ast->expression)
|
||||
|| cast<PostDecrementExpression *>(ast->expression)
|
||||
|| cast<UiScriptBinding *>(parent());
|
||||
|| cast<PostDecrementExpression *>(ast->expression);
|
||||
if (BinaryExpression *binary = cast<BinaryExpression *>(ast->expression)) {
|
||||
switch (binary->op) {
|
||||
case QSOperator::Assign:
|
||||
@@ -649,6 +648,16 @@ bool Check::visit(ExpressionStatement *ast)
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
if (!ok) {
|
||||
for (int i = 0; Node *p = parent(i); ++i) {
|
||||
if (UiScriptBinding *binding = cast<UiScriptBinding *>(p)) {
|
||||
if (!cast<Block *>(binding->statement)) {
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
warning(locationFromRange(ast->firstSourceLocation(), ast->lastSourceLocation()),
|
||||
|
Reference in New Issue
Block a user