diff options
-rw-r--r-- | qv4codegen.cpp | 2 | ||||
-rw-r--r-- | tests/TestExpectations | 12 |
2 files changed, 3 insertions, 11 deletions
diff --git a/qv4codegen.cpp b/qv4codegen.cpp index 56783738b8..dfc855ba2c 100644 --- a/qv4codegen.cpp +++ b/qv4codegen.cpp @@ -2289,6 +2289,8 @@ bool Codegen::visit(LocalForStatement *ast) bool Codegen::visit(ReturnStatement *ast) { + if (_mode == GlobalCode) + throwSyntaxError(ast->returnToken, QCoreApplication::translate("qv4codegen", "Return statement outside of function")); if (ast->expression) { Result expr = expression(ast->expression); move(_block->TEMP(_returnAddress), *expr); diff --git a/tests/TestExpectations b/tests/TestExpectations index e6a473f207..311f3c9e40 100644 --- a/tests/TestExpectations +++ b/tests/TestExpectations @@ -132,14 +132,4 @@ Sbp_A3_T1 failing Sbp_A4_T1 failing Sbp_A4_T2 failing S12.4_A1 failing -S12.9_A1_T1 failing -S12.9_A1_T10 failing -S12.9_A1_T2 failing -S12.9_A1_T3 failing -S12.9_A1_T4 failing -S12.9_A1_T5 failing -S12.9_A1_T6 failing -S12.9_A1_T7 failing -S12.9_A1_T8 failing -S12.9_A1_T9 failing -S15.2.4.4_A14 failing +S15.2.4.4_A14 failing
\ No newline at end of file |