Commit 847e5dfb authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS: Don't warn about expression statements in script bindings.

Reviewed-by: Roberto Raggi
parent 9574f4ee
......@@ -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()),
......
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