aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qv4codegen.cpp31
-rw-r--r--tests/auto/qml/v4misc/tst_v4misc.cpp1
2 files changed, 15 insertions, 17 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index f513184279..f332a66bd0 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -2054,7 +2054,7 @@ Codegen::Arguments Codegen::pushTemplateArgs(TemplateLiteral *args)
bool Codegen::visit(ConditionalExpression *ast)
{
if (hasError)
- return true;
+ return false;
RegisterScope scope(this);
TailCallBlocker blockTailCalls(this);
@@ -3196,7 +3196,7 @@ bool Codegen::visit(DebuggerStatement *)
bool Codegen::visit(DoWhileStatement *ast)
{
if (hasError)
- return true;
+ return false;
RegisterScope scope(this);
@@ -3226,16 +3226,13 @@ bool Codegen::visit(DoWhileStatement *ast)
bool Codegen::visit(EmptyStatement *)
{
- if (hasError)
- return true;
-
return false;
}
bool Codegen::visit(ExpressionStatement *ast)
{
if (hasError)
- return true;
+ return false;
RegisterScope scope(this);
TailCallBlocker blockTailCalls(this);
@@ -3254,7 +3251,7 @@ bool Codegen::visit(ExpressionStatement *ast)
bool Codegen::visit(ForEachStatement *ast)
{
if (hasError)
- return true;
+ return false;
RegisterScope scope(this);
TailCallBlocker blockTailCalls(this);
@@ -3270,7 +3267,7 @@ bool Codegen::visit(ForEachStatement *ast)
ControlFlowBlock controlFlow(this, ast);
Reference expr = expression(ast->expression);
if (hasError)
- return true;
+ return false;
expr.loadInAccumulator();
Instruction::GetIterator iteratorObjInstr;
@@ -3348,7 +3345,7 @@ bool Codegen::visit(ForEachStatement *ast)
bool Codegen::visit(ForStatement *ast)
{
if (hasError)
- return true;
+ return false;
RegisterScope scope(this);
TailCallBlocker blockTailCalls(this);
@@ -3391,7 +3388,7 @@ bool Codegen::visit(ForStatement *ast)
bool Codegen::visit(IfStatement *ast)
{
if (hasError)
- return true;
+ return false;
RegisterScope scope(this);
TailCallBlocker blockTailCalls(this);
@@ -3423,7 +3420,7 @@ bool Codegen::visit(IfStatement *ast)
bool Codegen::visit(LabelledStatement *ast)
{
if (hasError)
- return true;
+ return false;
RegisterScope scope(this);
@@ -3471,7 +3468,7 @@ void Codegen::emitReturn(const Reference &expr)
bool Codegen::visit(ReturnStatement *ast)
{
if (hasError)
- return true;
+ return false;
if (_functionContext->contextType != ContextType::Function && _functionContext->contextType != ContextType::Binding) {
throwSyntaxError(ast->returnToken, QStringLiteral("Return statement outside of function"));
@@ -3494,7 +3491,7 @@ bool Codegen::visit(ReturnStatement *ast)
bool Codegen::visit(SwitchStatement *ast)
{
if (hasError)
- return true;
+ return false;
if (requiresReturnValue)
Reference::fromConst(this, Encode::undefined()).storeOnStack(_returnAddress);
@@ -3628,7 +3625,7 @@ void Codegen::handleTryFinally(TryStatement *ast)
bool Codegen::visit(TryStatement *ast)
{
if (hasError)
- return true;
+ return false;
RegisterScope scope(this);
@@ -3644,7 +3641,7 @@ bool Codegen::visit(TryStatement *ast)
bool Codegen::visit(VariableStatement *ast)
{
if (hasError)
- return true;
+ return false;
variableDeclarationList(ast->declarations);
return false;
@@ -3653,7 +3650,7 @@ bool Codegen::visit(VariableStatement *ast)
bool Codegen::visit(WhileStatement *ast)
{
if (hasError)
- return true;
+ return false;
if (AST::cast<FalseLiteral *>(ast->expression))
return false;
@@ -3682,7 +3679,7 @@ bool Codegen::visit(WhileStatement *ast)
bool Codegen::visit(WithStatement *ast)
{
if (hasError)
- return true;
+ return false;
RegisterScope scope(this);
TailCallBlocker blockTailCalls(this);
diff --git a/tests/auto/qml/v4misc/tst_v4misc.cpp b/tests/auto/qml/v4misc/tst_v4misc.cpp
index a080826e15..e1796d18b4 100644
--- a/tests/auto/qml/v4misc/tst_v4misc.cpp
+++ b/tests/auto/qml/v4misc/tst_v4misc.cpp
@@ -111,6 +111,7 @@ void tst_v4misc::parserMisc_data()
QTest::newRow("8[++i][+++i]") << QString("ReferenceError: Prefix ++ operator applied to value that is not a reference.");
QTest::newRow("`a${1++}`") << QString("ReferenceError: Invalid left-hand side expression in postfix operation");
+ QTest::newRow("for (var f in ++!binaryMathg) ;") << QString("ReferenceError: Prefix ++ operator applied to value that is not a reference.");
}
void tst_v4misc::parserMisc()