From: Francis De Brabandere <francisdb@gmail.com> Return MAKE_VBSERROR with proper error codes instead of E_FAIL for invalid parenthesized call statements, class function redefinition, and Default Private declarations. --- dlls/vbscript/parser.y | 10 ++++------ dlls/vbscript/tests/run.c | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index 4977358b333..ecd6cc7502f 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -514,6 +514,7 @@ Storage_opt Storage : tPUBLIC tDEFAULT { $$ = STORAGE_IS_DEFAULT; } + | tDEFAULT tPRIVATE { ctx->error_loc = @1; ctx->hres = MAKE_VBSERROR(VBSE_DEFAULT_MUST_BE_PUBLIC); CHECK_ERROR; } | tPUBLIC { $$ = 0; } | tPRIVATE { $$ = STORAGE_IS_PRIVATE; } @@ -760,8 +761,7 @@ static call_expression_t *make_call_expression(parser_ctx_t *ctx, expression_t * } if(call_expr->args->next) { - FIXME("Invalid syntax: invalid use of parentheses for arguments\n"); - ctx->hres = E_FAIL; + ctx->hres = MAKE_VBSERROR(VBSE_CANNOT_USE_PARENS_CALLING_SUB); ctx->error_loc = ctx->ptr - ctx->code; return NULL; } @@ -1136,15 +1136,13 @@ static class_decl_t *add_class_function(parser_ctx_t *ctx, class_decl_t *class_d for(iter = class_decl->funcs; iter; iter = iter->next) { if(!wcsicmp(iter->name, decl->name)) { if(decl->type == FUNC_SUB || decl->type == FUNC_FUNCTION) { - FIXME("Redefinition of %s::%s\n", debugstr_w(class_decl->name), debugstr_w(decl->name)); - ctx->hres = E_FAIL; + ctx->hres = MAKE_VBSERROR(VBSE_NAME_REDEFINED); return NULL; } while(1) { if(iter->type == decl->type) { - FIXME("Redefinition of %s::%s\n", debugstr_w(class_decl->name), debugstr_w(decl->name)); - ctx->hres = E_FAIL; + ctx->hres = MAKE_VBSERROR(VBSE_NAME_REDEFINED); return NULL; } if(!iter->next_prop_func) diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index 1a231d5f40d..051831fae50 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -2812,7 +2812,7 @@ static void test_parse_errors(void) /* invalid use of parentheses for call statement */ L"strcomp(\"x\", \"y\")", 0, 17, - L"strcomp(\"x\", \"y\")", S_OK, -1044 + L"strcomp(\"x\", \"y\")", S_OK, 1044 }, { L"\n\n\n cint _\n throwInt(&h80001234&)", @@ -3018,7 +3018,7 @@ static void test_parse_errors(void) /* 'Default' must also specify 'Public' - error 1057 */ L"Class C\nDefault Private Function f()\nf = 1\nEnd Function\nEnd Class\n", 1, 0, - NULL, S_OK, -1057 + NULL, S_OK, 1057 } }; HRESULT hres; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10386