From: Francis De Brabandere <francisdb@gmail.com> A Class declaration may follow another statement separated by ':' at global scope, but a Sub, Function or Class inside a procedure body, or a Class inside a control-flow block, is rejected with err 1002. --- dlls/vbscript/tests/lang.vbs | 8 ++++++++ dlls/vbscript/tests/run.c | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index acdd992cbcf..c709549908e 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -877,6 +877,14 @@ ok x, "x is false" x = true : if false then x = false ok x, "x is false, if false called?" +' A Class declaration may follow another statement separated by ':'. +Dim inlineClassDummy : Class InlineClass + Public v +End Class +Dim inlineObj : Set inlineObj = New InlineClass +inlineObj.v = 7 +ok inlineObj.v = 7, "inline class member not 7" + if not false then x = true ok x, "x is false, if not false not called?" diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index decde599d0c..fda7e391f2e 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -3482,6 +3482,24 @@ static void test_parse_errors(void) L"Dim x\nFor Each x.y In Array(1)\nNext\n", 1, 13, NULL, S_OK, 1040 + }, + { + /* Sub declared inside another procedure - error 1002 */ + L"Sub Outer\nSub Inner\nEnd Sub\nEnd Sub\n", + 1, 0, + NULL, S_OK, 1002 + }, + { + /* Class declared inside a procedure - error 1002 */ + L"Sub Outer\nClass C\nEnd Class\nEnd Sub\n", + 1, 0, + NULL, S_OK, 1002 + }, + { + /* Class declared inside a control-flow block - error 1002 */ + L"If True Then\nClass C\nEnd Class\nEnd If\n", + 1, 0, + NULL, S_OK, 1002 } }; HRESULT hres; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10897