From: Francis De Brabandere <francisdb@gmail.com> When Property Get or Property Let appears at global scope (outside a Class block), Windows returns error 1048 ("must be defined inside a Class"). Detect the tGET and tLET tokens in parser_error() — they are only valid after tPROPERTY inside a PropertyDecl, so encountering them at statement level means a Property was used outside a class context. Note: tSET is not included because Set is a valid statement keyword (Set obj = ...), so it follows a different parse path. --- dlls/vbscript/parser.y | 11 +++++++++-- dlls/vbscript/tests/run.c | 8 +++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index c1a5b944268..04ef9561e0e 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -572,8 +572,15 @@ static int parser_error(unsigned *loc, parser_ctx_t *ctx, const char *str) if(ctx->error_loc == -1) ctx->error_loc = *loc; if(ctx->hres == S_OK) { - FIXME("%s: %s\n", debugstr_w(ctx->code + *loc), debugstr_a(str)); - ctx->hres = E_FAIL; + switch(ctx->last_token) { + case tGET: + case tLET: + ctx->hres = MAKE_VBSERROR(VBSE_MUST_BE_INSIDE_CLASS); + break; + default: + FIXME("%s: %s\n", debugstr_w(ctx->code + *loc), debugstr_a(str)); + ctx->hres = E_FAIL; + } }else { WARN("%s: %08lx\n", debugstr_w(ctx->code + *loc), ctx->hres); } diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index d3aebff098a..c0e596cebd1 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -2993,7 +2993,13 @@ static void test_parse_errors(void) /* Must be defined inside a Class - error 1048 */ L"Property Get x\nEnd Property\n", 0, 9, - NULL, S_OK, -1048 + NULL, S_OK, 1048 + }, + { + /* Must be defined inside a Class - error 1048 (Let) */ + L"Property Let x\nEnd Property\n", + 0, 9, + NULL, S_OK, 1048 }, { /* Expected Let or Set or Get - error 1049 */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10493