From: Francis De Brabandere <francisdb@gmail.com> Return "Expected 'Class'" when a class body is closed with 'End Sub', 'End Function', or other mismatched 'End' keywords instead of 'End Class'. --- dlls/vbscript/parser.y | 1 + dlls/vbscript/tests/run.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index b8b317c2fcf..89f3b3ac56c 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -503,6 +503,7 @@ PrimaryExpression ClassDeclaration : tCLASS Identifier StSep ClassBody tEND tCLASS StSep { $4->name = $2; $$ = $4; } | tCLASS Identifier tEND tCLASS { ctx->error_loc = @3; ctx->hres = MAKE_VBSERROR(VBSE_EXPECTED_STATEMENT); YYABORT; } + | tCLASS Identifier StSep ClassBody tEND error { ctx->hres = MAKE_VBSERROR(VBSE_EXPECTED_CLASS); YYABORT; } ClassBody : /* empty */ { $$ = new_class_decl(ctx); } diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index 844722a241f..6ae47dcbd96 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -3242,6 +3242,12 @@ static void test_parse_errors(void) L"Do For\nLoop\n", 0, 3, NULL, S_OK, 1028 + }, + { + /* Expected 'Class' - End Sub inside class body - error 1047 */ + L"Class C\nEnd Sub\n", + 1, 4, + NULL, S_OK, 1047 } }; HRESULT hres; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10637