fixes https://bugs.winehq.org/show_bug.cgi?id=53767
-- v3: vbscript: redim without dim
From: Francis De Brabandere francisdb@gmail.com
--- dlls/vbscript/interp.c | 11 ++++++++++- dlls/vbscript/tests/lang.vbs | 14 ++++++++++++++ dlls/vbscript/vbscript_defs.h | 1 + 3 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 937cdaf1c8c..edafc958ca9 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -1316,11 +1316,20 @@ static HRESULT interp_redim(exec_ctx_t *ctx) return hres; }
- if(ref.type != REF_VAR) { + // const + if (ref.type == REF_CONST) + return MAKE_VBSERROR(VBSE_ILLEGAL_ASSIGNMENT); + + if(ref.type != REF_VAR && ref.type != REF_NONE) { FIXME("got ref.type = %d\n", ref.type); return E_FAIL; }
+ if(ref.type == REF_NONE) { + ref.type = REF_VAR; + hres = add_dynamic_var(ctx, identifier, FALSE, &ref.u.v); + } + v = ref.u.v;
if(V_VT(v) == (VT_VARIANT|VT_BYREF)) { diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 3c6ce656f1c..8f751e608c5 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -1701,6 +1701,20 @@ e = err.number on error goto 0 ok e = 9, "e = " & e ' VBSE_OUT_OF_BOUNDS, can only change rightmost dimension
+' Redim without Dim should work, even in explicit mode +redim toCreateArr(3) +ok ubound(toCreateArr) = 3, "ubound(toCreateArr) = " & ubound(toCreateArr) +toCreateArr(3) = 10 +ok toCreateArr(3) = 10, "toCreateArr(3) = " & toCreateArr(3) + +const redimConst = 3 +on error resume next +redim redimConst(3) +ok err.number = 501, "err.number = " & err.number +err.clear +on error goto 0 + + sub TestReDimFixed on error resume next
diff --git a/dlls/vbscript/vbscript_defs.h b/dlls/vbscript/vbscript_defs.h index 139b71255a0..c32a94c7e85 100644 --- a/dlls/vbscript/vbscript_defs.h +++ b/dlls/vbscript/vbscript_defs.h @@ -267,6 +267,7 @@ #define VBSE_INVALID_DLL_FUNCTION_NAME 453 #define VBSE_INVALID_TYPELIB_VARIABLE 458 #define VBSE_SERVER_NOT_FOUND 462 +#define VBSE_ILLEGAL_ASSIGNMENT 501 #define VBSE_UNQUALIFIED_REFERENCE 505
#define VBS_COMPILE_ERROR 4096
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=150503
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: input.c:5873: Test failed: got pos (49,51)